]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
5 years agoissue-25872: Fix KeyError using linecache from multiple threads (GH-18007)
Michael Graczyk [Wed, 13 May 2020 22:41:57 +0000 (17:41 -0500)] 
issue-25872: Fix KeyError using linecache from multiple threads (GH-18007)

The crash that this fixes occurs when using traceback and other modules from multiple threads;
del cache[filename] can raise a KeyError.

5 years agobpo-38787: Fix Argument Clinic defining_class_converter (GH-20074)
Victor Stinner [Wed, 13 May 2020 22:31:31 +0000 (00:31 +0200)] 
bpo-38787: Fix Argument Clinic defining_class_converter (GH-20074)

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.

5 years agobpo-40334: Always show the caret on SyntaxErrors (GH-20050)
Lysandros Nikolaou [Wed, 13 May 2020 19:36:27 +0000 (22:36 +0300)] 
bpo-40334: Always show the caret on SyntaxErrors (GH-20050)

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.

5 years agobpo-34790: add version of removal of explicit passing of coros to `asyncio.wait`...
jack1142 [Wed, 13 May 2020 18:55:12 +0000 (20:55 +0200)] 
bpo-34790: add version of removal of explicit passing of coros to `asyncio.wait`'s documentation (#20008)

5 years agobpo-40613: Remove compiler warning from _xxsubinterpretersmodule (GH-20069)
Dong-hee Na [Wed, 13 May 2020 13:38:27 +0000 (22:38 +0900)] 
bpo-40613: Remove compiler warning from _xxsubinterpretersmodule (GH-20069)

5 years agobpo-40331: Increase test coverage for the statistics module (GH-19608)
Tzanetos Balitsaris [Wed, 13 May 2020 10:29:31 +0000 (13:29 +0300)] 
bpo-40331: Increase test coverage for the statistics module (GH-19608)

5 years agobpo-40602: Optimize _Py_hashtable_get_ptr() (GH-20066)
Victor Stinner [Wed, 13 May 2020 03:36:23 +0000 (05:36 +0200)] 
bpo-40602: Optimize _Py_hashtable_get_ptr() (GH-20066)

_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().

5 years agobpo-40609: _Py_hashtable_t values become void* (GH-20065)
Victor Stinner [Wed, 13 May 2020 02:40:30 +0000 (04:40 +0200)] 
bpo-40609: _Py_hashtable_t values become void* (GH-20065)

_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*).

5 years agobpo-40609: _tracemalloc allocates traces (GH-20064)
Victor Stinner [Wed, 13 May 2020 01:52:11 +0000 (03:52 +0200)] 
bpo-40609: _tracemalloc allocates traces (GH-20064)

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.

5 years agobpo-40609: Add destroy functions to _Py_hashtable (GH-20062)
Victor Stinner [Wed, 13 May 2020 00:50:18 +0000 (02:50 +0200)] 
bpo-40609: Add destroy functions to _Py_hashtable (GH-20062)

Add key_destroy_func and value_destroy_func parameters to
_Py_hashtable_new_full().

marshal.c and _tracemalloc.c use these destroy functions.

5 years agobpo-40609: Remove _Py_hashtable_t.key_size (GH-20060)
Victor Stinner [Wed, 13 May 2020 00:26:02 +0000 (02:26 +0200)] 
bpo-40609: Remove _Py_hashtable_t.key_size (GH-20060)

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 *".

5 years agobpo-40609: Rewrite how _tracemalloc handles domains (GH-20059)
Victor Stinner [Tue, 12 May 2020 23:36:47 +0000 (01:36 +0200)] 
bpo-40609: Rewrite how _tracemalloc handles domains (GH-20059)

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.

5 years agoFix Wikipedia link (GH-20031)
Allen Guo [Tue, 12 May 2020 22:54:18 +0000 (18:54 -0400)] 
Fix Wikipedia link (GH-20031)

5 years agobpo-40501: Replace ctypes code in uuid with native module (GH-19948)
Steve Dower [Tue, 12 May 2020 22:32:32 +0000 (23:32 +0100)] 
bpo-40501: Replace ctypes code in uuid with native module (GH-19948)

5 years agobpo-40602: Add _Py_HashPointerRaw() function (GH-20056)
Victor Stinner [Tue, 12 May 2020 16:46:20 +0000 (18:46 +0200)] 
bpo-40602: Add _Py_HashPointerRaw() function (GH-20056)

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.

