]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-45548: Make `Modules/Setup` easier to read (GH-29143)
Brett Cannon [Fri, 22 Oct 2021 00:07:26 +0000 (17:07 -0700)] 
bpo-45548: Make `Modules/Setup` easier to read (GH-29143)

4 years agobpo-29844: Remove obsolete paragraph from Tools/msi/README.txt (GH-29141)
Zachary Ware [Fri, 22 Oct 2021 00:02:12 +0000 (19:02 -0500)] 
bpo-29844: Remove obsolete paragraph from Tools/msi/README.txt (GH-29141)

4 years agobpo-43706: Use PEP 590 vectorcall to speed up enumerate() (GH-25154)
Dong-hee Na [Thu, 21 Oct 2021 23:20:43 +0000 (08:20 +0900)] 
bpo-43706: Use PEP 590 vectorcall to speed up enumerate() (GH-25154)

4 years agobpo-44019: Add test_all_exported_names for operator module (GH-29124)
Dong-hee Na [Thu, 21 Oct 2021 22:58:04 +0000 (07:58 +0900)] 
bpo-44019: Add test_all_exported_names for operator module (GH-29124)

4 years agobpo-44547: Make Fractions objects instances of typing.SupportsInt (GH-27851)
Mark Dickinson [Thu, 21 Oct 2021 22:09:47 +0000 (23:09 +0100)] 
bpo-44547: Make Fractions objects instances of typing.SupportsInt (GH-27851)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agobpo-41983: add availability info to socket docs (GH-27519)
andrei kulakov [Thu, 21 Oct 2021 21:13:37 +0000 (17:13 -0400)] 
bpo-41983: add availability info to socket docs (GH-27519)

* add availability info to AF_PACKET section

* add availability for AF_QIPCRTR as well

4 years agobpo-45526: obmalloc radix use 64 addr bits (GH-29062)
Neil Schemenauer [Thu, 21 Oct 2021 21:05:46 +0000 (14:05 -0700)] 
bpo-45526: obmalloc radix use 64 addr bits (GH-29062)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agobpo-44344: Document that pow can return a complex number for non-complex inputs....
Mark Dickinson [Thu, 21 Oct 2021 20:57:49 +0000 (21:57 +0100)] 
bpo-44344: Document that pow can return a complex number for non-complex inputs. (GH-27853)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agobpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129)
Eric V. Smith [Thu, 21 Oct 2021 20:42:55 +0000 (16:42 -0400)] 
bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129)

4 years agoAdd workflow_dispatch trigger to GHA workflows (GH-27873)
Ryan Mast [Thu, 21 Oct 2021 20:34:18 +0000 (13:34 -0700)] 
Add workflow_dispatch trigger to GHA workflows (GH-27873)

4 years agobpo-45160: Ttk optionmenu only set variable once (GH-28291)
E-Paine [Thu, 21 Oct 2021 20:25:52 +0000 (21:25 +0100)] 
bpo-45160: Ttk optionmenu only set variable once (GH-28291)

4 years agoMove several typing tests to a proper class, refs GH-28563 (GH-29126)
Nikita Sobolev [Thu, 21 Oct 2021 20:16:50 +0000 (23:16 +0300)] 
Move several typing tests to a proper class, refs GH-28563 (GH-29126)

4 years agobpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051)
Neil Schemenauer [Thu, 21 Oct 2021 13:38:36 +0000 (06:38 -0700)] 
bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051)

MAP_BOT_LENGTH was incorrectly used to compute MAP_TOP_MASK instead of
MAP_TOP_LENGTH. On 64-bit machines, the error causes the tree to hold
46-bits of virtual addresses, rather than the intended 48-bits.

4 years agobpo-45522: Allow to disable freelists on build time (GH-29056)
Christian Heimes [Thu, 21 Oct 2021 13:12:20 +0000 (16:12 +0300)] 
bpo-45522: Allow to disable freelists on build time (GH-29056)

Freelists for object structs can now be disabled. A new ``configure``
option ``--without-freelists`` can be used to disable all freelists
except empty tuple singleton. Internal Py*_MAXFREELIST macros can now
be defined as 0 without causing compiler warnings and segfaults.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-34451: Document prompt and output toggle feature in html tutorial (GH-27105)
Thomas [Thu, 21 Oct 2021 10:19:20 +0000 (03:19 -0700)] 
bpo-34451: Document prompt and output toggle feature in html tutorial (GH-27105)

4 years agobpo-44019: Add operator.call() to __all__ for the operator module (GH-29110)
Kreus Amredes [Thu, 21 Oct 2021 10:05:36 +0000 (11:05 +0100)] 
bpo-44019: Add operator.call() to __all__ for the operator module (GH-29110)

4 years agobpo-45315: PyType_FromSpec: Copy spec->name and have the type own the memory for...
Petr Viktorin [Thu, 21 Oct 2021 09:46:20 +0000 (11:46 +0200)] 
bpo-45315: PyType_FromSpec: Copy spec->name and have the type own the memory for its name (GH-29103)

