summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-104240: return code unit metadata from codegen (#104300)Irit Katriel2023-05-091-3/+47
|
* gh-99113: A Per-Interpreter GIL! (gh-104210)Eric Snow2023-05-082-45/+14
| | | | | This is the culmination of PEP 684 (and of my 8-year long multi-core Python project)! Each subinterpreter may now be created with its own GIL (via Py_NewInterpreterFromConfig()). If not so configured then the interpreter will share with the main interpreter--the status quo since subinterpreters were added decades ago. The main interpreter always has its own GIL and subinterpreters from Py_NewInterpreter() will always share with the main interpreter.
* gh-103650: Fix perf maps address format (#103651)Arthur Pastel2023-05-071-1/+1
|
* gh-104240: make _PyCompile_CodeGen support different compilation modes (#104241)Irit Katriel2023-05-071-2/+6
|
* gh-104018: remove unused format "z" handling in string formatfloat() (#104107)John Belmonte2023-05-071-1/+0
| | | This is a cleanup overlooked in PR #104033.
* gh-103886: Improve `builtins.__doc__` (#104179)Tomas R2023-05-071-2/+9
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-99113: Make Sure the GIL is Acquired at the Right Places (gh-104208)Eric Snow2023-05-063-40/+111
| | | This is a pre-requisite for a per-interpreter GIL. Without it this change isn't strictly necessary. However, there is no real downside otherwise.
* gh-104233: Fix "unused variable" warning in `ceval_gil.c` (#104234)Nikita Sobolev2023-05-061-0/+2
|
* gh-99113: Add PyInterpreterConfig.own_gil (gh-104204)Eric Snow2023-05-052-6/+29
| | | | | We also add PyInterpreterState.ceval.own_gil to record if the interpreter actually has its own GIL. Note that for now we don't actually respect own_gil; all interpreters still share the one GIL. However, PyInterpreterState.ceval.own_gil does reflect PyInterpreterConfig.own_gil. That lie is a temporary one that we will fix when the GIL really becomes per-interpreter.
* gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)Eric Snow2023-05-055-0/+5
| | | Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules. We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
* gh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)Eric Snow2023-05-052-39/+60
| | | In preparation for a per-interpreter GIL, we add PyInterpreterState.ceval.gil, set it to the shared GIL for each interpreter, and use that rather than using _PyRuntime.ceval.gil directly. Note that _PyRuntime.ceval.gil is still the actual GIL.
* GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque ↵Mark Shannon2023-05-053-3/+20
| | | | for users of PEP 523. (GH-96849)
* gh-103323: Remove PyRuntimeState_GetThreadState() (#104171)Victor Stinner2023-05-044-9/+7
| | | | | This function no longer makes sense, since its runtime parameter is no longer used. Use directly _PyThreadState_GET() and _PyInterpreterState_GET() instead.
* gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)Petr Viktorin2023-05-041-0/+12
| | | | Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-103845: Remove line & instruction instrumentations before adding them ↵Tian Gao2023-05-031-8/+33
| | | | back (GH-103851)
* GH-84976: Move Lib/datetime.py to Lib/_pydatetimePaul Ganssle2023-05-031-0/+1
| | | | | | This breaks the tests, but we are keeping it as a separate commit so that the move operation and editing of the moved files are separate, for a cleaner history.
* gh-104109: Expose Py_NewInterpreterFromConfig() in the Public C-API (gh-104110)Eric Snow2023-05-031-7/+8
| | | | | We also expose PyInterpreterConfig. This is part of the PEP 684 (per-interpreter GIL) implementation. We will add docs as soon as we can. FYI, I'm adding the new config field for per-interpreter GIL in gh-99114.
* gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074)Eric Snow2023-05-021-1/+1
| | | This makes it much cleaner to move more PyTypeObject fields to PyInterpreterState.
* gh-94673: Properly Initialize and Finalize Static Builtin Types for Each ↵Eric Snow2023-05-024-28/+26
| | | | | Interpreter (gh-104072) Until now, we haven't been initializing nor finalizing the per-interpreter state properly.
* gh-87092: Expose assembler to unit tests (#103988)Irit Katriel2023-05-012-33/+102
|
* gh-84436: Immortalize in _PyStructSequence_InitBuiltinWithFlags() (gh-104054)Eric Snow2023-05-013-9/+9
| | | This also does some cleanup.
* gh-103895: Improve how invalid `Exception.__notes__` are displayed (#103897)Carey Metcalfe2023-05-011-1/+4
|
* gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004)Ken Jin2023-04-303-43/+127
|
* gh-87092: change assembler to use instruction sequence instead of CFG (#103933)Irit Katriel2023-04-293-75/+80
|
* GH-103082: Code cleanup in instrumentation code (#103474)Mark Shannon2023-04-293-36/+39
|
* gh-98040: Remove just the `imp` module (#98573)Barry Warsaw2023-04-284-27/+19
|
* gh-103978: avoid using 'class' as an identifier (#103979)Carl Meyer2023-04-281-3/+3
|
* gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)Eric Snow2023-04-276-41/+16
| | | There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.
* gh-103879: Fix refleak in super specialization (#103882)Jelle Zijlstra2023-04-261-0/+2
|
* gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)Carl Meyer2023-04-255-291/+390
|
* gh-100227: Add a Granular Lock for _PyRuntime.imports.extensions.dict ↵Eric Snow2023-04-252-4/+14
| | | | | | (gh-103460) The lock is unnecessary as long as there's a GIL, but completely necessary with a per-interpreter GIL.
* gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)Eric Snow2023-04-243-8/+40
| | | | | | | | | | | | | | This is strictly about moving the "obmalloc" runtime state from `_PyRuntimeState` to `PyInterpreterState`. Doing so improves isolation between interpreters, specifically most of the memory (incl. objects) allocated for each interpreter's use. This is important for a per-interpreter GIL, but such isolation is valuable even without it. FWIW, a per-interpreter obmalloc is the proverbial canary-in-the-coalmine when it comes to the isolation of objects between interpreters. Any object that leaks (unintentionally) to another interpreter is highly likely to cause a crash (on debug builds at least). That's a useful thing to know, relative to interpreter isolation.
* gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)Carl Meyer2023-04-246-359/+564
| | | | | This speeds up `super()` (by around 85%, for a simple one-level `super().meth()` microbenchmark) by avoiding allocation of a new single-use `super()` object on each use.
* gh-100227: Only Use deepfreeze for the Main Interpreter (gh-103794)Eric Snow2023-04-242-33/+57
| | | | | | | Deep-frozen code objects are cannot be shared (currently) by interpreters, due to how adaptive specialization can modify the bytecodes. We work around this by only using the deep-frozen objects in the main interpreter. This does incur a performance penalty for subinterpreters, which we may be able to resolve later.
* gh-103492: Clarify SyntaxWarning with literal comparison (#103493)Shantanu2023-04-241-4/+12
|
* gh-101517: fix line number propagation in code generated for except* (#103550)Irit Katriel2023-04-241-12/+20
|
* gh-87092: fix a few cases of incorrect error handling in compiler (#103456)Irit Katriel2023-04-241-9/+23
| | | gh-87092: fix a few cases of incorrect error handling
* gh-103323: Get the "Current" Thread State from a Thread-Local Variable ↵Eric Snow2023-04-241-6/+32
| | | | | | | | | | | (gh-103324) We replace _PyRuntime.tstate_current with a thread-local variable. As part of this change, we add a _Py_thread_local macro in pyport.h (only for the core runtime) to smooth out the compiler differences. The main motivation here is in support of a per-interpreter GIL, but this change also provides some performance improvement opportunities. Note that we do not provide a fallback to the thread-local, either falling back to the old tstate_current or to thread-specific storage (PyThread_tss_*()). If that proves problematic then we can circle back. I consider it unlikely, but will run the buildbots to double-check. Also note that this does not change any of the code related to the GILState API, where it uses a thread state stored in thread-specific storage. I suspect we can combine that with _Py_tss_tstate (from here). However, that can be addressed separately and is not urgent (nor critical). (While this change was mostly done independently, I did take some inspiration from earlier (~2020) work by @markshannon (main...markshannon:threadstate_in_tls) and @vstinner (#23976).)
* gh-84436: Implement Immortal Objects (gh-19474)Eddie Elizondo2023-04-226-11/+53
| | | | | | | | | This is the implementation of PEP683 Motivation: The PR introduces the ability to immortalize instances in CPython which bypasses reference counting. Tagging objects as immortal allows up to skip certain operations when we know that the object will be around for the entire execution of the runtime. Note that this by itself will bring a performance regression to the runtime due to the extra reference count checks. However, this brings the ability of having truly immutable objects that are useful in other contexts such as immutable data sharing between sub-interpreters.
* gh-103082: Fix shifted field initialization in `instrumentation.c` (GH-103561)Oleg Iarygin2023-04-211-4/+4
| | | Fix shifted field initialization in instrumentation.c
* gh-102856: Initial implementation of PEP 701 (#102855)Pablo Galindo Salgado2023-04-191-2/+2
| | | | | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
* GH-100530: Change the error message for non-class class patterns (GH-103576)Nikita Sobolev2023-04-181-1/+1
|
* Fix unused functions warnings in instrumentation.c (GH-103515)Benjamin Peterson2023-04-131-0/+4
|
* GH-103488: Use return-offset, not yield-offset. (GH-103502)Mark Shannon2023-04-133-412/+429
| | | | * Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
* GH-103082: Turn on branch events for FOR_ITER instructions. (#103507)Mark Shannon2023-04-131-0/+2
| | | Turn on branch events for FOR_ITER instructions.
* gh-103326: Remove `Python/importlib.h` (GH-103331)Nikita Sobolev2023-04-121-1783/+0
| | | | Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-1214-1274/+4370
| | | | | | | | | | (GH-103083) * The majority of the monitoring code is in instrumentation.c * The new instrumentation bytecodes are in bytecodes.c * legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
* gh-87092: fix refleak in peepholer test harness (#103448)Irit Katriel2023-04-111-4/+0
|
* gh-77757: replace exception wrapping by PEP-678 notes in typeobject's ↵Irit Katriel2023-04-112-25/+30
| | | | __set_name__ (#103402)
* gh-91276: remove unused _PyOpcode_RelativeJump (#103156)Irit Katriel2023-04-111-23/+11
|