summaryrefslogtreecommitdiffstats
path: root/Tools/c-analyzer
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* gh-106316: Remove pytime.h header file (#106317)Victor Stinner2023-07-011-1/+8
| | | | | | | | | | | | | | | | | Remove the "cpython/pytime.h" header file: it only contained private functions. Move functions to the internal pycore_time.h header file. Move tests from _testcapi to _testinternalcapi. Rename also test methods to have the same name than tested C functions. No longer export these functions: * _PyTime_Add() * _PyTime_As100Nanoseconds() * _PyTime_FromMicrosecondsClamp() * _PyTime_FromTimespec() * _PyTime_FromTimeval() * _PyTime_GetPerfCounterWithInfo() * _PyTime_MulDiv()
* gh-106078: Convert `_decimal` types to heap types (#106079)Charlie Zhao2023-06-291-6/+1
| | | | | | | | | | | | | | - Establish global state struct - Convert static types to heap types and add them to global state: * PyDecContextManager_Type * PyDecContext_Type * PyDecSignalDictMixin_Type * PyDec_Type - Add to global state: * PyDecSignalDict_Type * DecimalTuple Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend@python.org>
* Fix c-analyzer for GCC: ignore LANG env var (#106173)Victor Stinner2023-06-281-1/+7
| | | | The c-analyzer doesn't support GCC localized messages, so just unset the LANG environment variable.
* gh-104584: Baby steps towards generating and executing traces (#105924)Guido van Rossum2023-06-272-0/+3
| | | | | Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose). All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-141-0/+1
| | | | | | | | | | internal frame. (GH-105727) * Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
* gh-105699: Use a Thread-Local Variable for PKGCONTEXT (gh-105740)Eric Snow2023-06-143-1/+9
| | | This fixes a race during import. The existing _PyRuntimeState.imports.pkgcontext is shared between interpreters, and occasionally this would cause a crash when multiple interpreters were importing extensions modules at the same time. To solve this we add a thread-local variable for the value. We also leave the existing state (and infrequent race) in place for platforms that do not support thread-local variables.
* gh-104812: Run Pending Calls in any Thread (gh-104813)Eric Snow2023-06-131-0/+1
| | | For a while now, pending calls only run in the main thread (in the main interpreter). This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run.
* gh-105407: Remove unused imports in Tools/c-analyzer/ (#105410)Victor Stinner2023-06-066-6/+2
|
* gh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-105258)Eric Snow2023-06-021-0/+1
| | | The _xxsubinterpreters module was meant to only use public API. Some internal C-API usage snuck in over the last few years (e.g. gh-28969). This fixes that.
* GH-104584: Plugin optimizer API (GH-105100)Mark Shannon2023-06-021-0/+4
|
* gh-104614: Make Sure ob_type is Always Set Correctly by PyType_Ready() ↵Eric Snow2023-06-011-0/+2
| | | | | | | (gh-105122) When I added the relevant condition to type_ready_set_bases() in gh-103912, I had missed that the function also sets tp_base and ob_type (if necessary). That led to problems for third-party static types. We fix that here, by making those extra operations distinct and by adjusting the condition to be more specific.
* gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (#105174)Gregory P. Smith2023-06-011-0/+1
| | | | | | | | | | | | | Upgrade builds to OpenSSL 1.1.1u. This OpenSSL version addresses a pile if less-urgent CVEs since 1.1.1t. The Mac/BuildScript/build-installer.py was already updated. Also updates _ssl_data_111.h from OpenSSL 1.1.1u, _ssl_data_300.h from 3.0.9, and adds a new _ssl_data_31.h file from 3.1.1 along with the ssl.c code to use it. Manual edits to the _ssl_data_300.h file prevent it from removing any existing definitions in case those exist in some peoples builds and were important (avoiding regressions during backporting). backports of this prior to 3.12 will not include the openssl 3.1 header.
* gh-104773: PEP 594: Remove the nis module (#104897)Victor Stinner2023-05-243-6/+0
|
* gh-104773: PEP 594: Remove the ossaudiodev module (#104862)Victor Stinner2023-05-242-5/+0
| | | | | * Remove ossaudiodev extension in configure.ac and regenerate the configure script. * Remove ossaudiodev in Modules/Setup and Modules/Setup.stdlib.in.
* gh-103295: expose API for writing perf map files (#103546)gsallam2023-05-211-0/+1
| | | | | Co-authored-by: Aniket Panse <aniketpanse@fb.com> Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Carl Meyer <carl@oddbird.net>
* gh-104549: Set __module__ on TypeAliasType (#104550)Jelle Zijlstra2023-05-181-0/+1
|
* GH-103092: isolate `pyexpat` (#104506)Kumar Aditya2023-05-161-1/+0
|
* gh-101819: Isolate `_io` (#101948)Erlend E. Aasland2023-05-151-4/+0
| | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* GH-103082: Filter LINE events in VM, to simplify tool implementation. ↵Mark Shannon2023-05-121-1/+1
| | | | | | | | (GH-104387) When monitoring LINE events, instrument all instructions that can have a predecessor on a different line. Then check that the a new line has been hit in the instrumentation code. This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
* gh-99108: Replace SHA3 implementation HACL* version (#103597)Jonathan Protzenko2023-05-081-7/+1
| | | | | | | | | | | Replaces our built-in SHA3 implementation with a verified one from the HACL* project. This implementation is used when OpenSSL does not provide SHA3 or is not present. 3.11 shiped with a very slow tiny sha3 implementation to get off of the <=3.10 reference implementation that wound up having serious bugs. This brings us back to a reasonably performing built-in implementation consistent with what we've just replaced our other guaranteed available standard hash algorithms with: code from the HACL* project. --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-101819: Port _io.PyBytesIOBuffer_Type to heap type (#104264)Erlend E. Aasland2023-05-071-1/+0
|
* gh-101819: Adapt _io.PyWindowsConsoleIO_Type to heap type (#104197)Erlend E. Aasland2023-05-071-1/+0
|
* gh-101819: Port _io.PyIncrementalNewlineDecoder_Type to heap type (#104249)Erlend E. Aasland2023-05-071-1/+0
|
* gh-103533: Use PEP 669 APIs for cprofile (GH-103534)Tian Gao2023-05-051-0/+1
|