summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* [3.7] bpo-33026: Fix jumping out of "with" block by setting f_lineno. ↵Serhiy Storchaka2018-03-111-0/+7
| | | | | | | (GH-6026). (#6074) (cherry picked from commit 26c9f565d016db21257a60d29ab2c99383dd5ac7) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)Miss Islington (bot)2018-02-223-3/+4
| | | | | (cherry picked from commit 745dc65b17b3936e3f9f4099f735f174d30c4e0c) Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
* bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)Miss Islington (bot)2018-02-132-6/+6
| | | | | (cherry picked from commit d019bc8319ea35e93bf4baa38098ff1b57cd3ee5) Co-authored-by: Oren Milman <orenmn@gmail.com>
* bpo-32827: Fix usage of _PyUnicodeWriter_Prepare() in decoding errors ↵Miss Islington (bot)2018-02-131-7/+3
| | | | | | | | handler. (GH-5636) (GH-5650) (cherry picked from commit b7e2d67f7c035f09c921ca4e7a36529cd502ccf7) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.7] bpo-32746: Fix multiple typos (GH-5144) (GH-5520)Miss Islington (bot)2018-02-043-3/+3
| | | | | | Fix typos found by codespell in docs, docstrings, and comments. (cherry picked from commit c3d9508ff22ece9a96892b628dd5813e2fb0cd80) Co-authored-by: Leo Arias <leo.arias@canonical.com>
* bpo-32583: Fix possible crashing in builtin Unicode decoders (#5325)Xiang Zhang2018-01-311-2/+20
| | | | | When using customized decode error handlers, it is possible for builtin decoders to write out-of-bounds and then crash.
* bpo-32703: Fix coroutine resource warning in case where there's an error ↵Yury Selivanov2018-01-291-6/+7
| | | | | (GH-5410) The commit removes one unnecessary "if" clause in genobject.c. That "if" clause was masking un-awaited coroutines warnings just to make writing unittests more convenient.
* bpo-28685: Fix compiler warning (GH-5423)Victor Stinner2018-01-291-1/+2
|
* bpo-28685: Optimize sorted() list.sort() with type-specialized comparisons ↵embg2018-01-292-71/+345
| | | | (#582)
* bpo-32690: Preserve order of locals() (#5379)Raymond Hettinger2018-01-281-2/+2
|
* bpo-32685: Improve suggestion for print statement (GH-5375)Nitish Chandra2018-01-281-14/+19
| | | | | | | Better account for single-line compound statements and semi-colon separated statements when suggesting Py3 replacements for Py2 print statements. Initial patch by Nitish Chandra.
* bpo-32677: Optimize str.isascii() (GH-5356)INADA Naoki2018-01-281-4/+36
|
* Fix wrong assert in unicodeobject (GH-5340)INADA Naoki2018-01-271-1/+1
|
* bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)INADA Naoki2018-01-276-1/+72
|
* bpo-32670: Enforce PEP 479. (#5327)Yury Selivanov2018-01-261-50/+8
|
* bpo-18533: Avoid RecursionError from repr() of recursive dictview (#4823)bennorth2018-01-261-4/+12
| | | | | | | | | | | | | | | | | dictview_repr(): Use a Py_ReprEnter() / Py_ReprLeave() pair to check for recursion, and produce "..." if so. test_recursive_repr(): Check for the string rather than a RecursionError. (Test cannot be any tighter as contents are implementation-dependent.) test_deeply_nested_repr(): Add new test, replacing the original test_recursive_repr(). It checks that a RecursionError is raised in the case of a non-recursive but deeply nested structure. (Very similar to what test_repr_deep() in test/test_dict.py does for a normal dict.) OrderedDictTests: Add new test case, to test behavior on OrderedDict instances containing their own values() or items().
* bpo-32571: Fix reading uninitialized memory (GH-5332)INADA Naoki2018-01-261-0/+5
| | | Reported by Coverity Scan.
* bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code ↵Serhiy Storchaka2018-01-257-131/+106
| | | | | (GH-5222) Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-231-0/+1
|
* bpo-31179: Make dict.copy() up to 5.5 times faster. (#3067)Yury Selivanov2018-01-221-0/+73
|
* bpo-32591: Add native coroutine origin tracking (#5250)Nathaniel J. Smith2018-01-211-4/+57
| | | | | | * Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread
* bpo-32028: Fix suggestions for indented print statements (GH-4688)Sanyam Khurana2018-01-201-5/+11
| | | | | | | The suggested replacement for print statements previously failed to account for leading whitespace and hence could end up including unwanted text in the proposed call to the print builtin. Patch by Sanyam Khurana.
* Removed unnecesssary bit inversion which doesn't improve dispersion ↵Raymond Hettinger2018-01-181-1/+1
| | | | statistics (#5235)
* bpo-32544: Speed up hasattr() and getattr() (GH-5173)INADA Naoki2018-01-161-6/+50
| | | | | AttributeError was raised always when attribute is not found. This commit skip raising AttributeError when `tp_getattro` is `PyObject_GenericGetAttr`. It makes hasattr() and getattr() about 4x faster when attribute is not found.
* bpo-26163: Frozenset hash improvement (#5194)Raymond Hettinger2018-01-161-0/+1
|
* bpo-29240: Fix locale encodings in UTF-8 Mode (#5170)Victor Stinner2018-01-151-331/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | Modify locale.localeconv(), time.tzname, os.strerror() and other functions to ignore the UTF-8 Mode: always use the current locale encoding. Changes: * Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx(). On decoding or encoding error, they return the position of the error and an error message which are used to raise Unicode errors in PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale(). * Replace _Py_DecodeCurrentLocale() with _Py_DecodeLocaleEx(). * PyUnicode_DecodeLocale() now uses _Py_DecodeLocaleEx() for all cases, especially for the strict error handler. * Add _Py_DecodeUTF8Ex(): return more information on decoding error and supports the strict error handler. * Rename _Py_EncodeUTF8_surrogateescape() to _Py_EncodeUTF8Ex(). * Replace _Py_EncodeCurrentLocale() with _Py_EncodeLocaleEx(). * Ignore the UTF-8 mode to encode/decode localeconv(), strerror() and time zone name. * Remove PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and PyUnicode_EncodeLocale() now ignore the UTF-8 mode: always use the "current" locale. * Remove _PyUnicode_DecodeCurrentLocale(), _PyUnicode_DecodeCurrentLocaleAndSize() and _PyUnicode_EncodeCurrentLocale().
* bpo-29476: Simplify set_add_entry() (#5175)Raymond Hettinger2018-01-141-2/+2
|
* bpo-29240: Ignore UTF-8 Mode in time module (#5148)Victor Stinner2018-01-111-0/+6
| | | | | | time.strftime() must use the current LC_CTYPE encoding, not UTF-8 if the UTF-8 mode is enabled. Add _PyUnicode_DecodeCurrentLocale() function.
* bpo-29240: readline now ignores the UTF-8 Mode (#5145)Victor Stinner2018-01-101-10/+52
| | | | | | | | | | | | Add new fuctions ignoring the UTF-8 mode: * _Py_DecodeCurrentLocale() * _Py_EncodeCurrentLocale() * _PyUnicode_DecodeCurrentLocaleAndSize() * _PyUnicode_EncodeCurrentLocale() Modify the readline module to use these functions. Re-enable test_readline.test_nonascii().
* bpo-32226: Make __class_getitem__ an automatic class method. (#5098)Serhiy Storchaka2018-01-042-4/+17
|
* Fix outdated comment in typeobject.c (GH-5090)Berker Peksag2018-01-041-1/+1
| | | | | The comment was added in 3abca127fe1565ec80f6b0a1ae48d65186ad887d. In d78448e912126410117723c7d240bbdfff06df16, it was changed to use PyArg_ParseTuple instead.
* bpo-32468: Better frame repr() (#5067)Antoine Pitrou2017-12-311-1/+10
| | | | bpo-32468: Better frame repr()
* bpo-32030: Add _Py_EncodeLocaleRaw() (#4961)Victor Stinner2017-12-211-4/+21
| | | | | | | | | | | | Replace Py_EncodeLocale() with _Py_EncodeLocaleRaw() in: * _Py_wfopen() * _Py_wreadlink() * _Py_wrealpath() * _Py_wstat() * pymain_open_filename() These functions are called early during Python intialization, only the RAW memory allocator must be used.
* bpo-32030: Add _Py_EncodeUTF8_surrogateescape() (#4960)Victor Stinner2017-12-211-0/+89
| | | | | Py_EncodeLocale() now uses _Py_EncodeUTF8_surrogateescape(), instead of using temporary unicode and bytes objects. So Py_EncodeLocale() doesn't use the Python C API anymore.
* bpo-32385: Clean up the C3 MRO algorithm implementation. (#4942)Serhiy Storchaka2017-12-201-77/+64
| | | Use tuples and raw arrays instead of lists.
* bpo-32379: Faster MRO computation for single inheritance (#4932)Antoine Pitrou2017-12-201-4/+36
| | | | * bpo-32379: Faster MRO computation for single inheritance
* bpo-32240: Add the const qualifier to declarations of PyObject* array ↵Serhiy Storchaka2017-12-1513-85/+89
| | | | arguments. (#4746)
* bpo-32226: Implementation of PEP 560 (core components) (#4732)Ivan Levkivskyi2017-12-142-0/+36
| | | | | This part of the PEP implementation adds support for __mro_entries__ and __class_getitem__ by updating __build_class__ and PyObject_GetItem.
* bpo-32225: Implementation of PEP 562 (#4731)Ivan Levkivskyi2017-12-141-4/+18
| | | | | Implement PEP 562: module __getattr__ and __dir__. The implementation simply updates module_getattro and module_dir.