My contributions to Python

Python 3.12 (dev) Contributions

New Features

  • Build: Add COMPILEALL_OPTS variable in Makefile

Changes

  • Invalid escape sequence in strings now generates SyntaxWarning, instead of DeprecationWarning

Remove

  • distutils package
  • Tools/demo/ directory (12 demos)
  • Tools/scripts/ directory: remove 70 scripts
  • ElementTree.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: Remove find_loader() and find_module() methods
  • Remove the keyfile, certfile and check_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 file
  • PyUnicode_InternImmortal()
  • SSTATE_INTERNED_IMMORTAL

Python 3.11 Contributions

New features

  • Add -P command line option, PYTHONSAFEPATH environment variable and sys.flags.safe_path: don’t prepend a potentially unsafe path to sys.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 module
  • binascii: remove a2b_hqx(), b2a_hqx(), rlecode_hqx() and rldecode_hqx()
  • float.__set_format__()
  • "U" flag of open(), io.open() and codecs.open()

Deprecate

  • locale.getdefaultlocale()
  • locale.resetlocale()
  • mailcap module
  • lib2to3 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>, like PyFrame_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 header
  • pystrhex.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 crash
  • faulthandler 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 with collections.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 and Py_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

Python 3.7 Contributions

  • New Python UTF-8 Mode: -X utf8 option and PYTHONUTF8=1 env var, PEP 540.
  • New Python Development Mode: -X dev and PYTHONDEVMODE 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() and PyTraceMalloc_Untrack() functions for numpy.

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 a ResourceWarning if the process is still running.
  • tracemalloc supports racing memory allocations in multiple different address spaces.
  • warnings: new source parameter, used to display the traceback where an object was allocated when displaying a ResourceWarning.
  • 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() uses pymalloc allocator, rater than malloc().
  • Remove make touch: add make 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: add sock_call() helper function which retries a syscall and recomputes the timeout.
  • asyncio:
    • Add create_task(), get_debug(), set_debug() and is_closed() functions.
    • Queue: new join() and task_done() methods.
    • proactor event loop supports SSL, collaborative work with Antoine Pitrou
  • time.monotonic() is always available.
  • os.urandom() uses getrandom() on Linux
  • New os.get_blocking() and os.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() and Py_EncodeLocale() functions.
    • New private _PyTime API to handle nanosecond timestamps.
    • Enhance Py_FatalError()
    • New private _Py_CheckFunctionResult() function.

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() and RAND_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:

I gave the bug triage permission to:

Python Enhancement Proposals (PEP)

Lisf of my PEPs and PEPs I co-wrote.

Draft PEPs

PEP Python Status Title
PEP 674 3.11 Draft Disallow using macros as l-value
PEP 620 3.10 Draft Hide implementation details from the C API

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 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

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 contributions to Python

Fuzzing on Python using my fuzzer “Fusil”.

Accepted patches:

Other patches (fixed as well):