4 years agobpo-44220: Export PyStructSequence_UnnamedField in the limited API (GH-26331)
Ken Jin [Thu, 21 Oct 2021 08:46:48 +0000 (16:46 +0800)] 
bpo-44220: Export PyStructSequence_UnnamedField in the limited API (GH-26331)

4 years agobpo-44174: [Enum] add reference to name mangling (GH-29116)
Ethan Furman [Thu, 21 Oct 2021 03:32:11 +0000 (20:32 -0700)] 
bpo-44174: [Enum] add reference to name mangling (GH-29116)

4 years agobpo-45548: add some missing entries to `Modules/Setup` (GH-29115)
Brett Cannon [Thu, 21 Oct 2021 00:34:49 +0000 (17:34 -0700)] 
bpo-45548: add some missing entries to `Modules/Setup` (GH-29115)

Also remove a duplicate entry for `_weakref`.

4 years agobpo-35673: Add a public alias for namespace package __loader__ attribute (#29049)
Barry Warsaw [Wed, 20 Oct 2021 21:05:29 +0000 (14:05 -0700)] 
bpo-35673: Add a public alias for namespace package __loader__ attribute (#29049)

Rename namespace package __loader__ class to be public.

Make the old name, i.e. _NamespaceLoader, an alias for the public name, for backward compatibility.

4 years agobpo-45192: Fix a bug that infers the type of an os.PathLike[bytes] object as str...
Kyungmin Lee [Wed, 20 Oct 2021 19:54:41 +0000 (04:54 +0900)] 
bpo-45192: Fix a bug that infers the type of an os.PathLike[bytes] object as str (GH-28323)

An object implementing the os.PathLike protocol can represent a file
system path as a str or bytes object.
Therefore, _infer_return_type function should infer os.PathLike[str]
object as str type and os.PathLike[bytes] object as bytes type.

4 years agobpo-45527: Don't count cache hits, just misses. (GH-29092)
Mark Shannon [Wed, 20 Oct 2021 18:53:48 +0000 (19:53 +0100)] 
bpo-45527: Don't count cache hits, just misses. (GH-29092)

4 years agobpo-45320: Remove long-deprecated inspect methods (GH-28618)
Hugo van Kemenade [Wed, 20 Oct 2021 18:48:55 +0000 (21:48 +0300)] 
bpo-45320: Remove long-deprecated inspect methods (GH-28618)

4 years agobpo-41374: Remove obsolete exclusion of netinet/tcp.h on Cygwin (GH-21649)
Zackery Spytz [Wed, 20 Oct 2021 17:14:59 +0000 (10:14 -0700)] 
bpo-41374: Remove obsolete exclusion of netinet/tcp.h on Cygwin (GH-21649)

4 years agobpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100)
Jeong YunWon [Wed, 20 Oct 2021 17:09:03 +0000 (02:09 +0900)] 
bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100)

4 years agobpo-45464: [doc] Explain that subclassing multiple exceptions is fragile (GH-29094)
Łukasz Langa [Wed, 20 Oct 2021 16:54:31 +0000 (18:54 +0200)] 
bpo-45464: [doc] Explain that subclassing multiple exceptions is fragile (GH-29094)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years agoCleanup a couple of comments left on PR 28775 post-merge. (GH-29079)
Gregory P. Smith [Wed, 20 Oct 2021 16:17:52 +0000 (09:17 -0700)] 
Cleanup a couple of comments left on PR 28775 post-merge. (GH-29079)

4 years agobpo-45536: Check OpenSSL APIs in configure (GH-29088)
Christian Heimes [Wed, 20 Oct 2021 15:18:34 +0000 (18:18 +0300)] 
bpo-45536: Check OpenSSL APIs in configure (GH-29088)

4 years agoAdd PEPs 593 & 647 to list of PEPs at top of typing docs (GH-29097)
Alex Waygood [Wed, 20 Oct 2021 15:15:59 +0000 (16:15 +0100)] 
Add PEPs 593 & 647 to list of PEPs at top of typing docs (GH-29097)