5 years agobpo-38787: Add PyCFunction_CheckExact() macro for exact type checks (GH-20024)
scoder [Tue, 12 May 2020 14:12:41 +0000 (16:12 +0200)] 
bpo-38787: Add PyCFunction_CheckExact() macro for exact type checks (GH-20024)

… now that we allow subtypes of PyCFunction.

Also add PyCMethod_CheckExact() and PyCMethod_Check() for checks against the PyCMethod subtype.

5 years agobpo-40596: Fix str.isidentifier() for non-canonicalized strings containing non-BMP...
Serhiy Storchaka [Tue, 12 May 2020 13:18:00 +0000 (16:18 +0300)] 
bpo-40596: Fix str.isidentifier() for non-canonicalized strings containing non-BMP characters on Windows. (GH-20053)

5 years agobpo-40602: Optimize _Py_hashtable for pointer keys (GH-20051)
Victor Stinner [Tue, 12 May 2020 11:31:59 +0000 (13:31 +0200)] 
bpo-40602: Optimize _Py_hashtable for pointer keys (GH-20051)

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.

5 years agobpo-40593: Improve syntax errors for invalid characters in source code. (GH-20033)
Serhiy Storchaka [Tue, 12 May 2020 09:42:04 +0000 (12:42 +0300)] 
bpo-40593: Improve syntax errors for invalid characters in source code. (GH-20033)

5 years agobpo-39481: remove generic classes from ipaddress/mmap (GH-20045)
Batuhan Taskaya [Tue, 12 May 2020 02:32:40 +0000 (05:32 +0300)] 
bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)

These were added by mistake (see https://bugs.python.org/issue39481#msg366288).

5 years agobpo-40480: restore ability to join fnmatch.translate() results (GH-20049)
Tim Peters [Tue, 12 May 2020 02:19:20 +0000 (21:19 -0500)] 
bpo-40480: restore ability to join fnmatch.translate() results (GH-20049)

In translate(), generate unique group names across calls.

The restores the undocumented ability to get a valid regexp
by joining multiple translate() results via `|`.

5 years agobpo-40602: _Py_hashtable_new() uses PyMem_Malloc() (GH-20046)
Victor Stinner [Tue, 12 May 2020 01:07:40 +0000 (03:07 +0200)] 
bpo-40602: _Py_hashtable_new() uses PyMem_Malloc() (GH-20046)

_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.

5 years agobpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)
Victor Stinner [Tue, 12 May 2020 00:42:19 +0000 (02:42 +0200)] 
bpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)

* 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.

5 years agobpo-40571: Make lru_cache(maxsize=None) more discoverable (GH-20019)
Raymond Hettinger [Tue, 12 May 2020 00:00:53 +0000 (17:00 -0700)] 
bpo-40571: Make lru_cache(maxsize=None) more discoverable (GH-20019)

5 years agobpo-39465: Don't access directly _Py_Identifier members (GH-20043)
Victor Stinner [Mon, 11 May 2020 23:43:38 +0000 (01:43 +0200)] 
bpo-39465: Don't access directly _Py_Identifier members (GH-20043)

* Replace id->object with _PyUnicode_FromId(&id)
* Use _Py_static_string_init(str) macro to initialize statically
  name_op in typeobject.c.

5 years agobpo-40334: produce specialized errors for invalid del targets (GH-19911)
Shantanu [Mon, 11 May 2020 21:53:58 +0000 (14:53 -0700)] 
bpo-40334: produce specialized errors for invalid del targets (GH-19911)

