summaryrefslogtreecommitdiffstats
path: root/Tools
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Fix typos in docs and comments (#109619)Heinz-Alexander Fuetterer2023-09-201-1/+1
|
* fixes gh-109559: Update `unicodedata` for Unicode 15.1.0 (GH-109560)James Gerity2023-09-201-12/+17
| | | | | --------- Co-authored-by: Benjamin Peterson <benjamin@python.org>
* gh-108724: Add PyMutex and _PyParkingLot APIs (gh-109344)Sam Gross2023-09-193-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* gh-109566: Run GHA and buildbot tests with --fail-rerun (#109567)Victor Stinner2023-09-191-2/+2
|
* gh-109125: Run mypy on `Tools/wasm` (#109126)Nikita Sobolev2023-09-194-38/+67
|
* 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-109373: Store metadata required for pystats comparison in the JSON ↵Michael Droettboom2023-09-151-32/+65
| | | | (GH-109374)
* gh-109287: Desugar inst(X) to op(X); macro(X) = X (#109294)Guido van Rossum2023-09-154-161/+92
| | | This makes the internal representation in the code generator simpler: there's a list of ops, and a list of macros, and there's no special-casing needed for ops that aren't macros. (There's now special-casing for ops that are also macros, but that's simpler.)
* 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.
* Fix invocation of wasm_build.py for node (GH-109383)Sam Gross2023-09-131-1/+1
|
* GH-109330: Dump and compare stats using opcode names, not numbers (GH-109335)Michael Droettboom2023-09-121-45/+27
|
* gh-106581: Honor 'always_exits' in write_components() (#109338)Guido van Rossum2023-09-121-1/+1
| | | | | | | | | | I must have overlooked this when refactoring the code generator. The Tier 1 interpreter contained a few silly things like ``` goto resume_frame; STACK_SHRINK(1); ``` (and other variations, some where the unconditional `goto` was hidden in a macro).
* gh-109256: allocate opcode IDs for internal opcodes in their own range (#109269)Irit Katriel2023-09-122-12/+24
|
* gh-109214: Rename SAVE_IP to _SET_IP, and similar (#109285)Guido van Rossum2023-09-114-10/+10
| | | | | | | | * Rename SAVE_IP to _SET_IP * Rename EXIT_TRACE to _EXIT_TRACE * Rename SAVE_CURRENT_IP to _SAVE_CURRENT_IP * Rename INSERT to _INSERT (This is for Ken Jin's abstract interpreter) * Rename IS_NONE to _IS_NONE * Rename JUMP_TO_TOP to _JUMP_TO_TOP
* gh-109039: Branch prediction for Tier 2 interpreter (#109038)Guido van Rossum2023-09-111-4/+14
| | | | | | | | | | | This adds a 16-bit inline cache entry to the conditional branch instructions POP_JUMP_IF_{FALSE,TRUE,NONE,NOT_NONE} and their instrumented variants, which is used to keep track of the branch direction. Each time we encounter these instructions we shift the cache entry left by one and set the bottom bit to whether we jumped. Then when it's time to translate such a branch to Tier 2 uops, we use the bit count from the cache entry to decided whether to continue translating the "didn't jump" branch or the "jumped" branch. The counter is initialized to a pattern of alternating ones and zeros to avoid bias. The .pyc file magic number is updated. There's a new test, some fixes for existing tests, and a few miscellaneous cleanups.
* gh-108455: peg_generator: enable mypy's `--warn-unreachable` setting and ↵Alex Waygood2023-09-083-9/+13
| | | | `redundant-expr` error code (#109160)
* gh-109136: Fix summarize_stats.py tool (#109137)Michael Droettboom2023-09-081-1/+1
|
* GH-108716: Turn off deep-freezing of code objects. (GH-108722)Mark Shannon2023-09-081-21/+9
|
* GH-108614: Add `RESUME_CHECK` instruction (GH-108630)Mark Shannon2023-09-072-1/+3
|
* gh-108740: Fix "make regen-all" race condition (#108741)Victor Stinner2023-09-061-1/+1
| | | | | | | | | | | | | | | | | | Fix a race condition in "make regen-all". The deepfreeze.c source and files generated by Argument Clinic are now generated or updated before generating "global objects". Previously, some identifiers may miss depending on the order in which these files were generated. * "make regen-global-objects": Make sure that deepfreeze.c is generated and up to date, and always run "make clinic". * "make clinic" no longer runs generate_global_objects.py script. * "make regen-deepfreeze" now only updates deepfreeze.c (C file). It doesn't build deepfreeze.o (object) anymore. * Remove misleading messages in "make regen-global-objects" and "make clinic". They are now outdated, these commands are now safe to use. * Document generates files in Doc/using/configure.rst. Co-authored-by: Erlend E. Aasland <erlend@python.org>
* gh-109002: Ensure only one wheel for each vendored package (#109003)Łukasz Langa2023-09-061-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | Output with one wheel: ``` ❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py Verifying checksum for /Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl. Expected digest: 7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be Actual digest: 7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be ::notice file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Successfully verified the checksum of the pip wheel. ``` Output with two wheels: ``` ❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py ::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl::Found more than one wheel for package pip. ::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Found more than one wheel for package pip. ``` Output without wheels: ``` ❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py ::error file=::Could not find a pip wheel on disk. ```
* Fix a typo in umarshal.py (#108803)KH2023-09-061-1/+1
| | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-106581: Support multiple uops pushing new values (#108895)Guido van Rossum2023-09-051-17/+53
| | | | Also avoid the need for the awkward .clone() call in the argument to mgr.adjust_inverse() and mgr.adjust().
* Disable `differing_test_runners` health check (#108886)Nikita Sobolev2023-09-041-0/+4
|
* gh-108494: Argument Clinic: inline parsing code for positional-only ↵Serhiy Storchaka2023-09-031-254/+489
| | | | parameters in the limited C API (GH-108622)
* gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726)Victor Stinner2023-08-311-37/+104
| | | | | | | | | | | | | | | | | | | | Argument Clinic now only includes pycore_gc.h if PyGC_Head is needed, and only includes pycore_runtime.h if _Py_ID() is needed. * Add 'condition' optional argument to Clinic.add_include(). * deprecate_keyword_use() includes pycore_runtime.h when using the _PyID() function. * Fix rendering of includes: comments start at the column 35. * Mark PC/clinic/_wmimodule.cpp.h and "Objects/stringlib/clinic/*.h.h" header files as generated in .gitattributes. Effects: * 42 header files generated by AC no longer include the internal C API, instead of 4 header files before. For example, Modules/clinic/_abc.c.h no longer includes the internal C API. * Fix _testclinic_depr.c.h: it now always includes pycore_runtime.h to get _Py_ID().
* GH-108614: Remove non-debug uses of `#if TIER_ONE` and `#if TIER_TWO` from ↵Mark Shannon2023-08-311-2/+2
| | | | `_POP_FRAME` op. (GH-108685)
* gh-108455: peg_generator: use `types-setuptools==68.1.0.1` in CI (#108697)Alex Waygood2023-08-313-11/+5
|
* gh-108455: peg_generator: install two stubs packages before running mypy ↵Alex Waygood2023-08-294-6/+17
| | | | (#108637)
* gh-107557: Remove unnecessary SAVE_IP instructions (#108583)Guido van Rossum2023-08-293-12/+21
| | | | | Also remove NOP instructions. The "stubs" are not optimized in this fashion (their SAVE_IP should always be preserved since it's where to jump next, and they don't contain NOPs by their nature).
* gh-108455: peg generator: Use `strict_optional=True` for `grammar_parser` ↵Nikita Sobolev2023-08-292-4/+1
| | | | (#108629)
* gh-108494: Argument Clinic: fix option group for Limited C API (#108574)Victor Stinner2023-08-291-3/+9
| | | Use PyTuple_Size() instead of PyTuple_GET_SIZE().
* gh-108455: peg_generator: make the mypy config slightly stricter (#108627)Alex Waygood2023-08-294-8/+12
| | | | | | | | | * Enable `--no-implicit-reexport` * Enable the `truthy-bool` error code * Enable the `ignore-without-code` error code * Explicitly note that `--warn-unreachable` cannot yet be enabled
* gh-108455: Simplify the peg_generator mypy config (#108620)Alex Waygood2023-08-291-18/+8
| | | make it easier to see exactly which options from mypy's `--strict` mode can't currently be enabled
* 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-107603: Clinic: Pass specific attributes to ``print_block()`` (#108581)Adam Turner2023-08-281-11/+17
|
* gh-108455: Run `mypy` on `Tools/peg_generator` (#108456)Nikita Sobolev2023-08-285-10/+17
| | | | Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-108494: Argument clinic: Improve the `parse_file()` API (#108575)Alex Waygood2023-08-281-7/+7
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-108494: Argument Clinic: fix support of Limited C API (GH-108536)Serhiy Storchaka2023-08-281-97/+124
|
* gh-104683: Argument Clinic: Refactor the module and class resolver (#108552)Erlend E. Aasland2023-08-281-16/+10
|
* gh-106320: Remove private AC converter functions (#108505)Victor Stinner2023-08-262-21/+13
| | | | | | | | | | | | | | 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-262-1/+12
| | | | | | | | | 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-262-0/+17
| | | | | | | | | | | 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-108494: AC supports pos-only args in limited C API (#108498)Victor Stinner2023-08-251-4/+20
| | | | AC now checks for "#define Py_LIMITED_API" pattern to use the limited C API.
* gh-107603: Argument Clinic can emit includes (#108486)Victor Stinner2023-08-251-17/+41
| | | | | | * Add Clinic.add_include() method * Add CConverter.include and CConverter.add_include() * Printer.print_block() gets a second parameter: clinic. * Remove duplicated declaration of "clinic" global variable.
* gh-108494: Argument Clinic partial supports of Limited C API (#108495)Victor Stinner2023-08-252-11/+45
| | | | | | | | | | Argument Clinic now has a partial support of the Limited API: * Add --limited option to clinic.c. * Add '_testclinic_limited' extension which is built with the limited C API version 3.13. * For now, hardcode in clinic.py that "_testclinic_limited.c" targets the limited C API.
* gh-107901: add the HAS_EVAL_BREAK instruction flag (#108375)Irit Katriel2023-08-252-4/+9
|
* gh-104504: Cases generator: enable mypy's `possibly-undefined` error code ↵Alex Waygood2023-08-252-5/+10
| | | | (#108454)