4 years agoAdd a comment about how to fix bogus test_host_resolution_bad_address failures (...
Barry Warsaw [Wed, 20 Oct 2021 15:08:57 +0000 (08:08 -0700)] 
Add a comment about how to fix bogus test_host_resolution_bad_address failures (#29085)

4 years agobpo-44525: Specialize simple Python calls. (GH-29033)
Mark Shannon [Wed, 20 Oct 2021 15:08:28 +0000 (16:08 +0100)] 
bpo-44525: Specialize simple Python calls. (GH-29033)

4 years agobpo-45229: Make doctest tests discoverable (GH-28986)
Serhiy Storchaka [Wed, 20 Oct 2021 14:36:27 +0000 (17:36 +0300)] 
bpo-45229: Make doctest tests discoverable (GH-28986)

4 years agobpo-25625: [doc] fix async/aync typo (GH-29091)
Thomas Grainger [Wed, 20 Oct 2021 13:51:07 +0000 (14:51 +0100)] 
bpo-25625: [doc] fix async/aync typo (GH-29091)

4 years agobpo-45474: Exclude all of marshal.h if Py_LIMITED_API is defined (GH-29061)
Petr Viktorin [Wed, 20 Oct 2021 09:32:14 +0000 (11:32 +0200)] 
bpo-45474: Exclude all of marshal.h if Py_LIMITED_API is defined (GH-29061)

Also, reword the What's New messages: this doesn't change the limited API, it only brings the Py_LIMITED_API macro closer to the ideal of only allowing the limited API.

Automerge-Triggered-By: GH:encukou
4 years agobpo-38371: Remove remaining use of tk.split from bigmem tcl test (GH-29082)
Zachary Ware [Wed, 20 Oct 2021 03:34:23 +0000 (22:34 -0500)] 
bpo-38371: Remove remaining use of tk.split from bigmem tcl test (GH-29082)

4 years agobpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077)
Zachary Ware [Wed, 20 Oct 2021 02:54:19 +0000 (21:54 -0500)] 
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077)

Since v8.6.11, a few configuration options seem to accept an empty value
where they did not previously; particularly the `type` of a `Menu`
widget, and the `compound` of any ttk widget with a label.  Providing an
explicit expected error message to `checkEnumParam` bypasses the check
of an empty value, which no longer raises `TclError`.

4 years agobpo-44525: Specialize ``CALL_FUNCTION`` for C function calls (GH-26934)
Ken Jin [Tue, 19 Oct 2021 23:16:36 +0000 (07:16 +0800)] 
bpo-44525: Specialize ``CALL_FUNCTION`` for C function calls (GH-26934)

4 years agobpo-25625: add contextlib.chdir (GH-28271)
Filipe Laíns [Tue, 19 Oct 2021 22:19:27 +0000 (23:19 +0100)] 
bpo-25625: add contextlib.chdir (GH-28271)

Added non parallel-safe :func:`~contextlib.chdir` context manager to change
the current working directory and then restore it on exit. Simple wrapper
around :func:`~os.chdir`.

Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agobpo-39679: Add tests for classmethod/staticmethod singledispatchmethods (GH-29034)
Alex Waygood [Tue, 19 Oct 2021 20:30:27 +0000 (21:30 +0100)] 
bpo-39679: Add tests for classmethod/staticmethod singledispatchmethods (GH-29034)

In Python 3.8 and 3.9, stacking `@functools.singledispatchmethod` on top of
`@classmethod` or `@staticmethod` caused an exception to be raised if the
method was registered using type-annotations rather than
`@method.register(int)`. This was not caught by unit tests, however, as the
tests only tested the `@method.register(int)` way of registering additional
implementations. The bug is no longer present in Python 3.10+, but
`test_functools.py` is still lacking regression tests for these cases. This
commit adds these test cases.

4 years agobpo-45506: Go back to not running most of test_embed in out-of-tree builds. (gh-29063)
Eric Snow [Tue, 19 Oct 2021 20:11:16 +0000 (14:11 -0600)] 
bpo-45506: Go back to not running most of test_embed in out-of-tree builds. (gh-29063)

In gh-28954 I adjusted how test_embed determines if it should be skipped. That broke out-of-tree builds. This change fixes them.

https://bugs.python.org/issue45506

4 years agobpo-45494: Fix parser crash when reporting errors involving invalid continuation...
Pablo Galindo Salgado [Tue, 19 Oct 2021 19:24:12 +0000 (20:24 +0100)] 
bpo-45494: Fix parser crash when reporting errors involving invalid continuation characters (GH-28993)

There are two errors that this commit fixes:

* The parser was not correctly computing the offset and the string
  source for E_LINECONT errors due to the incorrect usage of strtok().
* The parser was not correctly unwinding the call stack when a tokenizer
  exception happened in rules involving optionals ('?', [...]) as we
  always make them return valid results by using the comma operator. We
  need to check first if we don't have an error before continuing.

4 years ago[doc]: Fix missing space in c-api/init.rst and add rstlint rule (GH-28988)
Julien Palard [Tue, 19 Oct 2021 19:13:24 +0000 (21:13 +0200)] 
[doc]: Fix missing space in c-api/init.rst and add rstlint rule (GH-28988)

4 years agobpo-45500: Rewrite test_dbm (GH-29002)
Serhiy Storchaka [Tue, 19 Oct 2021 19:11:28 +0000 (22:11 +0300)] 
bpo-45500: Rewrite test_dbm (GH-29002)

* Generate test classes at import time. It allows to filter them when
  run with unittest. E.g: "./python -m unittest test.test_dbm.TestCase_gnu -v".
* Create a database class in a new directory which will be removed after
  test. It guarantees that all created files and directories be removed
  and will not conflict with other dbm tests.
