Commit graph

9727 commits

Author SHA1 Message Date
Brett Cannon
ad42dc1909
GH-130397: remove special-casing of C stack depth for WASI (#134469)
Removed special-casing for WASI when setting C stack depth limits. Since WASI has its own C stack checking this isn't a security risk.

Also disabled some tests that stopped passing. They all happened to have already been disabled under Emscripten.
2025-05-22 14:08:44 -07:00
Eric Snow
ac06b534ee
gh-132775: Fix Recently Introduced Warnings (gh-134530) 2025-05-22 17:24:09 +00:00
Tomas R.
484e00379b
GH-131798: Optimize away isinstance calls in the JIT (GH-134369) 2025-05-22 12:52:47 -04:00
Eric Snow
4a4ac3ab4d
gh-132775: Make _PyXI_session Opaque (gh-134452)
This is mostly a refactor to clean things up a bit, most notably the "XI namespace" code.

Making the session opaque requires adding the following internal-only functions:

* _PyXI_NewSession()
* _PyXI_FreeSession()
* _PyXI_GetMainNamespace()
2025-05-22 10:14:04 -06:00
Brandt Bucher
ec736e7dae
GH-131798: Optimize cached class attributes and methods in the JIT (GH-134403) 2025-05-22 11:15:03 -04:00
Nadeshiko Manju
8c5e5557c6
GH-131798: Turn _LOAD_SMALL_INT into _LOAD_CONST_INLINE_BORROW in the JIT (GH-134406) 2025-05-22 09:54:57 -04:00
Eric Snow
d0eedfa10e
gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134440)
This change includes some semi-related refactoring of queues and channels.
2025-05-22 06:50:06 -06:00
Eric Snow
88f8102a8f
gh-132775: Support Fallbacks in _PyObject_GetXIData() (gh-133482)
It now supports a "full" fallback to _PyFunction_GetXIData() and then `_PyPickle_GetXIData()`.  There's also room for other fallback modes if that later makes sense.
2025-05-21 07:23:48 -06:00
Peter Bierma
b8998fe2d8
gh-131185: Use a proper thread-local for cached thread states (gh-132510)
Switches over to a _Py_thread_local in place of autoTssKey, and also fixes a few other checks regarding PyGILState_Ensure after finalization.

