summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-42576: Raise TypeError when passing in keyword arguments to GenericAlias ↵kj2020-12-051-1/+1
| | | | | | | | | (GH-23656) Use `_PyArg_NoKeywords` instead of `_PyArg_NoKwnames` when checking the `kwds` tuple when creating `GenericAlias`. This fixes an interpreter crash when passing in keyword arguments to `GenericAlias`'s constructor. Needs backport to 3.9. Automerge-Triggered-By: GH:gvanrossum
* bpo-42536: GC track recycled tuples (GH-23623)Brandt Bucher2020-12-053-0/+26
| | | | | | | | | | | | | | | | Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector: - collections.OrderedDict.items - dict.items - enumerate - functools.reduce - itertools.combinations - itertools.combinations_with_replacement - itertools.permutations - itertools.product - itertools.zip_longest - zip Previously, they could have become untracked by a prior garbage collection.
* bpo-42431: Fix outdated bytes comments (GH-23458)Serhiy Storchaka2020-12-035-35/+21
| | | | Also move definitions of internal macros F_LJUST etc to private header.
* bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)Victor Stinner2020-12-0113-45/+45
| | | | | | | | | No longer use deprecated aliases to functions: * Replace PyObject_MALLOC() with PyObject_Malloc() * Replace PyObject_REALLOC() with PyObject_Realloc() * Replace PyObject_FREE() with PyObject_Free() * Replace PyObject_Del() with PyObject_Free() * Replace PyObject_DEL() with PyObject_Free()
* bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)Victor Stinner2020-12-0111-53/+53
| | | | | | | | | | | No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
* bpo-42202: Store func annotations as a tuple (GH-23316)Yurii Karabas2020-11-251-0/+19
| | | | | | | | | | | | | Reduce memory footprint and improve performance of loading modules having many func annotations. >>> sys.getsizeof({"a":"int","b":"int","return":"int"}) 232 >>> sys.getsizeof(("a","int","b","int","return","int")) 88 The tuple is converted into dict on the fly when `func.__annotations__` is accessed first. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-40170: Hide impl detail of Py_TRASHCAN_BEGIN macro (GH-23235)Hai Shi2020-11-241-0/+9
| | | | | The Py_TRASHCAN_BEGIN macro no longer accesses PyTypeObject attributes, but now can get the condition by calling the new private _PyTrash_cond() function which hides implementation details.
* bpo-42435: Speed up comparison of bytes and bytearray object (GH--23461)Serhiy Storchaka2020-11-222-33/+12
| | | | | * Speed up comparison of bytes objects with non-bytes objects when option -b is specified. * Speed up comparison of bytarray objects with non-buffer object.
* bpo-42423: Accept single base class in PyType_FromModuleAndSpec() (GH-23441)Serhiy Storchaka2020-11-222-10/+4
|
* bpo-42425: Fix possible leak in initialization of errmap for OSError (GH-23446)Serhiy Storchaka2020-11-211-1/+3
|
* bpo-42412: Fix possible leaks and check arguments in ↵Serhiy Storchaka2020-11-211-5/+18
| | | | | | | | PyType_FromModuleAndSpec() (GH-23410) * There were leaks if Py_tp_bases is used more than once or if some call is failed before setting tp_bases. * There was a crash if the bases argument or the Py_tp_bases slot is not a tuple. * The documentation was not accurate.
* bpo-40998: Address compiler warnings found by ubsan (GH-20929)Christian Heimes2020-11-181-1/+5
| | | | | Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
* bpo-42332: Add weakref slot to types.GenericAlias (GH-23250)kj2020-11-161-0/+6
| | | Automerge-Triggered-By: GH:gvanrossum
* bpo-42246: Partial implementation of PEP 626. (GH-23113)Mark Shannon2020-11-124-123/+435
| | | * Implement new line number table format, as defined in PEP 626.
* bpo-40170: Fix PyType_Ready() refleak on static type (GH-23236)Victor Stinner2020-11-111-2/+7
| | | | | | | | | bpo-1635741, bpo-40170: When called on a static type with NULL tp_base, PyType_Ready() no longer increments the reference count of the PyBaseObject_Type ("object). PyTypeObject.tp_base is a strong reference on a heap type, but it is borrowed reference on a static type. Fix 99 reference leaks at Python exit (showrefcount 18623 => 18524).
* bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931)Hai Shi2020-11-103-97/+137
| | | | | | | PyType_GetSlot() can now accept static types. Co-Authored-By: Petr Viktorin <encukou@gmail.com> Automerge-Triggered-By: GH:encukou
* bpo-42085: Introduce dedicated entry in PyAsyncMethods for sending values ↵Vladimir Matveev2020-11-104-31/+60
| | | | (#22780)
* Fix typo in unicodeobject.c (GH-23180)Ikko Ashimine2020-11-101-1/+1
| | | | | exeeds -> exceeds Automerge-Triggered-By: GH:Mariatta
* bpo-42233: Add union type expression support for GenericAlias and fix ↵kj2020-11-093-17/+23
| | | | de-duplicating of GenericAlias (GH-23077)
* bpo-41832: PyType_FromModuleAndSpec() now accepts NULL tp_doc (GH-23123)Hai Shi2020-11-061-0/+4
|
* bpo-42262: Add Py_NewRef() and Py_XNewRef() (GH-23152)Victor Stinner2020-11-051-0/+16
| | | | Added Py_NewRef() and Py_XNewRef() functions to increment the reference count of an object and return the object.
* Add _PyType_GetModuleByDef (GH-22835)Petr Viktorin2020-11-031-0/+38
| | | | | See https://mail.python.org/archives/list/capi-sig@python.org/thread/T3P2QNLNLBRFHWSKYSTPMVEIL2EEKFJU/ for discussion. https://bugs.python.org/issue42100
* bpo-42143: Ensure PyFunction_NewWithQualName() can't fail after creating the ↵Yonatan Goldschmidt2020-10-291-13/+16
| | | | | | func object (GH-22953) func_dealloc() does not handle partially-created objects. Best not to give it any.
* bpo-42161: Remove private _PyLong_Zero and _PyLong_One (GH-23003)Victor Stinner2020-10-271-18/+0
| | | | | Use PyLong_FromLong(0) and PyLong_FromLong(1) of the public C API instead. For Python internals, _PyLong_GetZero() and _PyLong_GetOne() of pycore_long.h can be used.
* bpo-42099: Fix reference to ob_type in unionobject.c and ceval (GH-22829)Neil Schemenauer2020-10-271-1/+1
| | | * Use Py_TYPE() rather than o->ob_type.
* bpo-42161: Use _PyLong_GetZero() and _PyLong_GetOne() (GH-22995)Victor Stinner2020-10-277-36/+61
| | | | Use _PyLong_GetZero() and _PyLong_GetOne() in Objects/ and Python/ directories.
* bpo-42161: Add _PyLong_GetZero() and _PyLong_GetOne() (GH-22993)Victor Stinner2020-10-261-23/+14
| | | | | | Add _PyLong_GetZero() and _PyLong_GetOne() functions and a new internal pycore_long.h header file. Python cannot be built without small integer singletons anymore.
* bpo-42157: unicodedata avoids references to UCD_Type (GH-22990)Victor Stinner2020-10-261-2/+1
| | | | | | | | | | * UCD_Check() uses PyModule_Check() * Simplify the internal _PyUnicode_Name_CAPI structure: * Remove size and state members * Remove state and self parameters of getcode() and getname() functions * Remove global_module_state
* bpo-1635741: _PyUnicode_Name_CAPI moves to internal C API (GH-22713)Victor Stinner2020-10-261-15/+16
| | | | | | | | | | The private _PyUnicode_Name_CAPI structure of the PyCapsule API unicodedata.ucnhash_CAPI moves to the internal C API. Moreover, the structure gets a new state member which must be passed to the getcode() and getname() functions. * Move Include/ucnhash.h to Include/internal/pycore_ucnhash.h * unicodedata module is now built with Py_BUILD_CORE_MODULE. * unicodedata: move hashAPI variable into unicodedata_module_state.
* bpo-42152: Use PyDict_Contains and PyDict_SetDefault if appropriate. (GH-22986)Serhiy Storchaka2020-10-262-94/+73
| | | | | | | If PyDict_GetItemWithError is only used to check whether the key is in dict, it is better to use PyDict_Contains instead. And if it is used in combination with PyDict_SetItem, PyDict_SetDefault can replace the combination.
* bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and ↵Serhiy Storchaka2020-10-265-51/+118
| | | | | | | | | | | _PyDict_GetItemId. (GH-22648) These functions are considered not safe because they suppress all internal errors and can return wrong result. PyDict_GetItemString and _PyDict_GetItemId can also silence current exception in rare cases. Remove no longer used _PyDict_GetItemId. Add _PyDict_ContainsId and rename _PyDict_Contains into _PyDict_Contains_KnownHash.
* Correctly compare the hint against the keys in _PyDict_GetItemHint (GH-22960)Pablo Galindo2020-10-251-1/+1
|
* bpo-41902: Micro optimization for range.index if step is 1 (GH-22479)Dong-hee Na2020-10-211-5/+11
|
* bpo-41902: Micro optimization for compute_item of range (GH-22492)Dong-hee Na2020-10-211-5/+11
|
* bpo-42093: Add opcode cache for LOAD_ATTR (GH-22803)Pablo Galindo2020-10-202-2/+67
|
* bpo-38252: Use 8-byte step to detect ASCII sequence in 64bit Windows build ↵Ma Lin2020-10-184-52/+52
| | | | (GH-16334)
* bpo-42065: Fix incorrectly formatted _codecs.charmap_decode error message ↵Max Bernstein2020-10-171-1/+1
| | | | (GH-19940)
* bpo-41984: GC track all user classes (GH-22701)Brandt Bucher2020-10-151-16/+6
|
* bpo-42015: Reorder dereferencing calls in meth_dealloc, to make sure m_self ↵Yannick Jadoul2020-10-121-2/+4
| | | | is kept alive long enough (GH-22670)
* Delete PyGen_Send (#22663)Vladimir Matveev2020-10-122-29/+20
|
* bpo-41991: Remove _PyObject_HasAttrId (GH-22629)Serhiy Storchaka2020-10-102-17/+7
| | | It can silence arbitrary exceptions.
* bpo-41756: Add PyIter_Send function (#22443)Vladimir Matveev2020-10-102-7/+25
|
* bpo-41985: Add _PyLong_FileDescriptor_Converter and AC converter for ↵Serhiy Storchaka2020-10-091-0/+11
| | | | "fildes". (GH-22620)
* bpo-41974: Remove complex.__float__, complex.__floordiv__, etc (GH-22593)Serhiy Storchaka2020-10-095-56/+19
| | | | | | Remove complex special methods __int__, __float__, __floordiv__, __mod__, __divmod__, __rfloordiv__, __rmod__ and __rdivmod__ which always raised a TypeError.
* Fix the attribute names in the docstring of GenericAlias (GH-22594)Mikhail Golubev2020-10-081-1/+1
|
* Revert "bpo-26680: Incorporate is_integer in all built-in and standard ↵Raymond Hettinger2020-10-072-33/+1
| | | | | library numeric types (GH-6121)" (GH-22584) This reverts commit 58a7da9e125422323f79c4ee95ac5549989d8162.
* Fix comment about PyObject_IsTrue. (GH-22343)Stefan Pochmann2020-10-071-1/+1
| | | The `for` statement doesn't use a condition and this function, the `while` statement does.
* bpo-41909: Enable previously disabled recursion checks. (GH-22536)Serhiy Storchaka2020-10-042-4/+0
| | | | | | | | | | | Enable recursion checks which were disabled when get __bases__ of non-type objects in issubclass() and isinstance() and when intern strings. It fixes a stack overflow when getting __bases__ leads to infinite recursion. Originally recursion checks was disabled for PyDict_GetItem() which silences all errors including the one raised in case of detected recursion and can return incorrect result. But now the code uses PyDict_GetItemWithError() and PyDict_SetDefault() instead.
* bpo-41922: Use PEP 590 vectorcall to speed up reversed() (GH-22523)Dong-hee Na2020-10-031-0/+19
|
* bpo-41692: Deprecate PyUnicode_InternImmortal() (GH-22486)Victor Stinner2020-10-021-0/+9
| | | | The PyUnicode_InternImmortal() function is now deprecated and will be removed in Python 3.12: use PyUnicode_InternInPlace() instead.