summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* GH-104142: Fix _Py_RefcntAdd to respect immortality (GH-104143)Brandt Bucher2023-05-051-0/+3
|
* gh-102500: Implement PEP 688 (#102521)Jelle Zijlstra2023-05-047-1/+38
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-104066: Improve performance of hasattr for module objects (#104063)Itamar Ostricher2023-05-041-0/+3
|
* gh-103323: Remove PyRuntimeState_GetThreadState() (#104171)Victor Stinner2023-05-041-8/+2
| | | | | 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-045-5/+18
| | | | Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-104109: Expose Py_NewInterpreterFromConfig() in the Public C-API (gh-104110)Eric Snow2023-05-032-3/+3
| | | | | 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: More Per-Interpreter Fields for Builtin Static Types (gh-103912)Eric Snow2023-05-031-0/+7
| | | | | his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses. Those three fields are effectively const for builtin static types (unlike tp_subclasses). In theory we only need to make their values immortal, along with their contents. However, that isn't such a simple proposition. (See gh-103823.) In the meantime the simplest solution is to move the fields into the interpreter. One alternative is to statically allocate the values, but that's its own can of worms.
* GH-103963: Make dis display names of args for intrinsics opcodes (#104029)Juhi Chandalia2023-05-031-14/+12
|
* gh-103743: Add PyUnstable_Object_GC_NewWithExtraData (GH-103744)Jurica Bradarić2023-05-021-0/+3
| | | | Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074)Eric Snow2023-05-022-6/+14
| | | 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-9/+14
| | | | | 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-015-0/+10
|
* gh-97696: asyncio eager tasks factory (#102853)Itamar Ostricher2023-05-014-0/+12
| | | | Co-authored-by: Jacob Bower <jbower@meta.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* gh-84436: Immortalize in _PyStructSequence_InitBuiltinWithFlags() (gh-104054)Eric Snow2023-05-011-2/+2
| | | This also does some cleanup.
* Fix typo in "expected" word in few source files (#104034)chgnrdv2023-05-011-1/+1
|
* gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004)Ken Jin2023-04-301-0/+10
|
* gh-87092: change assembler to use instruction sequence instead of CFG (#103933)Irit Katriel2023-04-292-5/+12
|
* GH-103082: Code cleanup in instrumentation code (#103474)Mark Shannon2023-04-291-3/+3
|
* gh-103978: avoid using 'class' as an identifier (#103979)Carl Meyer2023-04-281-1/+1
|
* gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)Eric Snow2023-04-272-6/+0
| | | There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.
* gh-102765: Update ntpath.isdir/isfile/islink/exists to use ↵Finn Womack2023-04-271-0/+18
| | | | GetFileInformationByName when available (GH-103485)
* gh-103015: Add entrypoint keyword param to sqlite3.Connection.load_extension ↵Erlend E. Aasland2023-04-264-0/+6
| | | | (#103073)
* gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)Carl Meyer2023-04-254-38/+53
|
* gh-100227: Add a Granular Lock for _PyRuntime.imports.extensions.dict ↵Eric Snow2023-04-251-0/+2
| | | | | | (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-249-7/+38
| | | | | | | | | | | | | | 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-95795: Move types.next_version_tag to PyInterpreterState (gh-102343)Eric Snow2023-04-243-27/+44
| | | | | | Core static types will continue to use the global value. All other types will use the per-interpreter value. They all share the same range, where the global types use values < 2^16 and each interpreter uses values higher than that.
* gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)Carl Meyer2023-04-243-14/+27
| | | | | 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-103323: Get the "Current" Thread State from a Thread-Local Variable ↵Eric Snow2023-04-243-12/+38
| | | | | | | | | | | (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-103091: Add PyUnstable_Type_AssignVersionTag (#103095)Brett Simmers2023-04-241-0/+7
|
* gh-84436: Implement Immortal Objects (gh-19474)Eddie Elizondo2023-04-229-50/+179
| | | | | | | | | 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-102856: Initial implementation of PEP 701 (#102855)Pablo Galindo Salgado2023-04-191-8/+14
| | | | | | 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-103488: Use return-offset, not yield-offset. (GH-103502)Mark Shannon2023-04-131-2/+8
| | | | * Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-129-179/+325
| | | | | | | | | | (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-77757: replace exception wrapping by PEP-678 notes in typeobject's ↵Irit Katriel2023-04-111-0/+2
| | | | __set_name__ (#103402)
* gh-91276: remove unused _PyOpcode_RelativeJump (#103156)Irit Katriel2023-04-112-17/+1
|
* gh-87092: move assembler related code from compile.c to assemble.c (#103277)Irit Katriel2023-04-112-3/+47
|
* Remove useless symbol in pystats.h (#101864)Stepfen Shawn2023-04-091-2/+0
|
* gh-102213: Revert "gh-102213: Optimize the performance of `__getattr__` ↵Nikita Sobolev2023-04-071-1/+0
| | | | | (GH-102248)" (GH-103332) This reverts commit aa0a73d1bc53dcb6348a869df1e775138991e561.
* gh-101659: Add _Py_AtExit() (gh-103298)Eric Snow2023-04-064-18/+64
| | | | | The function is like Py_AtExit() but for a single interpreter. This is a companion to the atexit module's register() function, taking a C callback instead of a Python one. We also update the _xxinterpchannels module to use _Py_AtExit(), which is the motivating case. (This is inspired by pain points felt while working on gh-101660.)
* GH-88691: Shrink the CALL caches (GH-103230)Brandt Bucher2023-04-052-2/+1
|
* gh-99069: Consolidate checks for static_assert (#94766)Joshua Root2023-04-051-13/+16
| | | | | | | | | | | | | | | | | | | | Several platforms don't define the static_assert macro despite having compiler support for the _Static_assert keyword. The macro needs to be defined since it is used unconditionally in the Python code. So it should always be safe to define it if undefined and not in C++11 (or later) mode. Hence, remove the checks for particular platforms or libc versions, and just define static_assert anytime it needs to be defined but isn't. That way, all platforms that need the fix will get it, regardless of whether someone specifically thought of them. Also document that certain macOS versions are among the platforms that need this. The C2x draft (currently expected to become C23) makes static_assert a keyword to match C++. So only define the macro for up to C17. Co-authored-by: Victor Stinner <vstinner@python.org>
* Post 3.12.0a7Thomas Wouters2023-04-041-1/+1
|
* Python 3.12.0a7v3.12.0a7Thomas Wouters2023-04-041-2/+2
|
* gh-102192: deprecate _PyErr_ChainExceptions (#102935)Irit Katriel2023-04-011-1/+1
|
* gh-87092: move CFG related code from compile.c to flowgraph.c (#103021)Irit Katriel2023-03-314-2/+228
|
* gh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters ↵Eric Snow2023-03-293-7/+23
| | | | | | | | | | | | | | | | | | | | | | | (gh-103084) Sharing mutable (or non-immortal) objects between interpreters is generally not safe. We can work around that but not easily. There are two restrictions that are critical for objects that break interpreter isolation. The first is that the object's state be guarded by a global lock. For now the GIL meets this requirement, but a granular global lock is needed once we have a per-interpreter GIL. The second restriction is that the object (and, for a container, its items) be deallocated/resized only when the interpreter in which it was allocated is the current one. This is because every interpreter has (or will have, see gh-101660) its own object allocator. Deallocating an object with a different allocator can cause crashes. The dict for the cache of module defs is completely internal, which simplifies what we have to do to meet those requirements. To do so, we do the following: * add a mechanism for re-using a temporary thread state tied to the main interpreter in an arbitrary thread * add _PyRuntime.imports.extensions.main_tstate` * add _PyThreadState_InitDetached() and _PyThreadState_ClearDetached() (pystate.c) * add _PyThreadState_BindDetached() and _PyThreadState_UnbindDetached() (pystate.c) * make sure the cache dict (_PyRuntime.imports.extensions.dict) and its items are all owned by the main interpreter) * add a placeholder using for a granular global lock Note that the cache is only used for legacy extension modules and not for multi-phase init modules. https://github.com/python/cpython/issues/100227
* GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)Brandt Bucher2023-03-293-3/+12
|
* gh-100227: Move the Dict of Interned Strings to PyInterpreterState (gh-102339)Eric Snow2023-03-284-674/+669
| | | | | We can revisit the options for keeping it global later, if desired. For now the approach seems quite complex, so we've gone with the simpler isolation solution in the meantime. https://github.com/python/cpython/issues/100227
* gh-100227: Revert gh-102925 "gh-100227: Make the Global Interned Dict Safe ↵Eric Snow2023-03-274-13/+0
| | | | | | | for Isolated Interpreters" (gh-103063) This reverts commit 87be8d9. This approach to keeping the interned strings safe is turning out to be too complex for my taste (due to obmalloc isolation). For now I'm going with the simpler solution, making the dict per-interpreter. We can revisit that later if we want a sharing solution.
* gh-99726: Fix order of recently added fields for FILE_STAT_BASIC_INFORMATION ↵Steve Dower2023-03-231-1/+1
| | | | (GH-102976)