5 years agobpo-40584: Update PyType_FromModuleAndSpec() to process tp_vectorcall_offset (GH...
Hai Shi [Mon, 11 May 2020 21:38:55 +0000 (05:38 +0800)] 
bpo-40584: Update PyType_FromModuleAndSpec() to process tp_vectorcall_offset (GH-20026)

5 years agobpo-40561: Add docstrings for webbrowser open functions (GH-19999)
Brad Solomon [Mon, 11 May 2020 18:50:11 +0000 (14:50 -0400)] 
bpo-40561: Add docstrings for webbrowser open functions (GH-19999)

Co-authored-by: Brad Solomon <brsolomon@deloitte.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
5 years agobpo-36346: array: Don't use deprecated APIs (GH-19653)
Inada Naoki [Mon, 11 May 2020 06:37:25 +0000 (15:37 +0900)] 
bpo-36346: array: Don't use deprecated APIs (GH-19653)

* 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>
5 years agobpo-40575: Avoid unnecessary overhead in _PyDict_GetItemIdWithError() (GH-20018)
scoder [Mon, 11 May 2020 04:04:31 +0000 (06:04 +0200)] 
bpo-40575: Avoid unnecessary overhead in _PyDict_GetItemIdWithError() (GH-20018)

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.

5 years agobpo-40585: Normalize errors messages in codeop when comparing them (GH-20030)
Pablo Galindo [Mon, 11 May 2020 00:41:26 +0000 (01:41 +0100)] 
bpo-40585: Normalize errors messages in codeop when comparing them (GH-20030)

With the new parser, the error message contains always the trailing
newlines, causing the comparison of the repr of the error messages
in codeop to fail. This commit makes the new parser mirror the old parser's
behaviour regarding trailing newlines.

5 years agoImprove code clarity for the set lookup logic (GH-20028)
Raymond Hettinger [Sun, 10 May 2020 21:53:29 +0000 (14:53 -0700)] 
Improve code clarity for the set lookup logic (GH-20028)

5 years agobpo-40257: Tweak docstrings for special generic aliases. (GH-20022)
Serhiy Storchaka [Sun, 10 May 2020 12:14:27 +0000 (15:14 +0300)] 
bpo-40257: Tweak docstrings for special generic aliases. (GH-20022)

* Add the terminating period.
* Omit module name for builtin types.

5 years agobpo-40397: Fix subscription of nested generic alias without parameters. (GH-20021)
Serhiy Storchaka [Sun, 10 May 2020 10:39:40 +0000 (13:39 +0300)] 
bpo-40397: Fix subscription of nested generic alias without parameters. (GH-20021)

5 years agobpo-37986: Improve perfomance of PyLong_FromDouble() (GH-15611)
Sergey Fedoseev [Sun, 10 May 2020 09:15:57 +0000 (14:15 +0500)] 
bpo-37986: Improve perfomance of PyLong_FromDouble() (GH-15611)

* bpo-37986: Improve perfomance of PyLong_FromDouble()

* Use strict bound check for safety and symmetry

* Remove possibly outdated performance claims

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
5 years agobpo-40549: Convert posixmodule.c to multiphase init (GH-19982)
Victor Stinner [Sun, 10 May 2020 09:05:29 +0000 (11:05 +0200)] 
bpo-40549: Convert posixmodule.c to multiphase init (GH-19982)

Convert posixmodule.c ("posix" or "nt" module) to the multiphase
initialization (PEP 489).

* Create the module using PyModuleDef_Init().
* Create ScandirIteratorType and DirEntryType with the new
  PyType_FromModuleAndSpec() (PEP 573)
* Get the module state from ScandirIteratorType and DirEntryType with
  the new PyType_GetModule() (PEP 573)
* Pass module to functions which access the module state.
* convert_sched_param() gets a new module parameter. It is now called
  directly since Argument Clinic doesn't support passing the module
  to an argument converter callback.
* Remove _posixstate_global macro.

5 years agobpo-40397: Remove __args__ and __parameters__ from _SpecialGenericAlias (GH-19984)
Serhiy Storchaka [Sun, 10 May 2020 08:53:16 +0000 (11:53 +0300)] 
bpo-40397: Remove __args__ and __parameters__ from _SpecialGenericAlias (GH-19984)

5 years agoAdd link to Enum class (GH-19884)
Andre Delfino [Sun, 10 May 2020 05:15:54 +0000 (02:15 -0300)] 
Add link to Enum class (GH-19884)

5 years agobpo-40334: Avoid collisions between parser variables and grammar variables (GH-19987)
Pablo Galindo [Sun, 10 May 2020 04:34:50 +0000 (05:34 +0100)] 
bpo-40334: Avoid collisions between parser variables and grammar variables (GH-19987)

This is for the C generator:
- Disallow rule and variable names starting with `_`
- Rename most local variable names generated by the parser to start with `_`

Exceptions:
- Renaming `p` to `_p` will be a separate PR
- There are still some names that might clash, e.g.
  - anything starting with `Py`
  - C reserved words (`if` etc.)
  - Macros like `EXTRA` and `CHECK`

5 years agobpo-40570: Improve compatibility of uname_result with late-bound .platform (#20015)
Jason R. Coombs [Sat, 9 May 2020 14:12:41 +0000 (10:12 -0400)] 
bpo-40570: Improve compatibility of uname_result with late-bound .platform (#20015)

* bpo-40570: Improve compatibility of uname_result with late-bound .platform.

* Add test capturing ability to cast uname to a tuple.

5 years agobpo-40566: Apply PEP 573 to abc module (GH-20005)
Dong-hee Na [Sat, 9 May 2020 08:31:40 +0000 (17:31 +0900)] 
bpo-40566: Apply PEP 573 to abc module (GH-20005)

5 years agobpo-39791: Add files() to importlib.resources (GH-19722)
Jason R. Coombs [Fri, 8 May 2020 23:20:26 +0000 (19:20 -0400)] 
bpo-39791: Add files() to importlib.resources (GH-19722)

* bpo-39791: Update importlib.resources to support files() API (importlib_resources 1.5).

* 📜🤖 Added by blurb_it.

* Add some documentation about the new objects added.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-40502: Initialize n->n_col_offset (GH-19988)
Joannah Nanjekye [Fri, 8 May 2020 20:58:28 +0000 (17:58 -0300)] 
bpo-40502: Initialize n->n_col_offset (GH-19988)

* initialize n->n_col_offset

* 📜🤖 Added by blurb_it.

* Move initialization

Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-40541: Add optional *counts* parameter to random.sample() (GH-19970)
Raymond Hettinger [Fri, 8 May 2020 14:53:15 +0000 (07:53 -0700)] 
bpo-40541: Add optional *counts* parameter to random.sample() (GH-19970)

5 years agoMake the first dataclass example more useful (GH-19994)
Ned Batchelder [Fri, 8 May 2020 11:39:57 +0000 (07:39 -0400)] 
Make the first dataclass example more useful (GH-19994)

5 years agobpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)
Chris Jerdonek [Fri, 8 May 2020 10:54:38 +0000 (03:54 -0700)] 
bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)

This fixes a possible memory leak in the C implementation of
asyncio.Task.

5 years agobpo-40273: Reversible mappingproxy (FH-19513)
Zackery Spytz [Fri, 8 May 2020 05:25:50 +0000 (23:25 -0600)] 
bpo-40273: Reversible mappingproxy (FH-19513)

5 years agobpo-40555: Check for p->error_indicator in loop rules after the main loop is done...
Pablo Galindo [Fri, 8 May 2020 02:38:44 +0000 (03:38 +0100)] 
bpo-40555: Check for p->error_indicator in loop rules after the main loop is done (GH-19986)

5 years agobpo-40517: Implement syntax highlighting support for ASDL (GH-19967)
Batuhan Taskaya [Thu, 7 May 2020 20:57:26 +0000 (23:57 +0300)] 
bpo-40517: Implement syntax highlighting support for ASDL (GH-19967)

5 years agobpo-40548: Always run GitHub action, even on doc PRs (GH-19981)
Victor Stinner [Thu, 7 May 2020 20:42:14 +0000 (22:42 +0200)] 
bpo-40548: Always run GitHub action, even on doc PRs (GH-19981)

Always run GitHub action jobs, even on documentation-only pull
requests. So it will be possible to make a GitHub action job, like
the Windows (64-bit) job, mandatory.

5 years agobpo-38787: Update structures.rst docs (PEP 573) (GH-19980)
Hai Shi [Thu, 7 May 2020 17:16:01 +0000 (01:16 +0800)] 
bpo-38787: Update structures.rst docs (PEP 573) (GH-19980)

5 years agobpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)
Eric Snow [Thu, 7 May 2020 14:56:01 +0000 (08:56 -0600)] 
bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)

