summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44707: Fix an undefined behavior of the null pointer arithmetic ↵Miss Islington (bot)2021-07-291-2/+9
| | | | | | | (GH-27292) (GH-27443) (cherry picked from commit e5c8ddb1714fb51ab1defa24352c98e0f01205dc) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44657: Fix instancemethod_call to use PyInstanceMethod_GET_FUNCTION ↵Miss Islington (bot)2021-07-281-1/+1
| | | | | | | (GH-27202) (cherry picked from commit ddf8ae31a0f371eff2db14c7f7a45976b86d56ea) Co-authored-by: Dong-hee Na <donghee.na@python.org>
* bpo-44698: Fix undefined behaviour in complex exponentiation. (GH-27278) ↵Miss Islington (bot)2021-07-261-8/+15
| | | | | | | (GH-27367) (cherry picked from commit 1d582bbc969e05896addf97844ddf17ce9830e5e) Co-authored-by: T. Wouters <thomas@python.org>
* bpo-44720: Don't crash when calling weakref.proxy(not_an_iterator).__next__ ↵Miss Islington (bot)2021-07-241-0/+6
| | | | | | | (GH-27316) (#27325) (cherry picked from commit 5370f0a82aaa4ba617070d5c71d2b18236096ac0) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* bpo-44184: Fix subtype_dealloc() for freed type (GH-26274)Miss Islington (bot)2021-07-151-2/+9
| | | | | | | | | | | | Fix a crash at Python exit when a deallocator function removes the last strong reference to a heap type. Don't read type memory after calling basedealloc() since basedealloc() can deallocate the type and free its memory. _PyMem_IsPtrFreed() argument is now constant. (cherry picked from commit 615069eb08494d089bf24e43547fbc482ed699b8) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-44184: Apply GH-26274 to the non-GC-type branch of subtype_dealloc ↵Miss Islington (bot)2021-07-151-3/+11
| | | | | | | | | | | (GH-27165) (GH-27175) 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 (cherry picked from commit 074e7659f208051b6b973f7fdb654dd22b93aaa2) Co-authored-by: T. Wouters <thomas@python.org>
* [3.9] bpo-44562: Remove invalid PyObject_GC_Del from error path of ↵Ken Jin2021-07-051-4/+4
| | | | types.GenericAlias … (GH-27016) (GH-27028)
* Revert "bpo-44562: Remove invalid PyObject_GC_Del from error path of ↵Pablo Galindo2021-07-041-3/+3
| | | | | types.GenericAlias … (GH-27016) (GH-27018)" (GH-27022) This reverts commit 4684a34c8d2a2ffac7b779edb4ba57f043783478.
* bpo-44562: Remove invalid PyObject_GC_Del from error path of ↵Miss Islington (bot)2021-07-041-3/+3
| | | | | | | | | types.GenericAlias … (GH-27016) (GH-27018) (cherry picked from commit d33943a6c368c2184e238019c63ac7a267da5594) Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
* bpo-44523: Remove the pass-through for hash() in weakref proxy objects ↵Miss Islington (bot)2021-06-291-16/+2
| | | | | | | (GH-26950) (GH-26960) (cherry picked from commit e2fea101fd5517f33371b04432842b971021c3bf) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Fix a potential reference-counting bug in long_pow (GH-26690) (#26702)Miss Islington (bot)2021-06-131-0/+1
| | | | | | | (cherry picked from commit 59242431991794064824cf2ab70886367613f29e) Co-authored-by: Mark Dickinson <mdickinson@enthought.com> Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
* [3.9] bpo-43667: Fix broken Unicode encoding in non-UTF locales on Solaris ↵Jakub Kulík2021-05-211-0/+40
| | | | | | | (GH-25096) (GH-25847) (cherry picked from commit 9032cf5cb1e33c0349089cfb0f6bf11ed3c30e86) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures ↵Miss Islington (bot)2021-05-161-4/+4
| | | | | | | | | | | | (GH-26062) (GH-26093) These are passed and called as PyCFunction, however they are defined here without the (ignored) args parameter. This works fine in some C compilers, but fails in webassembly or anything else that has strict function pointer call type checking. (cherry picked from commit ab383eb6f03896b0ef6634ee3d776344fcb9e5b8) Co-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk> Co-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk>
* bpo-44114: Remove redundant cast. (GH-26098)Miss Islington (bot)2021-05-131-2/+2
| | | | | (cherry picked from commit e0c614e5fd017ca43cab55a9f8490133750c704f) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* [3.9] bpo-42083: Allow NULL doc in PyStructSequence_NewType (#25896)Petr Viktorin2021-05-041-6/+11
| | | | | (cherry picked from commit 2f5baa17504feb9a7613bac32fdceed4894434de) Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
* 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.