My contributions to Python¶
Python 3.12 (dev) Contributions¶
New Features¶
- Build: Add
COMPILEALL_OPTS
variable inMakefile
Changes¶
- Invalid escape sequence in strings now generates
SyntaxWarning
, instead ofDeprecationWarning
Remove¶
distutils
packageTools/demo/
directory (12 demos)Tools/scripts/
directory: remove 70 scriptsElementTree.Element.copy()
(pure Python implementation)FTP_TLS.ssl_version
gzip.GzipFile.filename
io.OpenWrapper
,_pyio.OpenWrapper
locale.format()
ssl.RAND_pseudo_bytes()
ssl.match_hostname()
ssl.wrap_socket()
zipimport
: Removefind_loader()
andfind_module()
methods- Remove the
keyfile
,certfile
andcheck_hostname
parameters in modules: ftplib, http.client, imaplib, poplib and smtplib.
C API: New Features¶
PyFrame_GetVar()
PyFrame_GetVarString()
C API: Deprecate¶
Py_DebugFlag
Py_VerboseFlag
Py_QuietFlag
Py_InteractiveFlag
Py_InspectFlag
Py_OptimizeFlag
Py_NoSiteFlag
Py_BytesWarningFlag
Py_FrozenFlag
Py_IgnoreEnvironmentFlag
Py_DontWriteBytecodeFlag
Py_NoUserSiteDirectory
Py_UnbufferedStdioFlag
Py_HashRandomizationFlag
Py_IsolatedFlag
Py_LegacyWindowsFSEncodingFlag
Py_LegacyWindowsStdioFlag
Py_FileSystemDefaultEncoding
Py_FileSystemDefaultEncodeErrors
Py_UTF8Mode
C API: Remove¶
token.h
header filePyUnicode_InternImmortal()
SSTATE_INTERNED_IMMORTAL
Python 3.11 Contributions¶
New features¶
- Add
-P
command line option,PYTHONSAFEPATH
environment variable andsys.flags.safe_path
: don’t prepend a potentially unsafe path tosys.path
.
Changes¶
- On Unix, if the
sem_clockwait()
function is available,threading.Lock.acquire()
uses the monotonic clock for the timeout. math.nan
is now always available- C11 compiler and C99
<math.h>
are now required to build Python
Remove¶
binhex
modulebinascii
: removea2b_hqx()
,b2a_hqx()
,rlecode_hqx()
andrldecode_hqx()
float.__set_format__()
"U"
flag ofopen()
,io.open()
andcodecs.open()
Deprecate¶
locale.getdefaultlocale()
locale.resetlocale()
mailcap
modulelib2to3
package
C API: New Features¶
PyThreadState_EnterTracing()
,PyThreadState_LeaveTracing()
PyFloat_Pack2()
,PyFloat_Pack4()
,PyFloat_Pack8()
PyFloat_Unpack2()
,PyFloat_Unpack4()
,PyFloat_Unpack8()
PyConfig.safe_path
C API: Changes¶
- PEP 670: Convert many macros to static inline functions.
- Py_TYPE() and Py_SIZE() can no longer be used as l-value
- Move 8 non-limited header files to
Include/cpython/
- Frame API is now directly part of
<Python.h>
, likePyFrame_GetBack()
C API: Deprecate¶
PySys_AddWarnOption()
PySys_AddWarnOptionUnicode()
PySys_AddXOption()
PySys_HasWarnOptions()
PySys_SetArgv()
PySys_SetArgvEx()
PySys_SetPath()
Py_SetPath()
Py_SetProgramName()
Py_SetPythonHome()
Py_SetStandardStreamEncoding()
_Py_SetProgramFullPath()
C API: Limited C API¶
- The limited C API no longer includes
<stdlib.h>
,<stdio.h>
,<errno.h>
and<string.h>
. - Remove
PyWeakref_GET_OBJECT()
- Remove
PyUnicode_CHECK_INTERNED()
C API: Remove¶
HAVE_PY_SET_53BIT_PRECISION
PyHeapType_GET_MEMBERS()
Py_ADJUST_ERANGE1()
Py_ADJUST_ERANGE2()
Py_FORCE_DOUBLE()
Py_OVERFLOWED()
Py_SET_ERANGE_IF_OVERFLOW()
Py_SET_ERRNO_ON_MATH_ERROR()
Py_UNICODE_COPY()
Py_UNICODE_FILL()
eval.h
headerpystrhex.h
header
Python 3.10 Contributions¶
New features¶
- Add
sys.orig_argv
attribute - Add
sys.stdlib_module_names
attribute - Add new
./configure
options:--without-static-libpython
--with-wheel-pkg-dir=PATH
faulthandler
now lists third party C extensions on a crashfaulthandler
now detects if a fatal error occurs during a GC collection
Changes¶
- Optimize
python3 -m module
startup time: import less modules. - Static methods (@staticmethod) are now callable as regular functions
module:
collections.MutableMapping
must be replaced withcollections.abc.MutableMapping
. - At Python exit, if a callback registered with
atexit.register()
fails, its exception is now logged - Remove distutils
bdist_wininst
command - Remove deprecated aliases to Abstract Base Classes from the collections
New C API features¶
- Add
PyConfig.orig_argv
member - Add new functions:
PyModule_AddObjectRef()
Py_Is()
Py_IsFalse()
Py_IsNone()
Py_IsTrue()
Py_NewRef()
Py_XNewRef()
- Add new
Py_TPFLAGS_DISALLOW_INSTANTIATION
andPy_TPFLAGS_IMMUTABLETYPE
type flags
C API changes¶
Py_REFCNT()
can no longer be used as a l-value- Deprecate
PyUnicode_InternImmortal()
- Remove
_Py_CheckRecursionLimit
variable - Remove header files:
Python-ast.h
asdl.h
ast.h
symtable.h
- Remove functions:
PyAST_Compile()
PyAST_CompileEx()
PyAST_CompileObject()
PyAST_Validate()
PyArena_AddPyObject()
PyArena_Free()
PyArena_Malloc()
PyArena_New()
PyFuture_FromAST()
PyFuture_FromASTObject()
PyOS_InitInterrupts()
PyParser_ASTFromFile()
PyParser_ASTFromFileObject()
PyParser_ASTFromFilename()
PyParser_ASTFromString()
PyParser_ASTFromStringObject()
Py_SymtableString()
Python 3.9 Contributions¶
- New math.nextafter() and math.ulp() functions.
- New os.waitstatus_to_exitcode(): convert a waitpid wait status to an exit code.
- New random.randbytes() function.
- Add
./configure --with-platlibdir
option and add sys.platlibdir attribute: used by Fedora and OpenSUSE Linux distributions to install files in/usr/lib64
rather than/usr/lib
. - Remove many deprecated features and deprecate some functions.
- C API Changes: new functions to access structure members, private functions removed or moved o the internal C API. Many macros converted to static inline functions.
Python 3.8 Contributions¶
- PEP 587: https://docs.python.org/dev/c-api/init_config.html
- New sys.unraisablehook function
- New threading.excepthook function
io.IOBase
finalizer now logs close() exception usingsys.unraisablehook()
_thread.start_new_thread()
now logs thread function exception usingsys.unraisablehook()
, rather thansys.excepthook()
, so the hook gets the function which created the thread and a more helpful error message.
Python 3.7 Contributions¶
- New Python UTF-8 Mode:
-X utf8
option andPYTHONUTF8=1
env var, PEP 540. - New Python Development Mode:
-X dev
andPYTHONDEVMODE
env var - New time functions with nanosecond resolution, PEP 564:
time.clock_gettime_ns()
time.clock_settime_ns()
time.monotonic_ns()
time.perf_counter_ns()
time.process_time_ns()
time.time_ns()
- New sys.getandroidapilevel() function on Android.
- C API:
- New
PyTraceMalloc_Track()
andPyTraceMalloc_Untrack()
functions for numpy.
- New
Python 3.6 Contributions¶
- Add PYTHONMALLOC env var: it becomes possible to use debug hooks on a Python release build.
- New
ast.Constant
AST node. faulthandler
installs a handler for Windows exceptions.- Implement PEP 509: Add a private version to dict
- Add
os.getrandom()
function, PEP 524: Make os.urandom() blocking on Linux. subprocess
: destructor emits aResourceWarning
if the process is still running.tracemalloc
supports racing memory allocations in multiple different address spaces.warnings
: newsource
parameter, used to display the traceback where an object was allocated when displaying aResourceWarning
.- Optimize ASCII, Latin1 and UTF-8 decoders and encoders when handling undecodable bytes and unencodable characters for common error handlers (ignore, replace, surrogateescape, surrogatepass).
PyMem_Malloc()
usespymalloc
allocator, rater thanmalloc()
.- Remove
make touch
: addmake regen-all
.
Python 3.5 Contributions¶
- Add
os.scandir()
: collaborative work with Ben Hoyt. os.walk()
is 7x to 20x faster on Windows, thanks to os.scandir()- Implement PEP 475 with Charles-François Natali: Retry system calls failing
with EINTR. Refactor
Modules/socketmodule.c
: addsock_call()
helper function which retries a syscall and recomputes the timeout. - asyncio:
- Add
create_task()
,get_debug()
,set_debug()
andis_closed()
functions. - Queue: new
join()
andtask_done()
methods. - proactor event loop supports SSL, collaborative work with Antoine Pitrou
- Add
time.monotonic()
is always available.os.urandom()
usesgetrandom()
on Linux- New
os.get_blocking()
andos.set_blocking()
functions. signal.set_wakeup_fd()
accepts Windows socket handle- socket functions use a monotonic clock
- Fix socket.sendall() timeout
- C API:
- New
PyMem_Calloc()
function. - New
Py_DecodeLocale()
andPy_EncodeLocale()
functions. - New private
_PyTime
API to handle nanosecond timestamps. - Enhance
Py_FatalError()
- New private
_Py_CheckFunctionResult()
function.
- New
Python 3.4 Contributions¶
- New
tracemalloc
module: PEP 454 – Add a new tracemalloc module to trace Python memory allocations - Implement PEP 446: Make newly created file descriptors non-inheritable. New functions:
os.get_inheritable()
,os.set_inheritable()
os.get_handle_inheritable()
,os.set_handle_inheritable()
socket.socket.get_inheritable()
,socket.socket.set_inheritable()
- Implement PEP 445 – Add new APIs to customize Python memory allocators
- UTF-8, UTF-16 and UTF-32 codecs reject surrogates: collaborative work with Kang-Hao (Kenny) Lu and Serhiy Storchaka.
- New
os.cpu_count()
function ( (Contributed by Trent Nelson, Yogesh Chaudhari, Victor Stinner, and Charles-François Natali) - select.devpoll: add fileno(), close() methods and closed attribute.
PyUnicode_FromFormat()
supports width and precision specifications for%s
,%A
,%U
,%V
,%S
, and%R
. (Collaborative work with Ysj Ray.)- Better handling of
MemoryError
exceptions
Python 3.3 Contributions¶
- New
faulthandler
module - ssl: add
RAND_bytes()
andRAND_pseudo_bytes()
- subprocess: command strings can now be bytes objects on posix platforms
- time: add functions, PEP 418:
clock_getres()
clock_gettime()
clock_settime()
get_clock_info()
monotonic()
perf_counter()
process_time()
Python 3.2 Contributions¶
- Python’s import mechanism can now load modules installed in directories with non-ASCII characters in the path name. This solved an aggravating problem with home directories for users with non-ASCII characters in their usernames.
- New os.getenvb() function and os.environb mapping
Python 3.1 Contributions¶
- int: add
bit_length()
method. I wrote a first implementation, Mark Dickinson completed my implementation.
Mentoring, bug triage permission, core developers¶
I promoted the following developers as core devs:
- 2020-04-09: Dong-hee Na (vote)
- 2019-09-23: Joannah Nanjekye (vote)
- 2019-06-16: Paul Ganssle (vote)
- 2019-04-08: Stéphane Wirtel (vote)
- 2019-02-19: Cheryl Sabella (vote)
- 2018-06-20: Pablo Galindo Salgado (vote)
- 2017-12-08: Julien Palard
- 2016-11-21: Xiang Zhang
- 2016-06-03: Xavier de Gaye
- 2011-05-19: Charles-François Natali
I gave the bug triage permission to:
- 2020-11-13: Hai Shi
- 2019-06-06: Zackery Spytz
- 2019-02-22: Andrés Delfino
- 2019-02-15: Paul Ganssle (is now a core dev)
- 2019-02-02: Alexey Izbyshev
- 2019-02-01: Joannah Nanjekye (is now a core dev)
- 2018-01-18: Pablo Galindo Salgado (is now a core dev)
- 2017-12-06: Cheryl Sabella (is now a core dev)
- 2017-12-06: Sanyam Khurana
Python Enhancement Proposals (PEP)¶
Lisf of my PEPs and PEPs I co-wrote.
Accepted PEPs¶
PEP | Python | Status | Title |
---|---|---|---|
PEP 670 | 3.11 | Final | Convert macros to functions in the Python C API |
PEP 587 | 3.8 | Final | Python Initialization Configuration |
PEP 564 | 3.7 | Final | Add new time functions with nanosecond resolution (ex: time.time_ns() ) |
PEP 545 | — | Final | Python Documentation Translations – co-written with Juliend Palard and Naoki IANADA |
PEP 540 | 3.7 | Final | Add a new UTF-8 mode |
PEP 524 | 3.6 | Final | Make os.urandom() blocking on Linux |
PEP 509 | 3.6 | Final | Add a private version to dict |
PEP 475 | 3.5 | Final | Retry system calls failing with EINTR – co-written with Charles-François Natali |
PEP 454 | 3.4 | Final | Add a new tracemalloc module to trace Python memory allocations |
PEP 446 | 3.4 | Final | Make newly created file descriptors non-inheritable |
PEP 445 | 3.4 | Final | Add new APIs to customize Python memory allocators |
PEP 418 | 3.3 | Final | Add monotonic time, performance counter, and process time functions |
Total: 12 accepted PEPs.
Rejected PEPs¶
PEP | Python | Status | Title |
---|---|---|---|
PEP 8015 | — | Rejected | Organization of the Python community |
PEP 674 | 3.11 | Deferred | Disallow using macros as l-values |
PEP 620 | 3.10 | Withdrawn | Hide implementation details from the C API |
PEP 608 | 3.9 | Rejected | Coordinated Python release |
PEP 606 | 3.9 | Rejected | Python Compatibility Version |
PEP 546 | 2.7 | Rejected | Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7 – co-written with Cory Benfield |
PEP 511 | 3.6 | Rejected | API for code transformers |
PEP 510 | 3.6 | Rejected | Specialize functions with guards |
PEP 490 | 3.6 | Rejected | Chain exceptions at C level |
PEP 433 | 3.x | Superseded | Easier suppression of file descriptor inheritance – supersed by my accepted PEP 446 |
PEP 416 | 3.3 | Rejected | Add a frozendict builtin type |
PEP 410 | 3.3 | Rejected | Use decimal.Decimal type for timestamps |
PEP 400 | 3.3 | Deferred | Deprecate codecs.StreamReader and codecs.StreamWriter |
Total: 13 rejected, deferred or superseded PEPs.
Other contributions to PEPs¶
- PEP 460: I wrote the first version of the PEP 460 (bytes % args), then rewritten by Antoine Pitrou, to be later superseeded by the PEP 461 written by Ethan Furman.
- PEP 471 (os.scandir): I helped Ben Hoyt to implement, test and benchmark his PEP 471
Commits¶
Number of commits with the name “Victor Stinner”, per year, from 2010 to 2022-11-02:
- 2022: 348 (on going)
- 2021: 260
- 2020: 524
- 2019: 467
- 2018: 306
- 2017: 420 (migration to Git on GitHub)
- 2016: 612
- 2015: 731
- 2014: 820
- 2013: 630
- 2012: 261
- 2011: 1027 (migration to Mercurial)
- 2010: 696
Total: 7 102 commits
Old reports (2015-2017)¶
Old contributions to Python¶
Fuzzing on Python using my fuzzer “Fusil”.
Accepted patches:
- 2008-07-06: invalid ref count on locale.strcoll() error. Patch appliqué dans la révision 65134.
- 2008-07-09: bugs in scanstring_str() and scanstring_unicode() of _json module. Patch inspiré du mien commité dans la révision 65147.
- 2008-07-06: segfault on gettext(None). Patch appliqué dans la révision 65133.
- 2008-07-07: bugs in _sqlite module. Patch appliqué dans la révision 65040
- 2008-07-06: Use Py_XDECREF() instead of Py_DECREF() in MultibyteCodec and MultibyteStreamReader. Patch appliqué dans révision 65038
- 2008-07-07: dlopen() error with no error message from dlerror(). Patch appliqué dans rev 64976, rev 64977 et 64978
- 2008-07-07: missing lock release in BZ2File_iternext(). Appliqué dans le commit 64767.
- 2008-07-06: DoS when lo is negative in bisect.insort_right() / _left(). Appliqué dans le commit 64845.
- 2008-07-06: audioop.findmax() crashs with negative length. Appliqué dans le commit 64775.
- 2008-07-06: invalid call to PyMem_Free() in fileio_init(). Appliqué dans le commit 64758
- 2007-08-13: Improved patches for sndhdr and imghdr
- 2007-08-10: Fix the ctypes tests, corrige ctypes pour le passage de str/unicode à bytes/str.
- 2007-04-10: Segfaults quand la mémoire est épuisée (rapport de bug avec patch) => patch appliqué (avec un léger changement) dans le commit 54757 (par georg.brandl).
- 2007-02-27: trace.py needs to know about doctests. Patch applied the 23 Nov 2007.
- 2006-09-06: Bug locale.getdefaultlocale(), lorsque le module _locale est absent, la fonction locale.getdefaultlocale() retourne un charset errorné avec mes locales. Corrigé dans Python 2.5.1.
- 2006-08-23: Bug report with patch, La fonction setup() du module distutils refusait un tuple (au lieu d’une liste) pour la commande « register » (le patch a été retouché pour fonctionner sur Python 2.1)
- 2005-11-25: bug report + patch. La méthode seek(0,2) d’un objet du module bz2 était boguée dans Python 2.4.2
Other patches (fixed as well):
- 2008-07-06: block operation on closed socket/pipe for multiprocessing
- 2008-07-06: invalid check of _bsddb creation failure
- 2008-07-06: invalid object destruction in re.finditer()
- 2007-07-23: Unable to register or upload project (http error 302: moved)
- 2007-07-17: Problem with socket.gethostbyaddr() and KeyboardInterrupt