(Note: PEP 554 is not accepted and the implementation in the code base is a private one for use in the test suite.)

If code running in a subinterpreter raises an uncaught exception then the "run" call in the calling interpreter fails. A RunFailedError is raised there that summarizes the original exception as a string. The actual exception type, __cause__, __context__, state, etc. are all discarded. This turned out to be functionally insufficient in practice. There is a more helpful solution (and PEP 554 has been updated appropriately).

This change adds the exception propagation behavior described in PEP 554 to the _xxsubinterpreters module. With this change a copy of the original exception is set to __cause__ on the RunFailedError. For now we are using "pickle", which preserves the exception's state. We also preserve the original __cause__, __context__, and __traceback__ (since "pickle" does not preserve those).

https://bugs.python.org/issue32604

5 years agobpo-40545: Export _PyErr_GetTopmostException() function (GH-19978)
Victor Stinner [Thu, 7 May 2020 13:42:33 +0000 (15:42 +0200)] 
bpo-40545: Export _PyErr_GetTopmostException() function (GH-19978)

Declare _PyErr_GetTopmostException() with PyAPI_FUNC() to properly
export the function in the C API. The function remains private
("_Py") prefix.

Co-Authored-By: Julien Danjou <julien@danjou.info>
5 years agobpo-38787: C API for module state access from extension methods (PEP 573) (GH-19936)
Petr Viktorin [Thu, 7 May 2020 13:39:59 +0000 (15:39 +0200)] 
bpo-38787: C API for module state access from extension methods (PEP 573) (GH-19936)

