summaryrefslogtreecommitdiff
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* [3.7] bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304) ↵Miss Islington (bot)2019-07-012-6/+10
| | | | | | | | | | | | | (GH-14369) * bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304) * 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>
* [3.7] bpo-37219: Remove erroneous optimization for differencing an empty set ↵Raymond Hettinger2019-06-111-8/+0
| | | | | | (GH-13965) (GH-13968)
* [3.7] bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() ↵Zackery Spytz2019-06-071-2/+2
| | | | | | | (GH-13860) (GH-13896) (cherry picked from commit dc2476500d91082f0c907772c83a044bf49af279) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] Fix a possible crash due to PyType_FromSpecWithBases() (GH-10304) ↵Petr Viktorin2019-05-281-0/+1
| | | | | | | | | (GH-13495) If the PyObject_MALLOC() call failed in PyType_FromSpecWithBases(), PyObject_Free() would be called on a static string in type_dealloc(). (cherry picked from commit 0613c1e481440aa8f54ba7f6056924c175fbcc13) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)Miss Islington (bot)2019-05-281-1/+1
| | | | | | | Fix possible overflow in wrap_lenfunc() when sizeof(long) < sizeof(Py_ssize_t) (e.g., 64-bit Windows). (cherry picked from commit 05f16416d99dc9fc76fef11e56f16593e7a5955e) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] bpo-28866: No type cache for types with specialized mro, invalidation ↵Miss Islington (bot)2019-05-261-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | is hard. (GH-13157) (GH-13589) * No type cache for types with specialized mro, invalidation is hard. * FIX: Don't disable method cache custom types that do not implement mro(). * fixing implem. * Avoid storing error flags, also decref. * news entry * Clear as soon as we're getting an error. * FIX: Reference leak. (cherry picked from commit 180dc1b0f4a57c3f66351568ae8488fa8576d7f0) Co-authored-by: Julien Palard <julien@palard.fr> https://bugs.python.org/issue28866
* bpo-27987: pymalloc: align by 16bytes on 64bit platform (GH-12850)Miss Islington (bot)2019-05-251-0/+6
| | | | | (cherry picked from commit f0be4bbb9b3cee876249c23f2ae6f38f43fa7495) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-35091: Objects/listobject.c: Replace overflow checks in gallop fu… ↵Miss Islington (bot)2019-05-221-8/+4
| | | | | | | | | | | | | | | (GH-10202) …nctions with asserts The actual overflow can never happen because of the following: * The size of a list can't be greater than PY_SSIZE_T_MAX / sizeof(PyObject*). * The size of a pointer on all supported plaftorms is at least 4 bytes. * ofs is positive and less than the list size at the beginning of each iteration. https://bugs.python.org/issue35091 (cherry picked from commit 6bc5917903b722bdd0e5d3020949f26fec5dfe9a) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-36907: fix refcount bug in _PyStack_UnpackDict() (GH-13381) (GH-13493)Jeroen Demeyer2019-05-221-5/+12
|
* closes bpo-36951: Correct some types in the type_members struct in ↵Miss Islington (bot)2019-05-191-3/+3
| | | | | | | typeobject.c. (GH-13403) (cherry picked from commit 53d378c81286644138415cb56da52a7351e1a477) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] Fix typo in _PyMethodDef_RawFastCallKeywords error message (GH-13343) ↵Stéphane Wirtel2019-05-171-1/+1
| | | | | | | (GH-13385) (cherry picked from commit a8b46944d72bba6dc76260ed61da5c78d3f9d9c0) Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
* bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)Miss Islington (bot)2019-05-174-4/+8
| | | | | | | | | | The final addition (cur += step) may overflow, so use size_t for "cur". "cur" is always positive (even for negative steps), so it is safe to use size_t here. Co-Authored-By: Martin Panter <vadmium+py@gmail.com> (cherry picked from commit 14514d9084a40f599c57da853a305aa264562a43) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo:34848 : Correct an incorrect docstring for range().index method (GH-9877)Miss Islington (bot)2019-05-031-1/+1
| | | | | (cherry picked from commit 22c526394b2ef51b985873ddbfbcc32c16411919) Co-authored-by: Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) <thatiparthysreenivas@gmail.com>
* bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)Miss Islington (bot)2019-04-281-1/+3
| | | | | | https://bugs.python.org/issue36745 (cherry picked from commit e0dcb85b7d64153d1741698c04a6736c9669603a) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory ↵Victor Stinner2019-04-112-33/+18
| | | | | | | | | | | | | | | | | | | | | | | | (GH-12770) (GH-12788) * bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770) Replace _PyMem_IsFreed() function with _PyMem_IsPtrFreed() inline function. The function is now way more efficient, it became a simple comparison on integers, rather than a short loop. It detects also uninitialized bytes and "forbidden bytes" filled by debug hooks on memory allocators. Add unit tests on _PyObject_IsFreed(). (cherry picked from commit 2b00db68554422ec37faba2a80179a0172df6349) * bpo-36389: Change PyMem_SetupDebugHooks() constants (GH-12782) Modify CLEANBYTE, DEADDYTE and FORBIDDENBYTE constants: use 0xCD, 0xDD and 0xFD, rather than 0xCB, 0xBB and 0xFB, to use the same byte patterns than Windows CRT debug malloc() and free(). (cherry picked from commit 4c409beb4c360a73d054f37807d3daad58d1b567)
* bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603) (GH-12627)Miss Islington (bot)2019-03-301-0/+3
| | | | | | | The bug occurred when the encoded surrogate character is passed to the incremental decoder in two chunks. (cherry picked from commit 7a465cb5ee7e298cae626ace1fc3e7d97df79f2e) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)Miss Islington (bot)2019-03-261-6/+4
| | | | | | https://bugs.python.org/issue36433 (cherry picked from commit 871309c775fd4d72048bfaa31affd54f9934f7dd) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-36218: Fix handling of heterogeneous values in list.sort (GH-12209) ↵Miss Islington (bot)2019-03-251-11/+22
| | | | | | | GH-12532) (cherry picked from commit dd5417afcf8924bcdd7077351941ad21727ef644) Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
* bpo-36312: Fix decoders for some code pages. (GH-12369)Miss Islington (bot)2019-03-201-5/+16
| | | | | (cherry picked from commit c1e2c288f41cdc1c6e6e09d9a5277a58232ceb03) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36365: Fix compiler warning in structseq.c (GH-12451)Victor Stinner2019-03-201-4/+10
|
* [3.7] bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264). ↵Serhiy Storchaka2019-03-143-4/+4
| | | | | | | (GH-12322) (cherry picked from commit d53fe5f407ff4b529628b01a1bcbf21a6aad5c3a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). ↵Miss Islington (bot)2019-03-101-1/+1
| | | | | | | (GH-12252) (cherry picked from commit 8b91edadc06dcb0d391a65d1ecdf07dcb429df1b) Co-authored-by: sth <sth.dev@tejp.de>
* bpo-33989: Ensure that ms.key_compare is always initialized in ↵Miss Islington (bot)2019-02-211-0/+3
| | | | | | | list_sort_impl(). (GH-8710) (cherry picked from commit ebc793d6acb9650b9f497808e059805892031d74) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-31506: Clarify error messages for object.__new__ and object.__init__ ↵Miss Islington (bot)2019-02-191-3/+6
| | | | | | | | | | | (GH-11641) `object.__new__` and `object.__init__` do take one argument each, they just don't take extra user supplied arguments. Patch by Sanyam Khurana. (cherry picked from commit 5105483acb3aca318304bed056dcfd7e188fe4b5) Co-authored-by: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
* bpo-35992: Use PySequence_GetItem only if sq_item is not NULL (GH-11857)Miss Islington (bot)2019-02-171-2/+5
| | | | | | Not using `__class_getitem__()` fallback if there is a non-subcriptable metaclass was caused by a certain asymmetry between how `PySequenceMethods` and `PyMappingMethods` are used in `PyObject_GetItem`. This PR removes this asymmetry. No tests failed, so I assume it was not intentional. (cherry picked from commit ac28147e78c45a6217d348ce90ca5281d91f676f) Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
* bpo-35961: Fix a crash in slice_richcompare() (GH-11830)Miss Islington (bot)2019-02-131-24/+14
| | | | | | | | | | | Fix a crash in slice_richcompare(): use strong references rather than stolen references for the two temporary internal tuples. The crash (or assertion error) occurred if a garbage collection occurred during slice_richcompare(), especially while calling PyObject_RichCompare(t1, t2, op). (cherry picked from commit dcb68f47f74b0cc8a1896d4a4c5a6b83c0bbeeae) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-35552: Fix reading past the end in PyUnicode_FromFormat() and ↵Miss Islington (bot)2019-01-122-6/+18
| | | | | | | | | PyBytes_FromFormat(). (GH-11276) Format characters "%s" and "%V" in PyUnicode_FromFormat() and "%s" in PyBytes_FromFormat() no longer read memory past the limit if precision is specified. (cherry picked from commit d586ccb04f79863c819b212ec5b9d873964078e4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33817: Fix _PyBytes_Resize() for empty bytes object. (GH-11516)Miss Islington (bot)2019-01-111-0/+13
| | | | | | | Add also tests for PyUnicode_FromFormat() and PyBytes_FromFormat() with empty result. (cherry picked from commit 44cc4822bb3799858201e61294c5863f93ec12e2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35560: Remove assertion from format(float, "n") (GH-11288)Miss Islington (bot)2019-01-071-1/+1
| | | | | | | | Fix an assertion error in format() in debug build for floating point formatting with "n" format, zero padding and small width. Release build is not impacted. Patch by Karthikeyan Singaravelan. (cherry picked from commit 3f7983a25a3d19779283c707fbdd5bc91b1587ef) Co-authored-by: Xtreak <tir.karthi@gmail.com>
* closes bpo-35623: Fix integer overflow when sorting large lists (GH-11380)Miss Islington (bot)2019-01-011-1/+0
| | | | | | | | There is already a `Py_ssize_t i` defined at function scope that is used for similar loops. By removing the local `int i` declaration that `i` is used, which has the appropriate type. (cherry picked from commit f8b534477a2a51d85ea1663530f685f805f2b247) Co-authored-by: sth <sth.dev@tejp.de>
* bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. ↵Miss Islington (bot)2018-12-171-0/+4
| | | | | | | (GH-11175) (cherry picked from commit 842acaab1376c5c84fd5966bb6070e289880e1ca) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35444: Fix error handling when fail to look up builtin "getattr". ↵Serhiy Storchaka2018-12-113-23/+8
| | | | | (GH-11047) (GH-11107) (cherry picked from commit bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d)
* bpo-35454: Fix miscellaneous minor issues in error handling. (GH-11077)Miss Islington (bot)2018-12-101-9/+9
| | | | | | | | * bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference. (cherry picked from commit 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. ↵Zackery Spytz2018-12-071-1/+1
| | | | | (GH-11015) (GH-11020) (cherry picked from commit 4c49da0cb7434c676d70b9ccf38aca82ac0d64a9)
* bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)Miss Islington (bot)2018-12-031-5/+4
| | | | | (cherry picked from commit 4013c179117754b039957db4730880bf3285919d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33012: Fix more invalid function cast warnings with gcc 8. (GH-10751)Miss Islington (bot)2018-11-292-3/+3
| | | | | | Fix warnings with gcc 8 for wrapperfunc <-> wrapperfunc_kwds casts. (cherry picked from commit 1c607155c9e363489036ae6258b165a3fae75134) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34523, bpo-35322: Fix unicode_encode_locale() (GH-10759) (GH-10761)Victor Stinner2018-11-281-7/+5
| | | | | | | | Fix memory leak in PyUnicode_EncodeLocale() and PyUnicode_EncodeFSDefault() on error handling. Fix unicode_encode_locale() error handling. (cherry picked from commit bde9d6bbb46ca59bcee5d5060adaa33c3ffee3a6)
* bpo-33012: Fix signatures of METH_NOARGS functions. (GH-10736) (GH-10748)Serhiy Storchaka2018-11-271-1/+1
| | | | (cherry picked from commit 81524022d0c0df7a41f9b2b2df41e2ebe140e610)
* bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Miss Islington (bot)2018-11-277-51/+56
| | | | | | Fix also return type for few other functions (clear, releasebuffer). (cherry picked from commit d4f9cf5545d6d8844e0726552ef2e366f5cc3abd) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33954: Rewrite FILL() macro of unicodeobject.c (GH-10738)Victor Stinner2018-11-271-9/+17
| | | | | | | Copy code from master: add assertions on start and value, replace 'i' iterator with 'end' pointer for the loop stop condition. _PyUnicode_FastFill(): fix type of 'data', it must not be constant, since data is modified by FILL().
* bpo-33954: Fix _PyUnicode_InsertThousandsGrouping() (GH-10623) (GH-10718)Victor Stinner2018-11-262-225/+187
| | | | | | | | | | Fix str.format(), float.__format__() and complex.__format__() methods for non-ASCII decimal point when using the "n" formatter. Rewrite _PyUnicode_InsertThousandsGrouping(): it now requires a _PyUnicodeWriter object for the buffer and a Python str object for digits. (cherry picked from commit 59423e3ddd736387cef8f7632c71954c1859bed0)
* [3.7] bpo-9263: _PyObject_Dump() detects freed memory (GH-10061) (GH-10662)Victor Stinner2018-11-222-23/+76
| | | | | | | | | | | | | | | | | | | | | | | | * bpo-9263: _PyObject_Dump() detects freed memory (GH-10061) _PyObject_Dump() now uses an heuristic to check if the object memory has been freed: log "<freed object>" in that case. The heuristic rely on the debug hooks on Python memory allocators which fills the memory with DEADBYTE (0xDB) when memory is deallocated. Use PYTHONMALLOC=debug to always enable these debug hooks. (cherry picked from commit 82af0b63b07aa8d92b50098e382b458143cfc677) * bpo-9263: Fix _PyObject_Dump() for freed object (#10661) If _PyObject_Dump() detects that the object is freed, don't try to dump it (exit immediately). Enhance also _PyObject_IsFreed(): it now detects if the pointer itself looks like freed memory. (cherry picked from commit 2cf5d32fd9e61488e8b0be55a2e92a752ba8b06b)
* bpo-35269: Fix a possible segfault involving a newly-created coroutine ↵Miss Islington (bot)2018-11-181-1/+1
| | | | | | | | | | | | (GH-10585) coro->cr_origin wasn't initialized if compute_cr_origin() failed in PyCoro_New(), which would cause a crash during the coroutine's deallocation. https://bugs.python.org/issue35269 (cherry picked from commit 062a57bf4b768ef726975bcc1d34398387520147) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] bpo-35214: Fix OOB memory access in unicode escape parser (GH-10506) ↵Miss Islington (bot)2018-11-131-1/+1
| | | | | | | | | | | | | | | (GH-10522) Discovered using clang's MemorySanitizer when it ran python3's test_fstring test_misformed_unicode_character_name. An msan build will fail by simply executing: ./python -c 'u"\N"' (cherry picked from commit 746b2d35ea47005054ed774fecaed64fab803d7d) Co-authored-by: Gregory P. Smith <greg@krypto.org> https://bugs.python.org/issue35214
* bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)Miss Islington (bot)2018-11-121-1/+1
| | | | | | | Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER. Project based C Preprocessor namespacing at its finest. :P (cherry picked from commit 3015fb8ce4d25603434b9b44bb7effb98a481532) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* Disable getc_unlocked() with MemorySanitizer. (GH-10499)Miss Islington (bot)2018-11-121-1/+2
| | | | | | | clang's MemorySanitizer understand getc() but does not understand getc_unlocked(). Workaround: Don't use it on msan builds. (cherry picked from commit e6c77d8301ec1703abb755a7d3ce5bd8c999c082) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* closes bpo-35204: Disable thread and memory sanitizers for ↵Miss Islington (bot)2018-11-111-12/+31
| | | | | | | | | | | | address_in_range(). (GH-10442) This function may access memory which is mapped but is considered free by libc allocator. It behaves so by design, therefore we need to suppress sanitizer reports. GCC doesn't support MSan, so disable only TSan for it. (cherry picked from commit fd3a91cbf93dd7bd97f01add9c90075d63cd7316) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* Fix a possible crash in range.__reversed__(). (GH-10252)Miss Islington (bot)2018-10-311-0/+1
| | | | | (cherry picked from commit c9a6168924ffa4f3f78175998b392fe23d3edc50) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-34973: Fix crash in bytes constructor. (GH-9841)Miss Islington (bot)2018-10-211-35/+69
| | | | | | Constructing bytes from mutating list could cause a crash. (cherry picked from commit 914f9a078f997e58cfcfabcbb30fafdd1f277bef) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349). ↵Serhiy Storchaka2018-10-201-51/+19
| | | | | | (GH-10000) (cherry picked from commit 6f17e51345d930ccb4db306acc12b7d1f6c5e690)