summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46857: Fix refleak in OSError INIT_ALIAS() (GH-31594)Victor Stinner2022-02-262-12/+5
| | | _Py_GetRefTotal() no longer decrements _PySet_Dummy refcount.
* Propagate errors (however unlikely) from _Py_Deepfreeze_Init() (GH-31596)Kumar Aditya2022-02-261-5/+11
|
* bpo-46852: Remove the float.__set_format__() method (GH-31585)Victor Stinner2022-02-252-142/+3
| | | | | | Remove the undocumented private float.__set_format__() method, previously known as float.__set_format__() in Python 3.7. Its docstring said: "You probably don't want to use this function. It exists mainly to be used in Python's test suite."
* bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583)Victor Stinner2022-02-253-39/+39
| | | | | Rename also struct _interpreter_frame to struct _PyInterpreterFrame. Reduce risk of name conflicts if a project includes pycore_frame.h.
* bpo-45316: Move private PyCode C API to internal C API (GH-31576)Victor Stinner2022-02-252-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename private functions (no exported), add an underscore prefix: * PyLineTable_InitAddressRange() => _PyLineTable_InitAddressRange() * PyLineTable_NextAddressRange() => _PyLineTable_NextAddressRange() * PyLineTable_PreviousAddressRange() => _PyLineTable_PreviousAddressRange() Move private functions to the internal C API: * _PyCode_Addr2EndLine() * _PyCode_Addr2EndOffset() * _PyCode_Addr2Offset() * _PyCode_InitAddressRange() * _PyCode_InitEndAddressRange( * _PyLineTable_InitAddressRange() * _PyLineTable_NextAddressRange() * _PyLineTable_PreviousAddressRange() No longer export the following internal functions: * _PyCode_GetVarnames() * _PyCode_GetCellvars() * _PyCode_GetFreevars() * _Py_GetSpecializationStats() Add "extern" to pycore_code.h functions to identify them more easiliy (they are still not exported).
* bpo-1635741: Fix winreg reference leaks (GH-31560)Victor Stinner2022-02-251-0/+8
| | | Clear also the PyHKEY_Type static type at exit.
* bpo-46852: Rename float.__set_format__() to float.__setformat__() (GH-31558)Victor Stinner2022-02-252-17/+17
| | | | | | | | | | | Rename the private undocumented float.__set_format__() method to float.__setformat__() to fix a typo introduced in Python 3.7. The method is only used by test_float. The change enables again test_float tests on the float format which were previously skipped because of the typo. The typo was introduced in Python 3.7 by bpo-20185 in commit b5c51d3dd95bbfde533655fb86ac0f96f771ba7b.
* bpo-46656: Remove Py_NO_NAN macro (GH-31160)Victor Stinner2022-02-251-8/+0
| | | | Building Python now requires support for floating point Not-a-Number (NaN): remove the Py_NO_NAN macro.
* bpo-45459: C API uses type names rather than structure names (GH-31528)Victor Stinner2022-02-244-13/+12
| | | | Thanks to the new pytypedefs.h, it becomes to use type names like PyObject rather like structure names like "struct _object".
* Add (undocumented) _co_quickened attribute for code object. (GH-31552)Mark Shannon2022-02-241-2/+13
|
* bpo-45412: Add _PY_SHORT_FLOAT_REPR macro (GH-31171)Victor Stinner2022-02-231-8/+8
| | | | | | | | | | Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal C API). * Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h. * Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR macro which is always defined. gcc -Wundef emits a warning when using _PY_SHORT_FLOAT_REPR but the macro is not defined, if pycore_pymath.h include was forgotten.
* bpo-46765: Replace Locally Cached Strings with Statically Initialized ↵Eric Snow2022-02-234-52/+10
| | | | | Objects (gh-31366) https://bugs.python.org/issue46765
* bpo-46729: add number of sub-exceptions in str() of BaseExceptionGroup ↵Irit Katriel2022-02-221-1/+6
| | | | (GH-31294)
* dict: Add dk_log2_index_bytes (GH-31439)Inada Naoki2022-02-221-23/+27
|
* fix __bool__ docstring (GH-31301)Jelle Zijlstra2022-02-211-1/+1
|
* dict: Use DK_LOG_SIZE in hot loop. (GH-31405)Inada Naoki2022-02-191-12/+12
| | | DK_LOG_SIZE(key) < 8 is faster than DK_SIZE(key) <= 0xff, at least on GCC.
* bpo-46730: Fix refleak and tighten NULL checks (GH-31389)Christian Heimes2022-02-171-9/+18
| | | | | ``PyType_GetQualName`` returns a new reference. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-46745: Fix typo in PositionsIterator (#31322)Robert-André Mauchin2022-02-171-1/+1
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-46730: Add more info to @property AttributeError messages (GH-31311)Alex-Blade2022-02-161-13/+27
| | | On `obj.read_only_property = x`, raise `AttributeError: property 'read_only_property' of 'A' object has no setter`.
* bpo-46541: Discover the global strings. (gh-31346)Eric Snow2022-02-152-2/+3
| | | | | | | Instead of manually enumerating the global strings in generate_global_objects.py, we extrapolate the list from usage of _Py_ID() and _Py_STR() in the source files. This is partly inspired by gh-31261. https://bugs.python.org/issue46541
* Improve docstring for set.discard() (GH-31315)Raymond Hettinger2022-02-131-1/+2
|
* bpo-46615: Don't crash when set operations mutate the sets (GH-31120)Dennis Sweeney2022-02-111-8/+39
| | | Ensure strong references are acquired whenever using `set_next()`. Added randomized test cases for `__eq__` methods that sometimes mutate sets when called.
* bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)Petr Viktorin2022-02-111-6/+2
| | | | | * Make PyType_GetModuleByDef public (remove underscore) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-46430: Intern strings in deep-frozen modules (GH-30683)Kumar Aditya2022-02-091-0/+12
|
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-0830-610/+422
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-46675: Allow object value arrays and split key dictionaries larger than ↵Mark Shannon2022-02-081-39/+59
| | | | 16 (GH-31191)
* bpo-46670: Remove unused macros in the Objects directory (GH-31193)Victor Stinner2022-02-074-12/+0
|
* bpo-46670: Test if a macro is defined, not its value (GH-31178)Victor Stinner2022-02-071-3/+3
| | | | | | | | * audioop.c: #ifdef WORDS_BIGENDIAN * ctypes.h: #ifdef USING_MALLOC_CLOSURE_DOT_C * _ctypes/malloc_closure.c: #ifdef HAVE_FFI_CLOSURE_ALLOC and #ifdef USING_APPLE_OS_LIBFFI * pytime.c: #ifdef __APPLE__ * unicodeobject.c: #ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
* bpo-46670: Define all macros for stringlib (GH-31176)Victor Stinner2022-02-0710-17/+24
| | | | | bytesobject.c, bytearrayobject.c and unicodeobject.c now define all macros used by stringlib, to avoid using undefined macros. Fix "gcc -Wundef" warnings.
* bpo-46670: Remove unused get_frame_state() function (GH-31177)Victor Stinner2022-02-071-9/+0
| | | The PyFrame_MAXFREELIST macro is no longer defined.
* Pass reference to func, as well as args, when pushing frame. (GH-31100)Mark Shannon2022-02-031-0/+2
|
* bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)Zackery Spytz2022-02-031-0/+5
| | | | | Calling int(a) when type(a) implements __trunc__ but not __int__ or __index__ now raises a DeprecationWarning.
* bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696)Petr Viktorin2022-02-021-5/+4
| | | Automerge-Triggered-By: GH:encukou
* bpo-46072: Add some frame stats. (GH-31060)Mark Shannon2022-02-021-0/+1
|
* bpo-46072: Add some object layout and allocation stats (GH-31051)Mark Shannon2022-02-012-0/+16
|
* bpo-46564: do not create frame object for super object (GH-31002)Kumar Aditya2022-02-011-12/+8
|
* bpo-46407: Fix long_mod refleak (GH-31025)Ken Jin2022-01-311-1/+1
|
* bpo-46417: _PyStructSequence_FiniType() updates _Py_RefTotal (GH-30988)Victor Stinner2022-01-281-0/+3
|
* bpo-46407: Optimizing some modulo operations (GH-30653)Crowthebird2022-01-281-9/+106
| | | | | | | Added new internal functions to compute mod without also computing the quotient. The loops can be leaner then, which leads to modestly but reliably faster execution in contexts that know they don't need the quotient. Code by Jeremiah Vivian (Pascual).
* bpo-40170: Remove PyHeapType_GET_MEMBERS() macro (GH-30942)Victor Stinner2022-01-271-6/+6
| | | | | | | | Remove the PyHeapType_GET_MEMBERS() macro. It was exposed in the public C API by mistake, it must only be used by Python internally. Use the PyTypeObject.tp_members member instead. Rename PyHeapType_GET_MEMBERS() to _PyHeapType_GET_MEMBERS() and move it to the internal C API.
* bpo-40170: Move _Py_GetAllocatedBlocks() to pycore_pymem.h (GH-30943)Victor Stinner2022-01-271-3/+0
| | | | | Move _Py_GetAllocatedBlocks() and _PyObject_DebugMallocStats() declarations to pycore_pymem.h. These functions are related to memory allocators, not to the PyObject structure.
* bpo-46476: Simplify and fix _PyStaticCode_Dealloc (GH-30965)Christian Heimes2022-01-271-5/+8
|
* bpo-46476: Fix memory leak in code objects generated by deepfreeze (GH-30853)Kumar Aditya2022-01-271-0/+15
| | | Add _Py_Deepfreeze_Fini() and _PyStaticCode_Dealloc() functions.
* bpo-40170: Remove _Py_GetAllocatedBlocks() function (GH-30940)Victor Stinner2022-01-271-1/+5
| | | | Move _Py_GetAllocatedBlocks() and _PyObject_DebugMallocStats() private functions to the internal C API.
* bpo-40170: PyType_SUPPORTS_WEAKREFS() becomes a regular function (GH-30938)Victor Stinner2022-01-273-5/+14
| | | | | | | | Convert the PyType_SUPPORTS_WEAKREFS() macro to a regular function. It no longer access the PyTypeObject.tp_weaklistoffset member directly. Add _PyType_SUPPORTS_WEAKREFS() static inline functions, used internally by Python for best performance.
* bpo-46527: allow calling enumerate(iterable=...) again (GH-30904)Jelle Zijlstra2022-01-261-10/+37
|
* bpo-46504: faster code for trial quotient in x_divrem() (GH-30856)Tim Peters2022-01-251-1/+8
| | | | | | | | | | * bpo-46504: faster code for trial quotient in x_divrem() This brings x_divrem() back into synch with x_divrem1(), which was changed in bpo-46406 to generate faster code to find machine-word division quotients and remainders. Modern processors compute both with a single machine instruction, but convincing C to exploit that requires writing _less_ "clever" C code.
* bpo-46431: improve error message on invalid calls to ↵Irit Katriel2022-01-241-1/+4
| | | | BaseExceptionGroup.__new__ (GH-30854)
* bpo-43683: Streamline YIELD_VALUE and SEND (GH-30723)Mark Shannon2022-01-241-2/+4
| | | | | | | | * Split YIELD_VALUE into ASYNC_GEN_WRAP; YIELD_VALUE for async generators. * Split SEND into SEND; YIELD_VALUE. * Document new opcodes.
* bpo-46481: Implement vectorcall for weakref.ref.__call__ method. (GH-30820)Dong-hee Na2022-01-231-50/+30
|