Module C state is now accessible from C-defined heap type methods (PEP 573).
Patch by Marcel Plch and Petr Viktorin.

Co-authored-by: Marcel Plch <mplch@redhat.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
5 years agobpo-40334: Error message for invalid default args in function call (GH-19973)
Lysandros Nikolaou [Thu, 7 May 2020 10:44:06 +0000 (13:44 +0300)] 
bpo-40334: Error message for invalid default args in function call (GH-19973)

When parsing something like `f(g()=2)`, where the name of a default arg
is not a NAME, but an arbitrary expression, a specialised error message
is emitted.

5 years agobpo-40334: Fix error location upon parsing an invalid string literal (GH-19962)
Lysandros Nikolaou [Thu, 7 May 2020 10:37:51 +0000 (13:37 +0300)] 
bpo-40334: Fix error location upon parsing an invalid string literal (GH-19962)

When parsing a string with an invalid escape, the old parser used to
point to the beginning of the invalid string. This commit changes the new
parser to match that behaviour, since it's currently pointing to the
end of the string (or to be more precise, to the beginning of the next
token).

5 years agobpo-1635741: Port errno module to multiphase initialization (GH-19923)
Dong-hee Na [Thu, 7 May 2020 01:17:16 +0000 (10:17 +0900)] 
bpo-1635741: Port errno module to multiphase initialization (GH-19923)

5 years agobpo-40397: Refactor typing._GenericAlias (GH-19719)
Serhiy Storchaka [Thu, 7 May 2020 01:09:33 +0000 (04:09 +0300)] 
bpo-40397: Refactor typing._GenericAlias (GH-19719)

Make the design more object-oriented.
Split _GenericAlias on two almost independent classes: for special
generic aliases like List and for parametrized generic aliases like List[int].
Add specialized subclasses for Callable, Callable[...], Tuple and Union[...].

5 years agobpo-40334: Generate comments in the parser code to improve debugging (GH-19966)
Pablo Galindo [Wed, 6 May 2020 22:14:43 +0000 (23:14 +0100)] 
bpo-40334: Generate comments in the parser code to improve debugging (GH-19966)

5 years agobpo-40334: Allow trailing comma in parenthesised context managers (GH-19964)
Pablo Galindo [Wed, 6 May 2020 21:54:34 +0000 (22:54 +0100)] 
bpo-40334: Allow trailing comma in parenthesised context managers (GH-19964)

5 years agoFix typo in sqlite3 documentation (GH-19965)
Naglis [Wed, 6 May 2020 19:51:43 +0000 (19:51 +0000)] 
Fix typo in sqlite3 documentation (GH-19965)

*first* is repeated twice.

5 years agobpo-40334: Add type to the assignment rule in the grammar file (GH-19963)
Lysandros Nikolaou [Wed, 6 May 2020 18:11:04 +0000 (21:11 +0300)] 
bpo-40334: Add type to the assignment rule in the grammar file (GH-19963)

5 years agobpo-40521: Disable list free list in subinterpreters (GH-19959)
Victor Stinner [Wed, 6 May 2020 17:05:27 +0000 (19:05 +0200)] 
bpo-40521: Disable list free list in subinterpreters (GH-19959)

When Python is built with experimental isolated interpreters, disable
the list free list.

Temporary workaround until this cache is made per-interpreter.

5 years agobpo-40533: Disable GC in subinterpreters (GH-19961)
Victor Stinner [Wed, 6 May 2020 16:25:06 +0000 (18:25 +0200)] 
bpo-40533: Disable GC in subinterpreters (GH-19961)

When Python is built with experimental isolated interpreters, a
garbage collection now does nothing in an isolated interpreter.

Temporary workaround until subinterpreters stop sharing Python
objects.

5 years agobpo-40521: Disable method cache in subinterpreters (GH-19960)
Victor Stinner [Wed, 6 May 2020 16:23:58 +0000 (18:23 +0200)] 
bpo-40521: Disable method cache in subinterpreters (GH-19960)

