Commit graph

14096 commits

Author SHA1 Message Date
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
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