summaryrefslogtreecommitdiffstats
path: root/Include/cpython
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-96512: Move int_max_str_digits setting to PyConfig (#96944)Gregory P. Smith2022-10-031-0/+1
| | | | | | | | | | | It had to live as a global outside of PyConfig for stable ABI reasons in the pre-3.12 backports. This removes the `_Py_global_config_int_max_str_digits` and gets rid of the equivalent field in the internal `struct _is PyInterpreterState` as code can just use the existing nested config struct within that. Adds tests to verify unique settings and configs in subinterpreters.
* gh-96670: Raise SyntaxError when parsing NULL bytes (#97594)Pablo Galindo Salgado2022-09-271-0/+1
|
* GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)adphrost2022-09-151-1/+3
| | | | Co-authored-by: Andrew Frost <adfrost@fb.com> Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
* gh-96143: Allow Linux perf profiler to see Python calls (GH-96123)Pablo Galindo Salgado2022-08-301-0/+1
| | | | | | | :warning: :warning: Note for reviewers, hackers and fellow systems/low-level/compiler engineers :warning: :warning: If you have a lot of experience with this kind of shenanigans and want to improve the **first** version, **please make a PR against my branch** or **reach out by email** or **suggest code changes directly on GitHub**. If you have any **refinements or optimizations** please, wait until the first version is merged before starting hacking or proposing those so we can keep this PR productive.
* GH-93503: Add thread-specific APIs to set profiling and tracing functions in ↵Pablo Galindo Salgado2022-08-241-0/+2
| | | | | | | | | | | | | | | | | the C-API (#93504) * gh-93503: Add APIs to set profiling and tracing functions in all threads in the C-API * Use a separate API * Fix NEWS entry * Add locks around the loop * Document ignoring exceptions * Use the new APIs in the sys module * Update docs
* gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code ↵Eric Snow2022-08-111-0/+1
| | | | | | | | | | | | | | | | (gh-95860) We only statically initialize for core code and builtin modules. Extension modules still create the tuple at runtime. We'll solve that part of interpreter isolation separately. This change includes generated code. The non-generated changes are in: * Tools/clinic/clinic.py * Python/getargs.c * Include/cpython/modsupport.h * Makefile.pre.in (re-generate global strings after running clinic) * very minor tweaks to Modules/_codecsmodule.c and Python/Python-tokenize.c All other changes are generated code (clinic, global strings).
* gh-93274: Expose receiving vectorcall in the Limited API (GH-95717)Petr Viktorin2022-08-082-8/+5
|
* gh-94673: Add Per-Interpreter tp_subclasses for Static Builtin Types (gh-95301)Eric Snow2022-08-051-3/+2
|
* gh-94936: C getters: co_varnames, co_cellvars, co_freevars (#95008)Ken Jin2022-08-041-0/+6
|
* GH-95245: Store object values and dict pointers in single tagged pointer. ↵Mark Shannon2022-08-012-3/+4
| | | | (GH-95278)
* gh-94673: Add Per-Interpreter tp_weaklist for Static Builtin Types (#95302)Eric Snow2022-07-291-1/+1
| | | | | | | | | | | | | | | * Store tp_weaklist on the interpreter state for static builtin types. * Factor out _PyStaticType_GET_WEAKREFS_LISTPTR(). * Add _PyStaticType_ClearWeakRefs(). * Add a comment about how _PyStaticType_ClearWeakRefs() loops. * Document the change. * Update Doc/whatsnew/3.12.rst * Fix a typo.
* gh-95174: Add pthread stubs for WASI (GH-95234)Christian Heimes2022-07-272-0/+91
| | | Co-authored-by: Brett Cannon <brett@python.org>
* gh-94673: Add Per-Interpreter Storage for Static Builtin Types (#95255)Eric Snow2022-07-261-0/+1
| | | | | | | | | | | | | | This is the last precursor to storing tp_subclasses (and tp_weaklist) on the interpreter state for static builtin types. Here we add per-type storage on PyInterpreterState, but only for the static builtin types. This involves the following: * add PyInterpreterState.types * move PyInterpreterState.type_cache to it * add a "num_builtins_initialized" field * add a "builtins" field (a static array big enough for all the static builtin types) * add _PyStaticType_GetState() to look up a static builtin type's state * (temporarily) add PyTypeObject.tp_static_builtin_index (to hold the type's index into PyInterpreterState.types.builtins) We will be eliminating tp_static_builtin_index in a later change.
* GH-92678: Expose managed dict clear and visit functions (#95246)Mark Shannon2022-07-251-0/+3
|
* gh-93382: Sync up `co_code` changes with 3.11 (GH-94227)Ken Jin2022-06-241-1/+1
| | | Sync up co_code changes with 3.11 commit 852b4d4bcd12b0b6839a015a262ce976b134f6f3.
* gh-87347: Add parenthesis around macro arguments (#93915)Victor Stinner2022-06-2011-37/+38
| | | Add unit test on Py_MEMBER_SIZE() and some other macros.
* GH-93516: Speedup line number checks when tracing. (GH-93763)Mark Shannon2022-06-201-1/+3
| | | | * Use a lookup table to reduce overhead of getting line numbers during tracing.
* GH-93897: Store frame size in code object and de-opt if insufficient space ↵Mark Shannon2022-06-201-2/+2
| | | | on thread frame stack. (GH-93908)
* gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938)Victor Stinner2022-06-192-13/+17
| | | | | | | | | | | | | | | | Move the follow functions and type from frameobject.h to pyframe.h, so the standard <Python.h> provide frame getter functions: * PyFrame_Check() * PyFrame_GetBack() * PyFrame_GetBuiltins() * PyFrame_GetGenerator() * PyFrame_GetGlobals() * PyFrame_GetLasti() * PyFrame_GetLocals() * PyFrame_Type Remove #include "frameobject.h" from many C files. It's no longer needed.
* gh-77782: Deprecate global configuration variable (#93943)Victor Stinner2022-06-172-19/+22
| | | | | | | Deprecate global configuration variable like Py_IgnoreEnvironmentFlag: the Py_InitializeFromConfig() API should be instead. Fix declaration of Py_GETENV(): use PyAPI_FUNC(), not PyAPI_DATA().
* gh-74953: Add _PyTime_FromMicrosecondsClamp() function (#93942)Victor Stinner2022-06-171-0/+4
|
* gh-87347: Add parenthesis around PyXXX_Check() arguments (#92815)Victor Stinner2022-06-1610-18/+18
|
* GH-93516: Store offset of first traceable instruction in code object (GH-93769)Mark Shannon2022-06-141-0/+1
|
* gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)Serhiy Storchaka2022-06-141-0/+3
| | | | | | It combines PyImport_ImportModule() and PyObject_GetAttrString() and saves 4-6 lines of code on every use. Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
* gh-89653: PEP 670: Macros always cast arguments in cpython/ (#93766)Victor Stinner2022-06-139-92/+28
| | | | Header files in the Include/cpython/ are only included if the Py_LIMITED_API macro is not defined.
* Remove ANY_VARARGS() macro from the C API (#93764)Victor Stinner2022-06-131-1/+3
| | | The macro was exposed by mistake.
* gh-89653: PEP 670: Convert PyFunction macros (#93765)Victor Stinner2022-06-131-16/+39
| | | Convert PyFunction macros to static inline functions.
* gh-93382: Cache result of `PyCode_GetCode` in codeobject (GH-93383)Ken Jin2022-06-031-0/+1
| | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* gh-92536: Mark PyUnicode_READY() argument as unused (#93011)Wenzel Jakob2022-05-231-2/+2
|
* gh-89653: Add assertions on PyUnicode_READ() index (#92883)Victor Stinner2022-05-171-1/+9
| | | | Add assertions on the index argument of PyUnicode_READ(), PyUnicode_READ_CHAR() and PyUnicode_WRITE() functions.
* gh-89653: PEP 670: Fix PyUnicode_READ() cast (#92872)Victor Stinner2022-05-171-1/+2
| | | | _Py_CAST() cannot be used with a constant type: use _Py_STATIC_CAST() instead.
* gh-92781: Avoid mixing declarations and code in C API (#92783)Victor Stinner2022-05-155-11/+17
| | | | | Avoid mixing declarations and code in the C API to fix the compiler warning: "ISO C90 forbids mixed declarations and code" [-Werror=declaration-after-statement].
* gh-85858: Remove PyUnicode_InternImmortal() function (#92579)Victor Stinner2022-05-131-10/+3
| | | | | | | | | | | | | | | | | Remove the PyUnicode_InternImmortal() function and the SSTATE_INTERNED_IMMORTAL macro. The PyUnicode_InternImmortal() function is still exported in the stable ABI. The function is removed from the API. PyASCIIObject.state.interned size is now a single bit, rather than 2 bits. Keep SSTATE_NOT_INTERNED and SSTATE_INTERNED_MORTAL macros for backward compatibility, but no longer use them internally since the interned member is now a single bit and so can only have two values (interned or not interned). Update stats of _PyUnicode_ClearInterned().
* gh-89653: Use int type for Unicode kind (#92704)Victor Stinner2022-05-131-2/+2
| | | | Use the same type that PyUnicode_FromKindAndData() kind parameter type (public C API): int.
* gh-89653: PEP 670: Convert PyUnicode_KIND() macro to function (#92705)Victor Stinner2022-05-131-1/+15
| | | | | | | | In the limited C API version 3.12, PyUnicode_KIND() is now implemented as a static inline function. Keep the macro for the regular C API and for the limited C API version 3.11 and older to prevent introducing new compiler warnings. Update _decimal.c and stringlib/eq.h for PyUnicode_KIND().
* gh-92536: PEP 623: Remove wstr and legacy APIs from Unicode (GH-92537)Inada Naoki2022-05-121-219/+14
|
* gh-89653: PEP 670: unicodeobject.h uses _Py_CAST() (#92696)Victor Stinner2022-05-111-6/+12
| | | | | | | | | | Use _Py_CAST() and _Py_STATIC_CAST() in macros wrapping static inline functions of unicodeobject.h. Change also the kind type from unsigned int to int: same parameter type than PyUnicode_FromKindAndData(). The limited API version 3.11 no longer casts arguments to expected types.
* gh-89653: PEP 670: Convert PyDict_GET_SIZE() macro to function (#92695)Victor Stinner2022-05-111-1/+9
| | | The limited C API version 3.12 no longer casts the argument.
* gh-89653: PEP 670: Use PyObject* type for parameters (#92694)Victor Stinner2022-05-112-12/+16
| | | | | | | | | Use the PyObject* type for parameters of static inline functions: * Py_SIZE(): same parameter type than PyObject_Size() * PyList_GET_SIZE(), PyList_SET_ITEM(): same parameter type than PyList_Size() and PyList_SetItem() * PyTuple_GET_SIZE(), PyTuple_SET_ITEM(): same parameter type than PyTuple_Size() and PyTuple_SetItem().
* gh-89653: Add assertions to unicodeobject.h functions (#92692)Victor Stinner2022-05-111-2/+8
|
* gh-89653: PEP 670: Limited API doesn't cast arguments (#92654)Victor Stinner2022-05-113-3/+13
| | | | | | | | The limited API version 3.11 no longer casts arguments to expected types of functions of functions: * PyList_GET_SIZE(), PyList_SET_ITEM() * PyTuple_GET_SIZE(), PyTuple_SET_ITEM() * PyWeakref_GET_OBJECT()
* gh-89653: PEP 670: Convert unicodeobject.h macros to functions (#92648)Victor Stinner2022-05-111-48/+66
| | | | | | | | | | | | | | | | | | | | Convert the following Unicode macros to static inline functions. Surrogate functions: * Py_UNICODE_IS_SURROGATE() * Py_UNICODE_IS_HIGH_SURROGATE() * Py_UNICODE_IS_LOW_SURROGATE() * Py_UNICODE_HIGH_SURROGATE() * Py_UNICODE_LOW_SURROGATE() * Py_UNICODE_JOIN_SURROGATES() "Is" functions: * Py_UNICODE_ISALNUM() * Py_UNICODE_ISSPACE() In the implementation of these functions, the character type is now well defined to Py_UCS4.
* gh-89653: PEP 670: Convert PyCell macros to functions (#92653)Victor Stinner2022-05-111-2/+17
| | | | | | | | | | | Convert the following macros to static inline functions: * PyCell_GET() * PyCell_SET() Limited C API version 3.12 no longer casts arguments. Fix also usage of PyCell_SET(): only delete the old value after setting the new value.
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-051-0/+1
| | | | | | | | | | | | Add the -P command line option and the PYTHONSAFEPATH environment variable to not prepend a potentially unsafe path to sys.path. * Add sys.flags.safe_path flag. * Add PyConfig.safe_path member. * Programs/_bootstrap_python.c uses config.safe_path=0. * Update subprocess._optim_args_from_interpreter_flags() to handle the -P command line option. * Modules/getpath.py sets safe_path to 1 if a "._pth" file is present.
* gh-89653: PEP 670: Convert PyCFunction macros to functions (#92302)Victor Stinner2022-05-051-24/+56
| | | | | | | | | | Convert the following macros to static inline functions: * PyCFunction_GET_CLASS() * PyCFunction_GET_FLAGS() * PyCFunction_GET_FUNCTION() * PyCFunction_GET_SELF() Limited C API version 3.11 no longer casts arguments.
* gh-91321: Add _Py_NULL macro (#92253)Victor Stinner2022-05-032-12/+12
| | | | | | | | Fix C++ compiler warnings: "zero as null pointer constant" (clang -Wzero-as-null-pointer-constant). * Add the _Py_NULL macro used by static inline functions to use nullptr in C++. * Replace NULL with nullptr in _testcppext.cpp.
* gh-91320: Fix more old-style cast warnings in C++ (#92247)Victor Stinner2022-05-032-16/+17
| | | | | | | Use _Py_CAST(), _Py_STATIC_CAST() and _PyASCIIObject_CAST() in static inline functions to fix C++ compiler warnings: "use of old-style cast" (clang -Wold-style-cast). test_cppext now builds the C++ test extension with -Wold-style-cast.
* gh-89653: PEP 670: Convert PyBytes macros to functions (#91990)Victor Stinner2022-05-032-10/+43
| | | | | | | | | | | | Convert the following macros to static inline functions: * PyByteArray_AS_STRING() * PyByteArray_GET_SIZE() * PyBytes_AS_STRING() * PyBytes_GET_SIZE() Limited C API version 3.11 no longer casts arguments. Add _PyBytes_CAST() and _PyByteArray_CAST() macros.
* gh-92135: Rename _Py_reinterpret_cast() to _Py_CAST() (#92230)Victor Stinner2022-05-035-8/+8
| | | Rename also _Py_static_cast() to _Py_STATIC_CAST().
* gh-92154: Expose PyCode_GetCode in the C API (GH-92168)Ken Jin2022-05-031-0/+3
|