When Python is built with experimental isolated interpreters, disable
the type method cache.

Temporary workaround until the cache is made per-interpreter.

5 years agobpo-40528: Improve and clear several aspects of the ASDL definition code for the...
Batuhan Taskaya [Wed, 6 May 2020 14:29:32 +0000 (17:29 +0300)] 
bpo-40528: Improve and clear several aspects of the ASDL definition code for the AST (GH-19952)

5 years agobpo-40527: Fix command line argument parsing (GH-19955)
Victor Stinner [Wed, 6 May 2020 13:22:17 +0000 (15:22 +0200)] 
bpo-40527: Fix command line argument parsing (GH-19955)

5 years agoRevert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" (#19950)
Raymond Hettinger [Wed, 6 May 2020 05:33:55 +0000 (22:33 -0700)] 
Revert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" (#19950)

This reverts commit d60040ba226bd2e3b6f58d074015aa2499dc1cb8.

5 years agobpo-40517: Implement syntax highlighting support for ASDL (#19928)
Batuhan Taskaya [Wed, 6 May 2020 05:24:39 +0000 (08:24 +0300)] 
bpo-40517: Implement syntax highlighting support for ASDL (#19928)

5 years agobpo-40480 "fnmatch" exponential execution time (GH-19908)
Tim Peters [Wed, 6 May 2020 02:28:24 +0000 (21:28 -0500)] 
bpo-40480 "fnmatch" exponential execution time (GH-19908)

bpo-40480:  create different regexps in the presence of multiple `*`
patterns to prevent fnmatch() from taking exponential time.

5 years agobpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects ...
Pablo Galindo [Tue, 5 May 2020 21:58:19 +0000 (22:58 +0100)] 
bpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects (GH-19946)

5 years agobpo-40504: Allow weakrefs to lru_cache objects (GH-19938)
Dennis Sweeney [Tue, 5 May 2020 21:14:32 +0000 (17:14 -0400)] 
bpo-40504: Allow weakrefs to lru_cache objects (GH-19938)

5 years agobpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes ...
Curtis Bucher [Tue, 5 May 2020 19:40:56 +0000 (12:40 -0700)] 
bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
5 years agobpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944)
Victor Stinner [Tue, 5 May 2020 18:33:06 +0000 (20:33 +0200)] 
bpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944)

In the experimental isolated subinterpreters build mode,
_xxsubinterpreters.run_string() now releases the GIL.

5 years agobpo-40513: Per-interpreter GIL (GH-19943)
Victor Stinner [Tue, 5 May 2020 18:27:47 +0000 (20:27 +0200)] 
bpo-40513: Per-interpreter GIL (GH-19943)

In the experimental isolated subinterpreters build mode, the GIL is
now per-interpreter.

Move gil from _PyRuntimeState.ceval to PyInterpreterState.ceval.

new_interpreter() always get the config from the main interpreter.

5 years agobpo-40513: new_interpreter() init GIL earlier (GH-19942)
Victor Stinner [Tue, 5 May 2020 18:16:37 +0000 (20:16 +0200)] 
bpo-40513: new_interpreter() init GIL earlier (GH-19942)

Fix also code to handle init_interp_main() failure.

5 years agobpo-40522: _PyThreadState_Swap() sets autoTSSkey (GH-19939)
Victor Stinner [Tue, 5 May 2020 17:56:48 +0000 (19:56 +0200)] 
bpo-40522: _PyThreadState_Swap() sets autoTSSkey (GH-19939)

In the experimental isolated subinterpreters build mode,
_PyThreadState_GET() gets the autoTSSkey variable and
_PyThreadState_Swap() sets the autoTSSkey variable.

* Add _PyThreadState_GetTSS()
* _PyRuntimeState_GetThreadState() and _PyThreadState_GET()
  return _PyThreadState_GetTSS()
* PyEval_SaveThread() sets the autoTSSkey variable to current Python
  thread state rather than NULL.
* eval_frame_handle_pending() doesn't check that
  _PyThreadState_Swap() result is NULL.
* _PyThreadState_Swap() gets the current Python thread state with
  _PyThreadState_GetTSS() rather than
  _PyRuntimeGILState_GetThreadState().
* PyGILState_Ensure() no longer checks _PyEval_ThreadsInitialized()
  since it cannot access the current interpreter.

