Commit graph

29276 commits

Author SHA1 Message Date
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
Alex Waygood
42e3a8410b
gh-132139: 3.14 what's new: elaborate on why you can no longer set Union attributes (#132157) 2025-04-06 17:51:05 +02:00
Jelle Zijlstra
dbfc6a417a
gh-132139: Document that you can no longer set attributes on unions (#132146) 2025-04-06 13:43:09 +01:00
Rafael Fontenelle
376631829a
Fix numbered list syntax in programming.rst (#130158) 2025-04-05 20:20:21 +01:00
Adam Turner
561965fa5c
Generate social media preview cards for the documentation (#132101)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2025-04-05 14:20:06 +00: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
7473c600a5
gh-131933: Document UnionType/Union merger in What's New (#131941)
Co-authored-by: Alex Waygood
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-04 11:15:31 -07:00
Bénédikt Tran
0a97427ee5
gh-99108: Implement HACL* HMAC (#130157)
A new extension module, `_hmac`, now exposes the HACL* HMAC (formally verified) implementation.

The HACL* implementation is used as a fallback implementation when the OpenSSL implementation of HMAC
is not available or disabled. For now, only named hash algorithms are recognized and SIMD support provided
by HACL* for the BLAKE2 hash functions is not yet used.
2025-04-04 19:04:00 +02: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
Donghee Na
25275bda79
gh-131544: Update docs for PyType_AddWatcher (gh-132015) 2025-04-02 15:04:07 +00:00
Pablo Galindo Salgado
c2ac662f28
gh-131831: Implement PEP 758 – Allow except and except* expressions without parentheses (#131833) 2025-04-01 19:04:56 +00: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
Rafael Fontenelle
23a658b9af
Minor improvements to the programming FAQ (#127261)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-01 08:19:06 +01:00
Sergey B Kirpichev
2505573f20
gh-121249: Note struct module changes in What's New (#131867)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-01 07:16:36 +00: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
Malcolm Smith
fe5c4c53e7
gh-131531: Add android.py package command (#131532)
Adds a `package` entry point to the `android.py` build script to support
creating an Android distribution artefact.
2025-04-01 08:46:29 +08: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
Idan Noiman
b9ca438daa
gh-131741: Add documentation for Windows version detection change in platform (#131742)
Document the behavior change between 3.11 & 3.12, where ``platform`` now correctly detects Windows 11 and Windows Server releases past Windows Server 2012.

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: Wulian <1055917385@qq.com>
2025-03-26 14:50:37 +00:00
Ralf Gommers
ac12de2e6a
document that sys._is_gil_enabled is CPython-specific (#131748) 2025-03-26 17:32:52 +05:30
Bénédikt Tran
1d6a2e6481
gh-111178: fix UBSan for example code in extending/newtypes_tutorial docs (GH-131606)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-03-24 17:15:32 +01:00
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
Petr Viktorin
0e53038ea8
gh-128715: Expose ctypes.CField, with info attributes (GH-128950)
- Restore max field size to sys.maxsize, as in Python 3.13 & below
- PyCField: Split out bit/byte sizes/offsets.
- Expose CField's size/offset data to Python code
- Add generic checks for all the test structs/unions, using the newly exposed attrs
2025-03-24 14:18:34 +01:00
Petr Viktorin
01ea4c77e5
gh-123909: Remove obsolete note in PyType_FromMetaclass docs (GH-131506)
Docs of the other `PyType_From*` functions link to `PyType_FromMetaclass`,
which noted that they differ for backwards compatibility reasons.
The note is no longer relevant in 3.14.
The other functions have `versionchanged` blurbs.
2025-03-24 13:06:21 +01:00
Zsolt Dollenstein
5fc889ffbf
no-issue: Fix typo in importlib.metadata.rst (gh-131596) 2025-03-23 23:01:29 +09:00
Kanishk Pachauri
fd459b1153
gh-130283: update deprecated links and examples in urllib.request docs (#130284)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-23 13:29:29 +00:00
Sebb
557d2d20d4
gh-121529: Document from_ parameter in _mboxMMDF public methods (#121530) 2025-03-23 13:10:47 +01:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
8b7d20d3a9
gh-131457: Fix typo in BNF description of function signatures (#131460) 2025-03-22 10:54:48 +03:00
AN Long
00a9844888
gh-131453: Add additional constants to winsound module (GH-131454) 2025-03-20 16:35:52 +00:00
Adam Turner
443c0cd17c
gh-127833: Use productionlist nodes to implement the grammar-snippet directive (#130376)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-03-20 15:35:20 +00:00
Peter Bierma
86d5fa95cf
gh-127989: C API: Refer to "attached thread states" instead of the GIL (GH-127990)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-20 13:06:59 +01:00
Barney Gale
f141e8ec2a
GH-123599: Deprecate duplicate pathname2url() implementation (#127380)
Call `urllib.request.pathname2url()` from `pathlib.Path.as_uri()`, and
deprecate the duplicate implementation in `PurePath`.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-20 00:54:36 +00:00
Barney Gale
8abfaba5a6
GH-125866: Deprecate nturl2path module (#131432)
Deprecate the `nturl2path` module. Its functionality is merged into
`urllib.request`.

Add `tests.test_nturl2path` to exercise `nturl2path`, as it's no longer
covered by `test_urllib`.
2025-03-19 19:33:01 +00:00
Steve Dower
63a638c43f
gh-91349: Replace zlib with zlib-ng in Windows build (GH-131438) 2025-03-19 19:03:25 +00:00
Adam Turner
c1a02f9101
GH-121970: Extract pydoc_topics into a new extension (#131256) 2025-03-19 18:35:11 +00:00
Cody Maloney
a4832f6b9a
gh-131117: Update tp_finalize example to use PyErr_GetRaisedException (#131118)
The tp_finalize C API doc used PyErr_Fetch() and PyErr_Restore() in
its example code. That API was deprecated in 3.12.

Update to point to the suggested replacement function
PyErr_GetRaisedException() which has a sample usage.
2025-03-19 18:27:55 +01:00
R. David Murray
6146295a5b
gh-90548: Make musl test skips smarter (fixes Alpine errors) (#131313)
* Make musl test skips smarter (fixes Alpine errors)

A relatively small number of tests fail when the underlying c library is
provided by musl.  This was originally reported in bpo-46390 by
Christian Heimes.  Among other changes, these tests were marked for
skipping in gh-31947/ef1327e3 as part of bpo-40280 (emscripten support),
but the skips were conditioned on the *platform* being emscripten (or
wasi, skips for which ere added in 9b50585e02).

In gh-131071 Victor Stinner added a linked_to_musl function to enable
skipping a test in test_math that fails under musl, like it does on a
number of other platforms.  This check can successfully detect that
python is running under musl on Alpine, which was the original problem
report in bpo-46390.

This PR replaces Victor's solution with an enhancement to
platform.libc_ver that does the check more cheaply, and also gets the
version number.  The latter is important because the math test being
skipped is due to a bug in musl that has been fixed, but as of this
checkin date has not yet been released.  When it is, the test skip can
be fixed to check for the minimum needed version.

The enhanced version of linked_to_musl is also used to do the skips of
the other tests that generically fail under musl, as opposed to
emscripten or wasi only failures.  This will allow these tests to be
skipped automatically on Alpine.

This PR does *not* enhance libc_ver to support emscripten and wasi, as
I'm not familiar with those platforms; instead it returns a version
triple of (0, 0, 0) for those platforms.  This means the musl tests will
be skipped regardless of musl version, so ideally someone will add
support to libc_ver for these platforms.

* Platform tests and bug fixes.

In adding tests for the new platform code I found a bug in the old code:
if a valid version is passed for version and it is greater than the
version found for an so *and* there is no glibc version, then the
version from the argument was returned.  The code changes here fix
that.

* Add support docs, including for some preexisting is_xxx's.

* Add news item about libc_ver enhancement.

* Prettify platform re expression using re.VERBOSE.
2025-03-19 13:05:09 -04:00
Petr Viktorin
4bced29a74
gh-130587: Add hand-written docs for non-OP tokens (GH-130588)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-03-19 16:42:11 +01:00
Yuki Kobayashi
a0478c9f0c
Docs: Fix documentation for "PyTypeObject Definition" (GH-130936)
The structure definition for `PyTypeObject` is in `Include/cpython/object.h`,
not in `Include/object.h`.
2025-03-19 14:46:32 +01:00
Andrew Svetlov
61b4b2c57c
gh-131417: Mention asyncio Future and Task in docs for generic classes list (#131422)
Mention asyncio Future and Task in docs for generic classes list
2025-03-19 10:05:23 +01:00