summaryrefslogtreecommitdiffstats
path: root/Tools/c-analyzer
Commit message (Collapse)AuthorAgeFilesLines
* 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
* gh-109723: Disable Py_BUILD_CORE in _testcapi (#109727)Victor Stinner2023-09-221-6/+11
| | | | | | | | | | | | | | | | | | Make sure that the internal C API is not tested by mistake by _testcapi. Undefine Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE macros in Modules/_testcapi/parts.h: move code from _testcapimodule.c. heaptype_relative.c and vectorcall_limited.c are using the limited C API which is incompatible with the internal C API. Move test_long_numbits() from _testcapi to _testinternalcapi since it uses the internal C API "pycore_long.h". Fix Modules/_testcapi/pyatomic.c: don't include Python.h directly, just include _testcapi/parts.h. Ajust "make check-c-globals" for these changes.
* gh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE (#109690)Victor Stinner2023-09-211-2/+7
| | | | Fix make check-c-globals: complete USE_LIMITED_C_API list of the c-analyzer.
* gh-108724: Add PyMutex and _PyParkingLot APIs (gh-109344)Sam Gross2023-09-192-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | PyMutex is a one byte lock with fast, inlineable lock and unlock functions for the common uncontended case. The design is based on WebKit's WTF::Lock. PyMutex is built using the _PyParkingLot APIs, which provides a cross-platform futex-like API (based on WebKit's WTF::ParkingLot). This internal API will be used for building other synchronization primitives used to implement PEP 703, such as one-time initialization and events. This also includes tests and a mini benchmark in Tools/lockbench/lockbench.py to compare with the existing PyThread_type_lock. Uncontended acquisition + release: * Linux (x86-64): PyMutex: 11 ns, PyThread_type_lock: 44 ns * macOS (arm64): PyMutex: 13 ns, PyThread_type_lock: 18 ns * Windows (x86-64): PyMutex: 13 ns, PyThread_type_lock: 38 ns PR Overview: The primary purpose of this PR is to implement PyMutex, but there are a number of support pieces (described below). * PyMutex: A 1-byte lock that doesn't require memory allocation to initialize and is generally faster than the existing PyThread_type_lock. The API is internal only for now. * _PyParking_Lot: A futex-like API based on the API of the same name in WebKit. Used to implement PyMutex. * _PyRawMutex: A word sized lock used to implement _PyParking_Lot. * PyEvent: A one time event. This was used a bunch in the "nogil" fork and is useful for testing the PyMutex implementation, so I've included it as part of the PR. * pycore_llist.h: Defines common operations on doubly-linked list. Not strictly necessary (could do the list operations manually), but they come up frequently in the "nogil" fork. ( Similar to https://man.freebsd.org/cgi/man.cgi?queue) --------- Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* Fix a typo in c-analyzer (#109213)DongWoo Son2023-09-181-1/+1
| | | | Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> Co-authored-by: Dale Collison <92315623+dcollison@users.noreply.github.com>
* gh-107782: Use _testcapi to test non-representable signatures (GH-109325)Serhiy Storchaka2023-09-141-0/+1
| | | | | | | | | Builtin functions and methods that have non-representable signatures today will have representable signatures yesterday, and they will become unusable for testing this feature. So we need to add special functions and methods to the _testcapi module that always have non-representable signatures.
* gh-106320: Remove _PyAnextAwaitable_Type from the public C API (#108597)Victor Stinner2023-08-292-3/+2
| | | | It's not needed to declare it in Include/iterobject.h: just use "extern" where it's used (only in object.c).
* gh-106320: Remove private AC converter functions (#108505)Victor Stinner2023-08-261-21/+10
| | | | | | | | | | | | | | Move these private functions to the internal C API (pycore_abstract.h): * _Py_convert_optional_to_ssize_t() * _PyNumber_Index() Argument Clinic now emits #include "pycore_abstract.h" when these functions are used. The parser of the c-analyzer tool now uses a list of files which use the limited C API, rather than a list of files using the internal C API.
* gh-106320: Remove private _PyLong_FileDescriptor_Converter() (#108503)Victor Stinner2023-08-261-1/+4
| | | | | | | | | Move the private _PyLong converter functions to the internal C API * _PyLong_FileDescriptor_Converter(): moved to pycore_fileutils.h * _PyLong_Size_t_Converter(): moved to pycore_long.h Argument Clinic now emits includes for pycore_fileutils.h and pycore_long.h when these functions are used.
* gh-106320: Remove private _PyLong converter functions (#108499)Victor Stinner2023-08-261-0/+9
| | | | | | | | | | | Move these private functions to the internal C API (pycore_long.h): * _PyLong_UnsignedInt_Converter() * _PyLong_UnsignedLongLong_Converter() * _PyLong_UnsignedLong_Converter() * _PyLong_UnsignedShort_Converter() Argument Clinic now emits #include "pycore_long.h" when these functions are used.
* gh-107704: Argument Clinic: add support for deprecating keyword use of ↵Serhiy Storchaka2023-08-191-0/+4
| | | | | | | | | | | | parameters (GH-107984) It is now possible to deprecate passing keyword arguments for keyword-or-positional parameters with Argument Clinic, using the new '/ [from X.Y]' syntax. (To be read as "positional-only from Python version X.Y") Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-107557: Setup abstract interpretation (#107847)Ken Jin2023-08-152-0/+3
| | | | Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com> Co-authored-by: Jules <57632293+juliapoo@users.noreply.github.com>
* gh-84805: Autogenerate signature for METH_NOARGS and METH_O extension ↵Serhiy Storchaka2023-08-111-0/+1
| | | | functions (GH-107794)
* gh-95065: Argument Clinic: Add functional tests of deprecated positionals ↵Erlend E. Aasland2023-08-101-0/+2
| | | | | | | | | | | | (#107768) Move the "deprecated positinal" tests from clinic.test.c to _testclinic.c. Mock PY_VERSION_HEX in order to prevent generated compiler warnings/errors to trigger. Put clinic code for deprecated positionals in Modules/clinic/_testclinic_depr_star.c.h for easy inspection of the generated code. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-91054: make code watcher tests resilient to other watchers (#107821)Carl Meyer2023-08-091-0/+1
|
* gh-106263: Fix segfault in `signaldict_repr` in `_decimal` module (#106270)Charlie Zhao2023-07-301-0/+1
| | | Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
* gh-106078: Isolate `decimal` module (#107287)Charlie Zhao2023-07-281-1/+0
|
* gh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-107359)Eric Snow2023-07-272-1/+2
| | | The _xxsubinterpreters module should not rely on internal API. Some of the functions it uses were recently moved there however. Here we move them back (and expose them properly).
* remove outdated `_asyncio` globals from globals-to-fix.tsv (#107334)Kumar Aditya2023-07-271-2/+0
|
* gh-106320: Remove private _PyInterpreterID C API (#107053)Victor Stinner2023-07-221-1/+0
| | | | | | | Move the private _PyInterpreterID C API to the internal C API: add a new pycore_interp_id.h header file. Remove Include/interpreteridobject.h and Include/cpython/interpreteridobject.h header files.
* GH-106701: Move _PyUopExecute to Python/executor.c (GH-106924)Brandt Bucher2023-07-201-1/+1
|
* gh-106078: Prepare to isolate decimal module (#106880)Charlie Zhao2023-07-201-2/+2
| | | | | | * move signal_map to global_state * move cond_map to global_state
* gh-106078: Move external C-API functions to decimal module global state ↵Charlie Zhao2023-07-111-6/+0
| | | | (#106616)
* gh-106078: Move static variables initialized once to decimal module global ↵Charlie Zhao2023-07-101-3/+0
| | | | state (#106475)
* gh-106078: Move static objects related to `CONTEXTVAR` to the decimal module ↵Charlie Zhao2023-07-081-1/+0
| | | | | | global state (#106395) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* gh-106078: Move `context template` to decimal module global state (#106346)Charlie Zhao2023-07-031-3/+0
|
* gh-106320: Move _PyUnicodeWriter to the internal C API (#106342)Victor Stinner2023-07-031-3/+9
| | | | | | Move also _PyUnicode_FormatAdvancedWriter(). CJK codecs and multibytecodec.c now define the Py_BUILD_CORE_MODULE macro.
* gh-106078: Move DecimalException to _decimal state (#106301)Charlie Zhao2023-07-021-1/+0
|