5 years agobpo-40521: Disable free lists in subinterpreters (GH-19937)
Victor Stinner [Tue, 5 May 2020 17:55:29 +0000 (19:55 +0200)] 
bpo-40521: Disable free lists in subinterpreters (GH-19937)

When Python is built with experimental isolated interpreters, disable
tuple, dict and free free lists.

Temporary workaround until these caches are made per-interpreter.

Add frame_alloc() and frame_get_builtins() subfunctions to simplify
_PyFrame_New_NoTrack().

5 years agobpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH...
Steve Dower [Tue, 5 May 2020 17:45:35 +0000 (18:45 +0100)] 
bpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH-19845)

5 years agobpo-40521: Disable Unicode caches in isolated subinterpreters (GH-19933)
Victor Stinner [Tue, 5 May 2020 16:50:30 +0000 (18:50 +0200)] 
bpo-40521: Disable Unicode caches in isolated subinterpreters (GH-19933)

When Python is built in the experimental isolated subinterpreters
mode, disable Unicode singletons and Unicode interned strings since
they are shared by all interpreters.

Temporary workaround until these caches are made per-interpreter.

5 years agoRevert "bpo-40513: Per-interpreter signals pending (GH-19924)" (GH-19932)
Victor Stinner [Tue, 5 May 2020 15:40:18 +0000 (17:40 +0200)] 
Revert "bpo-40513: Per-interpreter signals pending (GH-19924)" (GH-19932)

This reverts commit 4e01946cafca0cf49f796c3118e0d65237bcad69.

5 years agobpo-40520: Remove redundant comment in pydebug.h (GH-19931)
Hai Shi [Tue, 5 May 2020 15:20:38 +0000 (10:20 -0500)] 
bpo-40520: Remove redundant comment in pydebug.h (GH-19931)

Automerge-Triggered-By: @corona10
5 years agobpo-29587: _PyErr_ChainExceptions() checks exception (GH-19902)
Victor Stinner [Tue, 5 May 2020 15:07:41 +0000 (17:07 +0200)] 
bpo-29587: _PyErr_ChainExceptions() checks exception (GH-19902)

_PyErr_ChainExceptions() now ensures that the first parameter is an
exception type, as done by _PyErr_SetObject().

* The following function now check PyExceptionInstance_Check() in an
  assertion using a new _PyBaseExceptionObject_cast() helper
  function:

  * PyException_GetTraceback(), PyException_SetTraceback()
  * PyException_GetCause(), PyException_SetCause()
  * PyException_GetContext(), PyException_SetContext()

* PyExceptionClass_Name() now checks PyExceptionClass_Check() with an
  assertion.

* Remove XXX comment and add gi_exc_state variable to _gen_throw().

* Remove comment from test_generators

5 years agobpo-40513: Per-interpreter recursion_limit (GH-19929)
Victor Stinner [Tue, 5 May 2020 14:52:52 +0000 (16:52 +0200)] 
bpo-40513: Per-interpreter recursion_limit (GH-19929)

Move recursion_limit member from _PyRuntimeState.ceval to
PyInterpreterState.ceval.

* Py_SetRecursionLimit() now only sets _Py_CheckRecursionLimit
  of ceval.c if the current Python thread is part of the main
  interpreter.
* Inline _Py_MakeEndRecCheck() into _Py_LeaveRecursiveCall().
* Convert _Py_RecursionLimitLowerWaterMark() macro into a static
  inline function.

5 years agobpo-32117: Updated Simpsons names in docs (GH-19737)
Javier Buzzi [Tue, 5 May 2020 14:49:57 +0000 (10:49 -0400)] 
bpo-32117: Updated Simpsons names in docs (GH-19737)

`sally` is not a Simpsons character

Automerge-Triggered-By: @gvanrossum
5 years agobpo-40514: Add --with-experimental-isolated-subinterpreters (GH-19926)
Victor Stinner [Tue, 5 May 2020 14:41:11 +0000 (16:41 +0200)] 
bpo-40514: Add --with-experimental-isolated-subinterpreters (GH-19926)

Add --with-experimental-isolated-subinterpreters build option to
configure: better isolate subinterpreters, experimental build mode.

When used, force the usage of the libc malloc() memory allocator,
since pymalloc relies on the unique global interpreter lock (GIL).

5 years agobpo-40513: Per-interpreter gil_drop_request (GH-19927)
Victor Stinner [Tue, 5 May 2020 14:14:31 +0000 (16:14 +0200)] 
bpo-40513: Per-interpreter gil_drop_request (GH-19927)

