summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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-111-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-141-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-131-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-131-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)
* bpo-34574: Prevent OrderedDict iterators from exhaustion during pickling. ↵Miss Islington (bot)2018-10-201-28/+9
| | | | | | | (GH-9051) (cherry picked from commit a5259fb05d03f4871837c14fed704541a20896c0) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
* bpo-1621: Avoid signed integer overflow in set_table_resize() (GH-9059) ↵Miss Islington (bot)2018-10-191-8/+3
| | | | | | | (GH-9198) Address a C undefined behavior signed integer overflow issue in set object table resizing. Our -fwrapv compiler flag and practical reasons why sets are unlikely to get this large should mean this was never an issue but it was incorrect code that generates code analysis warnings. Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
* bpo-34974: Do not replace unexpected errors in bytes() and bytearray(). ↵Miss Islington (bot)2018-10-142-3/+5
| | | | | | | | | (GH-9852) bytes and bytearray constructors converted unexpected exceptions (e.g. MemoryError and KeyboardInterrupt) to TypeError. (cherry picked from commit e890421e334ccf0c000c6b29c4a521d86cd12f47) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34910: Ensure that PyObject_Print() always returns -1 on error. (GH-9733)Miss Islington (bot)2018-10-061-2/+3
| | | | | (cherry picked from commit ae62f015240c9162773341a9922794e6b960779d) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-34899: Fix a possible assertion failure due to int_from_bytes_impl() ↵Miss Islington (bot)2018-10-051-1/+1
| | | | | | | | | (GH-9705) The _PyLong_FromByteArray() call in int_from_bytes_impl() was unchecked. (cherry picked from commit 7bb9cd0a6766fd3e7b3c1e8f2315304ae192b34c) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-34879: Fix a possible null pointer dereference in bytesobject.c (GH-9683)Miss Islington (bot)2018-10-031-1/+1
| | | | | | | | formatfloat() was not checking if PyBytes_FromStringAndSize() failed, which could lead to a null pointer dereference in _PyBytes_FormatEx(). (cherry picked from commit 96c593279400693226d5a560c420ae0fcf1731b9) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-34320: Fix dict(o) didn't copy order of dict subclass (GH-8624)Miss Islington (bot)2018-09-261-1/+3
| | | | | | | | | When dict subclass overrides order (`__iter__()`, `keys()`, and `items()`), `dict(o)` should use it instead of dict ordering. https://bugs.python.org/issue34320 (cherry picked from commit 2aaf98c16ae3070378de523a173e29644037d8bd) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* [3.7] Fix misleading mentions of tp_size in comments. (GH-9136)Benjamin Peterson2018-09-102-3/+3
| | | | | | | Many type object initializations labeled a field "tp_size" in the comment, but the name of that field is tp_basicsize.. (cherry picked from commit 0e0bc4e221f592f305d335faf5f8046484eb9238) Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
* bpo-25750: fix refcounts in type_getattro() (GH-6118)Miss Islington (bot)2018-09-071-6/+11
| | | | | | | When calling tp_descr_get(self, obj, type), make sure that we own a strong reference to "self". (cherry picked from commit 8f735485acf2e35a75d2fa019feb8f905598c4e5) Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>
* closes bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935)Miss Islington (bot)2018-08-261-1/+1
| | | | | | Reported by Svace static analyzer. (cherry picked from commit b57b4ac042b977e0b42a2f5ddb30ca7edffacfa9) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* closes bpo-34501: PyType_FromSpecWithBases: Check spec->name before ↵Miss Islington (bot)2018-08-251-4/+9
| | | | | | | | dereferencing it. (GH-8930) Reported by Svace static analyzer. (cherry picked from commit 5f79b50763d687aeeed8edcb4efcc7ac9f8fa186) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* closes bpo-34493: Objects/genobject.c: Add missing NULL check to ↵Miss Islington (bot)2018-08-251-0/+3
| | | | | | | compute_cr_origin() (GH-8911) (cherry picked from commit 8fdd331bbf7e60dd81c02c7077f44c7939e2a05d) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* closes bpo-34468: Objects/rangeobject.c: Fix an always-false condition in ↵Miss Islington (bot)2018-08-241-4/+4
| | | | | | | | | | | range_repr() (GH-8880) Also, propagate the error from PyNumber_AsSsize_t() because we don't care only about OverflowError which is not reported if the second argument is NULL. Reported by Svace static analyzer. (cherry picked from commit 7ecae3ca0bda3cacf3b0125bae0bc718a17cc071) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* closes bpo-34477: Objects/typeobject.c: Add missing NULL check to ↵Miss Islington (bot)2018-08-241-0/+3
| | | | | | | | type_init() (GH-8876) Reported by Svace static analyzer. (cherry picked from commit f6247aac08c1a79d0479145a405718bb76dba434) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-34436: Fix check that disables overallocation for the last fmt specifier ↵Miss Islington (bot)2018-08-231-3/+3
| | | | | | | | (GH-8826) Reported by Svace static analyzer. (cherry picked from commit ccd99752675042bd5f67d332c5b0ed85ba1f2da3) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-34435: Add missing NULL check to unicode_encode_ucs1(). (GH-8823)Miss Islington (bot)2018-08-191-2/+3
| | | | | | Reported by Svace static analyzer. (cherry picked from commit 74a307d48ef8b278c4629ca0ef2139be1c9a34e6) Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
* bpo-24618: Add a check in the code constructor. (GH-8283)Miss Islington (bot)2018-07-161-3/+15
| | | | | | Check that the size of the varnames tuple is enough at least for all arguments. (cherry picked from commit bd47384e07bde38a8f18b90b4cea02a505d95c75) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34087: Fix buffer overflow in int(s) and similar functions (GH-8274)Miss Islington (bot)2018-07-141-0/+2
| | | | | | | | | `_PyUnicode_TransformDecimalAndSpaceToASCII()` missed trailing NUL char. It caused buffer overflow in `_Py_string_to_number_with_underscores()`. This bug is introduced in 9b6c60cb. (cherry picked from commit 16dfca4d829e45f36e71bf43f83226659ce49315) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-34042: Fix dict.copy() to maintain correct total refcount (GH-8119)Miss Islington (bot)2018-07-061-0/+7
| | | | | (cherry picked from commit 0b75228700e0077d8bf2636e74733389514b4b2f) Co-authored-by: Yury Selivanov <yury@magic.io>
* fix two typos in Objects/odictobject.c comments (GH-8040)Miss Islington (bot)2018-07-061-2/+2
| | | | | (cherry picked from commit 6f19fc6d5607040ee36153a64a2ed004582af91f) Co-authored-by: Robert Krzyzanowski <technoguyrob@gmail.com>
* update to Unicode 11.0.0 (closes bpo-33778) (GH-7439) (GH-7470)Miss Islington (bot)2018-06-071-724/+946
| | | | | | Also, standardize indentation of generated tables. (cherry picked from commit 7c69c1c0fba8c1c8ff3969bce4c1135736a4cc58) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* Fix typo in __mul__ and __rmul__ docstring (GH-6674)Miss Islington (bot)2018-05-091-2/+2
| | | | | (cherry picked from commit 0904f766e116c269675317e11368a4d29eef0bc6) Co-authored-by: Grant Jenks <grant.jenks@gmail.com>
* bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)Miss Islington (bot)2018-05-021-1/+3
| | | | | (cherry picked from commit 491bbedc209fea314a04cb3015da68fb0aa63238) Co-authored-by: lekma <lekmalek@gmail.com>
* Spelling fixes to docs, docstrings, and comments (GH-6374)Miss Islington (bot)2018-04-201-1/+1
| | | | | (cherry picked from commit 61f82e0e337f971da57f8f513abfe693edf95aa5) Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
* bpo-33312: Fix clang ubsan out of bounds warnings in dict. (GH-6537) (GH-6543)Miss Islington (bot)2018-04-202-24/+14
| | | | | | | | | | | | | | | | | | | | | Fix clang ubsan (undefined behavior sanitizer) warnings in dictobject.c by adjusting how the internal struct _dictkeysobject shared keys structure is declared. This remains ABI compatible. We get rid of the union at the end of the struct being used for conveinence to avoid typecasting in favor of char[] variable length array at the end of a struct. This is known to clang to be used for variable sized objects and will not cause an undefined behavior problem. Similarly, char arrays do not have strict aliasing undefined behavior when cast. PEP-007 does not currently list variable length arrays (VLAs) as allowed in our subset of C99. If this turns out to be a problem, the fix to this is to change the char `dk_indices[]` into `dk_indices[1]` and restore the three size computation subtractions this change removes: `- Py_MEMBER_SIZE(PyDictKeysObject, dk_indices)` If this works as is I'll make a separate PR to update PEP-007. (cherry picked from commit 397f1b28c4a12e3b3ed59a89599eabc457412649)
* bpo-33205: dict: Change GROWTH_RATE to `used*3` (GH-6350)Miss Islington (bot)2018-04-171-6/+5
| | | | | (cherry picked from commit 5fbc511f56688654a05b9eba23d140318bb9b2d5) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* [3.7] bpo-33031: Remove dead code in C implementation of OrderedDict. ↵Serhiy Storchaka2018-04-091-76/+1
| | | | | | | | (GH-6120) (GH-6433) This code doesn't have effect on the final result, but causes GCC 8 warnings and can have an undefined behavior. (cherry picked from commit 827d49f3cf0296f1e267eae6834a977cf312cc1e)
* bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)Miss Islington (bot)2018-04-031-0/+1
| | | | | (cherry picked from commit d1c82c5cc7be0c21dddf86fd19c1702f6218459b) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* Fix typo and edit for clarity in the docstrings of sys.float_info. (GH-2251)Miss Islington (bot)2018-03-261-3/+2
| | | | | (cherry picked from commit 0301c9bdd1ebd788d1334cf3fe06c48f35bab0dc) Co-authored-by: Stefano Taschini <taschini@users.noreply.github.com>
* bpo-32374: m_traverse may be called with m_state=NULL (GH-5140)Miss Islington (bot)2018-03-171-0/+21
| | | | | | | | Multi-phase initialized modules allow m_traverse to be called while the module is still being initialized, so module authors may need to account for that. (cherry picked from commit c2b0b12d1a137ada1023ab7c10b8d9a0249d95f9) Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com>
* [3.7] bpo-17288: Prevent jumps from 'return' and 'exception' trace events. ↵xdegaye2018-03-131-4/+36
| | | | (GH-5928)