]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 years agobpo-45876: Have stdev() also use decimal specific square root. (GH-29869)
Raymond Hettinger [Wed, 1 Dec 2021 01:25:57 +0000 (19:25 -0600)] 
bpo-45876:  Have stdev() also use decimal specific square root. (GH-29869)

3 years agobpo-45876: Correctly rounded stdev() and pstdev() for the Decimal case (GH-29828)
Raymond Hettinger [Wed, 1 Dec 2021 00:20:08 +0000 (18:20 -0600)] 
bpo-45876:  Correctly rounded stdev() and pstdev() for the Decimal case (GH-29828)

3 years agobpo-45711: Change exc_info related APIs to derive type and traceback from the excepti...
Irit Katriel [Tue, 30 Nov 2021 22:37:04 +0000 (22:37 +0000)] 
bpo-45711: Change exc_info related APIs to derive type and traceback from the exception instance (GH-29780)

3 years agobpo-30533:Add function inspect.getmembers_static that does not call properties or...
Weipeng Hong [Tue, 30 Nov 2021 18:23:13 +0000 (02:23 +0800)] 
bpo-30533:Add function inspect.getmembers_static that does not call properties or dynamic properties. (#20911)

* Add function inspect.getmembers_static that does not call properties or dynamic
properties.

* update _getmembers args

* Update Misc/NEWS.d/next/Library/2020-06-16-18-00-56.bpo-30533.StL57t.rst

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
* Update Lib/inspect.py

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
* Removes the copy pasted doc string

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
Co-authored-by: Dino Viehland <dinoviehland@gmail.com>
3 years agobpo-45476: Disallow using asdl_seq_GET() as l-value (GH-29866)
Victor Stinner [Tue, 30 Nov 2021 14:13:55 +0000 (15:13 +0100)] 
bpo-45476: Disallow using asdl_seq_GET() as l-value (GH-29866)

The following internal macros can not longer be used as l-value:

* asdl_seq_GET()
* asdl_seq_GET_UNTYPED()
* asdl_seq_LEN()

They are modified to use the _Py_RVALUE() macro.

3 years agobpo-45476: Add _Py_RVALUE() macro (GH-29860)
Victor Stinner [Tue, 30 Nov 2021 11:14:45 +0000 (12:14 +0100)] 
bpo-45476: Add _Py_RVALUE() macro (GH-29860)

Add a new _Py_RVALUE() macro to prevent using an expression as an
l-value.

Replace a "(void)" cast with the _Py_RVALUE() macro in the following
macros:

* PyCell_SET()
* PyList_SET_ITEM()
* PyTuple_SET_ITEM()
* _PyGCHead_SET_FINALIZED()
* _PyGCHead_SET_NEXT()
* asdl_seq_SET()
* asdl_seq_SET_UNTYPED()

Add also parentheses around macro arguments in PyCell_SET() and
PyTuple_SET_ITEM() macros.

3 years agobpo-33381: [doc] strftime's %f option may pad zeros on the left or the right (GH...
Vishal Pandey [Tue, 30 Nov 2021 11:01:44 +0000 (16:31 +0530)] 
bpo-33381: [doc] strftime's %f option may pad zeros on the left or the right (GH-29801)

3 years agoFix EncodingWarning in Tools/freeze/test/freeze.py (GH-29742)
Inada Naoki [Tue, 30 Nov 2021 04:16:40 +0000 (13:16 +0900)] 
Fix EncodingWarning in Tools/freeze/test/freeze.py (GH-29742)

3 years agono-issue: remove unused import from test_graphlib.py (GH-29853)
Adrian Garcia Badaracco [Tue, 30 Nov 2021 02:27:37 +0000 (18:27 -0800)] 
no-issue: remove unused import from test_graphlib.py (GH-29853)

3 years agobpo-45931: Prevent Directory.Build.props/targets from leaking from directories above...
David Federman [Mon, 29 Nov 2021 22:40:34 +0000 (14:40 -0800)] 
bpo-45931: Prevent Directory.Build.props/targets from leaking from directories above the repo when building on Windows (GH-29854)

3 years agobpo-45653: fix test_embed on windows (GH-29814)
Kumar Aditya [Mon, 29 Nov 2021 20:27:34 +0000 (01:57 +0530)] 
bpo-45653: fix test_embed on windows (GH-29814)

3 years agobpo-45917: Add math.exp2() method - return 2 raised to the power of x (GH-29829)
Gideon [Mon, 29 Nov 2021 18:55:43 +0000 (12:55 -0600)] 
bpo-45917: Add math.exp2() method - return 2 raised to the power of x (GH-29829)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
3 years agobpo-43905: Expand dataclasses.astuple() and asdict() docs (GH-26154)
andrei kulakov [Mon, 29 Nov 2021 18:10:32 +0000 (13:10 -0500)] 
bpo-43905: Expand dataclasses.astuple() and asdict() docs (GH-26154)

Expanded ``astuple()`` docs, warning about deepcopy being applied
and providing a workaround.

Automerge-Triggered-By: GH:ericvsmith
3 years agobpo-44391: Remove unused argument from a varargs call. (GH-29843)
Vinay Sajip [Mon, 29 Nov 2021 17:26:50 +0000 (17:26 +0000)] 
bpo-44391: Remove unused argument from a varargs call. (GH-29843)

3 years agobpo-45881: configure --with-freeze-module --with-build-python (GH-29835)
Christian Heimes [Mon, 29 Nov 2021 16:23:29 +0000 (18:23 +0200)] 
bpo-45881: configure --with-freeze-module --with-build-python (GH-29835)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Ethan Smith <ethan@ethanhs.me>
3 years agobpo-45847: PY_STDLIB_MOD_SIMPLE now checks py_stdlib_not_available (GH-29844)
Christian Heimes [Mon, 29 Nov 2021 15:34:16 +0000 (17:34 +0200)] 
bpo-45847: PY_STDLIB_MOD_SIMPLE now checks py_stdlib_not_available (GH-29844)

3 years agobpo-45828: Use unraisable exceptions within sqlite3 callbacks (FH-29591)
Erlend Egeberg Aasland [Mon, 29 Nov 2021 15:22:32 +0000 (16:22 +0100)] 
bpo-45828: Use unraisable exceptions within sqlite3 callbacks (FH-29591)

3 years agobpo-40280: Emscripten systems use .wasm suffix by default (GH-29842)
Christian Heimes [Mon, 29 Nov 2021 15:01:55 +0000 (17:01 +0200)] 
bpo-40280: Emscripten systems use .wasm suffix by default (GH-29842)

3 years agobpo-45723: Sort the grand AC_CHECK_HEADERS check (GH-29846)
Erlend Egeberg Aasland [Mon, 29 Nov 2021 14:41:11 +0000 (15:41 +0100)] 
bpo-45723: Sort the grand AC_CHECK_HEADERS check (GH-29846)

Automerge-Triggered-By: GH:tiran
3 years agobpo-45847: Make socket module conditional (GH-29769)
Erlend Egeberg Aasland [Mon, 29 Nov 2021 13:57:36 +0000 (14:57 +0100)] 
bpo-45847: Make socket module conditional (GH-29769)

3 years ago[Doc] Add info to logging cookbook about running logging socket listeners i… (GH...
Vinay Sajip [Mon, 29 Nov 2021 13:06:52 +0000 (13:06 +0000)] 
[Doc] Add info to logging cookbook about running logging socket listeners i… (GH-29838)

3 years agobpo-45786: Allocate space for frame in frame object. (GH-29729)
Mark Shannon [Mon, 29 Nov 2021 12:34:59 +0000 (12:34 +0000)] 
bpo-45786: Allocate space for frame in frame object. (GH-29729)

3 years agobpo-43498: Fix dictionary iteration error in _ExecutorManagerThread (GH-24868)
Jakub Kulík [Mon, 29 Nov 2021 12:02:56 +0000 (13:02 +0100)] 
bpo-43498: Fix dictionary iteration error in _ExecutorManagerThread (GH-24868)

3 years agobpo-40280: Disable unusable core extension modules on emscripten (GH-29834)
Erlend Egeberg Aasland [Mon, 29 Nov 2021 11:39:14 +0000 (12:39 +0100)] 
bpo-40280: Disable unusable core extension modules on emscripten (GH-29834)

Co-authored-by: Christian Heimes <christian@python.org>
3 years agobpo-45847: Fix _multiprocessing on platforms without sem_open (GH-29833)
Christian Heimes [Mon, 29 Nov 2021 09:36:10 +0000 (11:36 +0200)] 
bpo-45847: Fix _multiprocessing on platforms without sem_open (GH-29833)

3 years agoRemove misleading comment in the AST optimizer (#29825)
Serhiy Storchaka [Mon, 29 Nov 2021 08:19:59 +0000 (10:19 +0200)] 
Remove misleading comment in the AST optimizer (#29825)

3 years agobpo-37658: Actually return result in race condition (GH-29202)
Sam Bull [Mon, 29 Nov 2021 08:12:57 +0000 (08:12 +0000)] 
bpo-37658: Actually return result in race condition (GH-29202)

3 years agobpo-45915: use fcntl(fd, F_GETFD) in is_valid_fd() (GH-29821)
Christian Heimes [Sun, 28 Nov 2021 18:40:27 +0000 (20:40 +0200)] 
bpo-45915: use fcntl(fd, F_GETFD) in is_valid_fd() (GH-29821)

3 years agobpo-45847: Port _multiprocessing to PY_STDLIB_MOD (GH-29768)
Erlend Egeberg Aasland [Sun, 28 Nov 2021 12:00:51 +0000 (13:00 +0100)] 
bpo-45847: Port _multiprocessing to PY_STDLIB_MOD (GH-29768)

3 years agobpo-19460: Add test for MIMENonMultipart (GH-29817)
180909 [Sun, 28 Nov 2021 09:24:41 +0000 (17:24 +0800)] 
bpo-19460: Add test for MIMENonMultipart (GH-29817)

3 years agobpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726)
Irit Katriel [Sat, 27 Nov 2021 22:00:10 +0000 (22:00 +0000)] 
bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726)

3 years agobpo-42268: Fail the configure step if the selected compiler doesn't support memory...
Pablo Galindo Salgado [Sat, 27 Nov 2021 18:04:06 +0000 (18:04 +0000)] 
bpo-42268: Fail the configure step if the selected compiler doesn't support memory sanitizer (GH-29806)

3 years agobpo-45876: Improve accuracy for stdev() and pstdev() in statistics (GH-29736)
Raymond Hettinger [Sat, 27 Nov 2021 05:54:50 +0000 (22:54 -0700)] 
bpo-45876: Improve accuracy for stdev() and pstdev() in statistics (GH-29736)

* Inlined code from variance functions

* Added helper functions for the float square root of a fraction

* Call helper functions

* Add blurb

* Fix over-specified test

* Add a test for the _sqrt_frac() helper function

* Increase the tested range

* Add type hints to the internal function.

* Fix test for correct rounding

* Simplify ⌊√(n/m)⌋ calculation

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* Add comment and beef-up tests

* Test for zero denominator

* Add algorithmic references

* Add test for the _isqrt_frac_rto() helper function.

* Compute the 109 instead of hard-wiring it

* Stronger test for _isqrt_frac_rto()

* Bigger range

* Bigger range

* Replace float() call with int/int division to be parallel with the other code path.

* Factor out division. Update proof link. Remove internal type declaration

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
3 years agobpo-44530: Reverts a change to the 'code.__new__' audit event (GH-29809)
Steve Dower [Sat, 27 Nov 2021 00:26:45 +0000 (00:26 +0000)] 
bpo-44530: Reverts a change to the 'code.__new__' audit event (GH-29809)

3 years agobpo-41735: Fix thread lock in zlib.Decompress.flush() may go wrong (GH-29587)
Ma Lin [Sat, 27 Nov 2021 00:18:17 +0000 (08:18 +0800)] 
bpo-41735: Fix thread lock in zlib.Decompress.flush() may go wrong (GH-29587)

* Fix thread lock in zlib.Decompress.flush() may go wrong

Getting `.unconsumed_tail` before acquiring the thread lock may mix up decompress state.

3 years agobpo-45901: Fixes argument passing when invoking .py files directly through the Store...
Steve Dower [Fri, 26 Nov 2021 23:08:20 +0000 (23:08 +0000)] 
bpo-45901: Fixes argument passing when invoking .py files directly through the Store package (GH-29799)

3 years agoFix markup buglet in Doc/howto/annotations.rst (#29802)
Guido van Rossum [Fri, 26 Nov 2021 22:10:01 +0000 (14:10 -0800)] 
Fix markup buglet in Doc/howto/annotations.rst (#29802)

3 years agobpo-45866: Fix typo in the NEWS entry (GH-29798)
Victor Stinner [Fri, 26 Nov 2021 21:56:25 +0000 (22:56 +0100)] 
bpo-45866: Fix typo in the NEWS entry (GH-29798)

3 years agobpo-40280: Move hard-coded feature checks to configure (GH-29789)
Christian Heimes [Fri, 26 Nov 2021 18:36:48 +0000 (20:36 +0200)] 
bpo-40280: Move hard-coded feature checks to configure (GH-29789)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
3 years agobpo-45019: Cleanup module freezing and deepfreeze (#29772)
Kumar Aditya [Fri, 26 Nov 2021 16:50:54 +0000 (22:20 +0530)] 
bpo-45019: Cleanup module freezing and deepfreeze (#29772)

3 years agobpo-45886: Fix OOT build when srcdir has frozen module headers (GH-29793)
Christian Heimes [Fri, 26 Nov 2021 16:05:16 +0000 (18:05 +0200)] 
bpo-45886: Fix OOT build when srcdir has frozen module headers (GH-29793)

The presence of frozen module headers in srcdir interfers with OOT
build. Make considers headers in srcdir up to date, but later builds do
not use VPATH to locate files. make clean now removes the headers, too.

Also remove stale ``_bootstrap_python`` from .gitignore.

3 years agobpo-40280: Add configure check for socket shutdown (GH-29795)
Christian Heimes [Fri, 26 Nov 2021 14:16:54 +0000 (16:16 +0200)] 
bpo-40280: Add configure check for socket shutdown (GH-29795)

3 years agobpo-45760: Remove PyNumber_InMatrixMultiply (GH-29751)
Dong-hee Na [Fri, 26 Nov 2021 14:10:10 +0000 (23:10 +0900)] 
bpo-45760: Remove PyNumber_InMatrixMultiply (GH-29751)

3 years agobpo-40280: clean and ignore .wasm files (GH-29794)
Christian Heimes [Fri, 26 Nov 2021 13:29:46 +0000 (15:29 +0200)] 
bpo-40280: clean and ignore .wasm files (GH-29794)

3 years agobpo-45866: pegen strips directory of "generated from" header (GH-29777)
Victor Stinner [Fri, 26 Nov 2021 10:50:34 +0000 (11:50 +0100)] 
bpo-45866: pegen strips directory of "generated from" header (GH-29777)

"make regen-all" now produces the same output when run from a
directory other than the source tree: when building Python out of the
source tree.

3 years agobpo-40280: Use Setup.stdlib static for wasm builds (GH-29784)
Christian Heimes [Fri, 26 Nov 2021 07:26:49 +0000 (09:26 +0200)] 
bpo-40280: Use Setup.stdlib static for wasm builds (GH-29784)

``Modules/Setup.stdlib`` contains ``Setup`` lines for all stdlib extension modules for which ``configure`` has detected their dependencies. The file is not used yet and still under development. To use the file, do ``ln -sfr Modules/Setup.stdlib Modules/Setup.local``.

3 years agobpo-45619: documentation of execution model: clarify and update binding summary ...
Arthur Milchior [Fri, 26 Nov 2021 05:19:06 +0000 (06:19 +0100)] 
bpo-45619: documentation of execution model: clarify and update binding summary (#29232)

This does two changes that are quite related.

0. it add that variable binding can occur in pattern matching, an update of 3.10
which seems to have been omitted from the list of bindings
1. Given how long the sentence already was, with even subcases in the middle of
the sentence, the commit breaks the sentence into an actual list.

3 years agobpo-44353: Correct docstring for `NewType` (#29785)
Alex Waygood [Fri, 26 Nov 2021 04:55:15 +0000 (04:55 +0000)] 
bpo-44353: Correct docstring for `NewType` (#29785)

The docstring for `typing.NewType` is no longer strictly accurate, now that `NewType` is a class, rather than a function

3 years agobpo-43137: webbrowser: Replace gvfs-open and gnome-open with "gio open" (GH-29154)
Simon McVittie [Thu, 25 Nov 2021 20:49:48 +0000 (20:49 +0000)] 
bpo-43137: webbrowser: Replace gvfs-open and gnome-open with "gio open" (GH-29154)

* [bpo-43137](): webbrowser: Prefer gio open over gvfs-open

    gvfs-open(1) was superseded by gio(1) in 2015, and removed from GNOME
    releases in 2018. Debian and its derivatives like Ubuntu currently still
    have a compatibility shim for gvfs-open, but we plan to remove it.

    webbrowser prefers xdg-settings and xdg-open over gvfs-open, so this
    will only have any practical effect on systems where the xdg-utils
    package is not installed.

    Note that we don't check for GNOME_DESKTOP_SESSION_ID before using gio.
    gio does the right thing on any desktop environment that follows
    freedesktop.org specifications, similar to xdg-settings, so it's
    unnecessary to guard in this way. GNOME_DESKTOP_SESSION_ID was deprecated
    in 2008 and removed from upstream gnome-session in 2018 (it's still
    present in Debian/Ubuntu for backward compatibility, but probably
    shouldn't be). The replacement way to detect a desktop environment is
    the XDG_CURRENT_DESKTOP environment variable, which is a colon-separated
    sequence where the first item is the current desktop environment and the
    second and subsequent items (if present) are other desktop environments
    that it resembles or is based on.

    Resolves:

* [bpo-43137](): webbrowser: Never invoke gnome-open

    gnome-open was part of GNOME 2, which was superseded in around 2010 and
    is unmaintained. The replacement was gvfs-open, which was subsequently
    replaced by gio(1) (as used in the previous commit).

* [bpo-43137](): webbrowser: Don't run gvfs-open on GNOME

    gvfs-open was deprecated in 2015 and removed in 2018. The replacement
    is gio(1) (as used in a previous commit).

    GNOME_DESKTOP_SESSION_ID was deprecated in 2008 and removed in 2018.
    The replacement is XDG_CURRENT_DESKTOP (as mentioned in a previous
    commit).

---

To test this on a typical modern Linux system, it is necessary to disable the `xdg-settings` and `xdg-open` code paths, for example with this hack:

<details><summary>Hack to disable use of xdg-settings and xdg-open</summary>

```diff
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 3244f206aa..8f6c09d1d2 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -459,7 +459,7 @@ def open(self, url, new=0, autoraise=True):
 def register_X_browsers():

     # use xdg-open if around
-    if shutil.which("xdg-open"):
+    if 0 and shutil.which("xdg-open"):
         register("xdg-open", None, BackgroundBrowser("xdg-open"))

     # Opens an appropriate browser for the URL scheme according to
@@ -549,7 +549,7 @@ def register_standard_browsers():
         # Prefer X browsers if present
         if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"):
             try:
-                cmd = "xdg-settings get default-web-browser".split()
+                cmd = "false xdg-settings get default-web-browser".split()
                 raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
                 result = raw_result.decode().strip()
             except (FileNotFoundError, subprocess.CalledProcessError, PermissionError, NotADirectoryError) :
```

</details>

I haven't attempted to assess which of the specific web browsers such as Galeon are still extant, and which ones disappeared years ago. They could almost certainly be cleaned up, but that's beyond the scope of this PR.

3 years agobpo-40280: Add wasm cross build targets (GH-29771)
Christian Heimes [Thu, 25 Nov 2021 20:24:40 +0000 (22:24 +0200)] 
bpo-40280: Add wasm cross build targets (GH-29771)

3 years agobpo-33393: Update config.guess and config.sub (GH-29781)
Christian Heimes [Thu, 25 Nov 2021 19:55:29 +0000 (21:55 +0200)] 
bpo-33393: Update config.guess and config.sub (GH-29781)

3 years agoAdd missing 'await writer.drain()' call to example (GH-29162)
Sergey Kolesnikov [Thu, 25 Nov 2021 17:15:24 +0000 (20:15 +0300)] 
Add missing 'await writer.drain()' call to example (GH-29162)

Automerge-Triggered-By: GH:asvetlov
3 years agobpo-45568: Actually use @asynccontextmanager in usage example (GH-29151)
Zbigniew Siciarz [Thu, 25 Nov 2021 12:30:48 +0000 (13:30 +0100)] 
bpo-45568: Actually use @asynccontextmanager in usage example (GH-29151)

Automerge-Triggered-By: GH:asvetlov
3 years agobpo-41498: Fix build on platforms without sigset_t (GH-29770)
Christian Heimes [Thu, 25 Nov 2021 11:28:41 +0000 (13:28 +0200)] 
bpo-41498: Fix build on platforms without sigset_t (GH-29770)

3 years agobpo-45711: use exc_value instead of exc_type to determine if exc_info is valid. Add...
Irit Katriel [Thu, 25 Nov 2021 09:41:28 +0000 (09:41 +0000)] 
bpo-45711: use exc_value instead of exc_type to determine if exc_info is valid. Add more assertions. (GH-29627)

3 years agobpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside paren...
Pablo Galindo Salgado [Wed, 24 Nov 2021 22:21:23 +0000 (22:21 +0000)] 
bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses (GH-29757)

3 years agobpo-45893: Add missing extern C to initconfig.h (GH-29761)
Christian Heimes [Wed, 24 Nov 2021 20:12:12 +0000 (22:12 +0200)] 
bpo-45893: Add missing extern C to initconfig.h (GH-29761)

Co-authored-by: Steve Dower <steve.dower@python.org>
3 years agobpo-45693: Document `port` parameter to `loop.create_server` (GH-29760)
Jim Crist-Harif [Wed, 24 Nov 2021 19:43:57 +0000 (13:43 -0600)] 
bpo-45693: Document `port` parameter to `loop.create_server` (GH-29760)

Document the `port` parameter to `loop.create_server` in `asyncio`. In
particular, note that if `host` resolves to multiple network interfaces,
passing in `port=0` will result in a different random unused port being
used for each interface.

Automerge-Triggered-By: GH:ericvsmith
3 years agoFix typo in freeze_modules (#29744)
Kumar Aditya [Wed, 24 Nov 2021 19:12:03 +0000 (00:42 +0530)] 
Fix typo in freeze_modules (#29744)

3 years agobpo-45020: Fix strict-prototypes warning (GH-29755)
Christian Heimes [Wed, 24 Nov 2021 19:01:39 +0000 (21:01 +0200)] 
bpo-45020: Fix strict-prototypes warning (GH-29755)

3 years agobpo-45822: Minor cleanups to the test_Py_CompileString test (GH-29750)
Pablo Galindo Salgado [Wed, 24 Nov 2021 18:30:03 +0000 (18:30 +0000)] 
bpo-45822: Minor cleanups to the test_Py_CompileString test (GH-29750)

3 years agobpo-45881: Use CC from env first for cross building (GH-29752)
Christian Heimes [Wed, 24 Nov 2021 17:53:33 +0000 (19:53 +0200)] 
bpo-45881: Use CC from env first for cross building (GH-29752)

3 years agobpo-45847: Fix _crypt detection on Ubuntu (GH-29743)
Christian Heimes [Wed, 24 Nov 2021 09:47:22 +0000 (11:47 +0200)] 
bpo-45847: Fix _crypt detection on Ubuntu (GH-29743)

3 years agobpo-45847: Port _uuid to PY_STDLIB_MOD (GH-29741)
Christian Heimes [Wed, 24 Nov 2021 09:20:37 +0000 (11:20 +0200)] 
bpo-45847: Port _uuid to PY_STDLIB_MOD (GH-29741)

3 years agobpo-45514: Deprecate importlib resources legacy functions. (GH-29036)
Jason R. Coombs [Wed, 24 Nov 2021 07:51:37 +0000 (02:51 -0500)] 
bpo-45514: Deprecate importlib resources legacy functions. (GH-29036)

* bpo-45514: Apply changes from importlib_resources@a3ef4128c6

* Mark legacy functions as deprecated in the docs and link to the migration docs in importlib_resources docs.

* Apply changes from importlib_resources@329ae9d5f2c.

* Indicate importlib.resources as a module.

Co-authored-by: Filipe Laíns <lains@riseup.net>
3 years agobpo-45847: Port _posixshmem to PY_STDLIB_MOD (GH-29738)
Erlend Egeberg Aasland [Wed, 24 Nov 2021 07:19:17 +0000 (08:19 +0100)] 
bpo-45847: Port _posixshmem to PY_STDLIB_MOD (GH-29738)

3 years agobpo-45886: Allow overriding freeze command for cross compiling (GH-29735)
Christian Heimes [Wed, 24 Nov 2021 07:07:15 +0000 (09:07 +0200)] 
bpo-45886: Allow overriding freeze command for cross compiling (GH-29735)

3 years agobpo-45616: Let py.exe distinguish between v3.1 and v3.10 (GH-29731)
Zachary Ware [Wed, 24 Nov 2021 04:41:04 +0000 (22:41 -0600)] 
bpo-45616: Let py.exe distinguish between v3.1 and v3.10 (GH-29731)

3 years agobpo-45847: Port _gdbm to PY_STDLIB_MOD (GH-29720)
Christian Heimes [Tue, 23 Nov 2021 21:58:38 +0000 (23:58 +0200)] 
bpo-45847: Port _gdbm to PY_STDLIB_MOD (GH-29720)

3 years agobpo-45847: Port _ssl and _hashlib to PY_STDLIB_MOD (GH-29727)
Christian Heimes [Tue, 23 Nov 2021 21:58:13 +0000 (23:58 +0200)] 
bpo-45847: Port _ssl and _hashlib to PY_STDLIB_MOD (GH-29727)

3 years agobpo-45847: Port _crypt to PY_STDLIB_MOD (GH-29725)
Christian Heimes [Tue, 23 Nov 2021 21:26:50 +0000 (23:26 +0200)] 
bpo-45847: Port _crypt to PY_STDLIB_MOD (GH-29725)

3 years agobpo-45873: Restore Python 3.6 compatibility (GH-29730)
Christian Heimes [Tue, 23 Nov 2021 20:36:40 +0000 (22:36 +0200)] 
bpo-45873: Restore Python 3.6 compatibility (GH-29730)

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
3 years agobpo-39026: Fix Python.h when building with Xcode (GH-29488)
Victor Stinner [Tue, 23 Nov 2021 17:58:57 +0000 (18:58 +0100)] 
bpo-39026: Fix Python.h when building with Xcode (GH-29488)

Fix Python.h to build C extensions with Xcode: remove a relative
include from Include/cpython/pystate.h.

3 years agobpo-45873: Get rid of bootstrap_python (#29717)
Guido van Rossum [Tue, 23 Nov 2021 16:56:06 +0000 (08:56 -0800)] 
bpo-45873: Get rid of bootstrap_python (#29717)

Instead we use $(PYTHON_FOR_REGEN) .../deepfreeze.py with the
frozen .h file as input, as we did for Windows in bpo-45850.

We also get rid of the code that generates the .h files
when make regen-frozen is run (i.e., .../make_frozen.py),
and the MANIFEST file.

Restore Python 3.8 and 3.9 as Windows host Python again

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
3 years agobpo-45703: Invalidate _NamespacePath cache on importlib.invalidate_ca… (GH-29384)
Miro Hrončok [Tue, 23 Nov 2021 15:38:02 +0000 (16:38 +0100)] 
bpo-45703: Invalidate _NamespacePath cache on importlib.invalidate_ca… (GH-29384)

Consider the following directory structure:

    .
    └── PATH1
        └── namespace
            └── sub1
                └── __init__.py

And both PATH1 and PATH2 in sys path:

    $ PYTHONPATH=PATH1:PATH2 python3.11
    >>> import namespace
    >>> import namespace.sub1
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> ...

While this interpreter still runs, PATH2/namespace/sub2 is created:

    .
    ├── PATH1
    │   └── namespace
    │       └── sub1
    │           └── __init__.py
    └── PATH2
        └── namespace
            └── sub2
                └── __init__.py

The newly created module cannot be imported:

    >>> ...
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> import namespace.sub2
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'namespace.sub2'

Calling importlib.invalidate_caches() now newly allows to import it:

    >>> import importlib
    >>> importlib.invalidate_caches()
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> import namespace.sub2
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace', '.../PATH2/namespace'])

This was not previously possible.

3 years agobpo-45783: Preserve file moves and deletions in the tests for the freeze tool. (GH...
Eric Snow [Tue, 23 Nov 2021 13:43:40 +0000 (06:43 -0700)] 
bpo-45783: Preserve file moves and deletions in the tests for the freeze tool. (GH-29527)

Use shutil.copytree rather than Git, which might be missing (or configured
differently) when testing Python built from a source release.

3 years agobpo-45878: convert `try/except` to `self.assertRaises` in `Lib/ctypes/test/test_funct...
Nikita Sobolev [Tue, 23 Nov 2021 11:12:13 +0000 (14:12 +0300)] 
bpo-45878: convert `try/except` to `self.assertRaises` in `Lib/ctypes/test/test_functions.py` (GH-29721)

3 years agoClarify that discutils.(plat)include is for CPython's headers (GH-29578)
Petr Viktorin [Tue, 23 Nov 2021 10:28:14 +0000 (11:28 +0100)] 
Clarify that discutils.(plat)include is for CPython's headers (GH-29578)

Change the docs to note that "include" and "platinclude" are
for CPython's headers, and not necessarily for headers of
third-party libraries.

See discussion in: https://discuss.python.org/t/clarification-on-a-wheels-header-data/9305/19

3 years agobpo-44525: Copy free variables in bytecode to allow calls to inner functions to be...
Mark Shannon [Tue, 23 Nov 2021 09:53:24 +0000 (09:53 +0000)] 
bpo-44525: Copy free variables in bytecode to allow calls to inner functions to be specialized (GH-29595)

* Make internal APIs that take PyFrameConstructor take a PyFunctionObject instead.

* Add reference to function to frame, borrow references to builtins and globals.

* Add COPY_FREE_VARS instruction to allow specialization of calls to inner functions.

3 years agobpo-45847: Port _socket to PY_STDLIB_MOD (GH-29713)
Erlend Egeberg Aasland [Tue, 23 Nov 2021 07:52:05 +0000 (08:52 +0100)] 
bpo-45847: Port _socket to PY_STDLIB_MOD (GH-29713)

3 years agobpo-45847: Fix xxlimited and xxlimited_35 build conditions (GH-29715)
Erlend Egeberg Aasland [Tue, 23 Nov 2021 07:51:30 +0000 (08:51 +0100)] 
bpo-45847: Fix xxlimited and xxlimited_35 build conditions (GH-29715)

3 years agobpo-45561: Run smelly.py tool from $(srcdir) (GH-29138)
Neil Schemenauer [Tue, 23 Nov 2021 07:51:02 +0000 (23:51 -0800)] 
bpo-45561: Run smelly.py tool from $(srcdir) (GH-29138)

3 years agobpo-42238: [doc] Announce the future removal of make suspicous. (GH-29652)
Julien Palard [Mon, 22 Nov 2021 23:17:54 +0000 (00:17 +0100)] 
bpo-42238: [doc] Announce the future removal of make suspicous. (GH-29652)

* bpo-42238: [doc] Announce the future removal of make suspicous.

* Add a news entry.

3 years agobpo-45847: Port xxlimited and xxlimited_35 to PY_STDLIB_MOD (GH-29707)
Erlend Egeberg Aasland [Mon, 22 Nov 2021 20:27:05 +0000 (21:27 +0100)] 
bpo-45847: Port xxlimited and xxlimited_35 to PY_STDLIB_MOD (GH-29707)

3 years agobpo-45850: Implement deep-freeze on Windows (#29648)
Guido van Rossum [Mon, 22 Nov 2021 18:09:48 +0000 (10:09 -0800)] 
bpo-45850: Implement deep-freeze on Windows (#29648)

Implement changes to build with deep-frozen modules on Windows.
Note that we now require Python 3.10 as the "bootstrap" or "host" Python.
This causes a modest startup speed (around 7%) on Windows.

3 years agobpo-45871: Refactor except matcher validation into a separate function so that it...
Irit Katriel [Mon, 22 Nov 2021 16:56:23 +0000 (16:56 +0000)] 
bpo-45871: Refactor except matcher validation into a separate function so that it can be reused. Add missing unit test. (GH-29711)

3 years agobpo-45847: port _struct to PY_STDLIB_MOD (GH-29706)
Christian Heimes [Mon, 22 Nov 2021 14:58:43 +0000 (16:58 +0200)] 
bpo-45847: port _struct to PY_STDLIB_MOD (GH-29706)

3 years agobpo-45859: Mark test_field_descriptor in test_collections as CPython-only (GH-29691)
Carl Friedrich Bolz-Tereick [Mon, 22 Nov 2021 14:44:57 +0000 (15:44 +0100)] 
bpo-45859: Mark test_field_descriptor in test_collections as CPython-only (GH-29691)

3 years agobpo-45847: Port audioop, _csv, and _posixsubprocess to PY_STDLIB_MOD_SIMPLE (GH-29705)
Erlend Egeberg Aasland [Mon, 22 Nov 2021 14:37:25 +0000 (15:37 +0100)] 
bpo-45847: Port audioop, _csv, and _posixsubprocess to PY_STDLIB_MOD_SIMPLE (GH-29705)

Automerge-Triggered-By: GH:tiran
3 years agobpo-45847: Port nis module to PY_STDLIB_MOD (GH-29699)
Christian Heimes [Mon, 22 Nov 2021 14:18:41 +0000 (16:18 +0200)] 
bpo-45847: Port nis module to PY_STDLIB_MOD (GH-29699)

3 years agobpo-45813: Make sure that frame->generator is NULLed when generator is deallocated...
Mark Shannon [Mon, 22 Nov 2021 14:01:23 +0000 (14:01 +0000)] 
bpo-45813: Make sure that frame->generator is NULLed when generator is deallocated. (GH-29700)

3 years agobpo-45847: Port compression libs to PY_STDLIB_MOD (GH-29702)
Christian Heimes [Mon, 22 Nov 2021 13:52:29 +0000 (15:52 +0200)] 
bpo-45847: Port compression libs to PY_STDLIB_MOD (GH-29702)

3 years agobpo-45847: Port mmap, select, and _xxsubinterpreters to Py_STDLIB_MOD (GH-29703)
Erlend Egeberg Aasland [Mon, 22 Nov 2021 13:49:58 +0000 (14:49 +0100)] 
bpo-45847: Port mmap, select, and _xxsubinterpreters to Py_STDLIB_MOD (GH-29703)

3 years agobpo-44649: Fix dataclasses(slots=True) with a field with a default, but init=False...
Eric V. Smith [Mon, 22 Nov 2021 13:26:12 +0000 (08:26 -0500)] 
bpo-44649: Fix dataclasses(slots=True) with a field with a default, but init=False (GH-29692)

Special handling is needed, because for non-slots dataclasses the instance attributes are not set: reading from a field just references the class's attribute of the same name, which contains the default value. But this doesn't work for classes using __slots__: they don't read the class's attribute. So in that case (and that case only), initialize the instance attribute. Handle this for both normal defaults, and for fields using default_factory.

3 years agobpo-45847: Port fcntl to Py_STDLIB_MOD (GH-29696)
Erlend Egeberg Aasland [Mon, 22 Nov 2021 13:02:27 +0000 (14:02 +0100)] 
bpo-45847: Port fcntl to Py_STDLIB_MOD (GH-29696)

Co-authored-by: Christian Heimes <christian@python.org>
3 years agobpo-45847: Various PY_STDLIB_MOD cleanups (GH-29697)
Christian Heimes [Mon, 22 Nov 2021 11:09:14 +0000 (13:09 +0200)] 
bpo-45847: Various PY_STDLIB_MOD cleanups (GH-29697)

3 years agobpo-45847: Port _lfprof, _opcode, _asyncio, _queue, _statistics, and _typing to PY_ST...
Erlend Egeberg Aasland [Mon, 22 Nov 2021 09:57:50 +0000 (10:57 +0100)] 
bpo-45847: Port _lfprof, _opcode, _asyncio, _queue, _statistics, and _typing to PY_STDLIB_MOD_SIMPLE (GH-29690)

Automerge-Triggered-By: GH:tiran
3 years agoFix out-of-tree build support for multissltest (GH-29694)
Christian Heimes [Mon, 22 Nov 2021 09:50:53 +0000 (11:50 +0200)] 
Fix out-of-tree build support for multissltest (GH-29694)

3 years agobpo-45847: Port _bisect, _heapq, _json, _pickle, _random, and _zoneinfo to PY_STDLIB_...
Erlend Egeberg Aasland [Mon, 22 Nov 2021 08:45:41 +0000 (09:45 +0100)] 
bpo-45847: Port _bisect, _heapq, _json, _pickle, _random, and _zoneinfo to PY_STDLIB_MOD_SIMPLE (GH-29689)

Automerge-Triggered-By: GH:tiran
3 years agobpo-45847: Port array, _contextvars, math, and cmath to PY_STDLIB_MOD_SIMPLE (GH...
Erlend Egeberg Aasland [Mon, 22 Nov 2021 08:05:36 +0000 (09:05 +0100)] 
bpo-45847: Port array, _contextvars, math, and cmath to PY_STDLIB_MOD_SIMPLE (GH-29688)