* Restore dbm._defaultmod after tests. Previously it was set to the last
  dbm module (dbm.dumb) which affected other tests.
* Enable the whichdb test for dbm.dumb.
* Move test_keys to the correct test class. It does not test whichdb().
* Remove some outdated code and comments.

4 years agobpo-42174: fallback to sane values if the columns or lines are 0 in get_terminal_size...
Filipe Laíns [Tue, 19 Oct 2021 18:42:13 +0000 (19:42 +0100)] 
bpo-42174: fallback to sane values if the columns or lines are 0 in get_terminal_size (GH-29046)

I considered only falling back when both were 0, but that still seems
wrong, and the highly popular rich[1] library does it this way, so I
thought we should probably inherit that behavior.

[1] https://github.com/willmcgugan/rich

Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agobpo-42222: Improve tests for invalid argument types in randrange() (GH-29021)
Serhiy Storchaka [Tue, 19 Oct 2021 18:40:30 +0000 (21:40 +0300)] 
bpo-42222: Improve tests for invalid argument types in randrange() (GH-29021)

4 years agobpo-40360: Make the 2to3 deprecation more obvious. (GH-29064)
Gregory P. Smith [Tue, 19 Oct 2021 18:28:27 +0000 (11:28 -0700)] 
bpo-40360: Make the 2to3 deprecation more obvious. (GH-29064)

4 years agobpo-45449: add note about PEP 585 in collections.abc's documentation (GH-29047)
Filipe Laíns [Tue, 19 Oct 2021 18:18:50 +0000 (19:18 +0100)] 
bpo-45449: add note about PEP 585 in collections.abc's documentation (GH-29047)

Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agoAdd zoneinfo to the datetime documentation (GH-29038)
Paul Ganssle [Tue, 19 Oct 2021 18:09:41 +0000 (14:09 -0400)] 
Add zoneinfo to the datetime documentation (GH-29038)

We should have done this way back when 3.9 was released, but it fell off
the radar.

Co-authored-by: Paul Ganssle <git@m.ganssle.io>
4 years agoRecord cache hits for BINARY_SUBSCR specializations (GH-29060)
Ken Jin [Tue, 19 Oct 2021 16:25:31 +0000 (00:25 +0800)] 
Record cache hits for BINARY_SUBSCR specializations (GH-29060)

4 years agobpo-42064: Add module backref to `sqlite3` callback context (GH-28242)
Erlend Egeberg Aasland [Tue, 19 Oct 2021 13:44:45 +0000 (15:44 +0200)] 
bpo-42064: Add module backref to `sqlite3` callback context (GH-28242)

4 years agobpo-43851: Build SQLite with SQLITE_OMIT_AUTOINIT on Windows (GH-25414)
Erlend Egeberg Aasland [Tue, 19 Oct 2021 10:59:57 +0000 (12:59 +0200)] 
bpo-43851: Build SQLite with SQLITE_OMIT_AUTOINIT on Windows (GH-25414)

4 years agobpo-45434: Only exclude <stdlib.h> in Python 3.11 limited C API (GH-29027)
Victor Stinner [Tue, 19 Oct 2021 10:10:22 +0000 (12:10 +0200)] 
bpo-45434: Only exclude <stdlib.h> in Python 3.11 limited C API (GH-29027)

The Python 3.11 limited C API no longer includes stdlib.h, stdio.h,
string.h and errno.h.

* Exclude Py_MEMCPY() from Python 3.11 limited C API.
* xxlimited C extension is now built with Python 3.11 limited C API.

4 years agobpo-45475: Revert `__iter__` optimization for GzipFile, BZ2File, and LZMAFile. (GH...
Inada Naoki [Tue, 19 Oct 2021 02:51:48 +0000 (11:51 +0900)] 
bpo-45475: Revert `__iter__` optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016)

This reverts commit d2a8e69c2c605fbaa3656a5f99aa8d295f74c80e.

4 years agobpo-45516: use documentation links in TraversableResources' description (GH-29045)
Filipe Laíns [Tue, 19 Oct 2021 00:52:28 +0000 (01:52 +0100)] 
bpo-45516: use documentation links in TraversableResources' description (GH-29045)

I think this makes the documentation much more digestible :)

Signed-off-by: Filipe Laíns <lains@riseup.net>
4 years agobpo-35134: Add Include/cpython/longobject.h (GH-29044)
Victor Stinner [Tue, 19 Oct 2021 00:04:52 +0000 (02:04 +0200)] 
bpo-35134: Add Include/cpython/longobject.h (GH-29044)

Move Include/longobject.h non-limited API to a new
Include/cpython/longobject.h header file.

Move the following definitions to the internal C API:

* _PyLong_DigitValue
* _PyLong_FormatAdvancedWriter()
* _PyLong_FormatWriter()

4 years agobpo-35134: Split warnings.h and weakrefobject.h (GH-29042)
Victor Stinner [Mon, 18 Oct 2021 23:31:57 +0000 (01:31 +0200)] 
bpo-35134: Split warnings.h and weakrefobject.h (GH-29042)

