Commit graph

13880 commits

Author SHA1 Message Date
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
Serhiy Storchaka
1d97488c95
gh-132099: Fix documentation for the BTPROTO_HCI protocol (GH-132118) 2025-04-13 18:39:22 +03:00
Case Zumbrum
00cf5eacc5
gh-129169: update asyncio.ensure_future docs to suggest taskgroups
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-04-13 07:59:22 +00:00
Charles Machalow
5863cd70b8
gh-132106: Ensure that running logging.handlers.QueueListener cannot be started again (GH-132444)
Prevents a thread leak
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-13 08:53:13 +01:00
Felix Scherz
64b066ad29
gh-132354: document return value for asyncio.Task.cancel (#132374) 2025-04-13 13:05:44 +05:30
Charles Machalow
517e96b9ed
gh-132106: Allow logging.handlers.QueueListener to be used as a context manager (#132107) 2025-04-12 12:00:04 +00:00
Stan Ulbrych
ad3bbe8fbc
gh-123441: Update Belorussian spelling (GH-132409) 2025-04-12 13:36:01 +03:00
Kumar Aditya
05d27a84f4
gh-130322: drop deprecation of asyncio.set_event_loop (#132349) 2025-04-12 12:03:52 +05:30
Serhiy Storchaka
e5f8b2c703
gh-85302: Add support for BTPROTO_SCO on FreeBSD (GH-131981)
BTPROTO_SCO has been supported on FreeBSD since 2008.
2025-04-11 19:38:17 +03:00
Jelle Zijlstra
07b8d3117f
gh-132261: Store annotations at hidden internal keys in the class dict (#132345) 2025-04-10 21:13:26 -07:00
Barney Gale
66cdb2bd8a
GH-123599: url2pathname(): handle authority section in file URL (#126844)
In `urllib.request.url2pathname()`, if the authority resolves to the
current host, discard it. If an authority is present but resolves somewhere
else, then on Windows we return a UNC path (as before), and on other
platforms we raise `URLError`.

Affects `pathlib.Path.from_uri()` in the same way.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-10 19:58:04 +00:00
Serhiy Storchaka
1557da622c
gh-106482: Clarify documentation of character set in RE (#106517)
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-10 16:41:41 +03:00
Liam DeVoe
4a88bbacb3
Docs: Add a missing trailing full stop (#130561) 2025-04-10 14:51:20 +03:00
180909
65357032e8
gh-72631: Fix wrong documentation for GzipFile.peek (#29820)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-04-10 14:21:32 +03:00
Jo
5f1aed1c7e
docs: Fix typo in context_aware_warnings flag (#132340) 2025-04-10 05:19:01 +01:00
Neil Schemenauer
d687900f98
gh-128384: Use a context variable for warnings.catch_warnings (gh-130010)
Make `warnings.catch_warnings()` use a context variable for holding
the warning filtering state if the `sys.flags.context_aware_warnings`
flag is set to true.  This makes using the context manager thread-safe in
multi-threaded programs.

Add the `sys.flags.thread_inherit_context` flag.  If true, starting a new
thread with `threading.Thread` will use a copy of the context
from the caller of `Thread.start()`.

Both these flags are set to true by default for the free-threaded build
and false for the default build.

Move the Python implementation of warnings.py into _py_warnings.py.

Make _contextvars a builtin module.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-04-09 16:18:54 -07:00
Tian Gao
efd8aca62c
gh-106670: Fix a typo in doc of pdb's exceptions command (#132277) 2025-04-08 12:19:16 -04:00
Hugo van Kemenade
29af6cee02 Python 3.14.0a7 2025-04-08 14:20:51 +03:00
Bénédikt Tran
3eda146035
gh-74598: add fnmatch.filterfalse for excluding names matching a patern (#121185) 2025-04-08 10:11:25 +00:00
David Brochart
297e05932d
Fixed a typo in the documentation (#132005) 2025-04-08 11:43:11 +03:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
403886c28d
gh-132021: Add bool type to the list of allowed JSON key types (#132048)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-04-08 11:25:46 +03:00
sobolevn
f7305a06c7
gh-115942: Add locked to several multiprocessing locks (#115944)
Co-authored-by: mpage <mpage@cs.stanford.edu>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-08 11:14:12 +03:00
Bénédikt Tran
fd1b98dd1d
gh-130843: add UUIDv7 timestamp recipes (#132154)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-07 17:21:56 +02:00
sobolevn
8b62374b34
gh-132221: Fix __match_args__ generation docs in dataclasses.rst (#132222) 2025-04-07 17:46:47 +03:00
Prometheus3375
316974382a
gh-131912: Use different grouping options for the integral and fractional parts (#132170) 2025-04-07 14:02:49 +02:00
Sergey B Kirpichev
6eaa4aeef2
Docs: Add a single table summary for `cmath` (#131887)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-04-07 00:36:21 +01:00
Brian Schubert
e2476398ee
gh-132168: Add __class_getitem__ to ctypes.py_object (#132169) 2025-04-06 22:05:19 +01:00
Emma Smith
0788948dcb
gh-84481: Add ZipFile.data_offset attribute (#132165)
* Add ZipFile.data_offset attribute

This attribute provides the offset to zip data from the start of the file, when available.

* Add blurb-it

* Try fixing class ref in NEWS
2025-04-06 13:51:42 -07:00
Semyon Moroz
37bc3865c8
gh-85162: Add HTTPSServer to http.server to serve files over HTTPS (#129607)
The `http.server` module now supports serving over HTTPS using the `http.server.HTTPSServer` class.
This functionality is also exposed by the command-line interface (`python -m http.server`) through the
`--tls-cert`, `--tls-key` and `--tls-password-file` options.
2025-04-05 08:49:48 +00:00
Yuki Kobayashi
99e9798d61
Docs: document plistlib.InvalidFileException (#132069) 2025-04-05 08:46:17 +00:00
Prometheus3375
06a110f522
gh-131912: Improve description of grouping options in the format specification docs (#132030)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-05 10:28:50 +02:00
Jelle Zijlstra
ac14d4a23f
gh-129463, gh-128593: Simplify ForwardRef (#129465) 2025-04-05 04:36:34 +00:00
Jelle Zijlstra
5518c2ae09
gh-128661: Remove DeprecationWarning in evaluate_forward_ref (#128930)
It doesn't make sense to use a deprecation for evaluate_forward_ref,
as it is a new function in Python 3.14 and doesn't have compatibility
guarantees.

I considered making it throw an error if type_params it not passed and
there is no owner. However, I think this is too unfriendly for users. The
case where this param is really needed is fairly esoteric and I don't think
this case is worth the pain of forcing users to write "type_params=()".
2025-04-03 09:52:17 -07:00
Pablo Galindo Salgado
943cc1431e
gh-131591: Implement PEP 768 (#131937)
Co-authored-by: Ivona Stojanovic <stojanovic.i@hotmail.com>
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
2025-04-03 16:20:01 +01:00
Tian Gao
6bd9689426
gh-60115: Support frozen modules for linecache.getline() (#131638) 2025-04-02 19:50:01 -04:00
mpage
053c285f6b
gh-130704: Strength reduce LOAD_FAST{_LOAD_FAST} (#130708)
Optimize `LOAD_FAST` opcodes into faster versions that load borrowed references onto the operand stack when we can prove that the lifetime of the local outlives the lifetime of the temporary that is loaded onto the stack.
2025-04-01 10:18:42 -07:00
Sergey B Kirpichev
0a3eb8855c
gh-125957: sync argument naming in sphinx docs of the cmath and help() (#125958)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-01 08:16:11 +01:00
Bénédikt Tran
ba11f45dd9
gh-130843: expose 48-bit timestamp for UUIDv7 (#131838) 2025-03-31 14:32:54 +02:00
Adam Dangoor
edfbd8c062
gh-131885: Document that dict.setdefault and dict.get take no keyword arguments (#128208) 2025-03-30 09:22:57 +00:00
Alexander Ershov
044a1e13d5
gh-129994: update docs when using dualstack_ipv6 in socket.create_server (#129996) 2025-03-30 08:19:36 +00:00
Totosuki
a5949986d6
gh-127541: Update os.walk example (GH-127765)
Update os.walk example to be more modern, skip `__pycache__` dirs rather than `CVS` dirs.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-28 23:25:13 -07:00
Simon Legner
52b5eb95b7
gh-131236: allow to generate multiple UUIDs at once via CLI (#131218)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-26 22:49:28 +02:00
Ralf Gommers
ac12de2e6a
document that sys._is_gil_enabled is CPython-specific (#131748) 2025-03-26 17:32:52 +05:30
David Lowry-Duda
d2d886215c
gh-115684: Clarify datetime replace documentation (#116519)
* Clarify datetime `replace` documentation

In #115684, HopedForLuck noted that `datetime.date.replace()`
documentation was confusing because it looked like it would be changing
immutable objects.

This documentation change specifies that the `replace()` methods in
`datetime` return new objects. This uses similar wording to the
documentation for `datetime.combine()`, which specifies that a new
datetime is returned. This is also similar to wording for
`string.replace()`, except `string.replace()` emphasizes that a "copy"
is returned.

Resolves #115684.

* Include reviewer comments

Thanks Privat33r-dev for the comments!

---------

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2025-03-24 11:33:16 -04:00