summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-45061: Detect Py_DECREF(Py_True) bug (GH-28089)Victor Stinner2021-08-312-7/+11
| | | | | Add a deallocator to the bool type to detect refcount bugs in C extensions which call Py_DECREF(Py_True) or Py_DECREF(Py_False) by mistake.
* bpo-45018: Fix rangeiter_reduce in rangeobject.c (GH-27938)chilaxan2021-08-271-1/+1
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44945: Specialize BINARY_ADD (GH-27967)Mark Shannon2021-08-271-6/+12
|
* bpo-44946: Streamline operators and creation of ints for common case of ↵Mark Shannon2021-08-251-92/+160
| | | | single 'digit'. (GH-27832)
* bpo-44990: Change layout of evaluation frames. "Layout B" (GH-27933)Mark Shannon2021-08-253-25/+11
| | | Places the locals between the specials and stack. This is the more "natural" layout for a C struct, makes the code simpler and gives a slight speedup (~1%)
* Fix bytes.__bytes__ to not truncate at a zero byte (GH-27902)Mark Dickinson2021-08-231-1/+1
|
* bpo-24234: Implement bytes.__bytes__ (GH-27901)Dong-hee Na2021-08-232-1/+39
|
* bpo-24234: implement complex.__complex__ (GH-27887)Mark Dickinson2021-08-232-1/+40
| | | Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* bpo-44954: Fix wrong result in float.fromhex corner case (GH-27834)Mark Dickinson2021-08-201-2/+2
|
* bpo-44698: Restore complex pow behaviour for small integral exponents (GH-27772)Mark Dickinson2021-08-171-21/+7
|
* bpo-42035: Add PyType_GetQualName() to get a type's qualified name. (GH-27551)Hai Shi2021-08-171-0/+6
|
* Fix a SystemError in code.replace() (#27771)Guido van Rossum2021-08-161-3/+5
| | | | | | | While the comment said 'We don't bother resizing localspluskinds', this would cause .replace() to crash when it happened. (Also types.CodeType(), but testing that is tedious, and this tests all code paths.)
* bpo-44914: Maintain invariants of type version tags. (GH-27773)Mark Shannon2021-08-161-27/+13
| | | | * Do not invalidate type versions unnecessarily.
* bpo-33930: Fix segfault with deep recursion when cleaning method objects ↵Pablo Galindo Salgado2021-08-101-1/+5
| | | | (GH-27678)
* bpo-44854: Remove trailing whitespaces (GH-27689)Serhiy Storchaka2021-08-092-2/+2
|
* bpo-44872: use new trashcan macros in framobject.c (#27683)Irit Katriel2021-08-091-2/+2
|
* bpo-44826: Specialize STORE_ATTR (GH-27590)Mark Shannon2021-08-091-3/+1
| | | | | | | * Generalize cache names for LOAD_ATTR to allow store and delete specializations. * Factor out specialization of attribute dictionary access. * Specialize STORE_ATTR.
* bpo-44821: Eagerly assign __dict__ for new objects. (GH-27589)Mark Shannon2021-08-042-4/+37
|
* bpo-27275: Change popitem() and pop() methods of collections.OrderedDict ↵Serhiy Storchaka2021-08-031-67/+26
| | | | | | | | | | | | | | | | | (GH-27530) * Unify the C and Python implementations of OrderedDict.popitem(). The C implementation no longer calls ``__getitem__`` and ``__delitem__`` methods of the OrderedDict subclasses. * Change popitem() and pop() methods of collections.OrderedDict For consistency with dict both implementations (pure Python and C) of these methods in OrderedDict no longer call __getitem__ and __delitem__ methods of the OrderedDict subclasses. Previously only the Python implementation of popitem() did not call them.
* bpo-44206: Make sure that dict-keys's version is set to zero when value is ↵Mark Shannon2021-08-021-0/+1
| | | | popped (GH-27542)
* bpo-44662: Add ability to annotate types.Union (#27214)Yurii Karabas2021-07-291-1/+23
| | | Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
* bpo-44707: Fix an undefined behavior of the null pointer arithmetic (GH-27292)Serhiy Storchaka2021-07-291-2/+9
|
* bpo-41103: Resurrect the old buffer protocol. (GH-27437)Inada Naoki2021-07-291-0/+79
| | | | | Revert "bpo-41103: Remove old buffer protocol support (#21117)" This reverts commit 6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed.
* bpo-42035: Add a PyType_GetName() to get type's short name. (GH-23903)Hai Shi2021-07-291-0/+6
|
* bpo-44657: Fix instancemethod_call to use PyInstanceMethod_GET_FUNCTION ↵Dong-hee Na2021-07-281-1/+1
| | | | (GH-27202)
* bpo-34013: Move the Python 2 hints from the exception constructor to the ↵Pablo Galindo Salgado2021-07-271-201/+0
| | | | parser (GH-27392)
* bpo-44698: Fix undefined behaviour in complex exponentiation. (GH-27278)T. Wouters2021-07-261-8/+15
|
* bpo-44732: Rename types.Union to types.UnionType (#27342)Hasan2021-07-261-3/+3
| | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-44590: Lazily allocate frame objects (GH-27077)Mark Shannon2021-07-263-233/+336
| | | | | | | | | | | | | | * Convert "specials" array to InterpreterFrame struct, adding f_lasti, f_state and other non-debug FrameObject fields to it. * Refactor, calls pushing the call to the interpreter upward toward _PyEval_Vector. * Compute f_back when on thread stack, only filling in value when frame object outlives stack invocation. * Move ownership of InterpreterFrame in generator from frame object to generator object. * Do not create frame objects for Python calls. * Do not create frame objects for generators.
* bpo-44717: improve AttributeError on circular imports of submodules (GH-27338)Filipe Laíns2021-07-241-0/+30
|
* bpo-44676: Serialize the union type using only public API (GH-27323)Serhiy Storchaka2021-07-241-48/+0
| | | | Remove also the _from_args() constructor.
* bpo-44676: Fix reference leaks in union_reduce (GH-27332)Pablo Galindo Salgado2021-07-241-1/+1
| | | Automerge-Triggered-By: GH:pablogsal
* bpo-44731: Simplify the union type implementation (GH-27318)Serhiy Storchaka2021-07-241-81/+7
| | | Remove direct support of typing types in the C code because they are already supported by defining methods __or__ and __ror__ in the Python code.
* Revert "bpo-44717: improve AttributeError on circular imports of submodules ↵Pablo Galindo Salgado2021-07-241-30/+0
| | | | | (GH-27299)" (GH-27331) This reverts commit 8072a1181dd64135f700b44372fbf7bf91e68072.
* bpo-44717: improve AttributeError on circular imports of submodules (GH-27299)Filipe Laíns2021-07-241-0/+30
| | | | | Signed-off-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44720: Don't crash when calling weakref.proxy(not_an_iterator).__next__ ↵Dennis Sweeney2021-07-241-0/+6
| | | | (GH-27316)
* bpo-42747: Remove Py_TPFLAGS_HAVE_AM_SEND and make ↵Petr Viktorin2021-07-233-30/+6
| | | | | | | | | | | | Py_TPFLAGS_HAVE_VERSION_TAG no-op (GH-27260) * Remove code that checks Py_TPFLAGS_HAVE_VERSION_TAG The field is always present in the type struct, as explained in the added comment. * Remove Py_TPFLAGS_HAVE_AM_SEND The flag is not needed, and since it was added in 3.10 it can be removed now.
* bpo-44676: Add ability to serialize types.Union (GH-27244)Yurii Karabas2021-07-231-0/+51
|
* bpo-44653: Support typing types in parameter substitution in the union type. ↵Serhiy Storchaka2021-07-221-13/+12
| | | | (GH-27247)
* bpo-41972: Tweak fastsearch.h string search algorithms (GH-27091)Dennis Sweeney2021-07-191-272/+331
|
* bpo-44661: Update property_descr_set to use vectorcall if possible. (GH-27206)Dong-hee Na2021-07-191-7/+18
|
* bpo-44633: Fix parameter substitution of the union type with wrong types. ↵Serhiy Storchaka2021-07-181-16/+28
| | | | | | (GH-27218) A TypeError is now raised instead of returning NotImplemented.
* bpo-44654: Refactor and clean up the union type implementation (GH-27196)Serhiy Storchaka2021-07-175-99/+55
|
* Remove legacy opcache structs (GH-27164)Ken Jin2021-07-161-1/+1
|
* bpo-44652: Preserve natural order of args in the union type. (GH-27185)Serhiy Storchaka2021-07-161-2/+2
|
* bpo-44636: Collapse union of equal types (GH-27178)Serhiy Storchaka2021-07-161-8/+16
| | | | | | The result of `int | int` is now `int`. Fix comparison of the union type with non-hashable objects. `int | str == {}` no longer raises a TypeError.
* bpo-44646: Fix the hash of the union type. (#27179)Serhiy Storchaka2021-07-161-4/+6
| | | | | | It no longer depends on the order of arguments. hash(int | str) == hash(str | int) Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
* bpo-44184: Apply GH-26274 to the non-GC-type branch of subtype_dealloc ↵T. Wouters2021-07-151-3/+11
| | | | | | | | (GH-27165) The non-GC-type branch of subtype_dealloc is using the type of an object after freeing in the same unsafe way as GH-26274 fixes. (I believe the old news entry covers this change well enough.) https://bugs.python.org/issue44184
* bpo-42073: allow classmethod to wrap other classmethod-like descriptors (#27115)Łukasz Langa2021-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Erik Welch. bpo-19072 (#8405) allows `classmethod` to wrap other descriptors, but this does not work when the wrapped descriptor mimics classmethod. The current PR fixes this. In Python 3.8 and before, one could create a callable descriptor such that this works as expected (see Lib/test/test_decorators.py for examples): ```python class A: @myclassmethod def f1(cls): return cls @classmethod @myclassmethod def f2(cls): return cls ``` In Python 3.8 and before, `A.f2()` return `A`. Currently in Python 3.9, it returns `type(A)`. This PR make `A.f2()` return `A` again. As of #8405, classmethod calls `obj.__get__(type)` if `obj` has `__get__`. This allows one to chain `@classmethod` and `@property` together. When using classmethod-like descriptors, it's the second argument to `__get__`--the owner or the type--that is important, but this argument is currently missing. Since it is None, the "owner" argument is assumed to be the type of the first argument, which, in this case, is wrong (we want `A`, not `type(A)`). This PR updates classmethod to call `obj.__get__(type, type)` if `obj` has `__get__`. Co-authored-by: Erik Welch <erik.n.welch@gmail.com>
* bpo-44632: Fix support of TypeVar in the union type (GH-27139)Serhiy Storchaka2021-07-141-1/+1
| | | | int | TypeVar('T') returns now an instance of types.Union instead of typing.Union.