]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
13 months agodocs: improve style in an example
Gregory P. Smith [Sat, 21 Sep 2024 17:40:51 +0000 (10:40 -0700)] 
docs: improve style in an example

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
13 months agodocs: words instead of <=
Gregory P. Smith [Sat, 21 Sep 2024 17:39:53 +0000 (10:39 -0700)] 
docs: words instead of <=

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
13 months agogh-55454: Clarify imaplib idle() docs
Forest [Wed, 11 Sep 2024 22:10:49 +0000 (15:10 -0700)] 
gh-55454: Clarify imaplib idle() docs

- Add example idle response tuples, to make the minor difference from other
  imaplib response tuples more obvious.
- Merge the idle context manager's burst() method docs with the IMAP
  object's idle() method docs, for easier understanding.
- Upgrade the Windows note regarding lack of pipe timeouts to a warning.
- Rephrase various things for clarity.

14 months agogh-55454: Add IMAP4 IDLE support to imaplib
Forest [Wed, 31 Jul 2024 00:20:41 +0000 (17:20 -0700)] 
gh-55454: Add IMAP4 IDLE support to imaplib

This extends imaplib with support for the rfc2177 IMAP IDLE command,
as requested in #55454.  It allows events to be pushed to a client as
they occur, rather than having to continually poll for mailbox changes.

The interface is a new idle() method, which returns an iterable context
manager.  Entering the context starts IDLE mode, during which events
(untagged responses) can be retrieved using the iteration protocol.
Exiting the context sends DONE to the server, ending IDLE mode.

An optional time limit for the IDLE session is supported, for use with
servers that impose an inactivity timeout.

The context manager also offers a burst() method, designed for programs
wishing to process events in batch rather than one at a time.

Notable differences from other implementations:

- It's an extension to imaplib, rather than a replacement.
- It doesn't introduce additional threads.
- It doesn't impose new requirements on the use of imaplib's existing methods.
- It passes the unit tests in CPython's test/test_imaplib.py module
  (and adds new ones).
- It works on Windows, Linux, and other unix-like systems.
- It makes IDLE available on all of imaplib's client variants
  (including IMAP4_stream).
- The interface is pythonic and easy to use.

Caveats:

- Due to a Windows limitation, the special case of IMAP4_stream running
  on Windows lacks a duration/timeout feature. (This is the stdin/stdout
  pipe connection variant; timeouts work fine for socket-based
  connections, even on Windows.) I have documented it where appropriate.

- The file-like imaplib instance attributes are changed from buffered to
  unbuffered mode. This could potentially break any client code that
  uses those objects directly without expecting partial reads/writes.
  However, these attributes are undocumented. As such, I think (and
  PEP 8 confirms) that they are fair game for changes.
  https://peps.python.org/pep-0008/#public-and-internal-interfaces

Usage examples:

https://github.com/python/cpython/issues/55454#issuecomment-2227543041

Original discussion:

https://discuss.python.org/t/gauging-interest-in-my-imap4-idle-implementation-for-imaplib/59272

Earlier requests and suggestions:

https://github.com/python/cpython/issues/55454

https://mail.python.org/archives/list/python-ideas@python.org/thread/C4TVEYL5IBESQQPPS5GBR7WFBXCLQMZ2/

