My contributions to Python

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 670 3.11 Draft Convert macros to functions in the Python C API
PEP 620 3.10 Draft Hide implementation details from the C API

Accepted PEPs

PEP Python Status Title
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

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

Old contributions to Python

Fuzzing on Python using my fuzzer “Fusil”.

Accepted patches:

Other patches (fixed as well):