summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)Batuhan Taskaya2020-05-121-2/+0
| | | These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
* bpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)Victor Stinner2020-05-124-737/+2
| | | | | | | * Move Modules/hashtable.h to Include/internal/pycore_hashtable.h * Move Modules/hashtable.c to Python/hashtable.c * Python is now linked to hashtable.c. _tracemalloc is no longer linked to hashtable.c. Previously, marshal.c got hashtable.c via _tracemalloc.c which is built as a builtin module.
* bpo-39465: Don't access directly _Py_Identifier members (GH-20043)Victor Stinner2020-05-111-2/+2
| | | | | * Replace id->object with _PyUnicode_FromId(&id) * Use _Py_static_string_init(str) macro to initialize statically name_op in typeobject.c.
* bpo-36346: array: Don't use deprecated APIs (GH-19653)Inada Naoki2020-05-112-49/+50
| | | | | | | | * Py_UNICODE -> wchar_t * Py_UNICODE -> unicode in Argument Clinic * PyUnicode_AsUnicode -> PyUnicode_AsWideCharString * Don't use "u#" format. Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40549: Convert posixmodule.c to multiphase init (GH-19982)Victor Stinner2020-05-102-129/+145
| | | | | | | | | | | | | | | Convert posixmodule.c ("posix" or "nt" module) to the multiphase initialization (PEP 489). * Create the module using PyModuleDef_Init(). * Create ScandirIteratorType and DirEntryType with the new PyType_FromModuleAndSpec() (PEP 573) * Get the module state from ScandirIteratorType and DirEntryType with the new PyType_GetModule() (PEP 573) * Pass module to functions which access the module state. * convert_sched_param() gets a new module parameter. It is now called directly since Argument Clinic doesn't support passing the module to an argument converter callback. * Remove _posixstate_global macro.
* bpo-40566: Apply PEP 573 to abc module (GH-20005)Dong-hee Na2020-05-091-15/+19
|
* bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)Chris Jerdonek2020-05-081-0/+4
| | | | This fixes a possible memory leak in the C implementation of asyncio.Task.
* bpo-38787: Update structures.rst docs (PEP 573) (GH-19980)Hai Shi2020-05-071-10/+6
|
* bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)Eric Snow2020-05-071-121/+1018
| | | | | | | | | (Note: PEP 554 is not accepted and the implementation in the code base is a private one for use in the test suite.) If code running in a subinterpreter raises an uncaught exception then the "run" call in the calling interpreter fails. A RunFailedError is raised there that summarizes the original exception as a string. The actual exception type, __cause__, __context__, state, etc. are all discarded. This turned out to be functionally insufficient in practice. There is a more helpful solution (and PEP 554 has been updated appropriately). This change adds the exception propagation behavior described in PEP 554 to the _xxsubinterpreters module. With this change a copy of the original exception is set to __cause__ on the RunFailedError. For now we are using "pickle", which preserves the exception's state. We also preserve the original __cause__, __context__, and __traceback__ (since "pickle" does not preserve those). https://bugs.python.org/issue32604
* bpo-38787: C API for module state access from extension methods (PEP 573) ↵Petr Viktorin2020-05-072-8/+328
| | | | | | | | | (GH-19936) Module C state is now accessible from C-defined heap type methods (PEP 573). Patch by Marcel Plch and Petr Viktorin. Co-authored-by: Marcel Plch <mplch@redhat.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-1635741: Port errno module to multiphase initialization (GH-19923)Dong-hee Na2020-05-071-310/+335
|
* bpo-40533: Disable GC in subinterpreters (GH-19961)Victor Stinner2020-05-061-0/+8
| | | | | | | When Python is built with experimental isolated interpreters, a garbage collection now does nothing in an isolated interpreter. Temporary workaround until subinterpreters stop sharing Python objects.
* bpo-40504: Allow weakrefs to lru_cache objects (GH-19938)Dennis Sweeney2020-05-051-1/+6
|
* bpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944)Victor Stinner2020-05-051-0/+15
| | | | In the experimental isolated subinterpreters build mode, _xxsubinterpreters.run_string() now releases the GIL.
* bpo-1635741: Port syslog module to multiphase initialization (GH-19907)Dong-hee Na2020-05-051-59/+63
|
* bpo-39435: Make the first argument of pickle.loads() positional-only. (GH-19846)Serhiy Storchaka2020-05-022-4/+5
| | | | It was positional-only de facto: documentation and two implementations used three different name.
* bpo-40334: Make the PyPegen* and PyParser* APIs more consistent (GH-19839)Lysandros Nikolaou2020-05-011-2/+2
| | | | | | | | | This commit makes both APIs more consistent by doing the following: - Remove the `PyPegen_CodeObjectFrom*` functions, which weren't used and will probably not be needed. Functions like `Py_CompileStringObject` can be used instead. - Include a `const char *filename` parameter in `PyPegen_ASTFromString`. - Rename `PyPegen_ASTFromFile` to `PyPegen_ASTFromFilename`, because its signature is not the same with `PyParser_ASTFromFile`.
* bpo-32494: Use gdbm_count for dbm_length if possible (GH-19814)Dong-hee Na2020-05-011-5/+25
|
* bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)Victor Stinner2020-05-015-8/+37
| | | | | | | | | An isolated subinterpreter cannot spawn threads, spawn a child process or call os.fork(). * Add private _Py_NewInterpreter(isolated_subinterpreter) function. * Add isolated=True keyword-only parameter to _xxsubinterpreters.create(). * Allow again os.fork() in "non-isolated" subinterpreters.
* bpo-1635741: Fix compiler warning in _stat.c (GH-19822)Victor Stinner2020-04-301-1/+1
| | | Cast Py_ARRAY_LENGTH() size_t to int explicitly.
* bpo-40334: Fix test_peg_parser to actually use the old parser (GH-19778)Lysandros Nikolaou2020-04-291-3/+11
| | | Now that the default parser is the new PEG parser, ast.parse uses it, which means that we don't actually test something in test_peg_parser. This commit introduces a new keyword argument (`oldparser`) for `_peg_parser.parse_string` for specifying that a string needs to be parsed with the old parser. This keyword argument is used in the tests to actually compare the ASTs the new parser generates with those generated by the old parser.
* bpo-40291: Add support for CAN_J1939 sockets (GH-19538)karl ding2020-04-292-0/+97
| | | | Add support for CAN_J1939 sockets that wrap SAE J1939 protocol functionality provided by Linux 5.4+ kernels.
* bpo-1635741: Port _stat module to multiphase initialization (GH-19798)Dong-hee Na2020-04-291-100/+127
|
* bpo-40328: Add tool for generating cjk mapping headers (GH-19602)Dong-hee Na2020-04-295-3/+6
|
* bpo-40286: Remove C implementation of Random.randbytes() (GH-19797)Victor Stinner2020-04-292-87/+1
| | | | | Remove _random.Random.randbytes(): the C implementation of randbytes(). Implement the method in Python to ease subclassing: randbytes() now directly reuses getrandbits().
* bpo-9216: Expose OpenSSL FIPS_mode() as _hashlib.get_fips_mode() (GH-19703)Victor Stinner2020-04-292-1/+85
| | | | | | test.pythoninfo logs OpenSSL FIPS_mode() and Linux /proc/sys/crypto/fips_enabled in a new "fips" section. Co-Authored-By: Petr Viktorin <encukou@gmail.com>
* bpo-40421: Add PyFrame_GetBack() function (GH-19765)Victor Stinner2020-04-291-4/+8
| | | | | | New PyFrame_GetBack() function: get the frame next outer frame. Replace frame->f_back with PyFrame_GetBack(frame) in most code but frameobject.c, ceval.c and genobject.c.
* bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)Victor Stinner2020-04-292-9/+10
| | | | The PyThreadState_GetFrame() function now returns a strong reference to the frame.
* bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)Victor Stinner2020-04-291-9/+7
| | | | | | | | | | | | | | | | | | | Remove the following function from the C API: * PyAsyncGen_ClearFreeLists() * PyContext_ClearFreeList() * PyDict_ClearFreeList() * PyFloat_ClearFreeList() * PyFrame_ClearFreeList() * PyList_ClearFreeList() * PySet_ClearFreeList() * PyTuple_ClearFreeList() Make these functions private, move them to the internal C API and change their return type to void. Call explicitly PyGC_Collect() to free all free lists. Note: PySet_ClearFreeList() did nothing.
* bpo-38880: List interpreters associated with a channel end (GH-17323)Lewis Gaul2020-04-291-6/+83
| | | | | This PR adds the functionality requested by https://github.com/ericsnowcurrently/multi-core-python/issues/52. Automerge-Triggered-By: @ericsnowcurrently
* bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)Victor Stinner2020-04-282-11/+15
|
* bpo-32604: Add support for a "default" arg in channel_recv(). (GH-19770)Eric Snow2020-04-281-11/+25
| | | | | This allows the caller to avoid creation of an exception when the channel is empty (just like `dict.get()` works). `ChannelEmptyError` is still raised if no default is provided. Automerge-Triggered-By: @ericsnowcurrently
* bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)Victor Stinner2020-04-281-7/+0
| | | Add frame_nslots() to factorize duplicate code.
* bpo-40421: Add PyFrame_GetCode() function (GH-19757)Victor Stinner2020-04-282-5/+6
| | | | | | | | | PyFrame_GetCode(frame): return a borrowed reference to the frame code. Replace frame->f_code with PyFrame_GetCode(frame) in most code, except in frameobject.c, genobject.c and ceval.c. Also add PyFrame_GetLineNumber() to the limited C API.
* bpo-40334: Support CO_FUTURE_BARRY_AS_BDFL in the new parser (GH-19721)Pablo Galindo2020-04-271-1/+2
| | | This commit also allows to pass flags to the new parser in all interfaces and fixes a bug in the parser generator that was causing to inline rules with actions, making them disappear.
* bpo-38061: subprocess uses closefrom() on FreeBSD (GH-19697)Victor Stinner2020-04-241-1/+7
| | | | | | | | | | | | | Optimize the subprocess module on FreeBSD using closefrom(). A single close(fd) syscall is cheap, but when sysconf(_SC_OPEN_MAX) is high, the loop calling close(fd) on each file descriptor can take several milliseconds. The workaround on FreeBSD to improve performance was to load and mount the fdescfs kernel module, but this is not enabled by default. Initial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans (kevans) and Kubilay Kocak (koobs): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274
* bpo-38061: os.closerange() uses closefrom() on FreeBSD (GH-19696)Victor Stinner2020-04-241-7/+20
| | | | | | | | | On FreeBSD, os.closerange(fd_low, fd_high) now calls closefrom(fd_low) if fd_high is greater than or equal to sysconf(_SC_OPEN_MAX). Initial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans (kevans) and Kubilay Kocak (koobs): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274
* bpo-40334: Improve various PEG-Parser related stuff (GH-19669)Lysandros Nikolaou2020-04-231-1/+1
| | | The changes in this commit are all related to @vstinner's original review comments of the initial PEP 617 implementation PR.
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-222-0/+110
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40138: Fix Windows os.waitpid() for large exit code (GH-19637)Victor Stinner2020-04-222-19/+34
| | | | | | | | Fix the Windows implementation of os.waitpid() for exit code larger than "INT_MAX >> 8". The exit status is now interpreted as an unsigned number. os.waitstatus_to_exitcode() now accepts wait status larger than INT_MAX.
* Fix uninitialized struct member (GH-19589)Raymond Hettinger2020-04-201-0/+1
|
* bpo-39849: Enable assertions in _testcapimodule.c and _testinternalcapi.c ↵Hai Shi2020-04-202-0/+6
| | | | (GH-19623)
* bpo-40178: Convert the remaining os functions to Argument Clinic. (GH-19360)Serhiy Storchaka2020-04-182-125/+715
| | | | | Convert os.getgrouplist(), os.initgroups(), os.sendfile() and os.get_terminal_size().
* bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)Serhiy Storchaka2020-04-181-3/+3
| | | | Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* bpo-40286: Makes simpler the relation between randbytes() and getrandbits() ↵Serhiy Storchaka2020-04-171-12/+6
| | | | (GH-19574)
* bpo-40282: Allow random.getrandbits(0) (GH-19539)Antoine Pitrou2020-04-171-2/+5
|
* bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)Victor Stinner2020-04-173-10/+10
| | | | | | | | | * Replace PY_INT64_T with int64_t * Replace PY_UINT32_T with uint32_t * Replace PY_UINT64_T with uint64_t sha3module.c no longer checks if PY_UINT64_T is defined since it's always defined and uint64_t is always available on platforms supported by Python.
* bpo-40286: Add randbytes() method to random.Random (GH-19527)Victor Stinner2020-04-173-9/+101
| | | | | | | | | | | | Add random.randbytes() function and random.Random.randbytes() method to generate random bytes. Modify secrets.token_bytes() to use SystemRandom.randbytes() rather than calling directly os.urandom(). Rename also genrand_int32() to genrand_uint32(), since it returns an unsigned 32-bit integer, not a signed integer. The _random module is now built with Py_BUILD_CORE_MODULE defined.
* bpo-40302: Add pycore_byteswap.h header file (GH-19552)Victor Stinner2020-04-175-91/+90
| | | | | | | | | | | | | | Add a new internal pycore_byteswap.h header file with the following functions: * _Py_bswap16() * _Py_bswap32() * _Py_bswap64() Use these functions in _ctypes, sha256 and sha512 modules, and also use in the UTF-32 encoder. sha256, sha512 and _ctypes modules are now built with the internal C API.
* bpo-40294: Fix _asyncio when module is loaded/unloaded multiple times (GH-19542)Jeffrey Quesnelle2020-04-171-0/+2
|