]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoRe-enable commented-out test in test_generators.py (#104130)
ymki4360 [Sun, 7 May 2023 04:44:46 +0000 (13:44 +0900)] 
Re-enable commented-out test in test_generators.py (#104130)

2 years agogh-104018: remove unused format "z" handling in string formatfloat() (#104107)
John Belmonte [Sun, 7 May 2023 04:41:42 +0000 (13:41 +0900)] 
gh-104018: remove unused format "z" handling in string formatfloat() (#104107)

This is a cleanup overlooked in PR #104033.

2 years agogh-97696: Use `PyObject_CallMethodNoArgs` and inline is_loop_running check in `_async...
Itamar Ostricher [Sun, 7 May 2023 04:25:45 +0000 (21:25 -0700)] 
gh-97696: Use `PyObject_CallMethodNoArgs` and inline is_loop_running check in `_asyncio` (#104255)

2 years agogh-103886: Improve `builtins.__doc__` (#104179)
Tomas R [Sun, 7 May 2023 02:05:34 +0000 (04:05 +0200)] 
gh-103886: Improve `builtins.__doc__` (#104179)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-104254: Document the optional keyword-only "context" argument to Task constructor...
Itamar Ostricher [Sun, 7 May 2023 01:31:53 +0000 (18:31 -0700)] 
gh-104254: Document the optional keyword-only "context" argument to Task constructor (#104251)

(This was added in 3.11. It was already documented for `create_task()`, but not for `Task()`.)

2 years agogh-101640: Make argparse _print_message catch any write error (#101802)
Oleg Iarygin [Sat, 6 May 2023 22:53:48 +0000 (02:53 +0400)] 
gh-101640: Make argparse _print_message catch any write error (#101802)

* In particular, don't exit when trying to print to stderr = None.
* Add tests

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-99113: Make Sure the GIL is Acquired at the Right Places (gh-104208)
Eric Snow [Sat, 6 May 2023 21:59:30 +0000 (15:59 -0600)] 
gh-99113: Make Sure the GIL is Acquired at the Right Places (gh-104208)

This is a pre-requisite for a per-interpreter GIL.  Without it this change isn't strictly necessary.  However, there is no real downside otherwise.

2 years agogh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)
Eric Snow [Sat, 6 May 2023 21:57:35 +0000 (15:57 -0600)] 
gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)

Py_MOD_PER_INTERPRETER_GIL_SUPPORTED is a new supported value for Py_mod_multiple_interpreters, added in gh-104205.

2 years agogh-101819: Remove unused 'locale_module' from _io state (#104246)
Erlend E. Aasland [Sat, 6 May 2023 20:26:06 +0000 (22:26 +0200)] 
gh-101819: Remove unused 'locale_module' from _io state (#104246)

The locale module reference was introduced by 932ff8368 in 2013,
and rendered unused by 710e82630 (gh-23050) in 2020.

2 years agoGH-103548: Improve performance of `pathlib.Path.[is_]absolute()` (GH-103549)
Barney Gale [Sat, 6 May 2023 18:03:07 +0000 (19:03 +0100)] 
GH-103548: Improve performance of `pathlib.Path.[is_]absolute()` (GH-103549)

Improve performance of `pathlib.Path.absolute()` and `cwd()` by joining paths only when necessary. Also improve
performance of `PurePath.is_absolute()` on Posix by skipping path parsing and normalization.

2 years agogh-90953: Emit deprecation warnings for `ast` features deprecated in Python 3.8 ...
Alex Waygood [Sat, 6 May 2023 16:48:07 +0000 (17:48 +0100)] 
gh-90953: Emit deprecation warnings for `ast` features deprecated in Python 3.8 (#104199)

`ast.Num`, `ast.Str`, `ast.Bytes`, `ast.Ellipsis` and `ast.NameConstant` now all emit deprecation warnings on import, access, instantation or `isinstance()` checks.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-104144: Optimize gather to finish eagerly when all futures complete eagerly (...
Itamar Ostricher [Sat, 6 May 2023 15:15:27 +0000 (08:15 -0700)] 
gh-104144: Optimize gather to finish eagerly when all futures complete eagerly (#104138)

2 years agoRewrite the turtledemo makeGraphFrame method (#104224)
Terry Jan Reedy [Sat, 6 May 2023 15:09:08 +0000 (11:09 -0400)] 
Rewrite the turtledemo makeGraphFrame method (#104224)

Replace `self._canvas` and `self.scanvas`, both bound to `canvas`,
with `self.canvas, which is accessed in other methods.
Replace `_s_` with `screen` and `_s_._canvas` with `canvas`.
Add a comment explaining the unorthodox use of
function turtle.Screen and singleton class turtle._Screen.

2 years agogh-65772: Clean-up turtle module (#104218)
Terry Jan Reedy [Sat, 6 May 2023 15:04:41 +0000 (11:04 -0400)] 
gh-65772: Clean-up turtle module (#104218)

* Remove the unused, private, and undocumented name `_ver` and
the commented-out `print` call.

* Don't add math functions to `__all__`.  Beginners should learn
to `import math` to access them.

* Gregor Lindel, who wrote this version of turtle, dropped plans
to implement turtle on another toolkit at least a decade ago.
Drop `_dot` code preparing for this, but add a hint comment.

* `_Screen` is meant to be a singleton class.  To enforce that,
it needs either a `__new__` that returns the singleton or
`else...raise` in `__iter__`.  Merely removing the `if` clauses
as suggested might break something if a user were to call `_Screen`
directly.  Leave the code alone until a problem is evident.

* Turtledemo injects into _Screen both _root and _canvas,
configured as it needs them to be.  Making _canvas an `__init__`
option would require skipping some but not all of the lines under
'if _Screen._canvas is None:`.  Leave working code alone.

2 years agogh-104233: Fix "unused variable" warning in `ceval_gil.c` (#104234)
Nikita Sobolev [Sat, 6 May 2023 14:58:32 +0000 (17:58 +0300)] 
gh-104233: Fix "unused variable" warning in `ceval_gil.c` (#104234)

2 years agoGH-97950: Use new-style index directive ('builtin') (#104164)
Adam Turner [Sat, 6 May 2023 03:54:08 +0000 (04:54 +0100)] 
GH-97950: Use new-style index directive ('builtin') (#104164)

* Uncomment builtin removal in pairindextypes

* Use new-style index directive ('builtin') - C API

* Use new-style index directive ('builtin') - Extending

* Use new-style index directive ('builtin') - Library

* Use new-style index directive ('builtin') - Reference

* Use new-style index directive ('builtin') - Tutorial

2 years agogh-102215: importlib documentation cleanups
Sam Morris [Sat, 6 May 2023 02:40:19 +0000 (03:40 +0100)] 
gh-102215: importlib documentation cleanups

2 years agogh-101819: Prepare to modernize the _io extension (#104178)
Victor Stinner [Fri, 5 May 2023 23:53:55 +0000 (01:53 +0200)] 
gh-101819: Prepare to modernize the _io extension (#104178)

* Add references to static types to _PyIO_State:

  * PyBufferedIOBase_Type
  * PyBytesIOBuffer_Type
  * PyIncrementalNewlineDecoder_Type
  * PyRawIOBase_Type
  * PyTextIOBase_Type

* Add the defining class to methods:

  * _io.BytesIO.getbuffer()
  * _io.FileIO.close()

* Add get_io_state_by_cls() function.
* Add state parameter to _textiowrapper_decode()
* _io_TextIOWrapper___init__() now sets self->state before calling
  _textiowrapper_set_decoder().

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-97696: Remove redundant #include (#104216)
Jacob Bower [Fri, 5 May 2023 23:50:06 +0000 (16:50 -0700)] 
gh-97696: Remove redundant #include (#104216)

Remove "#include cpython/context.h"` from `_asynciomodule.c`.

It's already included in `Python.h`.

2 years agogh-104144: Skip scheduling a done callback if a TaskGroup task completes eagerly...
Itamar Ostricher [Fri, 5 May 2023 23:44:03 +0000 (16:44 -0700)] 
gh-104144: Skip scheduling a done callback if a TaskGroup task completes eagerly (#104140)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2 years agogh-99113: Add PyInterpreterConfig.own_gil (gh-104204)
Eric Snow [Fri, 5 May 2023 21:59:20 +0000 (15:59 -0600)] 
gh-99113: Add PyInterpreterConfig.own_gil (gh-104204)

We also add PyInterpreterState.ceval.own_gil to record if the interpreter actually has its own GIL.

Note that for now we don't actually respect own_gil; all interpreters still share the one GIL.  However, PyInterpreterState.ceval.own_gil does reflect PyInterpreterConfig.own_gil.  That lie is a temporary one that we will fix when the GIL really becomes per-interpreter.

2 years agogh-104146: Remove unused var 'parser_body_declarations' from clinic.py (#104214)
Erlend E. Aasland [Fri, 5 May 2023 21:35:24 +0000 (23:35 +0200)] 
gh-104146: Remove unused var 'parser_body_declarations' from clinic.py (#104214)

2 years agogh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
Eric Snow [Fri, 5 May 2023 21:11:27 +0000 (15:11 -0600)] 
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)

Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules.  We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).

2 years agogh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-104148)
Eric Snow [Fri, 5 May 2023 20:04:55 +0000 (14:04 -0600)] 
gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-104148)

I'll be adding a value to indicate support for per-interpreter GIL in gh-99114.

2 years agogh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)
Eric Snow [Fri, 5 May 2023 19:23:00 +0000 (13:23 -0600)] 
gh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)

In preparation for a per-interpreter GIL, we add PyInterpreterState.ceval.gil, set it to the shared GIL for each interpreter, and use that rather than using _PyRuntime.ceval.gil directly.  Note that _PyRuntime.ceval.gil is still the actual GIL.

2 years agoGH-100479: Add `pathlib.PurePath.with_segments()` (GH-103975)
Barney Gale [Fri, 5 May 2023 19:04:53 +0000 (20:04 +0100)] 
GH-100479: Add `pathlib.PurePath.with_segments()` (GH-103975)

Add `pathlib.PurePath.with_segments()`, which creates a path object from arguments. This method is called whenever a derivative path is created, such as from `pathlib.PurePath.parent`. Subclasses may override this method to share information between path objects.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-69152: Add _proxy_response_headers attribute to HTTPConnection (#26152)
Alexey Namyotkin [Fri, 5 May 2023 18:52:24 +0000 (21:52 +0300)] 
gh-69152: Add _proxy_response_headers attribute to HTTPConnection (#26152)

Add _proxy_response_headers attribute to HTTPConnection (#26152)

---------

Co-authored-by: Senthil Kumaran <senthil@python.org>
2 years agogh-103533: Use PEP 669 APIs for cprofile (GH-103534)
Tian Gao [Fri, 5 May 2023 17:38:47 +0000 (10:38 -0700)] 
gh-103533: Use PEP 669 APIs for cprofile (GH-103534)

2 years agoGH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users...
Mark Shannon [Fri, 5 May 2023 16:53:07 +0000 (17:53 +0100)] 
GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (GH-96849)

2 years agogh-64595: Argument Clinic: Touch source file if any output file changed (#104152)
Erlend E. Aasland [Fri, 5 May 2023 12:38:38 +0000 (14:38 +0200)] 
gh-64595: Argument Clinic: Touch source file if any output file changed (#104152)

2 years agogh-64631: Test exception messages in cloned Argument Clinic funcs (#104167)
Erlend E. Aasland [Fri, 5 May 2023 12:08:24 +0000 (14:08 +0200)] 
gh-64631: Test exception messages in cloned Argument Clinic funcs (#104167)

2 years agogh-68395: Avoid naming conflicts by mangling variable names in Argument Clinic (...
Erlend E. Aasland [Fri, 5 May 2023 11:40:18 +0000 (13:40 +0200)] 
gh-68395: Avoid naming conflicts by mangling variable names in Argument Clinic (#104065)

Add all internally used variable names to CLINIC_PREFIXED_ARGS.

2 years agogh-64658: Expand Argument Clinic return converter docs (#104175)
Erlend E. Aasland [Fri, 5 May 2023 11:32:00 +0000 (13:32 +0200)] 
gh-64658: Expand Argument Clinic return converter docs (#104175)

2 years agoGH-103092: port `_asyncio` freelist to module state (#104196)
Kumar Aditya [Fri, 5 May 2023 11:12:58 +0000 (16:42 +0530)] 
GH-103092: port `_asyncio` freelist to module state (#104196)

2 years agogh-104051: fix crash in test_xxtestfuzz with -We (#104052)
Irit Katriel [Fri, 5 May 2023 10:34:13 +0000 (11:34 +0100)] 
gh-104051: fix crash in test_xxtestfuzz with -We (#104052)

2 years agogh-104190: fix ubsan crash (#104191)
sunmy2019 [Fri, 5 May 2023 09:54:03 +0000 (17:54 +0800)] 
gh-104190: fix ubsan crash (#104191)

2 years agogh-104106: Add gcc fallback of mkfifoat/mknodat for macOS (gh-104129)
Dong-hee Na [Fri, 5 May 2023 03:27:25 +0000 (12:27 +0900)] 
gh-104106: Add gcc fallback of mkfifoat/mknodat for macOS (gh-104129)

2 years agoGH-104142: Fix _Py_RefcntAdd to respect immortality (GH-104143)
Brandt Bucher [Fri, 5 May 2023 00:00:07 +0000 (17:00 -0700)] 
GH-104142: Fix _Py_RefcntAdd to respect immortality (GH-104143)

2 years agogh-104112: link from cached_property docs to method-caching FAQ (#104113)
Carl Meyer [Thu, 4 May 2023 22:38:53 +0000 (16:38 -0600)] 
gh-104112: link from cached_property docs to method-caching FAQ (#104113)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-68968: Correcting message display issue with assertEqual (#103937)
Michael Blahay [Thu, 4 May 2023 22:37:17 +0000 (18:37 -0400)] 
gh-68968: Correcting message display issue with assertEqual (#103937)

2 years agoGH-103899: Provide a hint when accidentally calling a module (GH-103900)
Brandt Bucher [Thu, 4 May 2023 22:07:42 +0000 (15:07 -0700)] 
GH-103899: Provide a hint when accidentally calling a module (GH-103900)

2 years agogh-103963: fix 'make regen-opcode' in out-of-tree builds (#104177)
Carl Meyer [Thu, 4 May 2023 17:45:56 +0000 (11:45 -0600)] 
gh-103963: fix 'make regen-opcode' in out-of-tree builds (#104177)

2 years agogh-102500: Add PEP 688 and 698 to the 3.12 release highlights (#104174)
Hugo van Kemenade [Thu, 4 May 2023 16:55:48 +0000 (19:55 +0300)] 
gh-102500: Add PEP 688 and 698 to the 3.12 release highlights (#104174)

2 years agoGH-81079: Add case_sensitive argument to `pathlib.Path.glob()` (GH-102710)
Barney Gale [Thu, 4 May 2023 16:44:36 +0000 (17:44 +0100)] 
GH-81079: Add case_sensitive argument to `pathlib.Path.glob()` (GH-102710)

This argument allows case-sensitive matching to be enabled on Windows, and
case-insensitive matching to be enabled on Posix.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2 years agogh-91896: Deprecate collections.abc.ByteString (#102096)
Shantanu [Thu, 4 May 2023 16:39:33 +0000 (09:39 -0700)] 
gh-91896: Deprecate collections.abc.ByteString (#102096)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-99593: Add tests for Unicode C API (part 2) (#99868)
Serhiy Storchaka [Thu, 4 May 2023 15:25:09 +0000 (18:25 +0300)] 
gh-99593: Add tests for Unicode C API (part 2) (#99868)

Add tests for lower-level functions.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agogh-102500: Document PEP 688 (#102571)
Jelle Zijlstra [Thu, 4 May 2023 15:23:40 +0000 (08:23 -0700)] 
gh-102500: Document PEP 688 (#102571)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-102500: Implement PEP 688 (#102521)
Jelle Zijlstra [Thu, 4 May 2023 14:59:46 +0000 (07:59 -0700)] 
gh-102500: Implement PEP 688 (#102521)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-96534: socketmodule: support FreeBSD divert(4) socket (#96536)
Gleb Smirnoff [Thu, 4 May 2023 14:57:05 +0000 (07:57 -0700)] 
gh-96534: socketmodule: support FreeBSD divert(4) socket (#96536)

2 years agogh-104066: Improve performance of hasattr for module objects (#104063)
Itamar Ostricher [Thu, 4 May 2023 14:50:26 +0000 (07:50 -0700)] 
gh-104066: Improve performance of hasattr for module objects (#104063)

2 years agogh-102795: Fix use of poll in test_epoll's test_control_and_wait (#102796)
Kevin Krakauer [Thu, 4 May 2023 14:38:20 +0000 (07:38 -0700)] 
gh-102795: Fix use of poll in test_epoll's test_control_and_wait (#102796)

This test can fail unnecessarily. In the test we wait for events on two
file descriptors. This is done in a single call to select.epoll's poll()
function. However, it is valid for the OS to return only one event via
poll() and the next via a subsequent call to poll(). This rarely
happens, but it can cause the test to fail despite properly functioning
polling.

Instead, we poll a second time when necessary.

2 years agogh-103323: Remove PyRuntimeState_GetThreadState() (#104171)
Victor Stinner [Thu, 4 May 2023 14:21:01 +0000 (16:21 +0200)] 
gh-103323: Remove PyRuntimeState_GetThreadState() (#104171)

This function no longer makes sense, since its runtime parameter is
no longer used. Use directly _PyThreadState_GET() and
_PyInterpreterState_GET() instead.

2 years agogh-104169: Ensure the tokenizer doesn't overwrite previous errors (#104170)
Pablo Galindo Salgado [Thu, 4 May 2023 14:15:26 +0000 (15:15 +0100)] 
gh-104169: Ensure the tokenizer doesn't overwrite previous errors (#104170)

2 years agoFix typo "involvin" → "involving" (#104166)
Christopher Chavez [Thu, 4 May 2023 13:03:52 +0000 (08:03 -0500)] 
Fix typo "involvin" â†’ "involving" (#104166)

2 years agogh-103092: Port _ctypes.COMError to heap type (#104020)
Erlend E. Aasland [Thu, 4 May 2023 13:03:24 +0000 (15:03 +0200)] 
gh-103092: Port _ctypes.COMError to heap type (#104020)

2 years agogh-97556: Raise null bytes syntax error upon null in multiline string (GH-104136)
Lysandros Nikolaou [Thu, 4 May 2023 12:26:23 +0000 (14:26 +0200)] 
gh-97556: Raise null bytes syntax error upon null in multiline string (GH-104136)

2 years agoGH-97950: Use new-style index directive ('statement') (#104162)
Adam Turner [Thu, 4 May 2023 10:48:45 +0000 (11:48 +0100)] 
GH-97950: Use new-style index directive ('statement') (#104162)

2 years agoGH-97950: Use new-style index directive ('exception') (#104160)
Adam Turner [Thu, 4 May 2023 10:30:24 +0000 (11:30 +0100)] 
GH-97950: Use new-style index directive ('exception') (#104160)

2 years agogh-104089: catch DeprecationWarning in `test_fstring` (#104137)
sunmy2019 [Thu, 4 May 2023 10:20:20 +0000 (18:20 +0800)] 
gh-104089: catch DeprecationWarning in `test_fstring` (#104137)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoGH-97950: Use new-style index directive ('object') (#104158)
Adam Turner [Thu, 4 May 2023 10:04:41 +0000 (11:04 +0100)] 
GH-97950: Use new-style index directive ('object') (#104158)

* Uncomment object removal in pairindextypes

* Use new-style index directive ('object') - C API

* Use new-style index directive ('object') - Library

* Use new-style index directive ('object') - Reference

* Use new-style index directive ('object') - Tutorial

2 years agoGH-97950: Use new-style index directive ('operator') (#104156)
Adam Turner [Thu, 4 May 2023 09:03:11 +0000 (10:03 +0100)] 
GH-97950: Use new-style index directive ('operator') (#104156)

2 years agoGH-97950: Use new-style index directive ('keyword') (#104153)
Adam Turner [Thu, 4 May 2023 08:44:12 +0000 (09:44 +0100)] 
GH-97950: Use new-style index directive ('keyword') (#104153)

* Uncomment keyword removal in pairindextypes

* Use new-style index directive ('keyword') - Reference

2 years agoGH-97950: Use new-style index directive ('module') (#103996)
Adam Turner [Thu, 4 May 2023 08:17:12 +0000 (09:17 +0100)] 
GH-97950: Use new-style index directive ('module') (#103996)

* Use new-style index directive ('module') - C API

* Use new-style index directive ('module') - Library

* Use new-style index directive ('module') - Reference

* Use new-style index directive ('module') - Tutorial

* Uncomment module removal in pairindextypes

* Use new-style index directive ('module') - C API

* Use new-style index directive ('module') - Library

* Use new-style index directive ('module') - Reference

2 years agogh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)
Petr Viktorin [Thu, 4 May 2023 07:56:53 +0000 (09:56 +0200)] 
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agoGH-97950: Allow translation of index directive content (#104000)
Adam Turner [Thu, 4 May 2023 07:11:09 +0000 (08:11 +0100)] 
GH-97950: Allow translation of index directive content (#104000)

2 years agogh-104146: Remove unused 'second_pass_replacements' from clinic.py (#104147)
Erlend E. Aasland [Thu, 4 May 2023 00:11:29 +0000 (02:11 +0200)] 
gh-104146: Remove unused 'second_pass_replacements' from clinic.py (#104147)

The code that manipulated 'second_pass_replacements' was removed in 2015
with commit 0759f84 (gh-67688, bpo-23500).

2 years agopydoc.safeimport: Use importlib.import_module instead of __import__ (GH-103118)
Yuxin Wu [Wed, 3 May 2023 23:26:39 +0000 (07:26 +0800)] 
pydoc.safeimport: Use importlib.import_module instead of __import__ (GH-103118)

2 years agogh-97850: Deprecate `find_loader` and `get_loader` in `pkgutil` (GH-98520)
Nikita Sobolev [Wed, 3 May 2023 23:11:54 +0000 (02:11 +0300)] 
gh-97850: Deprecate `find_loader` and `get_loader` in `pkgutil` (GH-98520)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agogh-103590: mention that the change is included in 3.11.4 and clarify except* document...
Irit Katriel [Wed, 3 May 2023 20:55:19 +0000 (21:55 +0100)] 
gh-103590: mention that the change is included in 3.11.4 and clarify except* documentation (#104095)

2 years agoGH-104114: Fix `pathlib.WindowsPath.glob()` use of literal pattern segment case ...
Barney Gale [Wed, 3 May 2023 16:28:44 +0000 (17:28 +0100)] 
GH-104114: Fix `pathlib.WindowsPath.glob()` use of literal pattern segment case (GH-104116)

We now use `_WildcardSelector` to evaluate literal pattern segments, which
allows us to retrieve the real filesystem case.

This change is necessary in order to implement a *case_sensitive* argument
(see GH-81079) and a *follow_symlinks* argument (see GH-77609).

2 years agoGH-103944: Remove last use of `utcfromtimestamp` (#103995)
Paul Ganssle [Wed, 3 May 2023 15:17:27 +0000 (11:17 -0400)] 
GH-103944: Remove last use of `utcfromtimestamp` (#103995)

* Remove last use of `utcfromtimestamp`

This was a weirdly valid use of `utcfromtimestamp` in the sense that the "timestamps" in TZif files are not epoch times, but actually something more properly thought of as "number of seconds since 1970 in the local time zone", so even though we didn't want UTC time, `utcfromtimestamp` was still a good way to get the thing we wanted. Since we're deprecating `utcfromtimestamp`, it's just as valid to use `timedelta` arithmetic here.

We may be able to avoid the question entirely by switching these tests over to using `ZoneInfo` in the future.

* Fix a few missing DeprecationWarnings in tests

In one test, we simply turn off DeprecationWarning rather than asserting about it, because whether the error condition happens before or after the warning seems to differ between the Python and C versions.

2 years agogh-103693: Add convenience variable feature to `pdb` (#103694)
Tian Gao [Wed, 3 May 2023 14:04:50 +0000 (07:04 -0700)] 
gh-103693: Add convenience variable feature to `pdb` (#103694)

2 years agogh-103968: Deprecate creating heap types whose metaclass has custom tp_new. (GH-103972)
Petr Viktorin [Wed, 3 May 2023 13:17:14 +0000 (15:17 +0200)] 
gh-103968: Deprecate creating heap types whose metaclass has custom tp_new. (GH-103972)

(That's a mouthful of an edge case!)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2 years agoGH-97850: Suppress cross-references to removed ``importlib.util`` functions (#104134)
Adam Turner [Wed, 3 May 2023 13:13:03 +0000 (14:13 +0100)] 
GH-97850: Suppress cross-references to removed ``importlib.util`` functions (#104134)

`importlib.utils` -> `importlib.util` in a few places

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoGH-97850: Suppress cross-references to the removed ``module_repr`` method (#104133)
Adam Turner [Wed, 3 May 2023 12:57:23 +0000 (13:57 +0100)] 
GH-97850: Suppress cross-references to the removed ``module_repr`` method (#104133)

Suppress cross-references to ``module_repr``

2 years agoGH-98040: Suppress cross-references to the removed ``imp`` module (#104131)
Adam Turner [Wed, 3 May 2023 12:29:42 +0000 (13:29 +0100)] 
GH-98040: Suppress cross-references to the removed ``imp`` module (#104131)

Suppress cross-references to imp

2 years agogh-98040: Remove find_loader, find_module and other deprecated APIs (#98059)
Barry Warsaw [Wed, 3 May 2023 11:55:22 +0000 (04:55 -0700)] 
gh-98040: Remove find_loader, find_module and other deprecated APIs (#98059)

* Remove deprecated classes from pkgutil
* Remove some other PEP 302 obsolescence
* Use find_spec instead of load_module
* Remove more tests of PEP 302 obsolete APIs
* Remove another bunch of tests using obsolete load_modules()
* Remove deleted names from __all__
* Remove obsolete footnote
* imp is removed
* Remove `imp` from generated stdlib names
* What's new and blurb
* Update zipimport documentation for the removed methods
* Fix some Windows tests
* Remove any test (or part of a test) that references `find_module()`.
* Use assertIsNone() / assertIsNotNone() consistently.
* Update Doc/reference/import.rst
* We don't need pkgutil._get_spec() any more either
*  test.test_importlib.fixtures.NullFinder
* ...BadLoaderFinder.find_module
* ...test_api.InvalidatingNullFinder.find_module
* ...test.test_zipimport test of z.find_module
* Suppress cross-references to find_loader and find_module
* Suppress cross-references to Finder
* Suppress cross-references to pkgutil.ImpImporter and pkgutil.ImpLoader

---------

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2 years agogh-103845: Remove line & instruction instrumentations before adding them back (GH...
Tian Gao [Wed, 3 May 2023 09:51:47 +0000 (02:51 -0700)] 
gh-103845: Remove line & instruction instrumentations before adding them back (GH-103851)

2 years agoGH-84976: Re-introduce `datetime.py` and fix reprs
Paul Ganssle [Thu, 23 Mar 2023 15:36:22 +0000 (11:36 -0400)] 
GH-84976: Re-introduce `datetime.py` and fix reprs

Without the change to the reprs, pure-python classes would have a repr
of `datetime._pydatetime.time`, etc.

2 years agoGH-84976: Move Lib/datetime.py to Lib/_pydatetime
Paul Ganssle [Thu, 23 Mar 2023 14:36:47 +0000 (10:36 -0400)] 
GH-84976: Move Lib/datetime.py to Lib/_pydatetime

This breaks the tests, but we are keeping it as a separate commit so
that the move operation and editing of the moved files are separate, for
a cleaner history.

2 years agogh-104078: Improve performance of PyObject_HasAttrString (#104079)
Itamar Ostricher [Wed, 3 May 2023 07:20:00 +0000 (00:20 -0700)] 
gh-104078: Improve performance of PyObject_HasAttrString (#104079)

2 years agogh-82012: Deprecate bitwise inversion (~) of bool (#103487)
Tim Hoffmann [Wed, 3 May 2023 07:00:42 +0000 (09:00 +0200)] 
gh-82012: Deprecate bitwise inversion (~) of bool (#103487)

The bitwise inversion operator on bool returns the bitwise inversion of the
underlying int value; i.e. `~True == -2` such that `bool(~True) == True`.

It's a common pitfall that users mistake `~` as negation operator and actually
want `not`. Supporting `~` is an artifact of bool inheriting from int. Since there
is no real use-case for the current behavior, let's deprecate `~` on bool and
later raise an error. This removes a potential source errors for users.

Full reasoning: https://github.com/python/cpython/issues/82012#issuecomment-1258705971

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-101100: Fix Sphinx warnings in `curses` and `curses.ascii` modules (#103457)
Hugo van Kemenade [Wed, 3 May 2023 05:09:04 +0000 (08:09 +0300)] 
gh-101100: Fix Sphinx warnings in `curses` and `curses.ascii` modules (#103457)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agoGH-89769: `pathlib.Path.glob()`: do not follow symlinks when checking for precise...
andrei kulakov [Wed, 3 May 2023 03:50:10 +0000 (23:50 -0400)] 
GH-89769: `pathlib.Path.glob()`: do not follow symlinks when checking for precise match (GH-29655)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2 years agogh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (#104067)
Ethan Furman [Wed, 3 May 2023 03:42:00 +0000 (20:42 -0700)] 
gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (#104067)

Do not expose the local server's on-disk location from `SimpleHTTPRequestHandler` when generating a directory index. (unnecessary information disclosure)

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-104109: Expose Py_NewInterpreterFromConfig() in the Public C-API (gh-104110)
Eric Snow [Wed, 3 May 2023 03:40:00 +0000 (21:40 -0600)] 
gh-104109: Expose Py_NewInterpreterFromConfig() in the Public C-API (gh-104110)

We also expose PyInterpreterConfig. This is part of the PEP 684 (per-interpreter GIL) implementation.  We will add docs as soon as we can.

FYI, I'm adding the new config field for per-interpreter GIL in gh-99114.

2 years agogh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)
Eric Snow [Wed, 3 May 2023 03:30:03 +0000 (21:30 -0600)] 
gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)

his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses.  Those three fields are effectively const for builtin static types (unlike tp_subclasses).  In theory we only need to make their values immortal, along with their contents.  However, that isn't such a simple proposition.  (See gh-103823.)  In the meantime the simplest solution is to move the fields into the interpreter.

One alternative is to statically allocate the values, but that's its own can of worms.

2 years agoGH-103963: Make dis display names of args for intrinsics opcodes (#104029)
Juhi Chandalia [Wed, 3 May 2023 02:00:17 +0000 (19:00 -0700)] 
GH-103963: Make dis display names of args for intrinsics opcodes (#104029)

2 years agoGH-104102: Optimize `pathlib.Path.glob()` handling of `../` pattern segments (GH...
Barney Gale [Tue, 2 May 2023 23:16:04 +0000 (00:16 +0100)] 
GH-104102: Optimize `pathlib.Path.glob()` handling of `../` pattern segments (GH-104103)

These segments do not require a `stat()` call, as the selector's
`_select_from()` method is called after we've established that the
parent is a directory.

2 years agoGH-104104: Optimize `pathlib.Path.glob()` by avoiding repeated calls to `os.path...
Barney Gale [Tue, 2 May 2023 21:51:18 +0000 (22:51 +0100)] 
GH-104104: Optimize `pathlib.Path.glob()` by avoiding repeated calls to `os.path.normcase()` (GH-104105)

Use `re.IGNORECASE` to implement case-insensitive matching. This
restores behaviour from before GH-31691.

2 years agogh-103822: [Calendar] change return value to enum for day and month APIs (GH-103827)
Prince Roshan [Tue, 2 May 2023 20:13:31 +0000 (01:43 +0530)] 
gh-103822: [Calendar] change return value to enum for day and month APIs (GH-103827)

2 years agogh-65022: Fix description of tuple return value in copyreg (#103892)
Shantanu [Tue, 2 May 2023 18:13:47 +0000 (11:13 -0700)] 
gh-65022: Fix description of tuple return value in copyreg (#103892)

2 years agoGH-103525: Improve exception message from `pathlib.PurePath()` (GH-103526)
Barney Gale [Tue, 2 May 2023 18:08:19 +0000 (19:08 +0100)] 
GH-103525: Improve exception message from `pathlib.PurePath()` (GH-103526)

Check that arguments are strings before calling `os.path.join()`.

Also improve performance of `PurePath(PurePath(...))` while we're in the
area: we now use the *unnormalized* string path of such arguments.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-84436: Add integration C API tests for immortal objects (gh-103962)
Dong-hee Na [Tue, 2 May 2023 15:05:30 +0000 (00:05 +0900)] 
gh-84436: Add integration C API tests for immortal objects (gh-103962)

2 years agogh-103743: Add PyUnstable_Object_GC_NewWithExtraData (GH-103744)
Jurica Bradarić [Tue, 2 May 2023 11:38:46 +0000 (13:38 +0200)] 
gh-103743: Add PyUnstable_Object_GC_NewWithExtraData (GH-103744)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-102997: Update Windows installer to SQLite 3.41.2. (#102999)
Mariusz Felisiak [Tue, 2 May 2023 07:37:57 +0000 (09:37 +0200)] 
gh-102997: Update Windows installer to SQLite 3.41.2. (#102999)

2 years agoGH-103484: Fix redirected permanently URLs (#104001)
Rafael Fontenelle [Tue, 2 May 2023 06:34:44 +0000 (03:34 -0300)] 
GH-103484: Fix redirected permanently URLs (#104001)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2 years agoImprove assert_type phrasing (#104081)
Shantanu [Tue, 2 May 2023 06:05:25 +0000 (23:05 -0700)] 
Improve assert_type phrasing (#104081)

I'd like to make the fact that this does nothing at runtime
really obvious, since I suspect this is unintuitive for users who are
unfamiliar with static type checking.

I thought of this because of
https://discuss.python.org/t/add-arg-check-type-to-types/26384
wherein I'm skeptical that the user really did want `assert_type`.

2 years agogh-102997: Update macOS installer to SQLite 3.41.2. (GH-102998)
Mariusz Felisiak [Tue, 2 May 2023 04:30:43 +0000 (06:30 +0200)] 
gh-102997: Update macOS installer to SQLite 3.41.2. (GH-102998)

2 years agoGH-103472: close response in HTTPConnection._tunnel (#103473)
Thomas Grainger [Tue, 2 May 2023 03:59:42 +0000 (04:59 +0100)] 
GH-103472: close response in HTTPConnection._tunnel (#103473)

Avoid a potential `ResourceWarning` in `http.client.HTTPConnection`
by closing the proxy / tunnel's CONNECT response explicitly.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>