Move gil_drop_request member from _PyRuntimeState.ceval to
PyInterpreterState.ceval.

5 years agobpo-40513: Per-interpreter signals pending (GH-19924)
Victor Stinner [Tue, 5 May 2020 13:43:37 +0000 (15:43 +0200)] 
bpo-40513: Per-interpreter signals pending (GH-19924)

Move signals_pending from _PyRuntime.ceval to
PyInterpreterState.ceval.

5 years agobpo-40286: Put methods in correct sections. Add security notice to use secrets for...
Raymond Hettinger [Tue, 5 May 2020 05:52:13 +0000 (22:52 -0700)] 
bpo-40286: Put methods in correct sections. Add security notice to use secrets for session tokens. (GH-19870)

5 years agobpo-40459: Fix NameError in platform.py (GH-19855)
Dennis Sweeney [Tue, 5 May 2020 02:33:17 +0000 (22:33 -0400)] 
bpo-40459: Fix NameError in platform.py (GH-19855)

5 years agobpo-1635741: Port syslog module to multiphase initialization (GH-19907)
Dong-hee Na [Tue, 5 May 2020 01:49:46 +0000 (10:49 +0900)] 
bpo-1635741: Port syslog module to multiphase initialization (GH-19907)

5 years agobpo-40499: Mention that asyncio.wait() needs a non-empty aws set (GH-19900)
Joel Rosdahl [Mon, 4 May 2020 21:56:00 +0000 (23:56 +0200)] 
bpo-40499: Mention that asyncio.wait() needs a non-empty aws set (GH-19900)

A similar formulation was added in bpo-21596
(db74d982d43d98040e38665d843cbc8de4a082b1) but was lost in bpo-33649
(3faaa8857a42a36383bb18425444e597fc876797).

5 years agobpo-39470: Indicate that ``os.makedirs`` is equivalent to ``Path.mkdir`` (GH-18216)
Joannah Nanjekye [Mon, 4 May 2020 19:47:03 +0000 (16:47 -0300)] 
bpo-39470: Indicate that ``os.makedirs`` is equivalent to ``Path.mkdir`` (GH-18216)

* Indicate os.makedirs is equivalent to Path.mkdir

* 📜🤖 Added by blurb_it.

* ignore news feed

Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-40360: Add a What's New entry for lib2to3 pending deprecation (GH-19898)
Miro Hrončok [Mon, 4 May 2020 19:02:00 +0000 (21:02 +0200)] 
bpo-40360: Add a What's New entry for lib2to3 pending deprecation (GH-19898)

5 years agobpo-40275: test.support imports lazily locale import (GH-19761)
Hai Shi [Mon, 4 May 2020 18:05:02 +0000 (02:05 +0800)] 
bpo-40275: test.support imports lazily locale import (GH-19761)

5 years agobpo-40489: Add test case for dict contain use after free (GH-19906)
Dong-hee Na [Mon, 4 May 2020 17:30:42 +0000 (02:30 +0900)] 
bpo-40489: Add test case for dict contain use after free (GH-19906)

5 years agobpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892)
Hai Shi [Mon, 4 May 2020 15:05:54 +0000 (23:05 +0800)] 
bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892)

Don't define shared memory block's name in test_shared_memory_across_processes():
use SharedMemory(create=True) instead.

5 years agobpo-40455: Remove gcc10 warning about x_digits (#19852)
Dong-hee Na [Mon, 4 May 2020 13:32:42 +0000 (22:32 +0900)] 
bpo-40455: Remove gcc10 warning about x_digits (#19852)

* bpo-40455: Remove gcc10 warning about x_digits

* bpo-40455: nit

* bpo-40455: fix logic error

5 years agobpo-39573: Use Py_IS_TYPE to check for types (GH-19882)
Hai Shi [Mon, 4 May 2020 13:31:38 +0000 (21:31 +0800)] 
bpo-39573: Use Py_IS_TYPE to check for types (GH-19882)

5 years agobpo-40246: Revert reporting of invalid string prefixes (GH-19888)
Lysandros Nikolaou [Mon, 4 May 2020 11:32:18 +0000 (14:32 +0300)] 
bpo-40246: Revert reporting of invalid string prefixes (GH-19888)

Due to backwards compatibility concerns regarding keywords immediately followed by a string without whitespace between them (like in `bg="#d00" if clear else"#fca"`) will fail to parse,
commit 41d5b94af44e34ac05d4cd57460ed104ccf96628 has to be reverted.