Commit graph

28254 commits

Author SHA1 Message Date
Mark Shannon 9cefcc0ee7
GH-120507: Lower the BEFORE_WITH and BEFORE_ASYNC_WITH instructions. (#120640)
* Remove BEFORE_WITH and BEFORE_ASYNC_WITH instructions.

* Add LOAD_SPECIAL instruction

* Reimplement `with` and `async with` statements using LOAD_SPECIAL
2024-06-18 12:17:46 +01:00
Saul Pwanson 0506f75c53
fix enum doc typo (#120091) 2024-06-17 21:31:15 +05:30
Victor Stinner 5c4235cd8c
gh-119182: Add PyUnicodeWriter C API (#119184) 2024-06-17 17:10:52 +02:00
Carol Willing a26d27e7ee
Update the documentation howto index page and group docs into 3 logical sections (GH-119366)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-06-17 16:37:33 +02:00
Bénédikt Tran 4bf17c381f
gh-119933: Improve `SyntaxError` message for invalid type parameters expressions (#119976)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-17 06:51:03 -07:00
Frank Dana 79e09e60d8
itertools doc: examples for groupby() and tee() (#120618) 2024-06-17 08:19:14 -05: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
mm-matthias 4f59f86382
gh-118596: Add thread-safety clarifications to the SSLContext documentation (#118597)
Add thread-safety clarifications to the SSLContext documentation. Per the issue:

This issue has also come up [here](https://github.com/psf/requests/pull/6667) where the matter was clarified by @tiran in [this comment](https://github.com/psf/requests/pull/6667):
> `SSLContext` is designed to be shared and used for multiple connections. It is thread safe as long as you don't reconfigure it once it is used by a connection. Adding new certs to the internal trust store is fine, but changing ciphers, verification settings, or mTLS certs can lead to surprising behavior. The problem is unrelated to threads and can even occur in a single-threaded program.
2024-06-16 13:27:44 -07:00
Hugo van Kemenade b8484c6ad7
Docs: remove temporary hardcoded links (#120348) 2024-06-16 06:51:17 -06:00
Nyuan Zhang 1fa595963e
gh-120572: add missing parentheses in TypeIs documentation (#120573) 2024-06-15 22:36:10 -07:00
Ruben Vorderman 08d09cf5ba
gh-112346: Always set OS byte to 255, simpler gzip.compress function. (GH-120486)
This matches the output behavior in 3.10 and earlier; the optimization in 3.11 allowed the zlib library's "os" value to be filled in instead in the circumstance when mtime was 0.  this keeps things consistent.
2024-06-15 18:46:39 +00:00
Jelle Zijlstra 9e0b11eb21
annotations: expand documentation on "simple" assignment targets (#120535)
This behavior is rather surprising and it was not clearly specified.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-15 15:18:16 +00:00
Tian Gao ed60ab5fab
gh-119824: Print stack entry when user input is needed (#119882)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-14 11:25:23 -07:00
Nikita Sobolev 7fadfd82eb
gh-120361: Add nonmember test with enum flags inside to test_enum (GH-120364)
* gh-120361: Add `nonmember` test with enum flags inside to `test_enum`
2024-06-14 10:25:35 -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
Barney Gale d88a1f2e15
GH-119054: Add "Renaming and deleting" section to pathlib docs. (#120465)
Add dedicated subsection for `pathlib.Path.rename()`, `replace()`,
`unlink()` and `rmdir()`.
2024-06-13 21:25:26 +01:00
Bénédikt Tran a3711afefa
gh-120012: clarify the behaviour of multiprocessing.Queue.empty on closed queues. (GH-120102)
* improve doc for `multiprocessing.Queue.empty`
* add tests for checking emptiness of queues

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-06-13 19:03:01 +00:00
Barney Gale c2d810b6d4
GH-119054: Add "Creating files and directories" section to pathlib docs. (#120186)
Add dedicated subsection for `pathlib.Path.touch()`, `mkdir()`,
`symlink_to()` and `hardlink_to()`. Also note that `open()`, `write_text()`
and `write_bytes()` are often used to create files.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-13 17:58:46 +00: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
Owain Davies 7dd8c37a06
gh-101575: document Decimal.__round__() (GH-101737) 2024-06-12 12:07:25 +02:00
Nikita Sobolev f5a9c34f38
gh-120056: Add IP_RECVERR, IP_RECVORIGDSTADDR, IP_RECVTTL to socket module (#120058)
* gh-120056: Add `IP_RECVERR` and `IP_RECVTTL` to `socket` module

* Fix news

* Address review

* Update NEWS
2024-06-11 21:00:56 -04:00
naglis 0335662fe1
Fix typo in ElementTree docs (#120342) 2024-06-11 20:01:48 +03:00
Victor Stinner 7aff2de62b
gh-120057: Add os.environ.refresh() method (#120059) 2024-06-10 16:34:17 +00:00
Clinton 7c016deae6
gh-120276: Fix incorrect email.header.Header maxlinelen default (GH-120277) 2024-06-08 20:18:58 +03:00
Erlend E. Aasland 225aab7f70
gh-110383: Improve 'old string formatting' text in tutorial (#120219) 2024-06-07 15:37:18 +02:00
Aditya Borikar 6646a9da26
gh-110383: Clarify "non-integral" wording in pow() docs (#119688) 2024-06-07 11:44:42 +02:00
Hugo van Kemenade 5c115567b1
Add Plausible for docs metrics (#119977)
Co-authored-by: Julien Palard <julien@palard.fr>
2024-06-07 00:38:31 -06: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
Barney Gale 14e1506a6d
GH-119054: Add "Reading directories" section to pathlib docs (#119956)
Add a dedicated subsection for `Path.iterdir()`-related methods,
specifically `iterdir()`, `glob()`, `rglob()` and `walk()`.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-06 23:27:39 +00:00
David Lowry-Duda 5bdc87b885
gh-120178: Documentation typo corrections (#120179) 2024-06-06 14:35:24 -07:00
Jan Kaliszewski f878d46e56
gh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)
The argument to collapse_addresses() is now described as an *iterable*
(rather than *iterator*).
2024-06-06 00:52:40 +03:00
Irit Katriel 5c02ea8bae
gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (#119657) 2024-06-05 11:56:01 +00:00
shurj0 b6b0dcbfc0
gh-120078: Fix struct_time attr typo tm_day -> tm_mday in Doc/library/time.rst (GH-120081) 2024-06-04 19:23:12 -05:00
Irit Katriel 770f3c1ead
gh-114616: Improve docs regarding changes to caches representation in dis (#120033) 2024-06-04 23:00:02 +00:00
Paulo Freitas bf5e1065f4
doc: Mention the missing reflected special methods for all binary operations (GH-119931) 2024-06-04 17:55:11 +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
Jason R. Coombs 4dcd91ceaf
gh-119588: Update docs to reflect decision to include the change with Python 3.13 and not 3.12. (#120043) 2024-06-04 15:20:01 +00:00
Bénédikt Tran ff1857d6ed
gh-120029: export DEF_TYPE_PARAM compiler flag (#120028) 2024-06-04 07:24:22 -07:00
Nikita Sobolev 1d4c2e4a87
gh-119057: Use better error messages for zero division (#119066) 2024-06-03 19:03:56 +03:00
Jason R. Coombs 42a34ddb0b
gh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (#119591) 2024-06-03 11:13:07 -04: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
Awbert cae4c80714
gh-119968: Improved monitoring c-api docs (#119969) 2024-06-03 12:31:02 +03: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
Barney Gale bd6d4ed645
GH-119054: Add "Reading and writing files" section to pathlib docs (#119524)
Add a dedicated subsection for `open()`, `read_text()`, `read_bytes()`,
`write_text()` and `write_bytes()`.
2024-06-02 19:39:19 +00:00
Jelle Zijlstra aa9fe98e06
Improve documentation for typing.get_type_hints (#119928)
- Explicit list of what it does that is different from
  "just return __annotations__"
- Remove reference to PEP 563; adding the future import doesn't
  do anything to type aliases, and in general it will never make
  get_type_hints() less likely to fail.
- Remove example, as the Annotated docs already have a similar
  example, and it's unbalanced to have one example about this
  one edge case but not about other behaviors of the function.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-02 08:13:24 -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
Alyssa Coghlan fd6cd621e0
gh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)
PEP 667's description of the planned changes to PyEval_GetLocals
was internally inconsistent when accepted, so the docs added for
gh-74929 didn't match either the current behaviour or the intended
behaviour once gh-118934 is fixed.

This PR updates the documentation and 3.13 What's New to match the
intended behaviour (once gh-118934 is fixed).

It also tidies up lingering references to `f_locals` always being a
dictionary (this hasn't been true since at least when custom
namespace support for class statement execution was added)
2024-06-02 04:44:29 +00:00