Commit Graph

4410 Commits

Author SHA1 Message Date
Erlend E. Aasland e006c7371d
gh-105201: Add PyIter_NextItem() (#122331)
Return -1 and set an exception on error; return 0 if the iterator is
exhausted, and return 1 if the next item was fetched successfully.

Prefer this API to PyIter_Next(), which requires the caller to use
PyErr_Occurred() to differentiate between iterator exhaustion and errors.

Co-authered-by: Irit Katriel <iritkatriel@yahoo.com>
2024-08-08 00:47:15 +02:00
Barney Gale 98dba73010
GH-73991: Rework `pathlib.Path.rmtree()` into `delete()` (#122368)
Rename `pathlib.Path.rmtree()` to `delete()`, and add support for deleting
non-directories. This simplifies the interface for users, and nicely
complements the upcoming `move()` and `copy()` methods (which will also
accept any type of file.)
2024-08-07 01:34:44 +01:00
Irit Katriel 498376d7a7
gh-122445: populate only modified fields in __static_attributes__ (#122446) 2024-08-02 15:40:42 +01:00
Petr Viktorin 0976339818
gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233)
## Encode header parts that contain newlines

Per RFC 2047:

> [...] these encoding schemes allow the
> encoding of arbitrary octet values, mail readers that implement this
> decoding should also ensure that display of the decoded data on the
> recipient's terminal will not cause unwanted side-effects

It seems that the "quoted-word" scheme is a valid way to include
a newline character in a header value, just like we already allow
undecodable bytes or control characters.
They do need to be properly quoted when serialized to text, though.


## Verify that email headers are well-formed

This should fail for custom fold() implementations that aren't careful
about newlines.


Co-authored-by: Bas Bloemsaat <bas@bloemsaat.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-31 00:19:48 +02:00
Petr Viktorin 3833d27f98
gh-105733: Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it. (GH-122281)
Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it.

Partially reverts 2211454fe2
2024-07-30 09:37:58 +02:00
Adam Turner 76bdfa4cd0
GH-122085: Use include files for C API deprecations (#109843) 2024-07-29 22:20:40 +01:00
Hugo van Kemenade 4e75509349
gh-122085: Use include files for `whatsnew/3.14.rst` deprecations (#122242) 2024-07-27 14:17:54 +03:00
Adam Turner 762e771cc0
Fix underline for 'pty' in What's New in Python 3.14 (#122337) 2024-07-27 01:00:56 +00:00
Irit Katriel bc94cf7e25
gh-122245: move checks for writes and shadowing of __debug__ to symtable (#122246) 2024-07-26 14:39:56 +01:00
Hugo van Kemenade b3b7b7d46a
gh-122085: Use include files for `whatsnew/3.12.rst` deprecations (#122093) 2024-07-24 02:29:35 -06:00
Serhiy Storchaka e6b25e9a09
gh-122163: Add notes for JSON serialization errors (GH-122165)
This allows to identify the source of the error.
2024-07-23 20:02:54 +03:00
Jelle Zijlstra 2762c6cc5e
gh-121637: Syntax error for optimized-away incorrect await (#121656)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-22 14:12:43 -07:00
Bénédikt Tran c09d4c4a26
gh-119698: deprecate ``symtable.Class.get_methods`` (#121902) 2024-07-22 07:04:17 -07:00
Barney Gale 094375b9b7
GH-73991: Add `pathlib.Path.rmtree()` (#119060)
Add a `Path.rmtree()` method that removes an entire directory tree, like
`shutil.rmtree()`. The signature of the optional *on_error* argument
matches the `Path.walk()` argument of the same name, but differs from the
*onexc* and *onerror* arguments to `shutil.rmtree()`. Consistency within
pathlib is probably more important.

In the private pathlib ABCs, we add an implementation based on `walk()`.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-20 20:14:13 +00:00
Rafael Fontenelle 3de092b82f
Docs: Fix a typo in What's New in Python 3.13 (#122051) 2024-07-20 04:46:57 +01:00
Rodrigo Oliveira d66b06107b
gh-118830: Bump pickle.DEFAULT_PROTOCOL to 5 (GH-119340) 2024-07-19 16:47:10 +02:00
Hugo van Kemenade a1df1b4439
Docs: move deprecations into include files (#121241) 2024-07-19 07:57:14 -06:00
Serhiy Storchaka 1a0c7b9ba4
gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
Serhiy Storchaka c8d2630995
gh-82017: Support as_integer_ratio() in the Fraction constructor (GH-120271)
Any objects that have the as_integer_ratio() method (e.g. numpy.float128)
can now be converted to a fraction.
2024-07-19 08:06:53 +03:00
Rafael Fontenelle 5d98a4d266
Remove duplicate "it" in whatsnew 3.13 (#121580) 2024-07-17 00:31:21 -07:00
Alyssa Coghlan d7a099d7ae
GH-105879: Note exec/eval keyword change in What's New (GH-121831) 2024-07-16 13:24:45 +00:00
Serhiy Storchaka 94bee45dee
gh-84978: Add float.from_number() and complex.from_number() (GH-26827)
They are alternate constructors which only accept numbers
(including objects with special methods __float__, __complex__
and __index__), but not strings.
2024-07-15 16:07:00 +00:00
Tian Gao 690b9355e0
gh-121450: Make inline breakpoints use the most recent pdb instance (#121451) 2024-07-10 19:54:27 -07:00
Hugo van Kemenade 006b53a42f
NEWS: Fix Sphinx warnings and increase threshold for new news nits (#121482)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-08 14:30:05 -06:00
Bénédikt Tran 9728ead361
gh-121141: add support for `copy.replace` to AST nodes (#121162) 2024-07-03 20:10:54 -07:00
Serhiy Storchaka ff5806c78e
gh-121027: Make the functools.partial object a method descriptor (GH-121089)
Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
2024-07-03 09:02:15 +03:00
Victor Stinner d44c550f7e
gh-120743: Soft deprecate os.popen() function (#120744)
Soft deprecate os.popen() and os.spawn*() functions.
2024-07-01 18:27:50 +02:00
Kumar Aditya 58a3580836
gh-107803: add whatsnew for asyncio double linked list implementation (#120995) 2024-06-28 14:33:31 +05:30
Serhiy Storchaka db96edd6d1
gh-121027: Add a future warning in functools.partial.__get__ (#121086) 2024-06-27 11:47:20 +00:00
Victor Stinner 2e157851e3
gh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849) 2024-06-24 17:40:39 +02:00
Christian Clauss 22b8a35d6e
docs: puremagic.what() as replacement for imghdr.what() (#120871) 2024-06-24 15:32:13 +02:00
Barney Gale 35e998f560
GH-73991: Add `pathlib.Path.copytree()` (#120718)
Add `pathlib.Path.copytree()` method, which recursively copies one
directory to another.

This differs from `shutil.copytree()` in the following respects:

1. Our method has a *follow_symlinks* argument, whereas shutil's has a
   *symlinks* argument with an inverted meaning.
2. Our method lacks something like a *copy_function* argument. It always
   uses `Path.copy()` to copy files.
3. Our method lacks something like a *ignore_dangling_symlinks* argument.
   Instead, users can filter out danging symlinks with *ignore*, or
   ignore exceptions with *on_error*
4. Our *ignore* argument is a callable that accepts a single path object,
   whereas shutil's accepts a path and a list of child filenames.
5. We add an *on_error* argument, which is a callable that accepts
   an `OSError` instance. (`Path.walk()` also accepts such a callable).

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-06-23 22:01:12 +01:00
Kumar Aditya 18b6ca9660
GH-120804: add docs for removal for asyncio child watchers (#120895)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-06-23 13:14:12 +00:00
Victor Stinner 4123226bbd
gh-119182: Add PyUnicodeWriter_DecodeUTF8Stateful() (#120639)
Add PyUnicodeWriter_WriteWideChar() and
PyUnicodeWriter_DecodeUTF8Stateful() functions.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-21 19:33:15 +02:00
Sam Gross 3af7263037
gh-117511: Make PyMutex public in the non-limited API (#117731) 2024-06-20 11:29:08 -04:00
Victor Stinner 16f8e22e7c
gh-120600: Make Py_TYPE() opaque in limited C API 3.14 (#120601)
In the limited C API 3.14 and newer, Py_TYPE() is now implemented as
an opaque function call to hide implementation details.
2024-06-18 14:28:48 +00:00
Victor Stinner 5c4235cd8c
gh-119182: Add PyUnicodeWriter C API (#119184) 2024-06-17 17:10:52 +02:00
Gregory P. Smith bac4edad69
gh-112346: Document the OS byte in `gzip.compress` output change in 3.11 (#120480)
gh-112346: Describe the "os" byte in gzip output change.
2024-06-16 22:47:10 -07:00
Barney Gale 7c38097add
GH-73991: Add `pathlib.Path.copy()` (#119058)
Add a `Path.copy()` method that copies the content of one file to another.

This method is similar to `shutil.copyfile()` but differs in the following ways:

- Uses `fcntl.FICLONE` where available (see GH-81338)
- Uses `os.copy_file_range` where available (see GH-81340)
- Uses `_winapi.CopyFile2` where available, even though this copies more metadata than the other implementations. This makes `WindowsPath.copy()` more similar to `shutil.copy2()`.

The method is presently _less_ specified than the `shutil` functions to allow OS-specific optimizations that might copy more or less metadata.

Incorporates code from GH-81338 and GH-93152.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2024-06-14 17:15:49 +01:00
Serhiy Storchaka 92c9c6ae14
gh-120345: Fix incorrect use of the :class: role with the "()" suffix (GH-120347)
* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
2024-06-12 17:23:03 +03:00
Bénédikt Tran 755dab719d
gh-120029: make `symtable.Symbol.__repr__` correctly reflect the compiler's flags, add methods (#120099)
Expose :class:`symtable.Symbol` methods :meth:`~symtable.Symbol.is_free_class`,
:meth:`~symtable.Symbol.is_comp_iter` and :meth:`~symtable.Symbol.is_comp_cell`.

---------

Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-06-12 05:14:50 -06:00
Victor Stinner 7aff2de62b
gh-120057: Add os.environ.refresh() method (#120059) 2024-06-10 16:34:17 +00:00
Jacob Walls 6b606522ca
gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762)
Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.
2024-06-06 20:18:30 -07:00
Irit Katriel 770f3c1ead
gh-114616: Improve docs regarding changes to caches representation in dis (#120033) 2024-06-04 23:00:02 +00:00
Trey Hunner 5f03f09134
Fix incorrect pull GitHub link in What's New (#120045)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-04 16:28:08 +00:00
Sergey B Kirpichev 61d3ab32da
gh-116560: Add PyLong_GetSign() public function (#116561)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-03 14:06:31 +02:00
Nikita Sobolev 84c3191954
gh-118827: Remove `Quoter` from `urllib.parse` (#118828)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-03 10:50:29 +03:00
Solomon Himelbloom 117a8acdab
gh-109975: What's New in Python 3.13: fix broken link for `telnetlib` alternative (#119958) 2024-06-02 17:43:03 -07:00
Mark Dickinson f79ffc879b
gh-119740: Remove deprecated trunc delegation (#119743)
Remove the delegation of `int` to the `__trunc__` special method: `int` will now only delegate to `__int__` and `__index__` (in that order). `__trunc__` continues to exist, but its sole purpose is to support `math.trunc`.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-02 10:16:49 +01:00
Nikita Sobolev 4aed319a8e
gh-119775: Remove ability to create immutable types with mutable bases (#119776) 2024-06-02 07:27:20 +00:00