summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* GH-100982: Break up COMPARE_AND_BRANCH (GH-102801)Brandt Bucher2023-03-233-22/+20
|
* gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters ↵Eric Snow2023-03-234-0/+13
| | | | | | | | | (gh-102925) This is effectively two changes. The first (the bulk of the change) is where we add _Py_AddToGlobalDict() (and _PyRuntime.cached_objects.main_tstate, etc.). The second (much smaller) change is where we update PyUnicode_InternInPlace() to use _Py_AddToGlobalDict() instead of calling PyDict_SetDefault() directly. Basically, _Py_AddToGlobalDict() is a wrapper around PyDict_SetDefault() that should be used whenever we need to add a value to a runtime-global dict object (in the few cases where we are leaving the container global rather than moving it to PyInterpreterState, e.g. the interned strings dict). _Py_AddToGlobalDict() does all the necessary work to make sure the target global dict is shared safely between isolated interpreters. This is especially important as we move the obmalloc state to each interpreter (gh-101660), as well as, potentially, the GIL (PEP 684). https://github.com/python/cpython/issues/100227
* gh-102859: Remove JUMP_IF_FALSE_OR_POP and JUMP_IF_TRUE_OR_POP (#102870)Irit Katriel2023-03-222-21/+19
|
* GH-101291: Rearrange the size bits in PyLongObject (GH-102464)Mark Shannon2023-03-225-30/+161
| | | | | | | | | | * Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts. * Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints. * Add functions to hide some internals of long object, and for setting sign and digit count. * Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
* gh-102406: replace exception chaining by PEP-678 notes in codecs (#102407)Irit Katriel2023-03-211-18/+0
|
* gh-102304: Move the Total Refcount to PyInterpreterState (gh-102545)Eric Snow2023-03-214-7/+20
| | | | | Moving it valuable with a per-interpreter GIL. However, it is also useful without one, since it allows us to identify refleaks within a single interpreter or where references are escaping an interpreter. This becomes more important as we move the obmalloc state to PyInterpreterState. https://github.com/python/cpython/issues/102304
* gh-98608: Stop Treating All Errors from _Py_NewInterpreterFromConfig() as ↵Eric Snow2023-03-213-4/+4
| | | | | | | Fatal (gh-102657) Prior to this change, errors in _Py_NewInterpreterFromConfig() were always fatal. Instead, callers should be able to handle such errors and keep going. That's what this change supports. (This was an oversight in the original implementation of _Py_NewInterpreterFromConfig().) Note that the existing [fatal] behavior of the public Py_NewInterpreter() is preserved. https://github.com/python/cpython/issues/98608
* gh-102755: PyErr_DisplayException only in ABI >= 3.12. Tests cover ↵Irit Katriel2023-03-211-0/+3
| | | | PyErr_Display as well (GH-102849)
* gh-102304: Move _Py_RefTotal to _PyRuntimeState (gh-102543)Eric Snow2023-03-205-9/+34
| | | | | | | The essentially eliminates the global variable, with the associated benefits. This is also a precursor to isolating this bit of state to PyInterpreterState. Folks that currently read _Py_RefTotal directly would have to start using _Py_GetGlobalRefTotal() instead. https://github.com/python/cpython/issues/102304
* gh-102778: Add sys.last_exc, deprecate sys.last_type, ↵Irit Katriel2023-03-184-0/+6
| | | | sys.last_value,sys.last_traceback (#102779)
* gh-102755: Add PyErr_DisplayException(exc) (#102756)Irit Katriel2023-03-162-0/+2
|
* gh-99726: Improves correctness of stat results for Windows, and uses faster ↵Steve Dower2023-03-162-1/+84
| | | | | API when available (GH-102149) This deprecates `st_ctime` fields on Windows, with the intent to change them to contain the correct value in 3.14. For now, they should keep returning the creation time as they always have.
* gh-102594: PyErr_SetObject adds note to exception raised on normalization ↵Irit Katriel2023-03-161-0/+4
| | | | error (#102675)
* gh-102660: Handle m_copy Specially for the sys and builtins Modules (gh-102661)Eric Snow2023-03-141-0/+1
| | | | | | | It doesn't make sense to use multi-phase init for these modules. Using a per-interpreter "m_copy" (instead of PyModuleDef.m_base.m_copy) makes this work okay. (This came up while working on gh-101660.) Note that we might instead end up disallowing re-load for sys/builtins since they are so special. https://github.com/python/cpython/issues/102660
* GH-94851: check unicode consistency of static strings in debug mode (#102684)Kumar Aditya2023-03-141-0/+664
|
* gh-102013: Add PyUnstable_GC_VisitObjects (#102014)Jacob Bower2023-03-141-0/+19
|
* gh-102213: Optimize the performance of `__getattr__` (GH-102248)wangxiang-hz2023-03-111-0/+1
| | | | When __getattr__ is defined, python with try to find an attribute using _PyObject_GenericGetAttrWithDict find nothing is reasonable so we don't need an exception, it will hurt performance.
* GH-90997: Shrink the LOAD_GLOBAL caches (#102569)Brandt Bucher2023-03-112-2/+2
|
* gh-102519: Add os.listdrives, os.listvolumes and os.listmounts on Windows ↵Steve Dower2023-03-104-0/+5
| | | | (GH-102544)
* gh-102255: Improve build support for Windows API partitions (GH-102256)Max Bachmann2023-03-091-0/+8
| | | | | Add `MS_WINDOWS_DESKTOP`, `MS_WINDOWS_APPS`, `MS_WINDOWS_SYSTEM` and `MS_WINDOWS_GAMES` preprocessor definitions to allow switching off functionality missing from particular API partitions ("partitions" are used in Windows to identify overlapping subsets of APIs). CPython only officially supports `MS_WINDOWS_DESKTOP` and `MS_WINDOWS_SYSTEM` (APPS is included by normal desktop builds, but APPS without DESKTOP is not covered). Other configurations are a convenience for people building their own runtimes. `MS_WINDOWS_GAMES` is for the Xbox subset of the Windows API, which is also available on client OS, but is restricted compared to `MS_WINDOWS_DESKTOP`. These restrictions may change over time, as they relate to the build headers rather than the OS support, and so we assume that Xbox builds will use the latest available version of the GDK.
* gh-100227: Isolate the Import State to Each Interpreter (gh-101941)Eric Snow2023-03-093-25/+23
| | | | | | | | | | | | Specific changes: * move the import lock to PyInterpreterState * move the "find_and_load" diagnostic state to PyInterpreterState Note that the import lock exists to keep multiple imports of the same module in the same interpreter (but in different threads) from stomping on each other. Independently, we use a distinct global lock to protect globally shared import state, especially related to loaded extension modules. For now we can rely on the GIL as that lock but with a per-interpreter GIL we'll need a new global lock. The remaining state in _PyRuntimeState.imports will (probably) continue being global. https://github.com/python/cpython/issues/100227
* gh-100227: Move dict_state.global_version to PyInterpreterState (gh-102338)Eric Snow2023-03-093-15/+10
| | | https://github.com/python/cpython/issues/100227
* gh-100227: Move next_keys_version to PyInterpreterState (gh-102335)Eric Snow2023-03-093-5/+8
| | | https://github.com/python/cpython/issues/100227
* gh-100227: Move func_state.next_version to PyInterpreterState (gh-102334)Eric Snow2023-03-084-6/+5
| | | https://github.com/python/cpython/issues/100227
* gh-102304: Consolidate Direct Usage of _Py_RefTotal (gh-102514)Eric Snow2023-03-083-7/+42
| | | | | This simplifies further changes to _Py_RefTotal (e.g. make it atomic or move it to PyInterpreterState). https://github.com/python/cpython/issues/102304
* Merge in the release of Python 3.12.0a6.Thomas Wouters2023-03-084-20/+31
|\
| * gh-102381: don't call watcher callback with dead object (#102382)Carl Meyer2023-03-084-20/+31
| | | | | | Co-authored-by: T. Wouters <thomas@python.org>
* | Post 3.12.0a6Thomas Wouters2023-03-081-1/+1
| |
* | Python 3.12.0a6v3.12.0a6Thomas Wouters2023-03-071-2/+2
|/
* gh-90110: Fix the c-analyzer Tool (#102483)Eric Snow2023-03-073-2/+9
| | | | | | | Some incompatible changes had gone in, and the "ignore" lists weren't properly undated. This change fixes that. It's necessary prior to enabling test_check_c_globals, which I hope to do soon. Note that this does include moving last_resort_memory_error to PyInterpreterState. https://github.com/python/cpython/issues/90110