My contributions to Python¶
Reports¶
Python 3.10 Contributions¶
New features¶
- Add
sys.orig_argvattribute - Add
sys.stdlib_module_namesattribute - Add new
./configureoptions:--without-static-libpython--with-wheel-pkg-dir=PATH
faulthandlernow lists third party C extensions on a crashfaulthandlernow detects if a fatal error occurs during a GC collection
Changes¶
- Optimize
python3 -m modulestartup time: import less modules. - Static methods (@staticmethod) are now callable as regular functions
module:
collections.MutableMappingmust be replaced withcollections.abc.MutableMapping. - At Python exit, if a callback registered with
atexit.register()fails, its exception is now logged - Remove distutils
bdist_wininstcommand - Remove deprecated aliases to Abstract Base Classes from the collections
New C API features¶
- Add
PyConfig.orig_argvmember - Add new functions:
PyModule_AddObjectRef()Py_Is()Py_IsFalse()Py_IsNone()Py_IsTrue()Py_NewRef()Py_XNewRef()
- Add new
Py_TPFLAGS_DISALLOW_INSTANTIATIONandPy_TPFLAGS_IMMUTABLETYPEtype flags
C API changes¶
Py_REFCNT()can no longer be used as a l-value- Deprecate
PyUnicode_InternImmortal() - Remove
_Py_CheckRecursionLimitvariable - Remove header files:
Python-ast.hasdl.hast.hsymtable.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-platlibdiroption and add sys.platlibdir attribute: used by Fedora and OpenSUSE Linux distributions to install files in/usr/lib64rather 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.IOBasefinalizer 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 utf8option andPYTHONUTF8=1env var, PEP 540. - New Python Development Mode:
-X devandPYTHONDEVMODEenv 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.ConstantAST node. faulthandlerinstalls 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 aResourceWarningif the process is still running.tracemallocsupports racing memory allocations in multiple different address spaces.warnings: newsourceparameter, 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()usespymallocallocator, 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
_PyTimeAPI to handle nanosecond timestamps. - Enhance
Py_FatalError() - New private
_Py_CheckFunctionResult()function.
- New
Python 3.4 Contributions¶
- New
tracemallocmodule: 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
MemoryErrorexceptions
Python 3.3 Contributions¶
- New
faulthandlermodule - 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.
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
April Fool¶
- [Python-Dev] The next major Python version will be Python 8
- https://mail.python.org/pipermail/python-dev/2016-March/143603.html
- https://hg.python.org/cpython/rev/9aedec2dbc01
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