summaryrefslogtreecommitdiffstats
path: root/Tools/c-analyzer
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-71587: Drop local reference cache to `_strptime` module in ↵Miss Islington (bot)2024-06-121-1/+0
| | | | | | | | | `_datetime` (gh-120424) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()). (cherry picked from commit 127c1d2771749853e287632c086b6054212bf12a, AKA gh-120224) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* [3.13] gh-117398: Use Per-Interpreter State for the _datetime Static Types ↵Miss Islington (bot)2024-06-032-0/+2
| | | | | | | | | | | (gh-120009) We make use of the same mechanism that we use for the static builtin types. This required a few tweaks. This change is the final piece needed to make _datetime support multiple interpreters. I've updated the module slot accordingly. (cherry picked from commit 105f22ea46ac16866e6df18ebae2a8ba422b7f45, AKA gh-119929) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-117398: Statically Allocate the Datetime C-API (GH-119472) (gh-119641)Eric Snow2024-05-281-0/+3
| | | | | | | This is a backport of 3 commits that go together. (cherry picked from commit a895756) (cherry picked from commit b30d30c) (cherry picked from commit a89fc26)
* gh-118518: Allow perf to work without frame pointers (#112254)Pablo Galindo Salgado2024-05-051-0/+2
|
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-041-0/+1
|
* gh-111997: C-API for signalling monitoring events (#116413)Irit Katriel2024-05-041-0/+1
|
* gh-116126: Implement PEP 696 (#116129)Jelle Zijlstra2024-05-031-0/+2
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-116738: Make `_codecs` module thread-safe (#117530)Brett Simmers2024-05-021-1/+1
| | | | | | | | | | | | | | | The module itself is a thin wrapper around calls to functions in `Python/codecs.c`, so that's where the meaningful changes happened: - Move codecs-related state that lives on `PyInterpreterState` to a struct declared in `pycore_codecs.h`. - In free-threaded builds, add a mutex to `codecs_state` to synchronize operations on `search_path`. Because `search_path_mutex` is used as a normal mutex and not a critical section, we must be extremely careful with operations called while holding it. - The codec registry is explicitly initialized as part of `_PyUnicode_InitEncodings` to simplify thread-safety.
* gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791)Eric Snow2024-04-241-5/+5
| | | See https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26.
* gh-117680: make _PyInstructionSequence a PyObject and use it in tests (#117629)Irit Katriel2024-04-171-0/+1
|
* gh-117142: Port _ctypes to multi-phase init (GH-117181)neonene2024-04-101-0/+1
|
* gh-117142: ctypes: Migrate global vars to module state (GH-117189)neonene2024-03-291-2/+2
|
* gh-76785: Drop PyInterpreterID_Type (gh-117101)Eric Snow2024-03-211-1/+0
| | | I added it quite a while ago as a strategy for managing interpreter lifetimes relative to the PEP 554 (now 734) implementation. Relatively recently I refactored that implementation to no longer rely on InterpreterID objects. Thus now I'm removing it.
* gh-115754: Add Py_GetConstant() function (#116883)Victor Stinner2024-03-211-0/+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-85283: Convert grp extension to the limited C API (#116611)Victor Stinner2024-03-121-0/+2
| | | | posixmodule.h: remove check on the limited C API, since these helpers are not part of the public C API.
* gh-116417: Fix make check-c-globals for _testlimitedcapi (#116570)Victor Stinner2024-03-102-1/+1
| | | | | * Remove unused '_testcapimodule' global in Modules/_testcapi/unicode.c. * Update c-analyzer to not use the internal C API in _testlimitedcapi.c.
* gh-116417: Add _testlimitedcapi C extension (#116419)Victor Stinner2024-03-071-2/+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-116265: Remove obsolete sentence. (#116284)Terry Jan Reedy2024-03-041-4/+2
| | | | | Remove sentence in Tools/c-analyzer/README referring to deleted ignore-globals.txt.
* gh-103092: Add a mutex to make the PRNG state of rotatingtree ↵AN Long2024-02-291-0/+1
| | | | concurrent-safe (#115301)
* GH-115816: Make tier2 optimizer symbols testable, and add a few tests. ↵Mark Shannon2024-02-271-2/+0
| | | | (GH-115953)
* Rename tier 2 redundancy eliminator to optimizer (#115888)Guido van Rossum2024-02-261-2/+2
| | | | The original name is just too much of a mouthful.
* gh-110850: Rename internal PyTime C API functions (#115734)Victor Stinner2024-02-201-0/+1
| | | | | | | | | | | | | | | | | Rename functions: * _PyTime_GetSystemClock() => _PyTime_TimeUnchecked() * _PyTime_GetPerfCounter() => _PyTime_PerfCounterUnchecked() * _PyTime_GetMonotonicClock() => _PyTime_MonotonicUnchecked() * _PyTime_GetSystemClockWithInfo() => _PyTime_TimeWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() Changes: * Remove "typedef PyTime_t PyTime_t;" which was "typedef PyTime_t _PyTime_t;" before a previous rename. * Update comments of "Unchecked" functions. * Remove invalid PyTime_Time() comment.
* GH-112354: Initial implementation of warm up on exits and trace-stitching ↵Mark Shannon2024-02-202-0/+6
| | | | (GH-114142)
* gh-114570: Add PythonFinalizationError exception (#115352)Victor Stinner2024-02-141-0/+2
| | | | | | | | | | | | | | | | | Add PythonFinalizationError exception. This exception derived from RuntimeError is raised when an operation is blocked during the Python finalization. The following functions now raise PythonFinalizationError, instead of RuntimeError: * _thread.start_new_thread() * subprocess.Popen * os.fork() * os.fork1() * os.forkpty() Morever, _winapi.Overlapped finalizer now logs an unraisable PythonFinalizationError, instead of an unraisable RuntimeError.
* gh-115399: Upgrade bundled libexpat to 2.6.0 (#115431)Seth Michael Larson2024-02-141-0/+1
|
* gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424)Eric Snow2024-02-131-4/+4
| | | | | For the most part, these changes make is substantially easier to backport subinterpreter-related code to 3.12, especially the related modules (e.g. _xxsubinterpreters). The main motivation is to support releasing a PyPI package with the 3.13 capabilities compiled for 3.12. A lot of the changes here involve either hiding details behind macros/functions or splitting up some files.
* gh-114058: Foundations of the Tier2 redundancy eliminator (GH-115085)Ken Jin2024-02-132-1/+3
| | | | | | | --------- Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com> Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
* gh-115015: Argument Clinic: fix generated code for METH_METHOD methods ↵Erlend E. Aasland2024-02-051-0/+1
| | | | without params (#115016)
* gh-113744: Add a new IncompleteInputError exception to improve incomplete ↵Pablo Galindo Salgado2024-01-301-0/+2
| | | | | input detection in the codeop module (#113745) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-113055: Use pointer for interp->obmalloc state (gh-113412)Neil Schemenauer2024-01-271-1/+2
| | | | | | | | | For interpreters that share state with the main interpreter, this points to the same static memory structure. For interpreters with their own obmalloc state, it is heap allocated. Add free_obmalloc_arenas() which will free the obmalloc arenas and radix tree structures for interpreters with their own obmalloc state. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-89532: Remove LibreSSL workarounds (#28728)Rami2024-01-061-2/+1
| | | | | | Remove LibreSSL specific workaround ifdefs from `_ssl.c` and delete the non-version-specific `_ssl_data.h` file (relevant for OpenSSL < 1.1.1, which we no longer support per PEP 644). Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* GH-111485: Delete the old generator code. (GH-113321)Mark Shannon2023-12-211-1/+0
|
* gh-76785: More Fixes for test.support.interpreters (gh-113012)Eric Snow2023-12-121-0/+1
| | | 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-76785: Fixes for test.support.interpreters (gh-112982)Eric Snow2023-12-121-0/+4
| | | This involves a number of changes for PEP 734.
* Add a fuzzer for `Py_CompileStringExFlags` (#111721)Brad Larsen2023-12-101-0/+3
|
* Fix typos in variable names, function names, and comments (GH-101868)Yang Hau2023-12-011-1/+1
|
* Remove `imp_dummy_def` from `Tools/c-analyzer/cpython/ignored.tsv` (gh-112122)Nikita Sobolev2023-11-161-1/+0
| | | It was removed in 3.12, no need to keep the ignore.
* Add a fuzz target for `_elementtree.XMLParser._parse_whole` (#111477)Brad Larsen2023-11-031-0/+3
| | | * Add a fuzzer for `_elementtree.XMLParser._parse_whole`
* gh-90815: Add mimalloc memory allocator (#109914)Dino Viehland2023-10-302-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-111339: Fix initialization and finalization of static optimizer types ↵Savannah Ostrowski2023-10-291-5/+5
| | | | (GH-111430)
* gh-110572: Remove `test_*` from `_testcapi/getargs.c` (GH-111214)Nikita Sobolev2023-10-241-1/+1
|
* gh-85283: Build md5 extension with limited C API (#110967)Victor Stinner2023-10-171-0/+1
| | | | | * Replace _Py_strhex() with few lines of code. * Replace _PyType_GetModuleState() with PyType_GetModuleState(). * Fix make check-c-globals.
* gh-106212: Raise when using c-analyzer with clang on darwin (#110757)Lysandros Nikolaou2023-10-131-0/+3
|
* gh-71587: Establish global state in `_datetime` (#110475)Erlend E. Aasland2023-10-121-9/+1
| | | | | | | | * Use explicit initialiser for m_base * Add module state stub; establish global state on stack * Put conversion factors in state struct * Move PyDateTime_TimeZone_UTC to state * Move PyDateTime_Epoch to state struct * Fix ref leaks in and clean up initialisation
* gh-104169: Fix test_peg_generator after tokenizer refactoring (#110727)Lysandros Nikolaou2023-10-121-2/+2
| | | | * Fix test_peg_generator after tokenizer refactoring * Remove references to tokenizer.c in comments etc.
* gh-104169: Refactor tokenizer into lexer and wrappers (#110684)Lysandros Nikolaou2023-10-111-1/+1
| | | | | | | | | | | * The lexer, which include the actual lexeme producing logic, goes into the `lexer` directory. * The wrappers, one wrapper per input mode (file, string, utf-8, and readline), go into the `tokenizer` directory and include logic for creating a lexer instance and managing the buffer for different modes. --------- Co-authored-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-106078: Suppress the warning caused by multi-phase initialization of ↵Charlie Zhao2023-10-061-0/+3
| | | | `decimal` (#107524)
* gh-88402: Add new sysconfig variables on Windows (GH-110049)Sam Gross2023-10-041-1/+1
| | | | Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
* gh-107954: Refactor initconfig.c: add CONFIG_SPEC (#110146)Victor Stinner2023-09-301-0/+4
| | | Add a specification of the PyConfig structure to factorize the code.
* gh-109098: Fuzz re module instead of internal sre (#109911)Ammar Askar2023-09-261-3/+3
| | | | | * gh-109098: Fuzz re module instead of internal sre * Fix c-analyzer globals test failure * Put globals exception in ignored.tsv