summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* gh-111138: Add PyList_Extend() and PyList_Clear() functions (#111862)Victor Stinner2023-11-131-0/+21
| | | | | | * Split list_extend() into two sub-functions: list_extend_fast() and list_extend_iter(). * list_inplace_concat() no longer has to call Py_DECREF() on the list_extend() result, since list_extend() now returns an int.
* gh-111928: make "memo" dict local to scan_once call (gh-112005)AN Long2023-11-131-23/+19
| | | Co-authored-by: Sam Gross <colesbury@gmail.com>
* gh-111777: Fix assertion errors on incorrectly still-tracked GC object ↵T. Wouters2023-11-121-1/+3
| | | | | | | | | | destruction (#111778) In PyObject_GC_Del, in Py_DEBUG mode, when warning about GC objects that were not properly untracked before starting destruction, take care to untrack the object _before_ warning, to avoid triggering a GC run and causing the problem the code tries to warn about. Also make sure to save and restore any pending exceptions, which the warning would otherwise clobber or trigger an assertion error on.
* Fix undefined behaviour in datetime.time.fromisoformat() (#111982)T. Wouters2023-11-111-1/+1
| | | Fix undefined behaviour in datetime.time.fromisoformat() when parsing a string without a timezone. 'tzoffset' is not assigned to by parse_isoformat_time if it returns 0, but time_fromisoformat then passes tzoffset to another function, which is undefined behaviour (even if the function in question does not use the value).
* gh-111789: Simplify the sqlite code (GH-111829)Serhiy Storchaka2023-11-102-17/+6
| | | | Use new C API functions PyDict_GetItemRef() and PyMapping_GetOptionalItemString().
* Add private _PyUnicode_AsUTF8NoNUL() function (GH-111957)Serhiy Storchaka2023-11-102-13/+2
| | | | Like PyUnicode_AsUTF8(), but check for embedded null characters.
* gh-111841: Fix os.putenv() and os.unsetenv() with embedded NUL on Windows ↵Serhiy Storchaka2023-11-101-1/+6
| | | | (GH-111842)
* gh-111569: Fix critical sections test on WebAssembly (GH-111897)Sam Gross2023-11-091-0/+4
| | | | | | | | This adds a macro `Py_CAN_START_THREADS` that corresponds to the Python function `test.support.threading_helper.can_start_thread()`. WASI and some Emscripten builds do not have a working pthread implementation. This macro is used to guard the critical sections C API tests that require a working threads implementation.
* gh-111835: Add seekable method to mmap.mmap (gh-111852)Donghee Na2023-11-091-7/+14
|
* GH-111804: Drop posix.fallocate() under WASI (GH-111869)Brett Cannon2023-11-092-5/+8
| | | | | | | Drop posix.fallocate() under WASI. The underlying POSIX function, posix_fallocate(), was found to vary too much between implementations to remain in WASI. As such, while it was available in WASI preview1, it's been dropped in preview2.
* gh-111569: Implement Python critical section API (gh-111571)Sam Gross2023-11-084-1/+218
| | | | | | | | Critical sections are helpers to replace the global interpreter lock with finer grained locking. They provide similar guarantees to the GIL and avoid the deadlock risk that plain locking involves. Critical sections are implicitly ended whenever the GIL would be released. They are resumed when the GIL would be acquired. Nested critical sections behave as if the sections were interleaved.
* Remove redundant check in dbm.open() (GH-111844)Serhiy Storchaka2023-11-081-5/+0
| | | PyUnicode_FSConverter() already checks for embedded null characters.
* gh-111495: Add tests for PyList C API (#111562)Kalyan2023-11-081-1/+179
| | | | | Signed-off-by: kalyanr <kalyan.ben10@live.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* socket: Update generated AC code (#111853)Jelle Zijlstra2023-11-081-2/+7
|
* gh-111662: Update socket module to use AC for optimizing performance (gh-111661)Bogdan Romanyuk2023-11-082-69/+223
|
* gh-111089: Revert PyUnicode_AsUTF8() changes (#111833)Victor Stinner2023-11-0727-154/+789
| | | | | | | | | | | | | | | | | | | | | * Revert "gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)" This reverts commit d9b606b3d04fc56fb0bcc479d7d6c14562edb5e2. * Revert "gh-111089: Use PyUnicode_AsUTF8() in getargs.c (#111620)" This reverts commit cde1071b2a72e8261ca66053ef61431b7f3a81fd. * Revert "gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)" This reverts commit d731579bfb9a497cfb0076cb6b221058a20088fe. * Revert "gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)" This reverts commit d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44. * Revert "gh-111089: Use PyUnicode_AsUTF8() in sqlite3 (#111122)" This reverts commit 37e4e20eaa8f27ada926d49e5971fecf0477ad26.
* gh-101180: Fix a bug where iso2022_jp_3 and iso2022_jp_2004 codecs read out ↵Masayuki Moriyama2023-11-061-3/+6
| | | | of bounds (gh-111695)
* gh-111495: Add tests for PyComplex C API (GH-111591)Sergey B Kirpichev2023-11-051-0/+92
|
* gh-111495: Add tests for PyFloat C API (GH-111624)Sergey B Kirpichev2023-11-051-0/+74
|
* gh-110395: invalidate open kqueues after fork (#110517)Davide Rizzo2023-11-041-7/+137
| | | Invalidate open select.kqueue instances after fork as the fd will be invalid in the child.
* gh-96954: use a directed acyclic word graph for storing the unicodedata ↵CF Bolz-Tereick2023-11-042-30225/+17432
| | | | | | | codepoint names (#97906) Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com> Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* GH-110829: Ensure Thread.join() joins the OS thread (#110848)Antoine Pitrou2023-11-041-55/+282
| | | | | | | Joining a thread now ensures the underlying OS thread has exited. This is required for safer fork() in multi-threaded processes. --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* Add a fuzz target for `_elementtree.XMLParser._parse_whole` (#111477)Brad Larsen2023-11-0359-0/+620
| | | * Add a fuzzer for `_elementtree.XMLParser._parse_whole`
* gh-90026: support XATTRs on Cygwin (GH-105075)Philippe Cerfon2023-11-031-3/+9
|
* gh-108082: Remove _PyErr_WriteUnraisableMsg() (GH-111643)Serhiy Storchaka2023-11-035-78/+16
| | | | Replace the remaining calls with PyErr_FormatUnraisable().
* gh-111482: Use Argument Clinic for clock_gettime() (#111641)Victor Stinner2023-11-022-32/+139
| | | | | | | | | | | | | | | | | | Use Argument Clinic for time.clock_gettime() and time.clock_gettime_ns() functions. Benchmark on time.clock_gettime_ns(): import time import pyperf runner = pyperf.Runner() runner.timeit( 'clock_gettime_ns(CLOCK_MONOTONIC_COARSE)', setup='import time; clock_gettime_ns=time.clock_gettime_ns; CLOCK_MONOTONIC_COARSE=6', stmt='clock_gettime_ns(CLOCK_MONOTONIC_COARSE)') Result on Linux with CPU isolation: Mean +- std dev: [ref] 134 ns +- 1 ns -> [change] 55.7 ns +- 1.4 ns: 2.41x faster
* gh-108082: Use PyErr_FormatUnraisable() (GH-111580)Serhiy Storchaka2023-11-025-16/+12
| | | | | | Replace most of calls of _PyErr_WriteUnraisableMsg() and some calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable(). Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-76785: Crossinterp utils additions (gh-111530)Eric Snow2023-11-011-390/+29
| | | | | | | | | | | | This moves several general internal APIs out of _xxsubinterpretersmodule.c and into the new Python/crossinterp.c (and the corresponding internal headers). Specifically: * _Py_excinfo, etc.: the initial implementation for non-object exception snapshots (in pycore_pyerrors.h and Python/errors.c) * _PyXI_exception_info, etc.: helpers for passing an exception beween interpreters (wraps _Py_excinfo) * _PyXI_namespace, etc.: helpers for copying a dict of attrs between interpreters * _PyXI_Enter(), _PyXI_Exit(): functions that abstract out the transitions between one interpreter and a second that will do some work temporarily Again, these were all abstracted out of _xxsubinterpretersmodule.c as generalizations. I plan on proposing these as public API at some point.
* gh-106718: Treat PyConfig.stdlib_dir as highest-priority setting for ↵Yilei Yang2023-11-011-10/+14
| | | | stdlib_dir when calculating paths (GH-108730)
* Simplify trivial calls of PyUnicode_FromFormat() (GH-111605)Serhiy Storchaka2023-11-012-2/+2
|
* gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)Victor Stinner2023-11-0125-781/+151
| | | | | | | Replace PyUnicode_AsUTF8AndSize() with PyUnicode_AsUTF8() to remove the explicit check for embedded null characters. The change avoids to have to include explicitly <string.h> to get the strlen() function when using a recent version of the limited C API.
* gh-111495: Add tests for PyBytes and PyByteArray C API (GH-111496)Serhiy Storchaka2023-11-012-0/+344
|
* gh-111495: add stub files for C API test modules (GH-111586)Sergey B Kirpichev2023-11-0111-3/+169
| | | | | This is to reduce merge conflicts (Modules/Setup.stdlib.in) for subsequent pull requests for the issue.
* gh-110968: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED was added to 3.12 (#111584)Victor Stinner2023-11-0110-17/+17
|
* gh-108082: Add PyErr_FormatUnraisable() function (GH-111086)Serhiy Storchaka2023-10-311-0/+25
|
* gh-76785: Move the Cross-Interpreter Code to Its Own File (gh-111502)Eric Snow2023-10-304-54/+56
| | | This is partly to clear this stuff out of pystate.c, but also in preparation for moving some code out of _xxsubinterpretersmodule.c. This change also moves this stuff to the internal API (new: Include/internal/pycore_crossinterp.h). @vstinner did this previously and I undid it. Now I'm re-doing it. :/
* gh-108082: C API: Add tests for PyErr_WriteUnraisable() (GH-111455)Serhiy Storchaka2023-10-301-0/+17
| | | | Also document the behavior when called with NULL.
* gh-110481: Implement biased reference counting (gh-110764)Sam Gross2023-10-3014-0/+84
|
* gh-90815: Add mimalloc memory allocator (#109914)Dino Viehland2023-10-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add mimalloc v2.12 Modified src/alloc.c to remove include of alloc-override.c and not compile new handler. Did not include the following files: - include/mimalloc-new-delete.h - include/mimalloc-override.h - src/alloc-override-osx.c - src/alloc-override.c - src/static.c - src/region.c mimalloc is thread safe and shares a single heap across all runtimes, therefore finalization and getting global allocated blocks across all runtimes is different. * mimalloc: minimal changes for use in Python: - remove debug spam for freeing large allocations - use same bytes (0xDD) for freed allocations in CPython and mimalloc This is important for the test_capi debug memory tests * Don't export mimalloc symbol in libpython. * Enable mimalloc as Python allocator option. * Add mimalloc MIT license. * Log mimalloc in Lib/test/pythoninfo.py. * Document new mimalloc support. * Use macro defs for exports as done in: https://github.com/python/cpython/pull/31164/ Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-94808: Add coverage test for number check (gh-111445)Evan Kohilas2023-10-291-0/+7
|
* gh-111342: fix typo in math.sumprod (GH-111416)Sergey B Kirpichev2023-10-281-1/+1
|
* gh-108765: Include explicitly <unistd.h> in signalmodule.c (#111402)Victor Stinner2023-10-271-0/+3
| | | unistd.h is needed by alarm() and pause() functions.
* no-issue: Remove unused variable in getpath.py (gh-111372)Satish Pokala2023-10-271-2/+0
|
* gh-109587: Allow "precompiled" perf-trampolines to largely mitigate the cost ↵gsallam2023-10-271-0/+32
| | | | of enabling perf-trampolines (#109666)
* GH-111293: Fix DirEntry.inode dropping higher bits on Windows (GH-111294)zcxsythenew2023-10-261-3/+3
|
* Output more details in the re tracing (GH-111357)Serhiy Storchaka2023-10-262-4/+42
|
* gh-67224: Show source lines in tracebacks when using the -c option when ↵Pablo Galindo Salgado2023-10-261-1/+1
| | | | running Python (#111200)
* gh-111230: Fix errors checking in _ssl module init (#111232)Nikita Sobolev2023-10-251-82/+71
| | | Introduce ADD_INT_CONST macro wrapper for PyModule_AddIntConstant()
* gh-111174: Fix crash in getbuffer() called repeatedly for empty BytesIO ↵Serhiy Storchaka2023-10-251-3/+4
| | | | (GH-111210)
* gh-106320: Re-add some PyLong/PyDict C-API functions (GH-#111162)scoder2023-10-255-5/+1
| | | | | | | | * gh-106320: Re-add _PyLong_FromByteArray(), _PyLong_AsByteArray() and _PyLong_GCD() to the public header files since they are used by third-party packages and there is no efficient replacement. See https://github.com/python/cpython/issues/111140 See https://github.com/python/cpython/issues/111139 * gh-111262: Re-add _PyDict_Pop() to have a C-API until a new public one is designed.