14 months agogh-123553: Fix compile warning in `compile.c` (#123578)
sobolevn [Sun, 1 Sep 2024 15:43:45 +0000 (18:43 +0300)] 
gh-123553: Fix compile warning in `compile.c` (#123578)

14 months agogh-118761: Speedup pathlib import by deferring shutil (#123520)
Daniel Hollas [Sun, 1 Sep 2024 14:44:48 +0000 (15:44 +0100)] 
gh-118761: Speedup pathlib import by deferring shutil (#123520)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
14 months agogh-123341: Support `tkinter.Event` type subcript (#123353)
Yoda [Sun, 1 Sep 2024 11:47:07 +0000 (13:47 +0200)] 
gh-123341: Support `tkinter.Event` type subcript (#123353)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
14 months agoBump types-setuptools from 71.1.0.20240726 to 74.0.0.20240831 in /Tools (#123565)
dependabot[bot] [Sun, 1 Sep 2024 10:38:58 +0000 (10:38 +0000)] 
Bump types-setuptools from 71.1.0.20240726 to 74.0.0.20240831 in /Tools (#123565)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
14 months agogh-91126: Docs and tests for slotted dataclasses with `__init_subclass__` (#123342)
sobolevn [Sun, 1 Sep 2024 10:25:34 +0000 (13:25 +0300)] 
gh-91126: Docs and tests for slotted dataclasses with `__init_subclass__` (#123342)

14 months agoBump mypy from 1.11.1 to 1.11.2 in /Tools (#123566)
dependabot[bot] [Sun, 1 Sep 2024 10:10:10 +0000 (10:10 +0000)] 
Bump mypy from 1.11.1 to 1.11.2 in /Tools (#123566)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
14 months agoBump types-psutil from 6.0.0.20240621 to 6.0.0.20240901 in /Tools (#123564)
dependabot[bot] [Sun, 1 Sep 2024 10:09:51 +0000 (11:09 +0100)] 
Bump types-psutil from 6.0.0.20240621 to 6.0.0.20240901 in /Tools (#123564)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
14 months agogh-123553: Fix compiler warning in `Python/compile.c` (#123554)
Kirill Podoprigora [Sun, 1 Sep 2024 06:29:34 +0000 (09:29 +0300)] 
gh-123553: Fix compiler warning in `Python/compile.c` (#123554)

14 months agogh-123550: Fix code snippet of `BUILD_TUPLE` in `dis` docs (#123551)
jlallas384 [Sun, 1 Sep 2024 06:11:40 +0000 (10:11 +0400)] 
gh-123550: Fix code snippet of `BUILD_TUPLE` in `dis` docs (#123551)

14 months agoGH-109975: Copyedit 3.13 What's New: Removals (#123529)
Adam Turner [Sun, 1 Sep 2024 05:41:17 +0000 (01:41 -0400)] 
GH-109975: Copyedit 3.13 What's New: Removals (#123529)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
14 months agogh-123494: Improve documentation for ``webbrowser`` return types (#123495)
Aarni Koskela [Sun, 1 Sep 2024 05:17:03 +0000 (08:17 +0300)] 
gh-123494: Improve documentation for ``webbrowser`` return types (#123495)

Document the return value for ``webbrowser.open*()``.

14 months agogh-115238: Remove a redundant f-string in graphlib (#115239)
Luka [Sun, 1 Sep 2024 05:12:53 +0000 (09:12 +0400)] 
gh-115238: Remove a redundant f-string in graphlib (#115239)

14 months agogh-123517: Remove unnecessary ``:meth:`` parentheses (#123518)
Wei-Hsiang (Matt) Wang [Sun, 1 Sep 2024 04:59:42 +0000 (12:59 +0800)] 
gh-123517: Remove unnecessary ``:meth:`` parentheses (#123518)

14 months agogh-121285: Remove backtracking when parsing tarfile headers (GH-121286)
Seth Michael Larson [Sat, 31 Aug 2024 22:17:05 +0000 (17:17 -0500)] 
gh-121285: Remove backtracking when parsing tarfile headers (GH-121286)

* Remove backtracking when parsing tarfile headers
* Rewrite PAX header parsing to be stricter
* Optimize parsing of GNU extended sparse headers v0.0

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
14 months agoEnable colour for doctest on GitHub Actions (#123536)
Hugo van Kemenade [Sat, 31 Aug 2024 14:15:44 +0000 (17:15 +0300)] 
Enable colour for doctest on GitHub Actions (#123536)

14 months agogh-123309: Remove check for redefined memo entry in pickletools.dis() (GH-123374)
Serhiy Storchaka [Sat, 31 Aug 2024 13:21:49 +0000 (16:21 +0300)] 
gh-123309: Remove check for redefined memo entry in pickletools.dis() (GH-123374)

Such pickles are supported by the Unpickler even if the Pickler does not
produce them.

14 months agogh-76960: Fix urljoin() and urldefrag() for URIs with empty components (GH-123273)
Serhiy Storchaka [Sat, 31 Aug 2024 09:42:08 +0000 (12:42 +0300)] 
gh-76960: Fix urljoin() and urldefrag() for URIs with empty components (GH-123273)

* urljoin() with relative reference "?" sets empty query and removes fragment.
* Preserve empty components (authority, params, query, fragment) in urljoin().
* Preserve empty components (authority, params, query) in urldefrag().

Also refactor the code and get rid of double _coerce_args() and
_coerce_result() calls in urljoin(), urldefrag(), urlparse() and
urlunparse().

14 months agogh-123309: Add more tests for the pickletools module (GH-123355)
Serhiy Storchaka [Sat, 31 Aug 2024 09:30:05 +0000 (12:30 +0300)] 
gh-123309: Add more tests for the pickletools module (GH-123355)

Add tests for genops() and dis().

14 months agogh-123407: Enable translating literal and code blocks (#123408)
Maciej Olko [Sat, 31 Aug 2024 06:31:36 +0000 (08:31 +0200)] 
gh-123407: Enable translating literal and code blocks (#123408)

14 months agogh-108172: do not override OS preferred browser if it is a super-string of a known...
Oded Arbel [Sat, 31 Aug 2024 06:11:57 +0000 (09:11 +0300)] 
gh-108172: do not override OS preferred browser if it is a super-string of a known browser (GH-113011)

When checking if the registering browser is the "OS preferred browser", do not use a substring search - that makes no sense: one can have a preferred browser that looks like a super-string of a known browser, e.g. "firefox-nightly" vs "firefox".

https://github.com/python/cpython/issues/108172 explains in more detail, and lays out a potential better future enhancement for this case of just using xdg-open.  We'll go with this for now.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
14 months agogh-121313: Limit the reading size from pipes to their default buffer size on POSIX...
Alexander P. [Sat, 31 Aug 2024 05:57:22 +0000 (07:57 +0200)] 
gh-121313: Limit the reading size from pipes to their default buffer size on POSIX systems (GH-121315)

See https://github.com/python/cpython/issues/121313 for analysis, but this greatly reduces memory overallocation and overhead when multiprocessing is sending non-small data over its pipes between processes.

14 months agoMake self turtledemo codeowner (#123524)
Terry Jan Reedy [Sat, 31 Aug 2024 01:59:12 +0000 (21:59 -0400)] 
Make self turtledemo codeowner (#123524)

14 months agogh-121404: rearrange code in compile.c so that codegen functions come first and compi...
Irit Katriel [Fri, 30 Aug 2024 21:54:42 +0000 (22:54 +0100)] 
gh-121404: rearrange code in compile.c so that codegen functions come first and compiler functions second (#123510)

14 months agogh-123440: Improve error message for `except as` used with not a name (#123442)
sobolevn [Fri, 30 Aug 2024 16:21:59 +0000 (19:21 +0300)] 
gh-123440: Improve error message for `except as` used with not a name (#123442)

14 months agogh-122854: Add Py_HashBuffer() function (#122855)
Victor Stinner [Fri, 30 Aug 2024 15:42:27 +0000 (17:42 +0200)] 
gh-122854: Add Py_HashBuffer() function (#122855)

14 months agogh-121645: Add PyBytes_Join() function (#121646)
Victor Stinner [Fri, 30 Aug 2024 12:57:33 +0000 (14:57 +0200)] 
gh-121645: Add PyBytes_Join() function (#121646)

* Replace _PyBytes_Join() with PyBytes_Join().
* Keep _PyBytes_Join() as an alias to PyBytes_Join().

14 months agogh-123484: Fix the debug offsets for PyLongObject (#123485)
Matt Wozniski [Fri, 30 Aug 2024 11:39:28 +0000 (07:39 -0400)] 
gh-123484: Fix the debug offsets for PyLongObject (#123485)

14 months agogh-123492: Remove unnecessary `:func:` parentheses (#123493)
Wei-Hsiang (Matt) Wang [Fri, 30 Aug 2024 11:34:09 +0000 (19:34 +0800)] 
gh-123492: Remove unnecessary `:func:` parentheses (#123493)

14 months agogh-123189: [`Modules/blake2module.c`]: Move function definitions and their usage...
Kirill Podoprigora [Fri, 30 Aug 2024 10:28:32 +0000 (13:28 +0300)] 
gh-123189: [`Modules/blake2module.c`]: Move function definitions and their usage under the macros (#123190)

14 months agogh-123446: Fix empty function names in `TypeError`s in `typeobject` (#123470)
sobolevn [Fri, 30 Aug 2024 07:36:51 +0000 (10:36 +0300)] 
gh-123446: Fix empty function names in `TypeError`s in `typeobject` (#123470)

14 months agogh-121485: Always use 64-bit integers for integers bits count (GH-121486)
Serhiy Storchaka [Fri, 30 Aug 2024 05:13:24 +0000 (08:13 +0300)] 
gh-121485: Always use 64-bit integers for integers bits count (GH-121486)

Use 64-bit integers instead of platform specific size_t or Py_ssize_t
to represent the number of bits in Python integer.

14 months agogh-123446: Fix empty function names in `TypeError`s in `_csv` module (#123462)
sobolevn [Thu, 29 Aug 2024 08:12:37 +0000 (11:12 +0300)] 
gh-123446: Fix empty function names in `TypeError`s in `_csv` module (#123462)

14 months agogh-123446: Fix empty function names in `TypeError`s in `_csv` module (#123461)
sobolevn [Thu, 29 Aug 2024 06:53:57 +0000 (09:53 +0300)] 
gh-123446: Fix empty function names in `TypeError`s in `_csv` module (#123461)

14 months agogh-123431: Harmonize extension code checks in pickle (GH-123434)
Serhiy Storchaka [Thu, 29 Aug 2024 05:26:16 +0000 (08:26 +0300)] 
gh-123431: Harmonize extension code checks in pickle (GH-123434)

This checks are redundant in normal circumstances and can only work if
the extension registry was intentionally broken.

* The Python implementation now raises exception for the extension code
  with false boolean value.
* Simplify the C code. RuntimeError is now raised in explicit checks.
* Add many tests.

14 months agogh-123448: Move `_PyNoDefault_Type` to the static types array (#123449)
Peter Bierma [Thu, 29 Aug 2024 01:27:40 +0000 (21:27 -0400)] 
gh-123448: Move `_PyNoDefault_Type` to the static types array (#123449)

14 months agogh-122136: test_asyncio: Don't fail if the kernel buffers more data than advertised...
Petr Viktorin [Wed, 28 Aug 2024 20:36:42 +0000 (22:36 +0200)] 
gh-122136: test_asyncio: Don't fail if the kernel buffers more data than advertised (GH-123423)

14 months agogh-123142: fix too wide source location of GET_ITER/GET_AITER (#123420)
Irit Katriel [Wed, 28 Aug 2024 16:11:52 +0000 (17:11 +0100)] 
gh-123142: fix too wide source location of GET_ITER/GET_AITER (#123420)

14 months agogh-101860: document `property.__name__` (GH-123399)
Bénédikt Tran [Wed, 28 Aug 2024 14:10:13 +0000 (16:10 +0200)] 
gh-101860: document `property.__name__` (GH-123399)

14 months agogh-123344: Add missing ast optimizations for PEP 696 (#123377)
Bogdan Romanyuk [Wed, 28 Aug 2024 13:38:56 +0000 (16:38 +0300)] 
gh-123344: Add missing ast optimizations for PEP 696 (#123377)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
14 months agoFix typos in docs, error messages and comments (#123336)
Wulian [Wed, 28 Aug 2024 11:41:04 +0000 (19:41 +0800)] 
Fix typos in docs, error messages and comments (#123336)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
14 months agogh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390)
Victor Stinner [Wed, 28 Aug 2024 10:16:13 +0000 (12:16 +0200)] 
gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390)

Add new functions to convert C <stdint.h> numbers from/to Python int:

* PyLong_FromInt32()
* PyLong_FromUInt32()
* PyLong_FromInt64()
* PyLong_FromUInt64()
* PyLong_AsInt32()
* PyLong_AsUInt32()
* PyLong_AsInt64()
* PyLong_AsUInt64()

14 months agogh-122561: Clean up and microoptimize str.translate and charmap codec (GH-122932)
Serhiy Storchaka [Wed, 28 Aug 2024 09:11:13 +0000 (12:11 +0300)] 
gh-122561: Clean up and microoptimize str.translate and charmap codec (GH-122932)

* Replace PyLong_AS_LONG() with PyLong_AsLong().
* Call PyLong_AsLong() only once per the replacement code.
* Use PyMapping_GetOptionalItem() instead of PyObject_GetItem().

14 months agogh-123254: Improve `tuple` C API docs with more info about errors (#123255)
sobolevn [Wed, 28 Aug 2024 07:30:21 +0000 (10:30 +0300)] 
gh-123254: Improve `tuple` C API docs with more info about errors (#123255)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
14 months agogh-123363: Show string value of CONTAINS_OP oparg in dis (#123387)
Alexandr Mitin [Wed, 28 Aug 2024 06:15:34 +0000 (12:15 +0600)] 
gh-123363: Show string value of CONTAINS_OP oparg in dis (#123387)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
14 months agogh-123270: Replaced SanitizedNames with a more surgical fix. (#123354)
Jason R. Coombs [Tue, 27 Aug 2024 21:10:30 +0000 (17:10 -0400)] 
gh-123270: Replaced SanitizedNames with a more surgical fix. (#123354)

Applies changes from zipp 3.20.1 and jaraco/zipp#124

14 months agogh-123271: Make builtin zip method safe under free-threading (#123272)
Pieter Eendebak [Tue, 27 Aug 2024 19:22:43 +0000 (21:22 +0200)] 
gh-123271: Make builtin zip method safe under free-threading (#123272)

The `zip_next` function uses a common optimization technique for methods
that generate tuples. The iterator maintains an internal reference to
the returned tuple. When the method is called again, it checks if the
internal tuple's reference count is 1. If so, the tuple can be reused.
However, this approach is not safe under the free-threading build:
after checking the reference count, another thread may perform the same
check and also reuse the tuple. This can result in a double decref on
the items of the replaced tuple and a double incref (memory leak) on
the items of the tuple being set.

This adds a function, `_PyObject_IsUniquelyReferenced` that
encapsulates the stricter logic necessary for the free-threaded build:
the internal tuple must be owned by the current thread, have a local
refcount of one, and a shared refcount of zero.

14 months agogh-121404: split compiler_nameop into a codegen part and a compiler part (#123398)
Irit Katriel [Tue, 27 Aug 2024 15:57:31 +0000 (16:57 +0100)] 
gh-121404: split compiler_nameop into a codegen part and a compiler part (#123398)

14 months agogh-109975: Fix a typo in What's New in Python 3.13 (#123393)
Daniel Hollas [Tue, 27 Aug 2024 14:53:45 +0000 (15:53 +0100)] 
gh-109975: Fix a typo in What's New in Python 3.13 (#123393)

14 months agoGH-117759: Document incremental GC (GH-123266)
Mark Shannon [Tue, 27 Aug 2024 14:23:39 +0000 (15:23 +0100)] 
GH-117759: Document incremental GC (GH-123266)

* Update what's new

* Update gc module docs and fix inconsistency in gc.get_objects

14 months agogH-80788: remove old weakset workaround for thread safety (#123388)
Kumar Aditya [Tue, 27 Aug 2024 13:42:44 +0000 (19:12 +0530)] 
gH-80788: remove old weakset workaround for thread safety (#123388)

14 months agogh-123089: Make weakref.WeakSet safe against concurrent mutations while it is being...
Kumar Aditya [Tue, 27 Aug 2024 13:04:03 +0000 (18:34 +0530)] 
gh-123089: Make weakref.WeakSet safe against concurrent mutations while it is being iterated  (#123279)

* Make `weakref.WeakSet` safe against concurrent mutations while it is being iterated.

`_IterationGuard` is no longer used for `WeakSet`, it now relies on copying the underlying set which is an atomic operation while iterating so that it can be modified by other threads.

14 months agogh-120426: Reword the glossary term "immortal" (GH-123191)
Petr Viktorin [Tue, 27 Aug 2024 11:37:56 +0000 (13:37 +0200)] 
gh-120426: Reword the glossary term "immortal" (GH-123191)

Reword the glossary term "immortal", mark it as an implementation detail

14 months agogh-121404: compiler_visit_* --> codegen_visit_* (#123382)
Irit Katriel [Tue, 27 Aug 2024 11:32:24 +0000 (12:32 +0100)] 
gh-121404: compiler_visit_* --> codegen_visit_* (#123382)

14 months agoGH-123232: Factor BINARY_SLICE and STORE_SLICE to handle stats properly for tier...
Mark Shannon [Tue, 27 Aug 2024 09:49:39 +0000 (10:49 +0100)] 
GH-123232: Factor BINARY_SLICE and STORE_SLICE to handle stats properly for tier 2. (GH-123381)

14 months agoGH-115775: Use `__static_attributes__` to initialize shared keys (GH-118468)
Mark Shannon [Tue, 27 Aug 2024 09:34:46 +0000 (10:34 +0100)] 
GH-115775: Use `__static_attributes__` to initialize shared keys (GH-118468)

14 months agoFurther revise idlelib/Icons/README.text (#123364)
Terry Jan Reedy [Mon, 26 Aug 2024 21:44:35 +0000 (17:44 -0400)] 
Further revise idlelib/Icons/README.text (#123364)

In particular, add trademark derivative approval information.

14 months agogh-122666: Tests for ast optimizations (#122667)
Kirill Podoprigora [Mon, 26 Aug 2024 19:27:22 +0000 (22:27 +0300)] 
gh-122666: Tests for ast optimizations (#122667)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
14 months agogh-123340: Show string value of `IS_OP` oparg in `dis` (#123348)
sobolevn [Mon, 26 Aug 2024 18:59:50 +0000 (21:59 +0300)] 
gh-123340: Show string value of `IS_OP` oparg in `dis` (#123348)

14 months agoGH-73991: Prune `pathlib.Path.copy()` and `copy_into()` arguments (#123337)
Barney Gale [Mon, 26 Aug 2024 16:05:34 +0000 (17:05 +0100)] 
GH-73991: Prune `pathlib.Path.copy()` and `copy_into()` arguments (#123337)

Remove *ignore* and *on_error* arguments from `pathlib.Path.copy[_into]()`,
because these arguments are under-designed. Specifically:

- *ignore* is appropriated from `shutil.copytree()`, but it's not clear
  how it should apply when the user copies a non-directory. We've changed
  the callback signature from the `shutil` version, but I'm not confident
  the new signature is as good as it can be.
- *on_error* is a generalisation of `shutil.copytree()`'s error handling,
  which is to accumulate exceptions and raise a single `shutil.Error` at
  the end. It's not obvious which solution is better.

Additionally, this arguments may be challenging to implement in future user
subclasses of `PathBase`, which might utilise a native recursive copying
method.

14 months agoGH-73991: Make `pathlib.Path.delete()` private. (#123315)
Barney Gale [Mon, 26 Aug 2024 15:26:34 +0000 (16:26 +0100)] 
GH-73991: Make `pathlib.Path.delete()` private. (#123315)

Per feedback from Paul Moore on GH-123158, it's better to defer making
`Path.delete()` public than ship it with under-designed error handling
capabilities.

We leave a remnant `_delete()` method, which is used by `move()`. Any
functionality not needed by `move()` is deleted.

14 months agogh-111495: Remove test_capi test_rshift_print() (#123338)
Victor Stinner [Mon, 26 Aug 2024 14:39:32 +0000 (16:39 +0200)] 
gh-111495: Remove test_capi test_rshift_print() (#123338)

The suggestion for "print >> value" was removed recently:
commit 9375b9ca3a4998678ba74ff5c77ed540a4dcf887.

14 months ago gh-111495: Add tests for PyNumber C API (#111996)
Sergey B Kirpichev [Mon, 26 Aug 2024 13:59:22 +0000 (16:59 +0300)] 
 gh-111495: Add tests for PyNumber C API (#111996)

14 months agoGH-73991: Add `pathlib.Path.copy_into()` and `move_into()` (#123314)
Barney Gale [Mon, 26 Aug 2024 13:14:23 +0000 (14:14 +0100)] 
GH-73991: Add `pathlib.Path.copy_into()` and `move_into()` (#123314)

These two methods accept an *existing* directory path, onto which we join
the source path's base name to form the final target path.

A possible alternative implementation is to check for directories in
`copy()` and `move()` and adjust the target path, which is done in several
`shutil` functions. This behaviour is helpful in a shell context, but
less so in a stored program that explicitly specifies destinations. For
example, a user that calls `Path('foo.py').copy('bar.py')` might not
imagine that `bar.py/foo.py` would be created, but under the alternative
implementation this will happen if `bar.py` is an existing directory.

14 months agogh-111495: Add tests for PyTuple C API (#118757)
Sergey B Kirpichev [Mon, 26 Aug 2024 09:57:52 +0000 (12:57 +0300)] 
gh-111495: Add tests for PyTuple C API (#118757)

Co-authored-by: kalyanr <kalyan.ben10@live.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
14 months agoRewrite idlelib/Icons/README.txt (#123329)
Terry Jan Reedy [Mon, 26 Aug 2024 02:11:59 +0000 (22:11 -0400)] 
Rewrite idlelib/Icons/README.txt (#123329)

14 months agogh-123177: Fix prompt for wrapped lines in pyrepl (#123324)
Matt Wozniski [Sun, 25 Aug 2024 22:54:06 +0000 (18:54 -0400)] 
gh-123177: Fix prompt for wrapped lines in pyrepl (#123324)

When display lines above the cursor come from the cache, the first line
to not come from the cache may be a wrapped line, starting half way
through a logical line in the buffer. Detect and handle this case to
avoid accidentally drawing a stray prompt in the middle of a logical
line.

14 months agogh-82378: Document the difference between sys.tracebacklimit and the limit arguments...
CF Bolz-Tereick [Sun, 25 Aug 2024 22:50:43 +0000 (00:50 +0200)] 
gh-82378: Document the difference between sys.tracebacklimit and the limit arguments (#123286)

14 months agogh-123177: Deactivate line wrap for Apple Terminal via scape codes in the new REPL...
Pablo Galindo Salgado [Sun, 25 Aug 2024 21:38:49 +0000 (22:38 +0100)] 
gh-123177: Deactivate line wrap for Apple Terminal via scape codes in the new REPL (#123267)

14 months agogh-123297: Propagate LD_FLAGS to LDCXXSHARED in sysconfig (#123298)
Pablo Galindo Salgado [Sun, 25 Aug 2024 20:01:58 +0000 (21:01 +0100)] 
gh-123297: Propagate LD_FLAGS to LDCXXSHARED in sysconfig (#123298)

14 months agogh-122982: Extend the deprecation period for bool inversion by two years (#123306)
Kirill Podoprigora [Sun, 25 Aug 2024 19:24:44 +0000 (22:24 +0300)] 
gh-122982: Extend the deprecation period for bool inversion by two years (#123306)

14 months agoGH-73991: Add `pathlib.Path.move()` (#122073)
Barney Gale [Sun, 25 Aug 2024 15:51:51 +0000 (16:51 +0100)] 
GH-73991: Add `pathlib.Path.move()` (#122073)

Add a `Path.move()` method that moves a file or directory tree, and returns a new `Path` instance pointing to the target.

This method is similar to `shutil.move()`, except that it doesn't accept a *copy_function* argument, and it doesn't check whether the destination is an existing directory.

14 months agogh-123228: don't leak file descriptors in pyrepl test (#123302)
CF Bolz-Tereick [Sun, 25 Aug 2024 14:52:51 +0000 (16:52 +0200)] 
gh-123228: don't leak file descriptors in pyrepl test (#123302)

14 months agoGH-109975: Copyedit 3.13 What's New: Optimizations (#123301)
Adam Turner [Sun, 25 Aug 2024 13:17:46 +0000 (14:17 +0100)] 
GH-109975: Copyedit 3.13 What's New: Optimizations (#123301)

14 months agoGH-123299: Move ctypes What's New entry to 3.14 (#123300)
Adam Turner [Sun, 25 Aug 2024 00:41:44 +0000 (01:41 +0100)] 
GH-123299: Move ctypes What's New entry to 3.14 (#123300)

14 months agoRevert "GH-120754: Add a strace helper and test set of syscalls for o… (#123303)
Shantanu [Sat, 24 Aug 2024 21:54:31 +0000 (14:54 -0700)] 
Revert "GH-120754: Add a strace helper and test set of syscalls for o… (#123303)

Revert "GH-120754: Add a strace helper and test set of syscalls for open().read() (#121143)"

This reverts commit e38d0afe3548b856ccf0b05c01ed3eefc69cb3e7.

14 months agoGH-120754: Add a strace helper and test set of syscalls for open().read() (#121143)
Cody Maloney [Sat, 24 Aug 2024 20:42:41 +0000 (13:42 -0700)] 
GH-120754: Add a strace helper and test set of syscalls for open().read() (#121143)

14 months agoRemove comment from pystate created in 2003 (#123259)
Anthony Shaw [Sat, 24 Aug 2024 20:36:42 +0000 (06:36 +1000)] 
Remove comment from pystate created in 2003 (#123259)

14 months agogh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (#123281)
Sergey B Kirpichev [Sat, 24 Aug 2024 15:46:05 +0000 (18:46 +0300)] 
gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (#123281)

Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
14 months agoGH-122890: Fix low-level error handling in `pathlib.Path.copy()` (#122897)
Barney Gale [Sat, 24 Aug 2024 14:11:39 +0000 (15:11 +0100)] 
GH-122890: Fix low-level error handling in `pathlib.Path.copy()` (#122897)

Give unique names to our low-level FD copying functions, and try each one
in turn. Handle errors appropriately for each implementation:

- `fcntl.FICLONE`: suppress `EBADF`, `EOPNOTSUPP`, `ETXTBSY`, `EXDEV`
- `posix._fcopyfile`: suppress `EBADF`, `ENOTSUP`
- `os.copy_file_range`: suppress `ETXTBSY`, `EXDEV`
- `os.sendfile`: suppress `ENOTSOCK`

14 months agoGH-109975: Copyedit 3.13 What's New: Improved Modules (#123132)
Adam Turner [Sat, 24 Aug 2024 13:32:35 +0000 (15:32 +0200)] 
GH-109975: Copyedit 3.13 What's New: Improved Modules (#123132)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
14 months agoDocs: Fix Makefile syntax (#123287)
Adam Turner [Sat, 24 Aug 2024 12:57:38 +0000 (14:57 +0200)] 
Docs: Fix Makefile syntax (#123287)

14 months agogh-123243: Fix reference leak in `_decimal` (#123244)
neonene [Sat, 24 Aug 2024 04:07:01 +0000 (13:07 +0900)] 
gh-123243: Fix reference leak in `_decimal` (#123244)

14 months agogh-117376: Make `Py_DECREF` a macro in ceval.c in free-threaded build (#122975)
Sam Gross [Fri, 23 Aug 2024 19:36:14 +0000 (15:36 -0400)] 
gh-117376: Make `Py_DECREF` a macro in ceval.c in free-threaded build (#122975)

`Py_DECREF` and `PyStackRef_CLOSE` are now implemented as macros in the
free-threaded build in ceval.c. There are two motivations;

 * MSVC has problems inlining functions in ceval.c in the PGO build.

 * We will want to mark escaping calls in order to spill the stack
   pointer in ceval.c and we will want to do this around `_Py_Dealloc`
   (or `_Py_MergeZeroLocalRefcount` or `_Py_DecRefShared`), not around
   the entire `Py_DECREF` or `PyStackRef_CLOSE` call.

14 months agogh-123205: `Python/bytecodes.c`: Fix compiler warning (#123206)
Kirill Podoprigora [Fri, 23 Aug 2024 19:35:25 +0000 (22:35 +0300)] 
gh-123205: `Python/bytecodes.c`: Fix compiler warning (#123206)

Fix MSVC warning "conversion from '__int64' to 'int'"

14 months agoGH-73991: Disallow copying directory into itself via `pathlib.Path.copy()` (#122924)
Barney Gale [Fri, 23 Aug 2024 19:03:11 +0000 (20:03 +0100)] 
GH-73991: Disallow copying directory into itself via `pathlib.Path.copy()` (#122924)

14 months agogh-121404: more compiler_* -> codegen_*, class_body and comprehensions (#123262)
Irit Katriel [Fri, 23 Aug 2024 18:53:15 +0000 (19:53 +0100)] 
gh-121404: more compiler_* -> codegen_*, class_body and comprehensions (#123262)

14 months agoFix typo mentioning threads instead of tasks (#123203)
Kevin Evans [Fri, 23 Aug 2024 16:24:12 +0000 (09:24 -0700)] 
Fix typo mentioning threads instead of tasks (#123203)

14 months agogh-122272: Guarantee specifiers %F and %C for datetime.strftime to be 0-padded (GH...
blhsing [Fri, 23 Aug 2024 15:45:03 +0000 (23:45 +0800)] 
gh-122272: Guarantee specifiers %F and %C for datetime.strftime to be 0-padded (GH-122436)

14 months agoGH-122298: Restore printing of GC stats (GH-123261)
Mark Shannon [Fri, 23 Aug 2024 15:39:08 +0000 (16:39 +0100)] 
GH-122298: Restore printing of GC stats (GH-123261)

14 months agogh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the...
Pablo Galindo Salgado [Fri, 23 Aug 2024 12:33:45 +0000 (13:33 +0100)] 
gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (#123263)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
14 months agoGH-123232: Fix "not specialized" stats (GH-123236)
Mark Shannon [Fri, 23 Aug 2024 09:46:03 +0000 (10:46 +0100)] 
GH-123232: Fix "not specialized" stats (GH-123236)

14 months agogh-121404: compiler_annassign --> codegen_annassign (#123245)
Irit Katriel [Fri, 23 Aug 2024 09:39:42 +0000 (10:39 +0100)] 
gh-121404: compiler_annassign --> codegen_annassign (#123245)

14 months agoGH-123040: Specialize shadowed `LOAD_ATTR`. (GH-123219)
Mark Shannon [Fri, 23 Aug 2024 09:22:35 +0000 (10:22 +0100)] 
GH-123040: Specialize shadowed `LOAD_ATTR`. (GH-123219)

14 months agogh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer...
Bar Harel [Fri, 23 Aug 2024 09:12:58 +0000 (12:12 +0300)] 
gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214)

14 months agoGH-99108: Amend Modules/Setup (#123146)
Jonathan Protzenko [Fri, 23 Aug 2024 06:40:31 +0000 (23:40 -0700)] 
GH-99108: Amend Modules/Setup (#123146)

14 months agogh-122546: Relax SyntaxError check when raising errors on the new REPL (#123233)
Sergey B Kirpichev [Thu, 22 Aug 2024 23:25:33 +0000 (02:25 +0300)] 
gh-122546: Relax SyntaxError check when raising errors on the new REPL (#123233)