Commit graph

29560 commits

Author SHA1 Message Date
Bénédikt Tran
30dde1eeb3
gh-133579: consistently report C curses function failures (#134327)
Some curses module-level functions and window methods now raise
a `curses.error` when a call to a C curses function fails:

- Module-level functions: assume_default_colors, baudrate, cbreak,
  echo, longname, initscr, nl, raw, termattrs, termname, and unctrl.
- Window methods: addch, addnstr, addstr, border, box, chgat,
  getbkgd, inch, insstr, and insnstr.

In addition, `curses.window.refresh` and `curses.window.noutrefresh`
now raise a `TypeError` instead of a `curses.error` when called with an
incorrect number of arguments for pads.

See also ee36db5500 for similar
changes.
2025-05-27 10:15:16 +00:00
Bénédikt Tran
737b4ba020
gh-134635: add zlib.{adler32,crc32}_combine to combine checksums (#134650) 2025-05-27 10:48:34 +02:00
Shamil
92ea1eb38f
gh-134664: document cleanup_socket parameter in asyncio.start_unix_server (#134750) 2025-05-27 08:23:06 +00:00
neonene
96905bdd27
gh-134160: Use multi-phase init in documentation examples (#134296)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-26 21:43:35 +00:00
Eric V. Smith
08c78e02fa
gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (#134734)
* Add t-string prefixes to _all_string_prefixes, and add a test to make sure we catch this error in the future.

* Update lexical analysis docs for t-string prefixes.
2025-05-26 13:49:39 -04:00
Jelle Zijlstra
7291eaba8b
gh-119180: Updates to PEP 649/749 docs (#134640)
- Mention (again) that `type.__annotations__` is unsafe. It is now safe
  when using only classes defined under PEP 649 semantics, but not with
  classes defined using `from __future__ import annotations`.
- Mention that annotations on instances no longer work. There was already
  an issue about this.
- Mention the general changes in the "Porting to Python 3.14" section.
- `annotationlib` was proposed by PEP-749, not PEP-649.

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-05-26 08:35:04 -07:00
tmlnv
71290a6fbe
gh-134559: Add versionadded for `object.__replace__()` (#134672) 2025-05-26 10:39:04 +01:00
Julien Palard
24a47155d2
Fix sphinx-lint warnings (default-role used). (GH-134647) 2025-05-25 21:22:52 +02:00
Jelle Zijlstra
57fef27cfc
gh-133960: Improve typing.evaluate_forward_ref (#133961)
As explained in #133960, this removes most of the behavior differences with ForwardRef.evaluate.
The remaining difference is about recursive evaluation of forwardrefs; this is practically useful
in cases where an annotation refers to a type alias that itself is string-valued.

This also improves several edge cases that were previously not handled optimally. For example,
the function now takes advantage of the partial evaluation behavior of ForwardRef.evaluate() to
evaluate more ForwardRefs in the FORWARDREF format.

This also fixes #133959 as a side effect, because the buggy behavior in #133959 derives from
evaluate_forward_ref().
2025-05-25 17:26:39 +00:00
Jelle Zijlstra
b51b08a0a5
annotationlib docs: note that ForwardRef.evaluate eventually defaults to empty globals (#134661) 2025-05-25 17:23:28 +00:00
Jasper Wong
7b1010a57d
gh-134595: Update HOWTO to reflect change in CIBW option (#134598) 2025-05-24 10:15:00 +03:00
Eddy Mulyono
80284b5c5e
gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462)
Doc/library/multiprocessing.rst: freeze_support: Change to specify spawn method instead of platform
Have multiprocessing.freeze_support() enable on spawn, not just win32.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-24 03:50:19 +00:00
Steve Dower
99a9ab1c64
Further improves Advanced installation docs for PyManager (GH-134541) 2025-05-23 11:17:18 +01:00
Blaise Pabon
1729468016
gh-106318: Add example for str.count() (#134519) 2025-05-23 12:47:11 +03:00
Blaise Pabon
da9b5c1c9c
gh-106318: Add example for str.center() (#134518) 2025-05-23 12:44:15 +03:00
Cheery
a7ed9dfcbe
Docs: fix link in free-threading-python.rst (#134548) 2025-05-22 20:37:20 -04:00
Thomas Grainger
a3d0306ca0
gh-128307: Update docs for asyncio.create_task, TaskGroup.create_task, asyncio.create_task (#134202) 2025-05-22 15:54:56 -07:00
Josh Cannon
9b292ff022
Avoid __file__ in hashlib example (GH-134540) 2025-05-22 14:32:00 -07:00
Kattni
742d5b5c5d
Docs: Add note to tutorial clarifying scope (#134534)
* Add note to tutorial

* Update formatting
2025-05-22 14:26:47 -04:00
Alex Kautz
bd4046f4f8
gh-134370: Added clarification on instance annotations (#134387)
Instances of classes cannot have annotations,
however sometimes they will erroneously have the
__annotations__ attribute
2025-05-22 06:46:29 -07:00
Hugo van Kemenade
bb244fd33d
Consistent sentence case in docs template files (#134412) 2025-05-22 12:51:02 +03:00
Petr Viktorin
1f0a294e8c
Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-05-22 09:36:37 +02:00
Cody Maloney
e1f891414b
gh-80050: Update BufferedReader.read docs around non-blocking (GH-130653) 2025-05-21 16:06:40 +00:00
Cody Maloney
b529b60fc2
gh-132246: Add special buffer methods to C API Type Object docs (gh-132247)
Two special methods, __buffer__ and __release_buffer__ were added to
Python 3.12 by PEP 688. The C API Type Object documentation for slots
includes `tp_as_buffer`, and sub-slots `bf_getbuffer`, `bf_releasebuffer`
but does not refer to the Python Data Model version of those. Add the
missing references.
2025-05-21 16:21:57 +02:00
Emma Smith
d862b6de1b
gh-132983: Add documentation for compression.zstd (GH-133911)
Add documentation for compression & compression.zstd.

🎉

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Sumana Harihareswara <sh@changeset.nyc>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
2025-05-21 07:18:21 -07:00
Yash Vijay
4eacf3883d
gh-134026: Fix grammar description of for statement (GH-134034) 2025-05-21 16:09:28 +02:00
Petr Viktorin
c7364f79b2
gh-127833: lexical analysis: Improve section on Names (GH-131474)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-21 16:01:52 +02:00
Yuki Kobayashi
15a8b5b9bd
gh-110631: Fix some incorrect indents in the documentation (#129312) 2025-05-21 13:52:02 +00:00
sobolevn
dcfc91e4e5
Fix signature of _curses.assume_default_colors in the docs (#134409) 2025-05-21 15:56:34 +03:00
ivonastojanovic
6856a04d68
Add documentation for remote debugging with pdb (#134260)
* Mention remote debugging via -p PID in usage text

Adds a brief note to the pdb help summary about attaching to a running
process using the -p option, making the remote debugging feature
more visible.

* Mention remote debugging in pdb.rst
2025-05-20 19:50:49 -04:00
tigerding
aadda87b3d
gh-134209: use heap-allocated memory in _curses.window.{instr,getstr} (GH-134283)
* made curses buffer heap allocated instead of stack
* change docs to explicitly mention the max buffer size
* changing GetStr() function to behave similarly too
* Update Doc/library/curses.rst
* Update instr with proper return error handling
* Update Modules/_cursesmodule.c
* change to strlen and better memory safety
* change from const int to Py_ssize_t
* add mem allocation guard
* update versionchanged to mention it was an increase.
* explicitly use versionchanged 3.14 as that is its own branch now.

TESTED: `python -m test -u curses test_curses`

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-20 20:36:04 +00:00
Alex Kautz
36eb711d2f
gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372)
Added a clarification that the underlying binary buffer of a TextIOBase can be a BufferedIOBase OR a RawIOBase
2025-05-20 18:18:58 +00:00
Kumar Aditya
b430e92dd8
gh-127945: Update What's New in Python 3.14 for free-threaded ctypes (#134332) 2025-05-20 22:27:23 +05:30
Kumar Aditya
0584533dc7
gh-128002: add what's new docs for asyncio (#134324) 2025-05-20 22:11:58 +05:30
Stan Ulbrych
86397cf65d
gh-76075: Correct datetime.timestamp documentation (#131202)
* Clean up timestamp docs

* Update datetime.rst

* Suggestion
2025-05-20 12:18:53 -04:00
Yuki Kobayashi
f3acbb72ff
gh-101100: Fix Sphinx warnings in library/decimal.rst (#134303) 2025-05-20 17:46:13 +03:00
Richard Hansen
3246ea514d
gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962)
* Add "cyclic isolate" to the glossary.
  * Add a new "Object Life Cycle" page.
  * Improve docs for related API, with special focus on cross-references and warnings

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-20 14:25:50 +02:00
Serhiy Storchaka
a31bbc951a
gh-53189: Document peculiarities of InteractiveConsole in relation to pickle (GH-123069)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-05-20 14:08:40 +02:00
Guido van Rossum
28625d4f95
gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio (#134304)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-20 14:11:22 +05:30
Alek Binion
66aaad6103
gh-134201: Expand explanation of Base85 encodings in base64 docs (#134288)
Explain history of de-facto standard and how to pick between the two Base-85 encoding functions in the base-64 module.

---------

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-05-19 18:59:06 -05:00
Sahil Shah
92f85ff3a0
gh-80184: Set getattr(socket, "SOMAXCONN", 5) as the default queue size for TCPServer (GH-134249)
socketserver.TCPServer default queue size becomes SOMAXCONN instead of 5 when possible.
2025-05-19 19:28:09 +00:00
Duprat
de70614c13
gh-132795: Add docs for multiprocessing.Semaphore.locked (#133299) 2025-05-19 20:06:09 +05:30
Serhiy Storchaka
44b73d3cd4
gh-122055: Clarify documentation for empty matches in RE (GH-133169) 2025-05-19 15:27:50 +02:00
Steve Dower
986c367028
gh-133779: Revert Windows generation of pyconfig.h and go back to a static header. (GH-133966)
Extension builders must specify Py_GIL_DISABLED if they want to link to the free-threaded builds.
This was usually the case already, but this change guarantees it in all circumstances.
2025-05-19 11:35:22 +01:00
Bénédikt Tran
d6dc33ed80
gh-134087: enforce signature of threading.RLock (#134178)
- Reject positional and keyword arguments in `_thread.RLock.__new__`.
- Convert `_thread.lock.__new__` to AC.
2025-05-19 11:26:14 +02:00
da-woods
bb32f3c698
document Py_VISIT as a macro in the docs (#133688) 2025-05-18 21:58:43 +05:30
Dave Jagoda
a1e2e6ca91
Fix example in Doc/howto/functional.rst (#133978) 2025-05-18 21:56:17 +05:30
Yongzi Li
4ce91871a9
fix indent in controlflow.rst docs (#134008) 2025-05-18 21:51:02 +05:30
Stan Ulbrych
b1c33294ca
gh-134114: Clarify FAQ note about dictonary keys (#134118) 2025-05-18 15:59:20 +00:00
Micha Albert
fa4e088668
gh-134150: Clarify distinction between JSON and Python objects (#134154)
* gh-134150: Clarify distinction between JSON objects and Python objects in json module docs

* Revert change to JSON introduction

* Clarify occurrences of "object literal" as JSON
2025-05-17 21:47:37 -04:00