Commit graph

4802 commits

Author SHA1 Message Date
Adam Turner
6baf552484
GH-137623: Begin enforcing docstring length in Argument Clinic (#137624) 2025-08-12 20:17:35 +00:00
sobolevn
68a61b0f1d
gh-133403: Check generate_stdlib_module_names and check_extension_modules with mypy (#137546) 2025-08-12 18:11:18 +03:00
Mark Shannon
af15e1d13e
GH-132532: Add new DSL macros to better declare semantics of exits at ends of instructions/uops. (GH-137098) 2025-08-09 15:41:28 +01:00
sobolevn
fb1cb00030
Bump mypy to 1.17.1 (#137542) 2025-08-08 10:14:51 +03:00
Brett Cannon
0953200b13
GH-137484: Have Tools/wasm/wasi use the build triple instead of "build" (GH-37485)
This should help prevent issuse where something like a container is used to do one build and then someone tries to build again locally.
2025-08-06 12:28:54 -07:00
Sam Gross
485b16b4f7
gh-137238: Fix data race in _Py_slot_tp_getattr_hook (gh-137240)
Replacing the slot isn't thread-safe if the GIL is disabled. Don't
require that the slot has been replaced when specializing.
2025-08-05 09:32:22 -04:00
Kliment Lamonov
406dc714f6
gh-136567: Add information about lost prefixes to Tools/cases_generator/interpreter_definition.md (#136780) 2025-08-03 21:43:13 +03:00
Mark Shannon
801cf3fcdd
GH-137276: Don't mark uop as escaping if the escaping call is on an exit branch (GH-137277) 2025-08-02 16:49:34 +01:00
Maciej Olko
7475887e1e
Remove incorrect feature coverage comment from msgfmt script's docstring (#112862)
Remove feature coverage comment from msgfmt script's docstring

msgfmt handles plural forms since cb081b83.

The comment was incorrectly applied in 637a33b -- original patch was from before the cb081b83 commit.

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-08-02 16:37:25 +02:00
Mark Shannon
e7b55f564d
GH-136410: Faster side exits by using a cold exit stub (GH-136411) 2025-08-01 16:26:07 +01:00
Kumar Aditya
e99bc7fd44
gh-133467: fix data race in type_set_name (#137302)
Fix data race in `type_set_name` by assigning name under stop the world pause making it thread safe in free-threading.
2025-08-01 13:40:40 +00:00
Brett Cannon
94498a53f3
GH-137248: Add a --logdir option to Tools/wasm/wasi (GH-137249) 2025-07-30 19:13:37 +00:00
Brett Cannon
2f1a9f2ed4
GH-137243: Have Tools/wasm/wasi detect WASI SDK installs in /opt when the release tarball is extracted (GH-137244) 2025-07-30 11:46:24 -07:00
Savannah Bailey
f7c380ef67
GH-132732: Use pure op machinery to optimize COMPARE_OP_INT/FLOAT/STR (#137062)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-07-25 19:02:04 -07:00
Zachary Ware
d5e75c0768
Exclude _testclinic_depr.c.h from c-analyzer (GH-137086)
_testclinic.c mocks out PY_VERSION_HEX to 3.8 before including
_testclinic_depr.c.h to avoid the errors the preprocessor would
otherwise throw due to the deprecation feature it is testing.

Also partially revert 74e2acddf6:
this restores Modules/_testclinic.c to match the same file in the 3.14
branch.
2025-07-24 15:50:01 -05:00
Hood Chatham
ae4d27eba7
gh-124621: Emscripten: Add smoke test for using pyrepl in Chrome (#137004)
Adds a mechanism to test browser-based initialisation of the Python interpreter,
via a Playwright headless browser instance.
2025-07-24 14:44:02 +08:00
Hood Chatham
ecb3f23b94
gh-136976: Emscripten: Add _decimal and libmpdec (#136997)
Adds tooling to build mpdec (and thus _decimal) as part of an Emscripten build.
2025-07-24 06:31:30 +00:00
Brett Cannon
ec7fad79d2
Touch up Setup.local handling in Tools/wasm/wasi (GH-137051)
The comment in the generated file is now more self-explanatory. The checks for unexpected file contents are also strengthened.
2025-07-23 11:50:15 -07:00
Hood Chatham
c933a6bb32
gh-124621: Emscripten: Support pyrepl in browser (GH-136931)
Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 12:13:38 +02:00
Hood Chatham
bbe589f93c
gh-133600: Move config.site-wasm32-emscripten into the emscripten folder (#136934)
Reorganises the large Emscripten-specific file into the Emscripten folder.
2025-07-22 07:58:31 +08:00
Mikhail Efimov
58d305cf38
gh-136438: Make sure test_generated_cases pass with all optimization levels (#136594)
Fix the `test_generated_cases` to work with `-O` or `-OO` flags.
Previously, `test_generated_cases` was catching an `AssertionError` while `Tools/cases_generator/optimizer_generator.py` used an `assert` statement.  This approach semantically incorrect, no one should trying to catch an `AssertionError`!
Now the `assert` statement has been replaced with an explicit `raise ValueError(...)` and the corresponding `self.assertRaisesRegex(AssertionError, ...)` has been updated to catch a `ValueError` instead.
2025-07-21 15:25:25 +03:00
adam j hartz
d1d526afe7
gh-136251: Improvements to WASM demo REPL (GH-136252)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-21 11:56:45 +02:00
Hood Chatham
9c7b2af73d
gh-136852: Emscripten: Fix bug in #136853 (#136909)
We need to get rid of some whitespace to make this work.
2025-07-21 11:17:36 +02:00
Hood Chatham
aec7f5f8b2
gh-136852: Emscripten: Add PYTHON_NODE_VERSION environment variable (#136853)
To choose the node version we use. Together with:
https://github.com/python/buildmaster-config/pull/614
closes #136852.
2025-07-21 00:30:35 +02:00
Hood Chatham
7ae4749d06
gh-124621: Emscripten: Add support for async input devices (GH-136822)
This is useful for implementing proper `input()`. It requires the
JavaScript engine to support the wasm JSPI spec which is now stage 4.
It is supported on Chrome since version 137 and on Firefox and node
behind a flag.

We override the `__wasi_fd_read()` syscall with our own variant that
checks for a readAsync operation. If it has it, we use our own async
variant of `fd_read()`, otherwise we use the original `fd_read()`.
We also add a variant of `FS.createDevice()` called
`FS.createAsyncInputDevice()`.

Finally, if JSPI is available, we wrap the `main()` symbol with
`WebAssembly.promising()` so that we can stack switch from `fd_read()`.
If JSPI is not available, attempting to read from an AsyncInputDevice
will raise an `OSError`.
2025-07-19 17:14:29 +02:00
chemelnucfin
f520f22927
parser_generator.py typo - keywods -> keywords (#135014) 2025-07-19 11:54:20 +03:00
Alper
eddc8c0a1d
gh-116738: Make pwd module thread-safe (#136695)
Make the pwd module functions getpwuid(), getpwnam(), and getpwall() thread-safe. These changes apply to scenarios where the GIL is disabled or in subinterpreter use cases.
2025-07-17 09:16:01 -07:00
Hood Chatham
e81c4e84b3
gh-127146: Report uid in Emscripten + node as native uid (#136509)
Corrects the handling of getuid on emscripten, which was consistently reporting as 0.
2025-07-16 06:17:16 +02:00
Alper
9363703bd3
gh-116738: Make grp module thread-safe (#135434)
Make grp module methods getgrgid() and getgrnam() thread-safe when the GIL is disabled and getgrgid_r()/getgrnam_r() C APIs are not available.
---------

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-14 11:18:41 -07:00
Brandt Bucher
3d8c38f6db
GH-135904: Improve the JIT's performance on macOS (GH-136528) 2025-07-14 10:14:20 -07:00
Serhiy Storchaka
b74fb8e220
gh-135256: Simplify parsing parameters in Argument Clinic (GH-135257) 2025-07-13 23:27:48 +03:00
Serhiy Storchaka
e18829a8ad
gh-132629: Deprecate accepting out-of-range values for unsigned integers in PyArg_Parse (GH-132630)
For unsigned integer formats in the PyArg_Parse* functions,
accepting Python integers with value that is larger than
the maximal value the corresponding C type or less than
the minimal value for the corresponding signed integer type
is now deprecated.
2025-07-13 12:44:54 +03:00
Will Childs-Klein
db47f4d844
gh-135401: Test AWS-LC as a cryptography library in CI (GH-135402)
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>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Zachary Ware <zach@python.org>
2025-07-11 17:24:11 -05:00
Brandt Bucher
c49dc3bd0f
GH-115802: Optimize JIT stencils for size (GH-136393) 2025-07-09 12:11:28 -07:00
sobolevn
db699db99d
gh-136297: Fix hypothesis and subTest usage in test_zoneinfo_property.py (#136384) 2025-07-08 07:51:36 +00:00
Ken Jin
b3308973e3
gh-136183: Deal with escapes in JIT optimizer's constant evaluator (GH-136184) 2025-07-02 14:08:25 +08:00
Weilin Du
698bab5a40
Doc: fix duplicated words (#136086)
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-29 18:04:02 -04:00
Pablo Galindo Salgado
5334732f9c
gh-91048: Fix external inspection multi-threaded performance (#136005) 2025-06-28 14:11:31 +01:00
Brandt Bucher
0e5d096130
GH-135904: Optimize the JIT's assembly control flow (GH-135905) 2025-06-27 08:20:51 -07:00
Ken Jin
695ab61351
gh-132732: Automatically constant evaluate pure operations (GH-132733)
This adds a "macro" to the optimizer DSL called "REPLACE_OPCODE_IF_EVALUATES_PURE", which allows automatically constant evaluating a bytecode body if certain inputs have no side effects upon evaluations (such as ints, strings, and floats).


Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-06-27 19:37:44 +08:00
Russell Keith-Magee
34393cbdd4
gh-135648: Document that shutil.copyfileobj doesn't flush (#135737)
Adds a note about flush/close on copyfileobj, and updates 
the Emscripten build script to follow documented advice.
2025-06-24 08:55:50 +08:00
Ken Jin
569fc6870f
gh-134584: Specialize POP_TOP by reference and type in JIT (GH-135761) 2025-06-24 00:57:14 +08:00
sobolevn
b3ae76911d
Bump mypy to 1.16.1 (#135720) 2025-06-23 15:29:30 +03:00
Kattni
ac9d37c60b
patchcheck: use URL paths to identify upstream remote (GH-135806)
* find defined "(fetch)" remotes with "python/cpython" in their URL
* if there is exactly one, use that remote name
* if there is one named "upstream", "origin", or "python",
  use that remote (in that precedence order)
* otherwise report an error listing the defined remotes
2025-06-22 04:51:23 +00:00
Ken Jin
0243260284
gh-135379: Move PyLong_CheckCompact to private header and rename it (GH-135707) 2025-06-19 13:09:09 +00:00
Mark Shannon
9731dd2c8d
GH-135379: Specialize int operations for compact ints only (GH-135668) 2025-06-19 11:10:29 +01:00
Ken Jin
fba5dded6d
gh-134584: Decref elimination for float ops in the JIT (GH-134588)
This PR adds a PyJitRef API to the JIT's optimizer that mimics the _PyStackRef API. This allows it to track references and their stack lifetimes properly. Thus opening up the doorway to refcount elimination in the JIT.
2025-06-17 23:25:53 +08:00
Mark Shannon
8dd8b5c2f0
GH-135379: Support limited scalar replacement for replicated uops in the JIT code generator. (GH-135563)
* Use it to support efficient specializations of COPY and SWAP in the JIT.
2025-06-17 13:43:09 +01:00
Emma Smith
acc20a83f4
gh-134262: Catch both URLError and ConnectionError in retries (#135365) 2025-06-17 14:51:23 +03:00
Michał Górny
0d582def34
gh-134632: Fix build-details.json to use INCLUDEPY path (#134633)
* gh-134632: Fix `build-details.json` to use `INCLUDEPY` path

Fix ``build-details.json`` generation to use ``INCLUDEPY``, in order to
reference the ``pythonX.Y`` subdirectory of the include directory, as
required in :pep:`739`, instead of the top-level include directory.

* test_build_details: Add tests for the c_api section

* test_build_details: Expect pkgconfig for CPython unconditionally
2025-06-17 08:05:04 +00:00