summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* gh-92135: Fix _Py_reinterpret_cast() for const (#92138)Victor Stinner2022-05-023-9/+18
| | | | | | | | | | Fix C++ compiler warnings on cast macros, like _PyObject_CAST(), when casting a constant expression to a non constant type: use const_cast<> in C++. * In C++, Py_SAFE_DOWNCAST() now uses static_cast<> rather than reinterpret_cast<>. * Add tests to the _testcppext C++ extension. * test_cppext no longer captures stdout in verbose mode.
* gh-90822: Make `PY_SSIZE_T_MAX` and `PY_SSIZE_T_MIN` constant expression ↵Ganesh Kathiresan2022-05-021-5/+6
| | | | (GH-92071)
* bpo-43224: Implement substitution of unpacked TypeVarTuple in C (GH-31828)Serhiy Storchaka2022-04-302-0/+2
| | | | Co-authored-by: Matthew Rahtz <mrahtz@gmail.com>
* gh-91603: Speed up isinstance/issubclass on union types (GH-91631)Yurii Karabas2022-04-281-0/+1
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-89479: Export _Py_GetSpecializationStats() internal function (#92011)Victor Stinner2022-04-281-2/+3
| | | | | | When Python is built with "./configure --enable-pystats" (if the Py_STATS macro is defined), the _Py_GetSpecializationStats() function must be exported, since it's used by the _opcode extension which is built as a shared library.
* gh-91869: Fix tracing of specialized instructions with extended args (GH-91945)Dennis Sweeney2022-04-282-67/+68
|
* gh-91320: Add _Py_reinterpret_cast() macro (#91959)Victor Stinner2022-04-279-17/+39
| | | | | | | | | | | | | | Fix C++ compiler warnings about "old-style cast" (g++ -Wold-style-cast) in the Python C API. Use C++ reinterpret_cast<> and static_cast<> casts when the Python C API is used in C++. Example of fixed warning: Include/object.h:107:43: error: use of old-style cast to ‘PyObject*’ {aka ‘struct _object*’} [-Werror=old-style-cast] #define _PyObject_CAST(op) ((PyObject*)(op)) Add _Py_reinterpret_cast() and _Py_static_cast() macros.
* gh-91719: Add pycore_opcode.h internal header file (#91906)Victor Stinner2022-04-252-564/+583
| | | | | | | | | | | Move the following API from Include/opcode.h (public C API) to a new Include/internal/pycore_opcode.h header file (internal C API): * EXTRA_CASES * _PyOpcode_Caches * _PyOpcode_Deopt * _PyOpcode_Jump * _PyOpcode_OpName * _PyOpcode_RelativeJump
* gh-64783: Fix signal.NSIG value on FreeBSD (#91929)Victor Stinner2022-04-252-16/+35
| | | | | | | | | Fix signal.NSIG value on FreeBSD to accept signal numbers greater than 32, like signal.SIGRTMIN and signal.SIGRTMAX. * Add Py_NSIG constant. * Add pycore_signal.h internal header file. * _Py_Sigset_Converter() now includes the range of valid signals in the error message.
* gh-89653: PEP 670: Functions don't cast pointers (#91697)Victor Stinner2022-04-252-52/+113
| | | | | | | | | | | | | | | | | | | | | In the limited C API version 3.11 and newer, the following functions no longer cast their object pointer argument with _PyObject_CAST() or _PyObject_CAST_CONST(): * Py_REFCNT(), Py_TYPE(), Py_SIZE() * Py_SET_REFCNT(), Py_SET_TYPE(), Py_SET_SIZE() * Py_IS_TYPE() * Py_INCREF(), Py_DECREF() * Py_XINCREF(), Py_XDECREF() * Py_NewRef(), Py_XNewRef() * PyObject_TypeCheck() * PyType_Check() * PyType_CheckExact() Split Py_DECREF() implementation in 3 versions to make the code more readable. Update the xxlimited.c extension, which uses the limited C API version 3.11, to pass PyObject* to these functions.
* gh-80527: Deprecate PEP 623 Unicode functions (#91801)Victor Stinner2022-04-221-5/+11
| | | | | | | | | | | Deprecate functions: * PyUnicode_AS_DATA() * PyUnicode_AS_UNICODE() * PyUnicode_GET_DATA_SIZE() * PyUnicode_GET_SIZE() Previously, these functions were macros and so it wasn't possible to decorate them with Py_DEPRECATED().
* Docs: Clarify availability of PyOS_CheckStack (GH-91816)Petr Viktorin2022-04-221-0/+1
|
* gh-89653: Add assertions to unicodeobject.h functions (#91800)Victor Stinner2022-04-211-0/+7
|
* gh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91799)Victor Stinner2022-04-211-18/+44
| | | | | | | | | | | | Convert unicodeobject.h macros to static inline functions: * PyUnicode_AS_DATA() * PyUnicode_AS_UNICODE() * PyUnicode_GET_DATA_SIZE() * PyUnicode_GET_SIZE() Static inline functions are wrapped by macros which casts arguments with _PyObject_CAST() to prevent introducing new compiler warnings when passing "const PyObject*".
* gh-79315: Add Include/cpython/pythread.h header (#91798)Victor Stinner2022-04-212-44/+45
|
* gh-79315: Add Include/cpython/modsupport.h header (#91797)Victor Stinner2022-04-212-106/+113
|
* gh-89653: PEP 670: Group deprecated API in unicodeobject.h (#91796)Victor Stinner2022-04-211-56/+58
|
* gh-91768: C API no longer use "const PyObject*" type (#91769)Victor Stinner2022-04-212-15/+11
| | | | | | | | | | | | | Py_REFCNT(), Py_TYPE(), Py_SIZE() and Py_IS_TYPE() functions argument type is now "PyObject*", rather than "const PyObject*". * Replace also "const PyObject*" with "PyObject*" in functions: * _Py_strhex_impl() * _Py_strhex_with_sep() * _Py_strhex_bytes_with_sep() * Remove _PyObject_CAST_CONST() and _PyVarObject_CAST_CONST() macros. * Py_IS_TYPE() can now use Py_TYPE() in its implementation.
* gh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91773)Victor Stinner2022-04-211-57/+74
| | | | | | | | | | | | | | | | | Convert unicodeobject.h macros to static inline functions: * PyUnicode_MAX_CHAR_VALUE() * PyUnicode_READ() * PyUnicode_READY() * PyUnicode_READ_CHAR() * PyUnicode_WRITE() Move PyUnicode_READY() after _PyUnicode_Ready(), since it uses _PyUnicode_Ready(). Static inline functions are wrapped by macros which casts arguments with _PyObject_CAST() and casts 'kind' arguments to "unsigned int" to prevent introducing new compiler warnings when passing "const PyObject*".
* GH-91719: Make MSVC generate somewhat faster switch code (#91718)Guido van Rossum2022-04-212-1/+79
| | | | | | | | | | | Apparently a switch on an 8-bit quantity where all cases are present generates a more efficient jump (doing only one indexed memory load instead of two). So we make opcode and use_tracing uint8_t, and generate a macro full of extra `case NNN:` lines for all unused opcodes. See https://github.com/faster-cpython/ideas/issues/321#issuecomment-1103263673
* GH-88116: Use a compact format to represent end line and column offsets. ↵Mark Shannon2022-04-212-27/+54
| | | | | | | | | | | | (GH-91666) * Stores all location info in linetable to conform to PEP 626. * Remove column table from code objects. * Remove end-line table from code objects. * Document new location table format
* gh-89653: PEP 670: Convert tuple macros to functions (#91786)Victor Stinner2022-04-212-11/+29
| | | | | | | | | | | | | | Convert macros to static inline functions: * PyTuple_GET_SIZE() * PyTuple_SET_ITEM() * PyList_GET_SIZE() * PyList_SET_ITEM() Add a macro converting arguments to PyTupleObject*, PyListObject* or PyObject* to prevent emitting new compiler warnings. According to PEP 670, PyTuple_GET_ITEM() and PyList_GET_ITEM() are left as macros.
* gh-91782: Define static_assert() macro on FreeBSD (#91787)Victor Stinner2022-04-211-0/+9
| | | | | On FreeBSD, if the static_assert() macro is not defined, define it in Python until <sys/cdefs.h> supports C11: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290
* gh-89653: PEP 670: Convert PyWeakref_GET_OBJECT() to function (#91785)Victor Stinner2022-04-211-10/+16
| | | | | | Convert the PyWeakref_GET_OBJECT() macro to a static inline function. Add an assertion to check the argument with PyWeakref_Check(). Add a macro converting the argument to PyObject* to prevent emitting new compiler warning.
* gh-89653: PEP 670: Convert unicodeobject.h macros to functions (#91705)Victor Stinner2022-04-211-41/+61
| | | | | | | | | | | | | | | | | | Convert unicodeobject.h macros to static inline functions: * PyUnicode_CHECK_INTERNED() * PyUnicode_DATA(), _PyUnicode_COMPACT_DATA(), _PyUnicode_NONCOMPACT_DATA() * PyUnicode_GET_LENGTH() * PyUnicode_IS_ASCII() * PyUnicode_IS_COMPACT() * PyUnicode_IS_COMPACT_ASCII() * PyUnicode_IS_READY() Reorder functions to declare functions before their first usage. Static inline functions are wrapped by macros which casts arguments with _PyObject_CAST() to prevent introducing new compiler warnings when passing "const PyObject*".
* gh-90667: Add specializations of Py_DECREF when types are known (GH-30872)Dennis Sweeney2022-04-194-8/+39
|
* gh-91576: Speed up iteration of strings (#91574)Kumar Aditya2022-04-181-0/+1
|
* gh-78607: Replace __ltrace__ with __lltrace__ (GH-91619)Dennis Sweeney2022-04-162-2/+2
|
* gh-89770: Implement PEP-678 - Exception notes (GH-31317)Irit Katriel2022-04-163-3/+3
|
* gh-91276: Make JUMP_IF_TRUE_OR_POP/JUMP_IF_FALSE_OR_POP relative (GH-32215)Irit Katriel2022-04-151-1/+1
|
* gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException (GH-30531)Irit Katriel2022-04-152-0/+6
|
* gh-91428: include specialized opcodes in _PyOpcode_OpName (GH-91467)Dennis Sweeney2022-04-141-0/+146
|
* gh-91502: Add a new API to check if a frame is an entry frame (GH-91503)Pablo Galindo Salgado2022-04-131-0/+10
|
* gh-91428: Add _PyOpcode_OpName to opcode.h of debug builds (GH-91430)Dennis Sweeney2022-04-111-0/+115
|
* GH-89480: Document motivation, design and implementation of 3.11 frame ↵Mark Shannon2022-04-111-0/+8
| | | | stack. (GH-32304)
* bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)John Belmonte2022-04-112-0/+3
| | | | | | | | Add "z" format specifier to coerce negative 0 to zero. See https://github.com/python/cpython/issues/90153 (originally https://bugs.python.org/issue45995) for discussion. This covers `str.format()` and f-strings. Old-style string interpolation is not supported. Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative (GH-32400)Irit Katriel2022-04-111-15/+23
|
* Add new PyFrame_GetLasti C-API function (GH-32413)Mark Shannon2022-04-081-0/+1
|
* bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208)Brandt Bucher2022-04-071-7/+10
|
* bpo-35134: Remove the Include/code.h header file (GH-32385)Victor Stinner2022-04-073-21/+14
| | | | | | Remove the Include/code.h header file. C extensions should only include the main <Python.h> header file. Python.h includes directly Include/cpython/code.h instead.
* bpo-35134: Add Include/cpython/setobject.h header (GH-32384)Victor Stinner2022-04-062-67/+73
|
* bpo-35134: Add Include/cpython/complexobject.h header (GH-32383)Victor Stinner2022-04-062-42/+47
| | | | Move the private _PyComplex_FormatAdvancedWriter() function to the internal C API. This function is no longer exported.
* bpo-26579: Add object.__getstate__(). (GH-2821)Serhiy Storchaka2022-04-061-0/+5
| | | | | | | Copying and pickling instances of subclasses of builtin types bytearray, set, frozenset, collections.OrderedDict, collections.deque, weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes implemented as slots.
* Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API ↵Victor Stinner2022-04-065-21/+14
| | | | | | | | | | | (GH-32052)" (GH-32343) * Revert "bpo-46850: Move _PyInterpreterState_SetEvalFrameFunc() to internal C API (GH-32054)" This reverts commit f877b40e3f7e0d97878884d80fbec879a85ab7e8. * Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)" This reverts commit b9a5522dd952125a99ff554f01f311cae25f5a91.
* Post 3.11.0a7Pablo Galindo2022-04-051-1/+1
|
* Python 3.11.0a7v3.11.0a7Pablo Galindo2022-04-051-2/+2
|
* bpo-47120: make JUMP_NO_INTERRUPT relative (GH-32221)Irit Katriel2022-04-051-3/+3
|
* bpo-47186: Replace JUMP_IF_NOT_EG_MATCH by CHECK_EG_MATCH + jump (GH-32309)Irit Katriel2022-04-051-36/+36
|
* Revert "bpo-44800: Document internal frame naming conventions (GH-32281)" ↵Mark Shannon2022-04-041-69/+0
| | | | | (#32301) This reverts commit 124227c95f310d2ecd4b567271ab1919fc7000cb.
* bpo-47000: Make `io.text_encoding()` respects UTF-8 mode (GH-32003)Inada Naoki2022-04-042-0/+2
| | | Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>