summaryrefslogtreecommitdiffstats
path: root/Modules/Setup.stdlib.in
Commit message (Collapse)AuthorAgeFilesLines
* gh-138122: Allow tachyon to write and read binary output (#142730)Pablo Galindo Salgado2025-12-221-1/+1
|
* gh-138122: Add --subprocesses flag to profile child processes in tachyon ↵Pablo Galindo Salgado2025-12-151-1/+1
| | | | (#142636)
* gh-138122: Implement frame caching in RemoteUnwinder to reduce memory reads ↵Pablo Galindo Salgado2025-12-061-1/+1
| | | | | | | | | | | (#142137) This PR implements frame caching in the RemoteUnwinder class to significantly reduce memory reads when profiling remote processes with deep call stacks. When cache_frames=True, the unwinder stores the frame chain from each sample and reuses unchanged portions in subsequent samples. Since most profiling samples capture similar call stacks (especially the parent frames), this optimization avoids repeatedly reading the same frame data from the target process. The implementation adds a last_profiled_frame field to the thread state that tracks where the previous sample stopped. On the next sample, if the current frame chain reaches this marker, the cached frames from that point onward are reused instead of being re-read from remote memory. The sampling profiler now enables frame caching by default.
* gh-138122: Split Modules/_remote_debugging_module.c into multiple files ↵Pablo Galindo Salgado2025-11-251-1/+1
| | | | | (#141934) gh-1381228: Split Modules/_remote_debugging_module.c into multiple files
* gh-140550: Initial implementation of PEP 793 – PyModExport (GH-140556)Petr Viktorin2025-11-051-1/+1
| | | | Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-81313: Add the math.integer module (PEP-791) (GH-133909)Serhiy Storchaka2025-10-311-0/+1
|
* gh-137210: Add a struct, slot & function for checking an extension's ABI ↵Petr Viktorin2025-09-051-1/+1
| | | | | (GH-137212) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* gh-136421: Load `_datetime` static types during interpreter initialization ↵Peter Bierma2025-07-211-3/+0
| | | | | (GH-136583) `_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.
* gh-136669: build `_asyncio` as static module (#136670)Kumar Aditya2025-07-161-1/+6
| | | `_asyncio` is now built as a static module so that thread states can be accessed directly via registers and avoids the overhead of function call.
* GH-132983: Build ``_zstd`` on Windows (#133366)Adam Turner2025-05-051-1/+1
|
* GH-91048: Minor fixes for ``_remotedebugging`` & rename to ↵Adam Turner2025-05-051-1/+1
| | | | ``_remote_debugging`` (#133398)
* gh-132983: Introduce `_zstd` bindings module (GH-133027)Emma Smith2025-05-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add _zstd module for https://peps.python.org/pep-0784/ This commit introduces the `_zstd` module, with bindings to libzstd from the pyzstd project. It also includes the unix build system configuration. Windows build system support will be integrated independently as it depends on integration with cpython-source-deps. * Add _zstd to modules * Fix path for compression.zstd module * Ignore _zstd module like _io * Expand module state macros to improve code quality Also removes module state references from the classes in the _zstd module and instead uses PyType_GetModuleState() * Remove backticks suggested in review Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> * Use critical sections to lock object state This should avoid races and deadlocks. * Remove compress/decompress and mark module as not reliant on the GIL The `compress`/`decompress` functions will be moved to Python code for simplicity. C implementations can always be re-added in the future. Also, mark _zstd as not requiring the GIL. * Lift critical section to avoid clang warning * Respond to comments by picnixz * Call out pyzstd explicitly in license description Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> * Use a much more robust implementation... ... for `get_zstd_state_from_type` Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> * Use PyList_GetItemRef for thread safety purposes * Use a macro for the minimum supported version * remove const from primivite types * Use PyMem_New in another spot * Simplify error handling in _get_frame_size * Another simplification of error handling in get_frame_info * Rename _module_state to mod_state * Rewrite comment explaining the context of the code * Add link to pyzstd * Add TODO about refactoring dict training code * Use PyModule_AddObjectRef over PyModule_AddObject PyModule_AddObject is soft-deprecated, so we should use PyModule_AddObjectRef * Check result of OutputBufferGrow * Simplify return logic in `add_constant_to_type` Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> * Ignore return value of _zstd_clear() Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> * Remove redundant comments * Remove __reduce__ from ZstdDict We should instead document that to pickle a dictionary a user should use the `.dict_content` attribute. * Use PyUnicode_FromFormat instead of a buffer * Don't use C constants/types in error messages * Make error messages easier to understand for Python users * Lower minimum required version 1.4.0 * Use casts and make slot function signatures correct * Be consistent with CPython on const usage * Make else clauses in line with PEP 7 * Fix over-indented blocks in argument clinic * Add critical section around ZSTD_DCtx_setParameter * Add a TODO about refactoring critical sections * Use Py_UNREACHABLE * Move bytes operations out of Py_BEGIN_ALLOW_THREADS * Add TODO about ensuring a lock is held * Remove asserts that may not be correct * Add TODO to make ZstdDict and others GC objects * Make objects GC tracked * Remove unused include * Fix some memory issues * Fix refleaks on module and in ZstdDict * Update configure to check for ZDICT_finalizeDictionary * Properly check version in configure * exit(1) if check fails * Use AC_RUN_IFELSE * Use a define() to re-use version check * Actually properly set _zstd module status based on version --------- Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* GH-91048: Add utils for printing the call stack for asyncio tasks (#133284)Pablo Galindo Salgado2025-05-041-1/+1
|
* gh-128813: hide mixed-mode functions for complex arithmetic from C-API (#131703)Sergey B Kirpichev2025-04-221-1/+1
|
* gh-131298: eliminate HACL* static libraries for cryptographic modules ↵Bénédikt Tran2025-04-201-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-132438) * simplify HACL* build for MD5, SHA1, SHA2 and SHA3 modules * remove statically linked libraries for HACL* implementation * is it better now? * is it better now? * fixup * Present HACL* as a static or shared library. On WASI, extension modules based on HACL* require the HACL* library to be linked statically. On other platforms, it can be built dynamically. * amend whitespace * remove temporary .so file as it requires more symlinks * avoid smelly symbols * fixup checksums * regen sbom * fixup shell warnings and comments * it *should* work
* gh-128384: Use a context variable for warnings.catch_warnings (gh-130010)Neil Schemenauer2025-04-091-1/+0
| | | | | | | | | | | | | | | | | | | | Make `warnings.catch_warnings()` use a context variable for holding the warning filtering state if the `sys.flags.context_aware_warnings` flag is set to true. This makes using the context manager thread-safe in multi-threaded programs. Add the `sys.flags.thread_inherit_context` flag. If true, starting a new thread with `threading.Thread` will use a copy of the context from the caller of `Thread.start()`. Both these flags are set to true by default for the free-threaded build and false for the default build. Move the Python implementation of warnings.py into _py_warnings.py. Make _contextvars a builtin module. Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-99108: Implement HACL* HMAC (#130157)Bénédikt Tran2025-04-041-5/+7
| | | | | | | A new extension module, `_hmac`, now exposes the HACL* HMAC (formally verified) implementation. The HACL* implementation is used as a fallback implementation when the OpenSSL implementation of HMAC is not available or disabled. For now, only named hash algorithms are recognized and SIMD support provided by HACL* for the BLAKE2 hash functions is not yet used.
* gh-93649: Add Modules/_testcapi/function.c file (#129521)Victor Stinner2025-01-311-1/+1
| | | | | * Move PyFunction C API tests to a new file. * Add Lib/test/test_capi/test_function.py. * Move tests from test_capi.test_misc to test_capi.test_function.
* gh-93649: Add Modules/_testcapi/type.c file (#129516)Victor Stinner2025-01-311-1/+1
| | | | | | | | | Move PyType C API tests to a new file. Move following tests from test_capi.test_misc to test_capi.test_type: * BuiltinStaticTypesTests * test_get_type_name() * test_get_base_by_token()
* gh-93649: Move PyFrame C API tests to test_capi (#129512)Victor Stinner2025-01-311-1/+1
| | | | | | * Add Lib/test/test_capi/test_frame.py file. * Move C API tests from test_frame to test_capi.test_frame. * Add Modules/_testcapi/frame.c file. * Move C API tests from _testcapimodule.c to frame.c
* gh-111495: Add PyFile tests (#129449)Victor Stinner2025-01-301-1/+1
| | | | | | | | | | | | | | Add tests for the following functions in test_capi.test_file: * PyFile_FromFd() * PyFile_GetLine() * PyFile_NewStdPrinter() * PyFile_WriteObject() * PyFile_WriteString() * PyObject_AsFileDescriptor() Add Modules/_testlimitedcapi/file.c file. Remove test_embed.StdPrinterTests which became redundant.
* gh-128911: Add PyImport_ImportModuleAttr() function (#128912)Victor Stinner2025-01-301-1/+1
| | | | | | | | | | | Add PyImport_ImportModuleAttr() and PyImport_ImportModuleAttrString() functions. * Add unit tests. * Replace _PyImport_GetModuleAttr() with PyImport_ImportModuleAttr(). * Replace _PyImport_GetModuleAttrString() with PyImport_ImportModuleAttrString(). * Remove "pycore_import.h" includes, no longer needed.
* gh-128911: Add tests on the PyImport C API (#128915)Victor Stinner2025-01-171-1/+1
| | | | | | | | * Add Modules/_testlimitedcapi/import.c * Add Lib/test/test_capi/test_import.py * Remove _testcapi.check_pyimport_addmodule(): tests already covered by newly added tests. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-128629: Add Py_PACK_VERSION and Py_PACK_FULL_VERSION (GH-128630)Petr Viktorin2025-01-091-1/+1
|
* gh-111495: Add tests for `PyCodec_*` C API (#123343)Bénédikt Tran2024-09-291-1/+1
|
* gh-107954, PEP 741: Add PyConfig_Get()/Set() functions (#123472)Victor Stinner2024-09-021-1/+1
| | | | | | | | | | | Add PyConfig_Get(), PyConfig_GetInt(), PyConfig_Set() and PyConfig_Names() functions to get and set the current runtime Python configuration. Add visibility and "sys spec" to config and preconfig specifications. _PyConfig_AsDict() now converts PyConfig.xoptions as a dictionary. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-111495: Add tests for PyTuple C API (#118757)Sergey B Kirpichev2024-08-261-1/+1
| | | | | Co-authored-by: kalyanr <kalyan.ben10@live.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-99108: Add HACL* Blake2 implementation to hashlib (GH-119316)Jonathan Protzenko2024-08-131-1/+1
| | | | | | | This replaces the existing hashlib Blake2 module with a single implementation that uses HACL\*'s Blake2b/Blake2s implementations. We added support for all the modes exposed by the Python API, including tree hashing, leaf nodes, and so on. We ported and merged all of these changes upstream in HACL\*, added test vectors based on Python's existing implementation, and exposed everything needed for hashlib. This was joint work done with @R1kM. See the PR for much discussion and benchmarking details. TL;DR: On many systems, 8-50% faster (!) than `libb2`, on some systems it appeared 10-20% slower than `libb2`.
* gh-111495: Add more tests on PyEval C APIs (#122789)Victor Stinner2024-08-081-1/+1
| | | | * Add Lib/test/test_capi/test_eval.py * Add Modules/_testlimitedcapi/eval.c
* gh-121554: remove unnecessary internal functions in compile.c (#121555)Irit Katriel2024-07-101-1/+0
| | | Co-authored-by: Erlend E. Aasland <erlend@python.org>
* gh-111997: C-API for signalling monitoring events (#116413)Irit Katriel2024-05-041-1/+1
|
* gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791)Eric Snow2024-04-241-3/+4
| | | See https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26.
* gh-117968: Add tests for the part of the PyRun family of the C API (GH-117982)Serhiy Storchaka2024-04-171-1/+1
| | | | Co-authored-by: NGRsoftlab <78017794+NGRsoftlab@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-94808:Improve coverage of PyObject_Print (GH-98749)MonadChains2024-04-011-1/+1
|
* gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() ↵Serhiy Storchaka2024-03-251-1/+1
| | | | | (GH-117160) Create a new bytes object and destroy the old one if it has refcount > 1.
* gh-115754: Add Py_GetConstant() function (#116883)Victor Stinner2024-03-211-1/+1
| | | | | | | | | | | | Add Py_GetConstant() and Py_GetConstantBorrowed() functions. In the limited C API version 3.13, getting Py_None, Py_False, Py_True, Py_Ellipsis and Py_NotImplemented singletons is now implemented as function calls at the stable ABI level to hide implementation details. Getting these constants still return borrowed references. Add _testlimitedcapi/object.c and test_capi/test_object.py to test Py_GetConstant() and Py_GetConstantBorrowed() functions.
* gh-116417: Move limited C API complex.c tests to _testlimitedcapi (#117014)Victor Stinner2024-03-191-1/+1
| | | | Split complex.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi.
* gh-116417: Move limited C API dict.c tests to _testlimitedcapi (#117006)Victor Stinner2024-03-191-1/+1
| | | | Split dict.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi.
* gh-116417: Move limited C API long.c tests to _testlimitedcapi (#117001)Victor Stinner2024-03-191-1/+1
| | | | | | | * Split long.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi. * Move testcapi_long.h from Modules/_testcapi/ to Modules/_testlimitedcapi/. * Add MODULE__TESTLIMITEDCAPI_DEPS to Makefile.pre.in.
* gh-116417: Move limited C API unicode.c tests to _testlimitedcapi (#116993)Victor Stinner2024-03-191-1/+1
| | | | | | Split unicode.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi. Update test_codecs.
* gh-116417: Move limited C API abstract.c tests to _testlimitedcapi (#116986)Victor Stinner2024-03-191-1/+1
| | | | | | | Split abstract.c and float.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi. Update test_bytes and test_class.
* gh-116417: Move limited C API list.c tests to _testlimitedcapi (#116602)Victor Stinner2024-03-181-1/+1
| | | | | Split list.c and set.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi.
* gh-116417: Move 4 limited C API test files to _testlimitedcapi (#116571)Victor Stinner2024-03-111-2/+2
| | | | | | | | | | | | | | | | Move the following files from Modules/_testcapi/ to Modules/_testlimitedcapi/: * bytearray.c * bytes.c * pyos.c * sys.c Changes: * Replace PyBytes_AS_STRING() with PyBytes_AsString(). * Replace PyBytes_GET_SIZE() with PyBytes_Size(). * Update related test_capi tests. * Copy Modules/_testcapi/util.h to Modules/_testlimitedcapi/util.h.
* gh-116303: Explicitly check for the _testsinglephase module in configure.ac ↵Erlend E. Aasland2024-03-071-1/+1
| | | | (#116479)
* gh-116417: Add _testlimitedcapi C extension (#116419)Victor Stinner2024-03-071-1/+2
| | | | | | | | | | | | | Add a new C extension "_testlimitedcapi" which is only built with the limited C API. Move heaptype_relative.c and vectorcall_limited.c from Modules/_testcapi/ to Modules/_testlimitedcapi/. * configure: add _testlimitedcapi test extension. * Update generate_stdlib_module_names.py. * Update make check-c-globals. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-115773: Add tests to exercise the _Py_DebugOffsets structure (#115774)Pablo Galindo Salgado2024-02-281-0/+1
|
* gh-110850: Add PyTime_t C API (GH-115215)Petr Viktorin2024-02-121-1/+1
| | | | | | | | | | | | * gh-110850: Add PyTime_t C API Add PyTime_t API: * PyTime_t type. * PyTime_MIN and PyTime_MAX constants. * PyTime_AsSecondsDouble(), PyTime_Monotonic(), PyTime_PerfCounter() and PyTime_GetSystemClock() functions. Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-76785: More Fixes for test.support.interpreters (gh-113012)Eric Snow2023-12-121-0/+3
| | | This brings the module (along with the associated extension modules) mostly in sync with PEP 734. There are only a few small things to wrap up.
* gh-111545: Test PyHash_GetFuncDef() function (#112098)Victor Stinner2023-11-151-1/+1
| | | Add Modules/_testcapi/hash.c and Lib/test/test_capi/test_hash.py.
* gh-111569: Implement Python critical section API (gh-111571)Sam Gross2023-11-081-1/+1
| | | | | | | | 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.