Commit Graph

13923 Commits

Author SHA1 Message Date
Rafael Fontenelle 2b67db7ce3
Apply 'mod' role to typing module (#133201)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-30 16:52:03 +00:00
dgpb a4b7128301
gh-89867: string.Formatter auto numbering doc updates (GH-129617) 2025-04-30 14:24:40 +02:00
Lysandros Nikolaou 60202609a2
gh-132661: Implement PEP 750 (#132662)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wingy <git@wingysam.xyz>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Paul Everitt <pauleveritt@me.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-30 11:46:41 +02:00
Inada Naoki 4e294f6feb
gh-133036: Deprecate codecs.open (#133038)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-30 10:11:09 +09:00
Tian Gao caee16f052
gh-121468: Support async breakpoint in pdb (#132576) 2025-04-29 12:28:24 -04:00
Semyon Moroz 0f84f6b334
gh-132726: Change the heading of `sysconfig` CLI section (#133035) 2025-04-28 17:44:49 +03:00
Hugo van Kemenade ee9102a535
gh-75223: Deprecate undotted extensions in `mimetypes.MimeTypes.add_type` (#128638)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2025-04-28 14:23:57 +00:00
Petr Viktorin 4ebbfcf30e
gh-87135: Raise PythonFinalizationError when joining a blocked daemon thread (gh-130402)
If `Py_IsFinalizing()` is true, non-daemon threads (other than the current one)
are done, and daemon threads are prevented from running, so they
cannot finalize themselves and become done. Joining them (without timeout)
would block forever.

Raise PythonFinalizationError instead of hanging.

Raise even when a timeout is given, for consistency with trying to join your own thread.

See gh-123940 for a use case: calling `join()` from `__del__`. This is
ill-advised, but an exception should at least make it easier to diagnose.
2025-04-28 15:48:48 +02:00
Sergey B Kirpichev 5bf0f3666e
gh-53032: support IEEE 754 contexts in the decimal module (#122003)
This was in C version from beginning, but available only
on conditional compilation (EXTRA_FUNCTIONALITY).  Current
patch adds function to create IEEE contexts to the
pure-python module as well.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-28 15:05:56 +02:00
Yuki Kobayashi 4e04511cb9
gh-133033: Add docs for `TypeIgnore` (#133034)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-04-28 13:49:07 +03:00
Yongzi Li cd76eff26e
Docs: fix a couple typos in `Doc/` (GH-132927)
fix minor typos
2025-04-27 15:56:58 -07:00
Bénédikt Tran 24436629ef
gh-127604: ensure `-ldl` is passed to the linker when `dladdr1` is found (#133040) 2025-04-28 00:28:42 +02:00
Michał Górny 019ee49d50
gh-133005: Support `tarfile.open(mode="w|xz", preset=...)` (GH-133007)
* gh-133005: Support `tarfile.open(mode="w|xz", preset=...)`

Support passing the `preset` option to `tarfile.open` when the file
is open with `mode="w|xz"`.  This aligns the behavior with `"w:xz"`
mode.

* Also raise an error for `compresslevel` or `preset` with wrong mode

Raise an error if `compresslevel` or `preset` argument is specified
for stream mode with incorrect compression. This should reduce the risk
of mistakes and align the stream modes with regular modes, that raise
an implicit TypeError on unsupported arguments.

* Apply suggestions from code review

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-04-27 22:19:59 +00:00
Alyssa Ross 314f4b9716
gh-132991: Add socket.IP_FREEBIND constant (GH-132998) 2025-04-26 20:54:12 +03:00
Ronald Oussoren 25e49841e3
gh-113539: Enable using ``$BROWSER`` to reorder default seach order in webbrowser.py (#113561)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-25 14:36:18 +03:00
Ruben Vorderman b1fc8b69ec
gh-98347: Add links to python-isal in the documentation (#98637)
Clearly note that this is primarily intended for users for who zlib/gzip is a bottleneck.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-25 01:53:23 +00:00
Brett Cannon 15ff60aff0
Differentiate bitwise OR from the word "or" (#132890) 2025-04-24 23:05:02 +01:00
RUANG (James Roy) 8e18a9dce2
gh-127385: Add F_DUPFD_QUERY to fcntl (GH-127386) 2025-04-25 00:06:42 +03:00
Serhiy Storchaka 9f5994b94c
gh-132742: Refactor fcntl.fcntl() and fcntl.ioctl() (GH-132768)
* Support arbitrary bytes-like objects, not only bytes, in fcntl().
* The fcntl() buffer argument is now null-terminated.
* Automatically retry an ioctl() system calls failing with EINTR.
* Release the GIL for an ioctl() system call even for large bytes-like object.
* Do not silence arbitrary errors whet try to get a buffer.
* Optimize argument parsing, check the argument type before trying to get
  a buffer or convert it to integer.
* Fix some error messages.
2025-04-24 19:17:11 +03:00
Sergey B Kirpichev 8047e50cb7
gh-128185: Align Decimal docs with spec (case irrelevant for nan/inf) (#128323) 2025-04-24 17:02:49 +03:00
Jordi Burguet-Castell 1583f9cdd4
gh-122399: change webbrowser.rst to better describe the contents of controller object (#122407)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-24 16:56:52 +03:00
Sergey B Kirpichev 85f89cb3e6
gh-121249: adjust formatting codes for complex types in struct/ctypes (#132827)
* F - for float _Complex
* D - for double _Complex
* G - for long double _Complex (not supported by the struct module)
2025-04-23 15:38:24 +02:00
Serhiy Storchaka 5f50541ebd
gh-132742: Update documentation for the fcntl module (GH-132765) 2025-04-23 14:27:21 +03:00
pulkin 77605fa3bb
gh-131913: multiprocessing: add interrupt for POSIX (GH-132453)
* multiprocessing: interrupt

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-22 23:55:24 -07:00
Serhiy Storchaka e84624450d
gh-132734: Add new constants for Bluetooth sockets (GH-132735) 2025-04-22 11:02:13 +00:00
Sebastian Rittau 2b47f46d7d
gh-122179: Fix hashlib.file_digest and non-blocking I/O (GH-122183)
* Fix hashlib.file_digest and non-blocking I/O
* Add documentation around this behavior
* Add versionchanged
2025-04-21 14:15:05 -07:00
Peter Bierma 8dfa840773
gh-127604: Add C stack dumps to `faulthandler` (#128159) 2025-04-21 20:48:02 +01:00
Adam Turner fee808936f
gh-85583: Add an overview of formatted string literals (f-strings) to ``str`` (#132689) 2025-04-21 07:49:06 +00:00
Stan Ulbrych a16586c9e7
gh-129327: revise hashlib documentation to account for FIPS removing sha1 (GH-132729)
* gh-129327: revise hashlib documentation to account for FIPS removing sha1

More generally, the current documentation is a bit scattered, talking
about what terms are "equal" despite those terms not being very
interesting and given the term "secure hash", probably wrong (because
md5 and sha1 are not secure anymore).

Let's talk about cryptographically secure instead, and note that two of
them aren't. And then we can also link to the source for NIST going
through the removal process for SHA1.

* Add Gregors Suggestion

* Clean up

---------

Co-authored-by: Eli Schwartz <eschwartz@gentoo.org>
2025-04-20 01:06:24 +00:00
Stan Ulbrych e154e4db36
Docs: Fix REPL example in `Doc/library/shutil.rst` (#132700) 2025-04-19 16:15:00 +02:00
Jeroen Bogers ce31ae5209
gh-129719: Restore missing `socket.CAN_RAW_ERR_FILTER` on Linux (#129721)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-04-18 22:59:37 +03:00
Raymond Hettinger 741c6386b8
Minor doc edit: Make multinomial() the first math example (gh-132697) 2025-04-18 12:41:13 -05:00
Yuki Kobayashi 7e2672cfcf
gh-132668: Remove outdated description of `POP_JUMP_*` instructions (#132669) 2025-04-18 14:08:50 +02:00
Tan90909090 f5512a2498
gh-132608: Fix a sample code coloring for ast.While (#132609)
Add missing '>' in prompt.
2025-04-16 19:23:13 +00:00
Jelle Zijlstra 14efcadfd4
typing docs: Clarify Protocol / runtime_checkable docs (#132606)
- Explicitly say that isinstance/issubclass do not work on non-runtime checkable
  protocols.
- Move the sentence "This raises TypeError when applied to a non-protocol class". It
  took me quite some time to decide what "this" was here: it refers to applying the
  decorator, not to an isinstance() call.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-04-16 17:44:17 +00:00
Serhiy Storchaka 8cb177d09b
gh-132099: Accept an integer as the address for BTPROTO_HCI on Linux (GH-132525)
Previously only an integer packed in a tuple was accepted, while
getsockname() could return a raw integer.
Now the result of getsockname() is always acceptable as an address.
2025-04-16 13:02:51 +03:00
Jelle Zijlstra 11f6603845
gh-132491: Rename annotationlib.value_to_string to type_repr (#132492) 2025-04-15 20:10:53 +00:00
Raymond Hettinger 818b6a9ead
Fix argument order in multinomial() example (gh-132557) 2025-04-15 11:50:52 -05:00
Barney Gale 0879ebc953
GH-123599: Match `file:` URL hostname against machine hostname in urllib (#132523)
In `_is_local_authority()`, return early if the authority matches the
machine hostname from `socket.gethostname()`, rather than resolving the
names and matching IP addresses.
2025-04-15 01:05:06 +01:00
Serhiy Storchaka 61638418a7
gh-70145: Add support for channels in Bluetooth HCI protocol (GH-132481) 2025-04-14 20:09:16 +03:00
Semyon Moroz bd47ec954d
gh-131885: Document `/` for `codecs` functions (#131992) 2025-04-14 18:55:29 +02:00
Jeremy Fleischman 939476bbbb
gh-131803: Clarify that you must register signal handlers for set_wakeup_fd (#131859) 2025-04-14 18:46:11 +02:00
Yongzi Li 4865c09cf3
Docs: fix some typos in `Doc/library` (#132511) 2025-04-14 13:24:46 +00:00
Serhiy Storchaka 1fc1df8dcc
gh-132099: Harmonize Bluetooth address handling (GH-132486)
Now all protocols always accept the Bluetooth address as string and
getsockname() always returns the Bluetooth address as string.

* BTPROTO_SCO now accepts not only bytes, but str.
* BTPROTO_SCO now checks address for embedded null.
* On *BSD, BTPROTO_HCI now accepts str instead of bytes.
* On FreeBSD, getsockname() for BTPROTO_HCI now returns str instead of bytes.
* On NetBSD and DragonFly BDS, BTPROTO_HCI now checks address for embedded null.
2025-04-14 08:58:56 +03:00
Barney Gale ccad61e35d
GH-125866: Support complete "file:" URLs in urllib (#132378)
Add optional *add_scheme* argument to `urllib.request.pathname2url()`; when
set to true, a complete URL is returned. Likewise add optional
*require_scheme* argument to `url2pathname()`; when set to true, a complete
URL is accepted.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-14 01:49:02 +01:00
Jelle Zijlstra 4d3ad0467e
gh-132064: Make annotationlib use __annotate__ if only it is present (#132195) 2025-04-13 16:32:44 -07:00
Robin Jadoul 2666a06d33
GH-115322: Add missing audit hooks (GH-115624)
Add extra audit hooks to catch C function calling from ctypes,
reading/writing files through readline and executing external
programs through _posixsubprocess.

* Make audit-tests for open pass when readline.append_history_file is unavailable
* Less direct testing of _posixsubprocess for audit hooks
* Also remove the audit hook from call_cdeclfunction now that _ctypes_callproc does it instead.
* reword the NEWS entry.
* mention readline in NEWS
* add versionchanged markers
* fix audit_events.rst versionadded
* doc lint

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-04-13 21:46:20 +00:00
Kumar Aditya ce753517a8
gh-86513: improve docs of loop.call_exception_handler (#132466) 2025-04-13 21:39:24 +00:00
Yuki Kobayashi fc7e4e7bbd
gh-101100: Fix sphinx warnings in `library/plistlib.rst` (#132422) 2025-04-13 18:35:26 +00:00
Tapeline 281fc338fd
gh-132111: Document dataclasses.InitVar (#132446) 2025-04-13 12:47:44 -04:00