Note that this doesn't fix concurrent use of PyGILState_Ensure with Py_Finalize; I'm pretty sure zapthreads doesn't work at all, and that needs to be fixed seperately.
2025-05-21 07:01:25 -06:00
Brandt Bucher
2f0570caf4
GH-131798: Narrow types more aggressively in the JIT (GH-134373) 2025-05-20 18:09:51 -04:00
Nadeshiko Manju
e1c0c451a2
GH-131798: Narrow the return type of _GET_LEN to int (GH-133345) 2025-05-20 18:02:50 -04:00
Hood Chatham
3b7888bf3d
gh-106213: Shorten Emscripten wasm-gc trampoline by a little (#133984)
Using the if instruction results in slightly shorter trampoline code.
2025-05-20 14:22:49 -04:00
Mark Shannon
6dcb0fdfe0
GH-134282: Always borrow references LOAD_CONST (GH-134284) 2025-05-20 11:24:11 -04:00
Tomas R.
a7f317d730
GH-131798: Add _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW (GH-134268) 2025-05-19 18:00:53 -04:00
Diego Russo
42d03f3933
GH-131798: Split CALL_LIST_APPEND into several uops (GH-134240) 2025-05-19 15:48:55 -04:00
Peter Bierma
27bd08273c
Revert "gh-128639: Don't assume one thread in subinterpreter finalization (gh-128640)" (gh-134256)
This reverts commit 9859791f9e.

The original change broke the iOS and android buildbots, where the tests are run single-process.
2025-05-19 12:22:05 -06:00
Victor Stinner
e79f640eb6
Simplify interp_look_up_id() (#134257)
Don't use PyInterpreterState_GetID() but get directly the interpreter
'id' member which cannot fail.
2025-05-19 18:09:10 +00:00
Tomas R.
8d490b3687
GH-131798: Narrow the return type of isinstance for some known arguments in the JIT (GH-133172) 2025-05-19 13:19:24 -04:00
Peter Bierma
9859791f9e
gh-128639: Don't assume one thread in subinterpreter finalization (gh-128640)
Incidentally, this also fixed the warning not showing up if a subinterpreter wasn't
cleaned up via _interpreters.destroy. I had to update some of the tests as a result.
2025-05-19 10:24:08 -06:00
b-pass
f2de1e6861
gh-134144: Fix use-after-free in zapthreads() (#134145) 2025-05-18 20:32:29 +05:30
Nico-Posada
4e9005d32f
gh-134100: Fix use-after-free in PyImport_ImportModuleLevelObject (#134117) 2025-05-18 12:41:38 +05:30
Victor Stinner
009e7b3698
gh-134064: Fix sys.remote_exec() error checking (#134067) 2025-05-18 00:24:40 +02:00
Max Bachmann
20095fb29a
Fix GetNamedPipeHandleStateW on non-desktop Windows API partitions (GH-134049) 2025-05-15 21:12:10 +01:00
Max Bachmann
5d118d0a92
gh-133580: Add missing exception to _sys_getwindowsversion_from_kernel32 (GH-133574) 2025-05-14 14:10:35 +01:00
Serhiy Storchaka
c09cec5d69
gh-133886: Fix sys.remote_exec() for non-UTF-8 paths (GH-133887)
It now supports non-ASCII paths in non-UTF-8 locales and
non-UTF-8 paths in UTF-8 locales.
2025-05-13 11:55:24 +03:00
Eric Snow
8cf4947b0f
gh-132775: Add _PyFunction_GetXIData() (gh-133481) 2025-05-12 22:10:56 +00:00
Lauta
c838e21fda
gh-133590: ensure that TableEntry.linenumber_borrow is initialized (#133681) 2025-05-11 10:16:28 +02:00
Bénédikt Tran
dc191d2484
gh-133336: Remove comment about reserved -J in `initconfig.c` (#133821) 2025-05-10 22:31:45 +01:00
Jelle Zijlstra
7dddb4e667
gh-133783: Fix __replace__ on AST nodes for optional attributes (#133797) 2025-05-10 09:17:38 -07:00
Stan Ulbrych
dbca27cfca
gh-133379: Fix misuse of the term "arguments" in error messages (GH-133382)
The right term is "parameters".
2025-05-10 15:00:43 +03:00
Bénédikt Tran
5044e85265
gh-133644: Remove deprecated Python initialization getter functions (#133661)
Remove functions:

* Py_GetExecPrefix()
* Py_GetPath()
* Py_GetPrefix()
* Py_GetProgramFullPath()
* Py_GetProgramName()
* Py_GetPythonHome()
2025-05-09 11:39:23 +00:00
Jelle Zijlstra
308ceffc68
gh-133581: Fix refleak in t-string AST unparsing (#133724) 2025-05-09 09:10:52 +02:00
Tomas R.
c492ac7252
GH-131798: Split up and optimize CALL_ISINSTANCE (GH-133339) 2025-05-08 14:26:30 -07:00
Tomas R.
3f2f59a91d
gh-133273: Keep instruction definitions in bytecodes.c and optimizer_bytecodes.c in sync (GH-133320) 2025-05-09 01:54:49 +08:00
Eric Snow
c81fa2b9cd
gh-132775: Add _PyCode_GetScriptXIData() (gh-133480)
This converts functions, code, str, bytes, bytearray, and memoryview objects to PyCodeObject,
and ensure that the object looks like a script.  That means no args, no return, and no closure.
_PyCode_GetPureScriptXIData() takes it a step further and ensures there are no globals.

We also add _PyObject_SupportedAsScript() to the internal C-API.
2025-05-08 15:07:46 +00:00
Xuehai Pan
f0f93ba5fa
gh-131942: Use the Python-specific Py_DEBUG macro rather than _DEBUG in Windows-related C code (GH-131944) 2025-05-08 15:01:25 +00:00
Jelle Zijlstra
bfac7d2edc
gh-133581: Improve AST unparsing of t-strings (#133635) 2025-05-08 06:13:57 -07:00
Bénédikt Tran
a2c4467d06
gh-133644: remove deprecated PyImport_ImportModuleNoBlock (#133655) 2025-05-08 13:08:43 +00:00
Sergey Miryanov
0ec8fc83a8
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598) 2025-05-08 12:09:20 +01:00
Neil Schemenauer
751db4e649
gh-132917: Use /proc/self/status for mem usage info. (#133544)
On Linux, use /proc/self/status for mem usage info.  Using smaps_rollup is quite a lot slower and
we can get the similar info from /proc/self/status.
2025-05-08 04:32:23 +00:00
T. Wouters
53e6d76aa3
gh-132917: Fix data race detected by tsan (#133508)
Fix data race detected by tsan
(4171271720):
young.count can be modified by other threads even while the gcstate is
locked.

This is the simplest fix to (potentially) unblock beta 1, although this
particular code path seems like it could just be an atomic swap followed by
an atomic add, without having the lock at all.
2025-05-06 11:23:10 +00:00
Irit Katriel
296cd128bf
Revert "gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)" (#133498) 2025-05-06 13:12:26 +03:00
Noah Kim
c4bcc6a778
gh-102567: Add -X importtime=2 for logging an importtime message for already-loaded modules (#118655)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-05-06 01:03:55 +01:00
Eric Snow
ea598730ef
gh-132775: Add _PyCode_GetXIData() (gh-133475) 2025-05-05 23:46:03 +00:00
Eric Snow
e9616110aa
gh-132775: Do Not Set __name__ to __main__ With _PyPickle_GetXIData() (gh-133472)
This is a follow-up to gh-133107.  I realized that we could end up with an
infinite recursion if we try to run a function from __main__ in a subinterpreter.
2025-05-05 17:25:26 -06:00
Brandt Bucher
b1aa515bd6
GH-133231: Add JIT utilities in sys._jit (GH-133233) 2025-05-05 15:25:22 -07:00
Diego Russo
9cc77aaf9d
GH-131798: Split CALL_LEN into several uops (GH-133180) 2025-05-05 14:31:48 -07:00
Neil Schemenauer
893034cf93
gh-132917: Use RSS + swap for estimate of process memory usage (gh-133464) 2025-05-05 14:15:05 -07:00
Neil Schemenauer
5c245ffce7
gh-132917: Check resident set size (RSS) before GC trigger. (gh-133399)
For the free-threaded build, check the process resident set size (RSS)
increase before triggering a full automatic garbage collection.  If the RSS
has not increased 10% since the last collection then it is deferred.
2025-05-05 17:17:05 +00:00
Irit Katriel
082dbf7788
gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396) 2025-05-05 17:46:56 +01:00