summaryrefslogtreecommitdiff
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* [3.8] bpo-37879: Suppress subtype_dealloc decref when base type is a C heap ↵Petr Viktorin2019-09-121-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | type (GH-15323, GH-16004) (GH-15966) The instance destructor for a type is responsible for preparing an instance for deallocation by decrementing the reference counts of its referents. If an instance belongs to a heap type, the type object of an instance has its reference count decremented while for static types, which are permanently allocated, the type object is unaffected by the instance destructor. Previously, the default instance destructor searched the class hierarchy for an inherited instance destructor and, if present, would invoke it. Then, if the instance type is a heap type, it would decrement the reference count of that heap type. However, this could result in the premature destruction of a type because the inherited instance destructor should have already decremented the reference count of the type object. This change avoids the premature destruction of the type object by suppressing the decrement of its reference count when an inherited, non-default instance destructor has been invoked. Finally, an assertion on the Py_SIZE of a type was deleted. Heap types have a non zero size, making this into an incorrect assertion. https://github.com/python/cpython/pull/15323. (cherry picked from commit ff023ed36ea260ab64be5895f1f1f087c798987a) Fixup: https://github.com/python/cpython/pull/16004. (cherry picked from commit 5e9caeec76119a0d61c25f1466c27b7dbd5115bd) Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
* bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895) ↵Paul Ganssle2019-09-112-2/+2
| | | | (GH-15961)
* Doc: Fix typo in fastsearch comments (GH-14608) (GH-15933)Miss Islington (bot)2019-09-111-2/+2
| | | | | (cherry picked from commit 60bba83b5d9947fb3106325293e3a4e9c9cdea7e) Co-authored-by: Valentin Haenel <esc@users.noreply.github.com>
* Remove unneeded assignment in PyBytes_Concat() (GH-15274)Miss Islington (bot)2019-09-101-1/+0
| | | | | | The `wb.len = -1` assignment is unneeded since its introduction in 161d695fb0455ce52530d4f43a9eac4c738f64bb as `PyObject_GetBuffer` always fills it in. (cherry picked from commit afdeb189e97033b54cef44a7490d89d2013cb4e5) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
* bpo-37619: update_one_slot() should not ignore wrapper descriptors for wrong ↵Miss Islington (bot)2019-09-101-6/+13
| | | | | | | type (GH-15838) (cherry picked from commit 57ea33560662e0f20a3b0334bb20065771edf4da) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* Fix typo in dict object comment (GH-15814)Miss Islington (bot)2019-09-101-1/+1
| | | | | (cherry picked from commit 359143c68659d165f52320d368667e0eff279dc5) Co-authored-by: dalgarno <32097481+dalgarno@users.noreply.github.com>
* Revert "bpo-33418: Add tp_clear for function object (GH-8058)" (GH-15826)Victor Stinner2019-09-101-21/+13
| | | This reverts commit 3c452404ae178b742967589a0bb4a5ec768d76e0.
* [3.8] bpo-37994: Fix silencing all errors if an attribute lookup fails. ↵Serhiy Storchaka2019-09-016-90/+95
| | | | | | | (GH-15630) (GH-15635) Only AttributeError should be silenced. (cherry picked from commit 41c57b335330ff48af098d47e379e0f9ba09d233)
* Fix typos mostly in comments, docs and test names (GH-15209)Miss Islington (bot)2019-08-302-2/+2
| | | | | (cherry picked from commit 39d87b54715197ca9dcb6902bb43461c0ed701a2) Co-authored-by: Min ho Kim <minho42@gmail.com>
* [3.8] bpo-37034: Display argument name on errors with keyword arguments with ↵Serhiy Storchaka2019-08-2910-56/+56
| | | | | | | Argument Clinic. (GH-13593). (GH-15599) (cherry picked from commit 4901fe274bc82b95dc89bcb3de8802a3dfedab32) Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
* Fix unused variable and signed/unsigned warnings (GH-15537) (GH-15551)Miss Islington (bot)2019-08-271-0/+6
| | | | | (cherry picked from commit 0138c4ceab1e10d42d0aa962d2ae079b46da7671) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
* [3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details ↵Nick Coghlan2019-08-261-9/+0
| | | | | | | | | | | | | | | | | | | (GH-15491) - drop TargetScopeError in favour of raising SyntaxError directly as per the updated PEP 572 - comprehension iteration variables are explicitly local, but named expression targets in comprehensions are nonlocal or global. Raise SyntaxError as specified in PEP 572 - named expression targets in the outermost iterable of a comprehension have an ambiguous target scope. Avoid resolving that question now by raising SyntaxError. PEP 572 originally required this only for cases where the bound name conflicts with the iteration variable in the comprehension, but CPython can't easily restrict the exception to that case (as it doesn't know the target variable names when visiting the outermost iterator expression) (cherry picked from commit 5dbe0f59b7a4f39c7c606b48056bc29e406ebf78)
* [3.8] bpo-37830: Fix compilation of break and continue in finally. ↵Serhiy Storchaka2019-08-241-7/+16
| | | | | | | | | (GH-15320) (GH-15456) Fix compilation of "break" and "continue" in the "finally" block when the corresponding "try" block contains "return" with a non-constant value. (cherry picked from commit ef61c524ddeeb56da3858b86e349e7288d68178e)
* bpo-36311: Fixes decoding multibyte characters around chunk boundaries and ↵Miss Islington (bot)2019-08-211-6/+10
| | | | | | | improves decoding performance (GH-15083) (cherry picked from commit 7ebdda0dbee7df6f0c945a7e1e623e47676e112d) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-37732: Fix GCC warning in _PyObject_Malloc() (GH-15333) (GH-15342)Victor Stinner2019-08-201-17/+15
| | | | | | | | | pymalloc_alloc() now returns directly the pointer, return NULL on memory allocation error. allocate_from_new_pool() already uses NULL as marker for "allocation failed". (cherry picked from commit 18f8dcfa10d8a858b152d12a9ad8fa83b7e967f0)
* bpo-37681: no_sanitize_thread support from GCC 5.1 (GH-15096)Miss Islington (bot)2019-08-141-2/+2
| | | | | | | Fix the following warning with GCC 4.8.5: Objects/obmalloc.c: warning: ‘no_sanitize_thread’ attribute directive ignored (cherry picked from commit 7e479c82218450255572e3f5fa1549dc283901ea) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* [3.8] bpo-36974: separate vectorcall functions for each calling convention ↵Jeroen Demeyer2019-07-233-78/+354
| | | | (GH-13781) (#14782)
* bpo-37233: optimize method_vectorcall in case of totalargs == 0 (GH-14550)Miss Islington (bot)2019-07-031-6/+10
| | | | | (cherry picked from commit 53c214344038341ce86fcf7efa12dc33be9d5b45) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* [3.8] bpo-37233: use _PY_FASTCALL_SMALL_STACK in method_vectorcall (GH-13974)Inada Naoki2019-07-031-5/+13
| | | | | (cherry picked from commit 988e6aa322fb61651812fa5a61ec73316c71b041) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* Stop using Argument Clinic for dict_pop (GH-13935)Inada Naoki2019-07-022-50/+28
|
* bpo-37221: Add PyCode_NewWithPosOnlyArgs to be used internally and set ↵Miss Islington (bot)2019-07-011-15/+31
| | | | | | | | PyCode_New as a compatibility wrapper (GH-13959) (#14505) Add PyCode_NewEx to be used internally and set PyCode_New as a compatibility wrapper (cherry picked from commit 4a2edc34a405150d0b23ecfdcb401e7cf59f4650) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-37417: Fix error handling in bytearray.extend. (GH-14407)Miss Islington (bot)2019-06-261-0/+4
| | | | | (cherry picked from commit 2a7d596f27b2342caf168a03c95ebf3b56e5dbbd) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304)Miss Islington (bot)2019-06-252-6/+10
| | | | | | | | | * The UTF-8 incremental decoders fails now fast if encounter a sequence that can't be handled by the error handler. * The UTF-16 incremental decoders with the surrogatepass error handler decodes now a lone low surrogate with final=False. (cherry picked from commit 894263ba80af4b7733c2df95b527e96953922656) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36974: inherit tp_vectorcall_offset unconditionally (GH-13858) (GH-14342)Miss Islington (bot)2019-06-252-7/+7
| | | | | (cherry picked from commit a8b27e623d75377aabe50df27e97cab4e81a174a) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* bpo-36922: use Py_TPFLAGS_METHOD_DESCRIPTOR in lookup_maybe_method() (GH-13865)Miss Islington (bot)2019-06-171-1/+1
| | | | | (cherry picked from commit 2e9954d3472a23919b96323fcd5bb6c1d6927155) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* bpo-37236: pragma optimize off for _Py_c_quot on Windows arm64 (GH-13983)Miss Islington (bot)2019-06-121-0/+7
| | | | | (cherry picked from commit ff6bb0aa95259413f359d42410526ff0b4dccfb7) Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
* bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13997) (GH-14000)Miss Islington (bot)2019-06-121-1/+1
| | | | | | | | | | Fix MSVC warning: objects\codeobject.c(285): warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned char', possible loss of data (cherry picked from commit 376ce9852eec4e97745c723f0dd0fe64383c6cd3) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37219: Remove erroneous optimization for differencing an empty set ↵Miss Islington (bot)2019-06-111-8/+0
| | | | | | | (GH-13965) (GH-13967) (cherry picked from commit 1f11cf9521114447b3e32e2ac88f075ffaa37555) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
* bpo-37138: fix undefined behaviour with memcpy() on NULL array (GH-13867)Miss Islington (bot)2019-06-071-1/+5
| | | | | (cherry picked from commit 1f9531764cc0f8dbca1d8f429d162dc28282f4b4) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* [3.8] bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() ↵Zackery Spytz2019-06-071-2/+2
| | | | | | | (GH-13860) (GH-13891) (cherry picked from commit dc2476500d91082f0c907772c83a044bf49af279) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13809)Victor Stinner2019-06-041-1/+2
| | | | | | Fix this MSVC warning: objects\codeobject.c(264): warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned char', possible loss of data
* bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)Inada Naoki2019-06-032-12/+78
| | | | | | This patch implements per opcode cache mechanism, and use it in only LOAD_GLOBAL opcode. Based on Yury's opcache3.patch in bpo-26219.
* bpo-36027: Really fix "incompatible pointer type" compiler warning (GH-13761)Petr Viktorin2019-06-031-1/+1
| | | Apologies for the earlier hasty attempt.
* bpo-36974: add some assertions for PEP 590 (GH-13682)Jeroen Demeyer2019-06-031-0/+14
|
* bpo-37012: Clean up special cases in PyType_FromSpecWithBases slot ↵Petr Viktorin2019-06-031-9/+11
| | | | | | | | | assignments (GH-13496) The main slot assignment loop is now if-else if ladder, making the control flow clearer. Based on suggestion by Victor Stinner in: https://github.com/python/cpython/pull/10304/#issuecomment-491123026
* bpo-36027 bpo-36974: Fix "incompatible pointer type" compiler warnings ↵Petr Viktorin2019-06-031-1/+1
| | | | (GH-13758)
* bpo-36974: Make tp_call=PyVectorcall_Call work for inherited types (GH-13699)Petr Viktorin2019-06-022-11/+25
| | | | | | | | | | | | | | | | | | When inheriting a heap subclass from a vectorcall class that sets `.tp_call=PyVectorcall_Call` (as recommended in PEP 590), the subclass does not inherit `_Py_TPFLAGS_HAVE_VECTORCALL`, and thus `PyVectorcall_Call` does not work for it. This attempts to solve the issue by: * always inheriting `tp_vectorcall_offset` unless `tp_call` is overridden in the subclass * inheriting _Py_TPFLAGS_HAVE_VECTORCALL for static types, unless `tp_call` is overridden * making `PyVectorcall_Call` ignore `_Py_TPFLAGS_HAVE_VECTORCALL` This means it'll be ever more important to only call `PyVectorcall_Call` on classes that support vectorcall. In `PyVectorcall_Call`'s intended role as `tp_call` filler, that's not a problem.
* Call PyObject_GC_UnTrack in structseq dealloc (GH-13751)Pablo Galindo2019-06-021-0/+1
|
* bpo-37126: Allow structseq objects to be tracked by the GC (GH-13729)Pablo Galindo2019-06-021-2/+18
|
* bpo-36027: Extend three-argument pow to negative second argument (GH-13266)Mark Dickinson2019-06-021-12/+118
|
* bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108)Serhiy Storchaka2019-06-023-3/+31
|
* bpo-36842: Pass positional only parameters to code_new audit hook (GH-13707)Pablo Galindo2019-06-011-3/+3
|
* Improve exception message for str.format (GH-12675)Francisco Couzo2019-06-011-2/+7
|
* bpo-37122: Make co->co_argcount represent the total number of positonal ↵Pablo Galindo2019-06-013-11/+10
| | | | arguments in the code object (GH-13726)
* Improve docstring of list.sort (GH-8516)Tim Hoffmann2019-05-312-4/+20
|
* bpo-37029: keep usable_arenas in sorted order without searching (#13612)Tim Peters2019-05-311-32/+77
| | | | | This adds a vector of "search fingers" so that usable_arenas can be kept in sorted order (by number of free pools) via constant-time operations instead of linear search. This should reduce worst-case time for reclaiming a great many objects from O(A**2) to O(A), where A is the number of arenas. See bpo-37029.
* bpo-37108: Support super with methods that use positional-only arguments ↵Pablo Galindo2019-05-311-1/+1
| | | | (GH-13695)
* bpo-36379: __ipow__ must be a ternaryfunc, not a binaryfunc (GH-13546)Zackery Spytz2019-05-311-1/+1
| | | | | | | If a type's __ipow__ method was implemented in C, attempting to use the *modulo* parameter would cause crashes. https://bugs.python.org/issue36379
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-3035-156/+155
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36974: rename _FastCallKeywords -> _Vectorcall (GH-13653)Jeroen Demeyer2019-05-304-11/+11
|