aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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-171-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-161-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.
* bpo-44635: Convert None to NoneType in the union type constructor (GH-27136)Serhiy Storchaka2021-07-141-9/+7
|
* bpo-44606: Fix __instancecheck__ and __subclasscheck__ for the union type. ↵Serhiy Storchaka2021-07-141-4/+19
| | | | | | | | | | (GH-27120) * Fix issubclass() for None. E.g. issubclass(type(None), int | None) returns now True. * Fix issubclass() for virtual subclasses. E.g. issubclass(dict, int | collections.abc.Mapping) returns now True. * Fix crash in isinstance() if the check for one of items raises exception.
* bpo-44207: Add an internal version number to function objects. (GH-27078)Mark Shannon2021-07-121-1/+25
|
* bpo-43908: Immutable types inherit vectorcall (GH-27001)Erlend Egeberg Aasland2021-07-081-4/+4
| | | | | | Heap types with the Py_TPFLAGS_IMMUTABLETYPE flag can now inherit the PEP 590 vectorcall protocol. Previously, this was only possible for static types. Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43950: Add option to opt-out of PEP-657 (GH-27023)Ammar Askar2021-07-072-35/+44
| | | | | Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com> Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* bpo-44530: Add co_qualname field to PyCodeObject (GH-26941)Gabriele N. Tornetta2021-07-074-61/+104
|
* bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980)Yurii Karabas2021-07-062-19/+84
| | | | Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias (GH-27021)Pablo Galindo2021-07-051-2/+2
| | | | | | | | | * bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias * Update Objects/genericaliasobject.c Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-43950: use 0-indexed column offsets for bytecode positions (GH-27011)Batuhan Taskaya2021-07-041-11/+8
|
* bpo-44562: Remove invalid PyObject_GC_Del from error path of ↵Ken Jin2021-07-041-3/+3
| | | | types.GenericAlias … (GH-27016)
* bpo-44553: Correct failure in tp_new for the union object (GH-27008)Pablo Galindo2021-07-031-2/+2
|
* bpo-44553 : Implement GC methods for types.Union (GH-26993)Ken Jin2021-07-031-4/+17
|
* bpo-43950: Add code.co_positions (PEP 657) (GH-26955)Pablo Galindo2021-07-022-30/+271
| | | | | | | | | | | | | | | This PR is part of PEP 657 and augments the compiler to emit ending line numbers as well as starting and ending columns from the AST into compiled code objects. This allows bytecodes to be correlated to the exact source code ranges that generated them. This information is made available through the following public APIs: * The `co_positions` method on code objects. * The C API function `PyCode_Addr2Location`. Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* bpo-43770: Cleanup _PyObject_GetMethod() (GH-26946)Victor Stinner2021-07-011-21/+19
| | | | | | | | _PyObject_GetMethod() now uses _PyType_IsReady() to decide if PyType_Ready() must be called or not, rather than testing if tp->tp_dict is NULL. Move also variable declarations closer to where they are used, and use Py_NewRef().
* bpo-44531: Add _PyType_AllocNoTrack() function (GH-26947)Victor Stinner2021-07-013-28/+49
| | | | | | | | | | | | Add an internal _PyType_AllocNoTrack() function to allocate an object without tracking it in the GC. Modify dict_new() to use _PyType_AllocNoTrack(): dict subclasses are now only tracked once all PyDictObject members are initialized. Calling _PyObject_GC_UNTRACK() is no longer needed for the dict type. Similar change in tuple_subtype_new() for tuple subclasses. Replace tuple_gc_track() with _PyObject_GC_TRACK().
* bpo-44523: Remove the pass-through for hash() in weakref proxy objects ↵Pablo Galindo2021-06-291-16/+2
| | | | (GH-26950)
* bpo-44531: Fix type_repr() if tp_name is NULL (GH-26948)Victor Stinner2021-06-291-0/+6
| | | | | Allow to call type_repr() on a type which is not fully initialized yet. This fix helps debugging crashes occurring early at Python initialization.
* bpo-44110: Improve string's __getitem__ error message (GH-26042)Miguel Brito2021-06-271-1/+2
|
* bpo-43693 Get rid of CO_NOFREE -- it's unused (GH-26839)Guido van Rossum2021-06-231-7/+0
| | | | | | All uses of this flag are either setting it or in doc or tests for it. So we should be able to get rid of it completely.
* bpo-39947: Remove old private trashcan C API functions (GH-26869)Victor Stinner2021-06-231-48/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove 4 C API private trashcan functions which were only kept for the backward compatibility of the stable ABI with Python 3.8 and older, since the trashcan API was not usable with the limited C API on Python 3.8 and older. The trashcan API was excluded from the limited C API in Python 3.9. Removed functions: * _PyTrash_deposit_object() * _PyTrash_destroy_chain() * _PyTrash_thread_deposit_object() * _PyTrash_thread_destroy_chain() The trashcan C API was never usable with the limited C API, since old trashcan macros accessed directly PyThreadState members like "_tstate->trash_delete_nesting", whereas the PyThreadState structure is opaque in the limited C API. Exclude also the PyTrash_UNWIND_LEVEL constant from the C API. The trashcan C API was modified in Python 3.9 by commit 38965ec5411da60d312b59be281f3510d58e0cf1 and in Python 3.10 by commit ed1a5a5baca8f61e9a99c5be3adc16b1801514fe to hide implementation details.
* bpo-43770: Cleanup PyModuleDef_Init() (GH-26879)Victor Stinner2021-06-231-2/+1
| | | | | PyModuleDef_Init() no longer tries to make PyModule_Type type: it's already done by _PyTypes_Init() at Python startup. Replace PyType_Ready() call with an assertion.