summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-42800: Add audit events for f_code and tb_frame (GH-24182)Steve Dower2021-05-032-7/+9
| | | | | | | | Accessing the following attributes will now fire PEP 578 style audit hooks as (object.__getattr__, obj, name): * PyTracebackObject: tb_frame * PyFrameObject: f_code * PyGenObject: gi_code, gi_frame * PyCoroObject: cr_code, cr_frame * PyAsyncGenObject: ag_code, ag_frame
* bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208) (#24211)Miss Islington (bot)2021-04-261-2/+4
| | | | | | | Before, using the * operator to repeat a bytearray would copy data from the start of the internal buffer (ob_bytes) and not from the start of the actual data (ob_start). (cherry picked from commit 61d8c54f43a7871d016f98b38f86858817d927d5) Co-authored-by: Tobias Holl <TobiasHoll@users.noreply.github.com>
* bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)Miss Islington (bot)2021-03-171-4/+5
| | | | | | | | | | | | | Python no longer fails at startup with a fatal error if a command line argument contains an invalid Unicode character. The Py_DecodeLocale() function now escapes byte sequences which would be decoded as Unicode characters outside the [U+0000; U+10ffff] range. Use MAX_UNICODE constant in unicodeobject.c. (cherry picked from commit 9976834f807ea63ca51bc4f89be457d734148682) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.9] bpo-43499: Restrict co_code to be under INT_MAX in codeobject ↵Ammar Askar2021-03-172-1/+11
| | | | | (GH-20628) (GH-24896) (cherry picked from commit 3b3b83c965447a8329b34cb4befe6e9908880ee5)
* bpo-41654: Fix compiler warning in MemoryError_dealloc() (GH-22387) (GH-24894)Miss Islington (bot)2021-03-161-1/+2
| | | | | | | | | | | Fix warning: Objects\exceptions.c(2324,56): warning C4098: 'MemoryError_dealloc': 'void' function returning a value (cherry picked from commit bbeb223e9a5e9f9374df384efa386b4068a65c0e) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43499: Silence compiler warnings about using legacy C API on Windows ↵Serhiy Storchaka2021-03-161-0/+6
| | | | (GH-24873)
* [3.9] bpo-40052: Fix alignment issue in PyVectorcall_Function() (GH-23999) ↵Miss Islington (bot)2021-01-051-1/+2
| | | | | | | | | | | | | | | | | | | | (GH-24005) ``` In file included from /usr/include/python3.8/Python.h:147: In file included from /usr/include/python3.8/abstract.h:837: /usr/include/python3.8/cpython/abstract.h:91:11: error: cast from 'char *' to 'vectorcallfunc *' (aka 'struct _object *(**)(struct _object *, struct _object *const *, unsigned long, struct _object *)') increases required alignment from 1 to 8 [-Werror,-Wcast-align] ptr = (vectorcallfunc*)(((char *)callable) + offset); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. ``` Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-Authored-By: Andreas Schneider <asn@cryptomilk.org> Co-Authored-By: Antoine Pitrou <antoine@python.org> (cherry picked from commit 056c08211b402b4dbc1530a9de9d00ad5309909f)
* [3.9] bpo-42425: Fix possible leak in initialization of errmap for OSError ↵Serhiy Storchaka2021-01-021-1/+3
| | | | | | (GH-23446). (GH-24057) (cherry picked from commit ed1007c0d74e658d1e6c9b51b12ce7501eb8cbf9)
* [3.9] bpo-42195: Ensure consistency of Callable's __args__ in ↵kj2020-12-141-21/+39
| | | | | collections.abc and typing (GH-23765) Backport of GH-23060.
* bpo-42536: GC track recycled tuples (GH-23623) (GH-23651)Brandt Bucher2020-12-073-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. (cherry picked from commit 226a012d1cd61f42ecd3056c554922f359a1a35d)
* bpo-42576: Raise TypeError when passing in keyword arguments to GenericAlias ↵Miss Islington (bot)2020-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 (cherry picked from commit 804d6893b801e8f30318afc38c20d4d0e6161db3) Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com>
* bpo-42412: Fix possible leaks and check arguments in ↵Miss Islington (bot)2020-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. (cherry picked from commit 1db76394ea79030aa4ed5349c950f6c6da51450f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-40998: Address compiler warnings found by ubsan (GH-20929)Miss Islington (bot)2020-11-181-1/+5
| | | | | | | | Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran (cherry picked from commit 07f2adedf0940b06d136208ec386d69b7d2d5b43) Co-authored-by: Christian Heimes <christian@python.org>
* [3.9] bpo-42332: Add weakref slot to types.GenericAlias (GH-23250) (GH-23309)kj2020-11-171-0/+6
| | | (cherry picked from commit 384b7a4bd988986bca227c7e85c32d766da74708)
* Fix typo in unicodeobject.c (GH-23180)Miss Islington (bot)2020-11-101-1/+1
| | | | | | | | exeeds -> exceeds Automerge-Triggered-By: GH:Mariatta (cherry picked from commit 38811d68caf9b782ea7168479acb09557e126efe) Co-authored-by: Ikko Ashimine <eltociear@gmail.com>
* bpo-42143: Ensure PyFunction_NewWithQualName() can't fail after creating the ↵Miss Skeleton (bot)2020-10-291-13/+16
| | | | | | | | | func object (GH-22953) (GH-23021) func_dealloc() does not handle partially-created objects. Best not to give it any. (cherry picked from commit 350526105fa9b131d8b941ae753378b741dabb2f) Co-authored-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
* bpo-42065: Fix incorrectly formatted _codecs.charmap_decode error message ↵Miss Skeleton (bot)2020-10-181-1/+1
| | | | | | | (GH-19940) (cherry picked from commit 3635388f52b42e5280229104747962117104c453) Co-authored-by: Max Bernstein <tekknolagi@users.noreply.github.com>
* bpo-41984: GC track all user classes (GH-22701/GH-22702)Miss Skeleton (bot)2020-10-151-16/+6
| | | (cherry picked from commit c13b847a6f913b72eeb71651ff626390b738d973)
* bpo-42015: Reorder dereferencing calls in meth_dealloc, to make sure m_self ↵Miss Skeleton (bot)2020-10-121-2/+4
| | | | | | | is kept alive long enough (GH-22670) (cherry picked from commit 04b8631d84a870dda456ef86039c1baf34d08500) Co-authored-by: Yannick Jadoul <yannick.jadoul@belgacom.net>
* Fix the attribute names in the docstring of GenericAlias (GH-22594)Miss Skeleton (bot)2020-10-081-1/+1
| | | | | (cherry picked from commit 77f0a23e7a9fb247101b9b14a060c4ba1c4b87a5) Co-authored-by: Mikhail Golubev <qsolo825@gmail.com>
* [3.9] bpo-41909: Enable previously disabled recursion checks. (GH-22536) ↵Serhiy Storchaka2020-10-042-4/+0
| | | | | | | | | | | | | | | (GH-22550) 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. (cherry picked from commit 9ece9cd65cdeb0a1f6e60475bbd0219161c348ac)
* bpo-41780: Fix __dir__ of types.GenericAlias (GH-22262)Miss Islington (bot)2020-09-151-0/+39
| | | | | | Automerge-Triggered-By: @gvanrossum (cherry picked from commit 2e87774df1a0eaf2a1fe8cc4d958df60f7125b6e) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
* bpo-29590: fix stack trace for gen.throw() with yield from (GH-19896)Miss Islington (bot)2020-09-041-0/+10
| | | | | | | | | | | * Add failing test. * bpo-29590: fix stack trace for gen.throw() with yield from (GH-NNNN) When gen.throw() is called on a generator after a "yield from", the intermediate stack trace entries are lost. This commit fixes that. (cherry picked from commit 8b33961e4bc4020d8b2d5b949ad9d5c669300e89) Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
* [3.9] bpo-41654: Fix deallocator of MemoryError to account for subclasses ↵Pablo Galindo2020-09-011-2/+12
| | | | | | | | | | | | (GH-22020) (GH-22045) When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.. (cherry picked from commit 9b648a95ccb4c3b14f1e87158f5c9f5dbb2f62c0) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-41295: Reimplement the Carlo Verre "hackcheck" (GH-21528)Miss Islington (bot)2020-07-181-7/+20
| | | | | | | | Walk down the MRO backwards to find the type that originally defined the final `tp_setattro`, then make sure we are not jumping over intermediate C-level bases with the Python-level call. Automerge-Triggered-By: @gvanrossum (cherry picked from commit c53b310e5926266ce267c44a168165cacd786d6e) Co-authored-by: scoder <stefan_ml@behnel.de>
* bpo-41175: Guard against a NULL pointer dereference within bytearrayobject ↵Miss Islington (bot)2020-07-101-1/+3
| | | | | | | | | | (GH-21240) The issue is triggered by the bytearray() + bytearray() operation. Detected by GCC 10 static analysis tool. (cherry picked from commit 61fc23ca106bc82955b0e59d1ab42285b94899e2) Co-authored-by: stratakis <cstratak@redhat.com>
* bpo-39960: Allow heap types in the "Carlo Verre" hack check that override ↵Miss Islington (bot)2020-07-031-11/+30
| | | | | | | | "tp_setattro()" (GH-21092) Automerge-Triggered-By: @gvanrossum (cherry picked from commit 148f32913573c29250dfb3f0d079eb8847633621) Co-authored-by: scoder <stefan_ml@behnel.de>
* bpo-40824: Do not mask errors in __iter__ in "in" and the operator module. ↵Miss Islington (bot)2020-06-221-1/+3
| | | | | | | | | | (GH-20537) Unexpected errors in calling the __iter__ method are no longer masked by TypeError in the "in" operator and functions operator.contains(), operator.indexOf() and operator.countOf(). (cherry picked from commit cafe1b6e9d3594a34aba50e872d4198296ffaadf) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)Inada Naoki2020-06-181-0/+23
| | | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> (cherry picked from commit 2c4928d37edc5e4aeec3c0b79fa3460b1ec9b60d)
* bpo-40703: Let PyType_FromSpec() set "type.__module__" only if it is not set ↵Miss Islington (bot)2020-06-101-15/+20
| | | | | yet. (GH-20273) (GH-20782) (cherry picked from commit 24b8bad6d30ae4fb37ee686a073adfa5308659f9)
* bpo-40724: Support setting buffer slots from type specs (GH-20648) (GH-20683)Miss Islington (bot)2020-06-071-2/+2
| | | | This is not part of the limited API but makes the buffer slots available for type specs. (cherry picked from commit f7c4e236429606e1c982cacf24e10fc86ef4462f)
* bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for ↵Miss Islington (bot)2020-05-282-93/+11
| | | | | | | | | | | | PyType_FromSpec types (reverts GH-19414) (GH-20264) Heap types now always visit the type in tp_traverse. See added docs for details. This reverts commit 0169d3003be3d072751dd14a5c84748ab63a249f. Automerge-Triggered-By: @encukou (cherry picked from commit 1cf15af9a6f28750f37b08c028ada31d38e818dd) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Remove spurious NULL in descrobject.c (GH-20344)Miss Islington (bot)2020-05-241-1/+0
| | | | | | Co-authored-by: hai shi <shihai1991@126.com> (cherry picked from commit 3f5f61409ebf95fa606bcbb15dfaaadad6084dc6) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-40696: Fix a hang that can arise after gen.throw() (GH-20287)Miss Islington (bot)2020-05-221-4/+6
| | | | | | | | | | This updates _PyErr_ChainStackItem() to use _PyErr_SetObject() instead of _PyErr_ChainExceptions(). This prevents a hang in certain circumstances because _PyErr_SetObject() performs checks to prevent cycles in the exception context chain while _PyErr_ChainExceptions() doesn't. (cherry picked from commit 7c30d12bd5359b0f66c4fbc98aa055398bcc8a7e) Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
* [3.9] bpo-40514: Remove --with-experimental-isolated-subinterpreters in 3.9 ↵Victor Stinner2020-05-196-40/+4
| | | | | | | (GH-20228) Remove --with-experimental-isolated-subinterpreters configure option in Python 3.9: the experiment continues in the master branch, but it's no longer needed in 3.9.
* Use _PyErr_ChainStackItem() inside gen_send_ex(). (GH-20173) (#20202)Miss Islington (bot)2020-05-191-10/+2
| | | | | | | | _PyErr_ChainStackItem was just added in GH-19951 (for bpo-31033). (cherry picked from commit ff7a8b03c49153021d6de5d0b2fa8b5163059ed6) Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com> Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
* bpo-31033: Improve the traceback for cancelled asyncio tasks (GH-19951)Chris Jerdonek2020-05-181-17/+3
| | | | | When an asyncio.Task is cancelled, the exception traceback now starts with where the task was first interrupted. Previously, the traceback only had "depth one."
* bpo-39075: types.SimpleNamespace no longer sorts attributes in its repr ↵Zackery Spytz2020-05-161-2/+0
| | | | (GH-19430)
* bpo-40521: Add PyInterpreterState.unicode (GH-20081)Victor Stinner2020-05-131-31/+33
| | | | | | | Move PyInterpreterState.fs_codec into a new PyInterpreterState.unicode structure. Give a name to the fs_codec structure and use this structure in unicodeobject.c.
* bpo-29587: Make gen.throw() chain exceptions with yield from (GH-19858)Chris Jerdonek2020-05-131-10/+12
| | | | | | | | | | | | The previous commits on bpo-29587 got exception chaining working with gen.throw() in the `yield` case. This patch also gets the `yield from` case working. As a consequence, implicit exception chaining now also works in the asyncio scenario of awaiting on a task when an exception is already active. Tests are included for both the asyncio case and the pure generator-only case.
* bpo-39465: Remove _PyUnicode_ClearStaticStrings() from C API (GH-20078)Victor Stinner2020-05-131-3/+3
| | | | Remove the _PyUnicode_ClearStaticStrings() function from the C API. Make the function fully private (declare it with "static").
* bpo-38787: Add PyCFunction_CheckExact() macro for exact type checks (GH-20024)scoder2020-05-121-1/+1
| | | | | … now that we allow subtypes of PyCFunction. Also add PyCMethod_CheckExact() and PyCMethod_Check() for checks against the PyCMethod subtype.
* bpo-40596: Fix str.isidentifier() for non-canonicalized strings containing ↵Serhiy Storchaka2020-05-121-4/+22
| | | | non-BMP characters on Windows. (GH-20053)
* bpo-40593: Improve syntax errors for invalid characters in source code. ↵Serhiy Storchaka2020-05-121-23/+41
| | | | (GH-20033)
* bpo-39465: Don't access directly _Py_Identifier members (GH-20043)Victor Stinner2020-05-112-8/+8
| | | | | * Replace id->object with _PyUnicode_FromId(&id) * Use _Py_static_string_init(str) macro to initialize statically name_op in typeobject.c.
* bpo-40584: Update PyType_FromModuleAndSpec() to process tp_vectorcall_offset ↵Hai Shi2020-05-111-2/+12
| | | | (GH-20026)
* bpo-40575: Avoid unnecessary overhead in _PyDict_GetItemIdWithError() (GH-20018)scoder2020-05-111-1/+3
| | | | | Avoid unnecessary overhead in _PyDict_GetItemIdWithError() by calling _PyDict_GetItem_KnownHash() instead of the more generic PyDict_GetItemWithError(), since we already know the hash of interned strings.
* Improve code clarity for the set lookup logic (GH-20028)Raymond Hettinger2020-05-101-125/+55
|
* bpo-37986: Improve perfomance of PyLong_FromDouble() (GH-15611)Sergey Fedoseev2020-05-102-23/+17
| | | | | | | | | * bpo-37986: Improve perfomance of PyLong_FromDouble() * Use strict bound check for safety and symmetry * Remove possibly outdated performance claims Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-40273: Reversible mappingproxy (FH-19513)Zackery Spytz2020-05-081-0/+9
|