summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40612: Fix SyntaxError edge cases in traceback formatting (GH-20072)Guido van Rossum2020-05-155-39/+94
| | | | | | | | | | | | | This fixes both the traceback.py module and the C code for formatting syntax errors (in Python/pythonrun.c). They now both consistently do the following: - Suppress caret if it points left of text - Allow caret pointing just past end of line - If caret points past end of line, clip to *just* past end of line The syntax error formatting code in traceback.py was mostly rewritten; small, subtle changes were applied to the C code in pythonrun.c. There's still a difference when the text contains embedded newlines. Neither handles these very well, and I don't think the case occurs in practice. Automerge-Triggered-By: @gvanrossum
* Update code comment re: location of struct _is. (GH-20067)Chris Jerdonek2020-05-151-1/+1
|
* bpo-40548: github actions: pass the changes check on no source changes ↵Filipe Laíns2020-05-151-1/+1
| | | | | (GH-20097) Signed-off-by: Filipe Laíns <lains@archlinux.org>
* bpo-40334: Correctly identify invalid target in assignment errors (GH-20076)Pablo Galindo2020-05-1510-44/+136
| | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-38872: Document exec symbol for codeop.compile_command (GH-20047)Joannah Nanjekye2020-05-153-5/+7
| | | | | | | * Document exec symbol for codeop.compile_command * Remove extra statements Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
* bpo-40462: Fix typo in test_json (GH-20094)Victor Stinner2020-05-141-1/+1
|
* bpo-40460: Fix typo in idlelib/zzdummy.py (GH-20093)Victor Stinner2020-05-141-1/+1
| | | Replace ztest with ztext.
* bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-19983)Filipe Laíns2020-05-141-0/+24
| | | Signed-off-by: Filipe Laíns <lains@archlinux.org>
* bpo-40602: _Py_hashtable_set() reports rehash failure (GH-20077)Victor Stinner2020-05-142-14/+26
| | | | If _Py_hashtable_set() fails to grow the hash table (rehash), it now fails rather than ignoring the error.
* bpo-40618: Disallow invalid targets in augassign and except clauses (GH-20083)Lysandros Nikolaou2020-05-145-46/+82
| | | | | | | | | This commit fixes the new parser to disallow invalid targets in the following scenarios: - Augmented assignments must only accept a single target (Name, Attribute or Subscript), but no tuples or lists. - `except` clauses should only accept a single `Name` as a target. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40619: Correctly handle error lines in programs without file mode (GH-20090)Pablo Galindo2020-05-142-25/+7
|
* bpo-40602: Write unit tests for _Py_hashtable_t (GH-20091)Victor Stinner2020-05-144-120/+151
| | | | | | | Cleanup also hashtable.c. Rename _Py_hashtable_t members: * Rename entries to nentries * Rename num_buckets to nbuckets
* Revert "bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)" ↵Victor Stinner2020-05-142-1325/+123
| | | | | | | | | | | (GH-20089) * Revert "bpo-40613: Remove compiler warning from _xxsubinterpretersmodule (GH-20069)" This reverts commit fa0a66e62d087765dbc5c1b89d6149a23ecfb0a6. * Revert "bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)" This reverts commit a1d9e0accd33af1d8e90fc48b34c13d7b07dcf57.
* bpo-40549: posixmodule.c uses defining_class (GH-20075)Victor Stinner2020-05-142-137/+132
| | | | | | | | | Pass PEP 573 defining_class to os.DirEntry methods. The module state is now retrieve from defining_class rather than Py_TYPE(self), to support subclasses (even if DirEntry doesn't support subclasses yet). * Pass the module rather than defining_class to DirEntry_fetch_stat(). * Only get the module state once in _posix_clear(), _posix_traverse() and _posixmodule_exec().
* bpo-40495: compileall option to hardlink duplicate pyc files (GH-19901)Lumír 'Frenzy' Balhar2020-05-146-15/+285
| | | | | | | compileall is now able to use hardlinks to prevent duplicates in a case when .pyc files for different optimization levels have the same content. Co-authored-by: Miro Hrončok <miro@hroncok.cz> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40275: Import locale module lazily in gettext (GH-19905)Hai Shi2020-05-141-1/+7
|
* bpo-40597: email: Use CTE if lines are longer than max_line_length ↵Arkadiusz Hiler2020-05-143-7/+23
| | | | | | | | | | | | | | | consistently (gh-20038) raw_data_manager (default for EmailPolicy, EmailMessage) does correct wrapping of 'text' parts as long as the message contains characters outside of 7bit US-ASCII set: base64 or qp Content-Transfer-Encoding is applied if the lines would be too long without it. It did not, however, do this for ascii-only text, which could result in lines that were longer than policy.max_line_length or even the rfc 998 maximum. This changeset fixes the heuristic so that if lines are longer than policy.max_line_length, it will always apply a content-transfer-encoding so that the lines are wrapped correctly.
* bpo-40521: Add PyInterpreterState.unicode (GH-20081)Victor Stinner2020-05-133-40/+48
| | | | | | | Move PyInterpreterState.fs_codec into a new PyInterpreterState.unicode structure. Give a name to the fs_codec structure and use this structure in unicodeobject.c.
* bpo-29587: Make gen.throw() chain exceptions with yield from (GH-19858)Chris Jerdonek2020-05-133-11/+57
| | | | | | | | | | | | The previous commits on bpo-29587 got exception chaining working with gen.throw() in the `yield` case. This patch also gets the `yield from` case working. As a consequence, implicit exception chaining now also works in the asyncio scenario of awaiting on a task when an exception is already active. Tests are included for both the asyncio case and the pure generator-only case.
* bpo-39465: Remove _PyUnicode_ClearStaticStrings() from C API (GH-20078)Victor Stinner2020-05-135-6/+8
| | | | Remove the _PyUnicode_ClearStaticStrings() function from the C API. Make the function fully private (declare it with "static").
* issue-25872: Fix KeyError using linecache from multiple threads (GH-18007)Michael Graczyk2020-05-131-3/+3
| | | | The crash that this fixes occurs when using traceback and other modules from multiple threads; del cache[filename] can raise a KeyError.
* bpo-38787: Fix Argument Clinic defining_class_converter (GH-20074)Victor Stinner2020-05-131-2/+7
| | | | | | | Don't hardcode defining_class parameter name to "cls": * Define CConverter.set_template_dict(): do nothing by default * CLanguage.render_function() now calls set_template_dict() on all converters.
* bpo-40334: Always show the caret on SyntaxErrors (GH-20050)Lysandros Nikolaou2020-05-135-192/+293
| | | | | | | | | | | | | | This commit fixes SyntaxError locations when the caret is not displayed, by doing the following: - `col_number` always gets set to the location of the offending node/expr. When no caret is to be displayed, this gets achieved by setting the object holding the error line to None. - Introduce a new function `_PyPegen_raise_error_known_location`, which can be called, when an arbitrary `lineno`/`col_offset` needs to be passed. This function then gets used in the grammar (through some new macros and inline functions) so that SyntaxError locations of the new parser match that of the old.
* bpo-34790: add version of removal of explicit passing of coros to ↵jack11422020-05-132-1/+2
| | | | `asyncio.wait`'s documentation (#20008)
* bpo-40613: Remove compiler warning from _xxsubinterpretersmodule (GH-20069)Dong-hee Na2020-05-131-0/+8
|
* bpo-40331: Increase test coverage for the statistics module (GH-19608)Tzanetos Balitsaris2020-05-131-0/+60
|
* bpo-40602: Optimize _Py_hashtable_get_ptr() (GH-20066)Victor Stinner2020-05-131-24/+23
| | | | | | | _Py_hashtable_get_entry_ptr() avoids comparing the entry hash: compare directly keys. Move _Py_hashtable_get_entry_ptr() just after _Py_hashtable_get_entry_generic().
* bpo-40609: _Py_hashtable_t values become void* (GH-20065)Victor Stinner2020-05-134-303/+140
| | | | | | | | | | | | | | | | | | | | | _Py_hashtable_t values become regular "void *" pointers. * Add _Py_hashtable_entry_t.data member * Remove _Py_hashtable_t.data_size member * Remove _Py_hashtable_t.get_func member. It is no longer needed to specialize _Py_hashtable_get() for a specific value size, since all entries now have the same size (void*). * Remove the following macros: * _Py_HASHTABLE_GET() * _Py_HASHTABLE_SET() * _Py_HASHTABLE_SET_NODATA() * _Py_HASHTABLE_POP() * Rename _Py_hashtable_pop() to _Py_hashtable_steal() * _Py_hashtable_foreach() callback now gets key and value rather than entry. * Remove _Py_hashtable_value_destroy_func type. value_destroy_func callback now only has a single parameter: data (void*).
* bpo-40609: _tracemalloc allocates traces (GH-20064)Victor Stinner2020-05-133-102/+117
| | | | | | | | | | | | | Rewrite _tracemalloc to store "trace_t*" rather than directly "trace_t" in traces hash tables. Traces are now allocated on the heap memory, outside the hash table. Add tracemalloc_copy_traces() and tracemalloc_copy_domains() helper functions. Remove _Py_hashtable_copy() function since there is no API to copy a key or a value. Remove also _Py_hashtable_delete() function which was commented.
* bpo-40609: Add destroy functions to _Py_hashtable (GH-20062)Victor Stinner2020-05-134-52/+73
| | | | | | Add key_destroy_func and value_destroy_func parameters to _Py_hashtable_new_full(). marshal.c and _tracemalloc.c use these destroy functions.
* bpo-40609: Remove _Py_hashtable_t.key_size (GH-20060)Victor Stinner2020-05-134-188/+120
| | | | | | | | | | Rewrite _Py_hashtable_t type to always store the key as a "const void *" pointer. Add an explicit "key" member to _Py_hashtable_entry_t. Remove _Py_hashtable_t.key_size member. hash and compare functions drop their hash table parameter, and their 'key' parameter type becomes "const void *".
* bpo-40609: Rewrite how _tracemalloc handles domains (GH-20059)Victor Stinner2020-05-122-160/+174
| | | | | | | | | | Rewrite how the _tracemalloc module stores traces of other domains. Rather than storing the domain inside the key, it now uses a new hash table with the domain as the key, and the data is a per-domain traces hash table. * Add tracemalloc_domain hash table. * Remove _Py_tracemalloc_config.use_domain. * Remove pointer_t and related functions.
* Fix Wikipedia link (GH-20031)Allen Guo2020-05-121-5/+5
|
* bpo-40501: Replace ctypes code in uuid with native module (GH-19948)Steve Dower2020-05-129-186/+248
|
* bpo-40602: Add _Py_HashPointerRaw() function (GH-20056)Victor Stinner2020-05-123-5/+13
| | | | | Add a new _Py_HashPointerRaw() function which avoids replacing -1 with -2 to micro-optimize hash table using pointer keys: using _Py_hashtable_hash_ptr() hash function.
* bpo-38787: Add PyCFunction_CheckExact() macro for exact type checks (GH-20024)scoder2020-05-125-4/+10
| | | | | … now that we allow subtypes of PyCFunction. Also add PyCMethod_CheckExact() and PyCMethod_Check() for checks against the PyCMethod subtype.
* bpo-40596: Fix str.isidentifier() for non-canonicalized strings containing ↵Serhiy Storchaka2020-05-123-4/+31
| | | | non-BMP characters on Windows. (GH-20053)
* bpo-40602: Optimize _Py_hashtable for pointer keys (GH-20051)Victor Stinner2020-05-122-94/+153
| | | | | | | | | | | | | | | Optimize _Py_hashtable_get() and _Py_hashtable_get_entry() for pointer keys: * key_size == sizeof(void*) * hash_func == _Py_hashtable_hash_ptr * compare_func == _Py_hashtable_compare_direct Changes: * Add get_func and get_entry_func members to _Py_hashtable_t * Convert _Py_hashtable_get() and _Py_hashtable_get_entry() functions to static nline functions. * Add specialized get and get entry for pointer keys.
* bpo-40593: Improve syntax errors for invalid characters in source code. ↵Serhiy Storchaka2020-05-1210-43/+90
| | | | (GH-20033)
* bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)Batuhan Taskaya2020-05-123-13/+0
| | | These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
* bpo-40480: restore ability to join fnmatch.translate() results (GH-20049)Tim Peters2020-05-122-7/+34
| | | | | | | In translate(), generate unique group names across calls. The restores the undocumented ability to get a valid regexp by joining multiple translate() results via `|`.
* bpo-40602: _Py_hashtable_new() uses PyMem_Malloc() (GH-20046)Victor Stinner2020-05-121-3/+4
| | | | | | | _Py_hashtable_new() now uses PyMem_Malloc/PyMem_Free allocator by default, rather than PyMem_RawMalloc/PyMem_RawFree. PyMem_Malloc is faster than PyMem_RawMalloc for memory blocks smaller than or equal to 512 bytes.
* bpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)Victor Stinner2020-05-128-13/+26
| | | | | | | * Move Modules/hashtable.h to Include/internal/pycore_hashtable.h * Move Modules/hashtable.c to Python/hashtable.c * Python is now linked to hashtable.c. _tracemalloc is no longer linked to hashtable.c. Previously, marshal.c got hashtable.c via _tracemalloc.c which is built as a builtin module.
* bpo-40571: Make lru_cache(maxsize=None) more discoverable (GH-20019)Raymond Hettinger2020-05-124-1/+57
|
* bpo-39465: Don't access directly _Py_Identifier members (GH-20043)Victor Stinner2020-05-114-11/+11
| | | | | * Replace id->object with _PyUnicode_FromId(&id) * Use _Py_static_string_init(str) macro to initialize statically name_op in typeobject.c.
* bpo-40334: produce specialized errors for invalid del targets (GH-19911)Shantanu2020-05-114-181/+352
|
* bpo-40584: Update PyType_FromModuleAndSpec() to process tp_vectorcall_offset ↵Hai Shi2020-05-113-5/+18
| | | | (GH-20026)
* bpo-40561: Add docstrings for webbrowser open functions (GH-19999)Brad Solomon2020-05-112-0/+17
| | | | Co-authored-by: Brad Solomon <brsolomon@deloitte.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-36346: array: Don't use deprecated APIs (GH-19653)Inada Naoki2020-05-114-55/+63
| | | | | | | | * Py_UNICODE -> wchar_t * Py_UNICODE -> unicode in Argument Clinic * PyUnicode_AsUnicode -> PyUnicode_AsWideCharString * Don't use "u#" format. Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40575: Avoid unnecessary overhead in _PyDict_GetItemIdWithError() (GH-20018)scoder2020-05-111-1/+3
| | | | | Avoid unnecessary overhead in _PyDict_GetItemIdWithError() by calling _PyDict_GetItem_KnownHash() instead of the more generic PyDict_GetItemWithError(), since we already know the hash of interned strings.