Split header files to move the non-limited API to Include/cpython/:

* Include/warnings.h => Include/cpython/warnings.h
* Include/weakrefobject.h => Include/cpython/weakrefobject.h

Exclude PyWeakref_GET_OBJECT() from the limited C API. It never
worked since the PyWeakReference structure is opaque in the limited C
API.

Move _PyWarnings_Init() and _PyErr_WarnUnawaitedCoroutine() to the
internal C API.

4 years agobpo-45516: add protocol description to the Traversable documentation (#29039)
Filipe Laíns [Mon, 18 Oct 2021 22:58:13 +0000 (23:58 +0100)] 
bpo-45516: add protocol description to the Traversable documentation (#29039)

* bpo-45516: add protocol description to the Traversable documentation

Signed-off-by: Filipe Laíns <lains@riseup.net>
* Update Doc/library/importlib.rst

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* Update Lib/importlib/abc.py

* Update Doc/library/importlib.rst

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
4 years agobpo-45221: Fix handling of LDFLAGS and CPPFLAGS options in setup.py (GH-29031)
andrei kulakov [Mon, 18 Oct 2021 18:26:23 +0000 (14:26 -0400)] 
bpo-45221: Fix handling of LDFLAGS and CPPFLAGS options in setup.py (GH-29031)

4 years agobpo-43760: Rename _PyThreadState_DisableTracing() (GH-29032)
Victor Stinner [Mon, 18 Oct 2021 16:40:43 +0000 (18:40 +0200)] 
bpo-43760: Rename _PyThreadState_DisableTracing() (GH-29032)

* Rename _PyThreadState_DisableTracing()
  to _PyThreadState_PauseTracing()
* Rename _PyThreadState_ResetTracing()
  to _PyThreadState_ResumeTracing()

4 years agobpo-45256: Avoid C calls for most Python to Python calls. (GH-28937)
Mark Shannon [Mon, 18 Oct 2021 08:57:24 +0000 (09:57 +0100)] 
bpo-45256: Avoid C calls for most Python to Python calls. (GH-28937)

* Avoid making C calls for most calls to Python functions.

* Change initialize_locals(steal=true) and _PyTuple_FromArraySteal to consume the argument references regardless of whether they succeed or fail.

4 years agobpo-45434: Include stdlib.h for specialize stat (GH-29015)
Dong-hee Na [Mon, 18 Oct 2021 08:31:18 +0000 (17:31 +0900)] 
bpo-45434: Include stdlib.h for specialize stat (GH-29015)

4 years agoImprove multiserver queue recipe (GH-29012)
Raymond Hettinger [Sun, 17 Oct 2021 23:20:34 +0000 (18:20 -0500)] 
Improve multiserver queue recipe (GH-29012)

4 years agobpo-45229: Make test_http_cookiejar discoverable (GH-29004)
Serhiy Storchaka [Sun, 17 Oct 2021 12:06:40 +0000 (15:06 +0300)] 
bpo-45229: Make test_http_cookiejar discoverable (GH-29004)

4 years agoFix contributor person name in rst files (GH-29005)
Benjamin Szőke [Sun, 17 Oct 2021 11:59:22 +0000 (13:59 +0200)] 
Fix contributor person name in rst files (GH-29005)

4 years agobpo-45495: Add 'case' and 'match' to IDLE completions list. (GH-29000)
Terry Jan Reedy [Sat, 16 Oct 2021 22:44:00 +0000 (18:44 -0400)] 
bpo-45495: Add 'case' and 'match' to IDLE completions list. (GH-29000)

Since the keyword list is frozen, only compute it once per
session.  The colorizer already handles context keywords.

4 years agobpo-45020: Default to using frozen modules unless running from source tree. (gh-28940)
Eric Snow [Sat, 16 Oct 2021 19:16:08 +0000 (13:16 -0600)] 
bpo-45020: Default to using frozen modules unless running from source tree. (gh-28940)

The default was "off".  Switching it to "on" means users get the benefit of frozen stdlib modules without having to do anything.  There's a special-case for running-in-source-tree, so contributors don't get surprised when their stdlib changes don't get used.

https://bugs.python.org/issue45020

4 years agobpo-45249: Fix caret location when end_offset is set to 0 (GH-28855)
Pablo Galindo Salgado [Sat, 16 Oct 2021 17:27:43 +0000 (18:27 +0100)] 
bpo-45249: Fix caret location when end_offset is set to 0 (GH-28855)

4 years agobpo-42222: Remove deprecated support for non-integer values (GH-28983)
Raymond Hettinger [Sat, 16 Oct 2021 15:16:53 +0000 (10:16 -0500)] 
bpo-42222: Remove deprecated support for non-integer values (GH-28983)

4 years agobpo-45489: Update ForwardRef to support | operator. (GH-28991)
Dong-hee Na [Sat, 16 Oct 2021 15:12:58 +0000 (00:12 +0900)] 
bpo-45489: Update ForwardRef to support | operator. (GH-28991)

4 years agobpo-45463: Clarify that global statements allows multiple names (GH-28851)
Luca Chiodini [Sat, 16 Oct 2021 12:55:12 +0000 (14:55 +0200)] 
bpo-45463: Clarify that global statements allows multiple names (GH-28851)

The global statement allows specifying a list of identifiers
(https://docs.python.org/3/reference/simple_stmts.html#the-global-statement).

The "Execution model" chapter described the global statement as if it
only allowed one single name. Pluralize "name" in the appropriate places.

4 years agobpo-45442: Add deactivate step to venv tutorial. (GH-28981)
srinivasan [Fri, 15 Oct 2021 21:24:25 +0000 (02:54 +0530)] 
bpo-45442: Add deactivate step to venv tutorial. (GH-28981)

@vsajip Sorry for the trouble—made a [fairly significant] git error in the previous PR.

Have edited the patch as you had said in #28959.

Automerge-Triggered-By: GH:vsajip
4 years agobpo-45440: Remove pymath.c fallbacks (GH-28977)
Victor Stinner [Fri, 15 Oct 2021 17:45:34 +0000 (19:45 +0200)] 
bpo-45440: Remove pymath.c fallbacks (GH-28977)

Remove fallbacks for missing round(), copysign() and hypot() in
Python/pymath.c. Python now requires these functions to build.

These fallbacks were needed on Visual Studio 2012 and older. They are
no longer needed since Visual Stuido 2013. Python is now built with
Visual Studio 2017 or newer since Python 3.6.

4 years agobpo-30459: Use (void) in macros setting variables (GH-28982)
Victor Stinner [Fri, 15 Oct 2021 17:44:35 +0000 (19:44 +0200)] 
bpo-30459: Use (void) in macros setting variables (GH-28982)

Convert the result of macros setting variables to void to avoid risks
of misusing them:

* _PyGCHead_SET_NEXT()
* asdl_seq_SET()
* asdl_seq_SET_UNTYPED()

4 years agobpo-43760: Add PyThreadState_EnterTracing() (GH-28542)
Victor Stinner [Fri, 15 Oct 2021 14:06:30 +0000 (16:06 +0200)] 
bpo-43760: Add PyThreadState_EnterTracing() (GH-28542)

Add PyThreadState_EnterTracing() and PyThreadState_LeaveTracing()
functions to the limited C API to suspend and resume tracing and
profiling.

Add an unit test on the PyThreadState C API to _testcapi.

Add also internal _PyThreadState_DisableTracing() and
_PyThreadState_ResetTracing().

4 years agobpo-45482: Rename namespaceobject.h to pycore_namespace.h (GH-28975)
Victor Stinner [Fri, 15 Oct 2021 13:21:21 +0000 (15:21 +0200)] 
bpo-45482: Rename namespaceobject.h to pycore_namespace.h (GH-28975)

Rename Include/namespaceobject.h to
Include/internal/pycore_namespace.h.

The _testmultiphase extension is now built with the
Py_BUILD_CORE_MODULE macro defined to access _PyNamespace_Type.

object.c: remove unused "pycore_context.h" include.

4 years agobpo-44113: Move the What's New entry to Deprecate section (GH-28974)
Victor Stinner [Fri, 15 Oct 2021 11:43:44 +0000 (13:43 +0200)] 
bpo-44113: Move the What's New entry to Deprecate section (GH-28974)

4 years agobpo-45445: Remove incorrectly commited test file (GH-28972)
Pablo Galindo Salgado [Fri, 15 Oct 2021 11:18:22 +0000 (12:18 +0100)] 
bpo-45445: Remove incorrectly commited test file (GH-28972)

4 years agobpo-45434: Remove Include/eval.h header file (GH-28973)
Victor Stinner [Fri, 15 Oct 2021 11:06:05 +0000 (13:06 +0200)] 
bpo-45434: Remove Include/eval.h header file (GH-28973)

Move Include/eval.h content into Include/ceval.h and
Include/cpython/ceval.h, and remove Include/eval.h.

4 years agobpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)
Victor Stinner [Fri, 15 Oct 2021 09:56:34 +0000 (11:56 +0200)] 
bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)

Move the interpreteridobject.h header file from Include/ to
Include/internal/. It only provides private functions.

4 years agobpo-45428: Fix reading filenames from stdin in py_compile (GH-28848)
Graham Inggs [Fri, 15 Oct 2021 09:38:55 +0000 (11:38 +0200)] 
bpo-45428: Fix reading filenames from stdin in py_compile (GH-28848)

Strip trailing '\n'.

4 years agobpo-35134: Move classobject.h to Include/cpython/ (GH-28968)
Victor Stinner [Fri, 15 Oct 2021 07:46:29 +0000 (09:46 +0200)] 
bpo-35134: Move classobject.h to Include/cpython/ (GH-28968)

Move classobject.h, context.h, genobject.h and longintrepr.h header
files from Include/ to Include/cpython/.

Remove redundant "#ifndef Py_LIMITED_API" in context.h.

Remove explicit #include "longintrepr.h" in C files. It's not needed,
Python.h already includes it.

4 years agobpo-45479: Futher simplify Py_UniversalNewlineFgets. (GH-28967)
Benjamin Peterson [Fri, 15 Oct 2021 06:10:52 +0000 (23:10 -0700)] 
bpo-45479: Futher simplify Py_UniversalNewlineFgets. (GH-28967)

Thank you to Eryk Sun for the suggestions in https://github.com/python/cpython/pull/28965#discussion_r729527143.

4 years agocloses bpo-45479: Degunkify Py_UniversalNewlineFgets. (GH-28965)
Benjamin Peterson [Fri, 15 Oct 2021 04:28:52 +0000 (21:28 -0700)] 
closes bpo-45479: Degunkify Py_UniversalNewlineFgets. (GH-28965)

Remove dead variables and control flow.

4 years agobpo-35134: Move Include/cellobject.h to Include/cpython/ (GH-28964)
Victor Stinner [Fri, 15 Oct 2021 00:39:58 +0000 (02:39 +0200)] 
bpo-35134: Move Include/cellobject.h to Include/cpython/ (GH-28964)

4 years agopo-35134: Move Include/funcobject.h to Include/cpython/ (GH-28958)
Victor Stinner [Thu, 14 Oct 2021 23:50:28 +0000 (01:50 +0200)] 
po-35134: Move Include/funcobject.h to Include/cpython/ (GH-28958)

Remove redundant "#ifndef Py_LIMITED_API" in funcobject.h.

4 years agobpo-45434: Remove useless space in includes (GH-28963)
Victor Stinner [Thu, 14 Oct 2021 23:50:04 +0000 (01:50 +0200)] 
bpo-45434: Remove useless space in includes (GH-28963)

Micro-optimize spaces!

4 years agobpo-41710: Fix What's New Entry credit (GH-28962)
Victor Stinner [Thu, 14 Oct 2021 23:49:32 +0000 (01:49 +0200)] 
bpo-41710: Fix What's New Entry credit (GH-28962)

Fix bad copy/paste.

4 years agobpo-45434: Limited Python.h no longer includes stdio.h (GH-28960)
Victor Stinner [Thu, 14 Oct 2021 23:09:06 +0000 (01:09 +0200)] 
bpo-45434: Limited Python.h no longer includes stdio.h (GH-28960)

The <Python.h> header file no longer includes <stdio.h> if the
Py_LIMITED_API macro is defined.

4 years agobpo-45474: Fix the limited C API of marshal.h (GH-28956)
Victor Stinner [Thu, 14 Oct 2021 22:20:33 +0000 (00:20 +0200)] 
bpo-45474: Fix the limited C API of marshal.h (GH-28956)

Remove two functions from the limited C API:

* PyMarshal_WriteLongToFile()
* PyMarshal_WriteObjectToFile()

The PEP 384 excludes functions expecting "FILE*" from the stable ABI.

Remove also the Py_MARSHAL_VERSION macro from the limited C API.

4 years agobpo-35134: Add Include/cpython/floatobject.h (GH-28957)
Victor Stinner [Thu, 14 Oct 2021 21:41:06 +0000 (23:41 +0200)] 
bpo-35134: Add Include/cpython/floatobject.h (GH-28957)

Split Include/floatobject.h into sub-files: add
Include/cpython/floatobject.h and
Include/internal/pycore_floatobject.h.

4 years agobpo-21736: Set __file__ on frozen stdlib modules. (gh-28656)
Eric Snow [Thu, 14 Oct 2021 21:32:18 +0000 (15:32 -0600)] 
bpo-21736: Set __file__ on frozen stdlib modules. (gh-28656)

Currently frozen modules do not have __file__ set.  In their spec, origin is set to "frozen" and they are marked as not having a location.  (Similarly, for frozen packages __path__ is set to an empty list.)  However, for frozen stdlib modules we are able to extrapolate __file__ as long as we can determine the stdlib directory at runtime.  (We now do so since gh-28586.)  Having __file__ set is helpful for a number of reasons.  Likewise, having a non-empty __path__ means we can import submodules of a frozen package from the filesystem (e.g. we could partially freeze the encodings module).

This change sets __file__ (and adds to __path__) for frozen stdlib modules.  It uses sys._stdlibdir (from gh-28586) and the frozen module alias information (from gh-28655).  All that work is done in FrozenImporter (in Lib/importlib/_bootstrap.py).
 Also, if a frozen module is imported before importlib is bootstrapped (during interpreter initialization) then we fix up that module and its spec during the importlib bootstrapping step (i.e. imporlib._bootstrap._setup()) to match what gets set by FrozenImporter, including setting the file info (if the stdlib dir is known).  To facilitate this, modules imported using PyImport_ImportFrozenModule() have __origname__ set using the frozen module alias info.  __origname__ is popped off during importlib bootstrap.

(To be clear, even with this change the new code to set __file__ during fixups in imporlib._bootstrap._setup() doesn't actually get triggered yet.  This is because sys._stdlibdir hasn't been set yet in interpreter initialization at the point importlib is bootstrapped.  However, we do fix up such modules at that point to otherwise match the result of importing through FrozenImporter, just not the __file__ and __path__ parts.  Doing so will require changes in the order in which things happen during interpreter initialization.  That can be addressed separately.  Once it is, the file-related fixup code from this PR will kick in.)

Here are things this change does not do:

* set __file__ for non-stdlib modules (no way of knowing the parent dir)
* set __file__ if the stdlib dir is not known (nor assume the expense of finding it)
* relatedly, set __file__ if the stdlib is in a zip file
* verify that the filename set to __file__ actually exists (too expensive)
* update __path__ for frozen packages that alias a non-package (since there is no package dir)

Other things this change skips, but we may do later:

* set __file__ on modules imported using PyImport_ImportFrozenModule()
* set co_filename when we unmarshal the frozen code object while importing the module (e.g. in FrozenImporter.exec_module()) -- this would allow tracebacks to show source lines
* implement FrozenImporter.get_filename() and FrozenImporter.get_source()

https://bugs.python.org/issue21736

4 years agobpo-45417: [Enum] fix quadratic behavior during creation (GH-28907)
Carl Friedrich Bolz-Tereick [Thu, 14 Oct 2021 20:59:51 +0000 (22:59 +0200)] 
bpo-45417: [Enum] fix quadratic behavior during creation (GH-28907)

Creating an Enum exhibited quadratic behavior based on the number of members in three places:
- `EnumDict._member_names`: a list searched with each new member's name
- member creation: a `for` loop checking each existing member to see if new member was a duplicate
- `auto()` values: a list of all previous values in enum was copied before being sent to `_generate_next_value()`

Two of those issues have been resolved:
- `_EnumDict._member_names` is now a dictionary so lookups are fast
- member creation tries a fast value lookup before falling back to the slower `for` loop lookup

The third issue still remains, as `_generate_next_value_()` can be user-overridden and could corrupt the last values list if it were not copied.

4 years agobpo-45471: Do not set PyConfig.stdlib_dir in Py_SetPythonHome(). (gh-28954)
Eric Snow [Thu, 14 Oct 2021 20:48:32 +0000 (14:48 -0600)] 
bpo-45471: Do not set PyConfig.stdlib_dir in Py_SetPythonHome(). (gh-28954)

The change in gh-28586 (bpo-45211) should not have included code to set _Py_path_config.stdlib_dir in Py_SetPythonHome(). We fix that here.

https://bugs.python.org/issue45471

4 years agobpo-45439: Move _PyObject_VectorcallTstate() to pycore_call.h (GH-28893)
Victor Stinner [Thu, 14 Oct 2021 19:53:04 +0000 (21:53 +0200)] 
bpo-45439: Move _PyObject_VectorcallTstate() to pycore_call.h (GH-28893)

* Move _PyObject_VectorcallTstate() and _PyObject_FastCallTstate() to
  pycore_call.h (internal C API).
* Convert PyObject_CallOneArg(), PyObject_Vectorcall(),
  _PyObject_FastCall() and PyVectorcall_Function() static inline
  functions to regular functions.
* Add _PyVectorcall_FunctionInline() static inline function.
* PyObject_Vectorcall(), _PyObject_FastCall(), and
  PyObject_CallOneArg() now call _PyThreadState_GET() rather
  than PyThreadState_Get().

4 years agobpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec...
Serhiy Storchaka [Thu, 14 Oct 2021 17:04:19 +0000 (20:04 +0300)] 
bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944)

They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.raw_unicode_escape_decode().
It is True by default to match the former behavior.

4 years agono-issue: Make silence about warning '_POSIX_C_SOURCE redefined' (GH-28948)
Dong-hee Na [Thu, 14 Oct 2021 15:59:56 +0000 (00:59 +0900)] 
no-issue: Make silence about  warning '_POSIX_C_SOURCE redefined' (GH-28948)

4 years agobpo-45367: Specialize BINARY_MULTIPLY (GH-28727)
Dennis Sweeney [Thu, 14 Oct 2021 14:56:33 +0000 (10:56 -0400)] 
bpo-45367: Specialize BINARY_MULTIPLY (GH-28727)

4 years agobpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec...
Serhiy Storchaka [Thu, 14 Oct 2021 10:17:00 +0000 (13:17 +0300)] 
bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939)

They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.unicode_escape_decode().
It is True by default to match the former behavior.

4 years agoEnsure that instruction cases are self-contained (GH-28938)
Brandt Bucher [Wed, 13 Oct 2021 22:34:11 +0000 (15:34 -0700)] 
Ensure that instruction cases are self-contained (GH-28938)