Commit graph

982 commits

Author SHA1 Message Date
Hugo van Kemenade
b092705907 Python 3.14.0b1 2025-05-06 18:33:52 +03:00
Serhiy Storchaka
ac56f8cc8d
gh-133306: Support \z as a synonym for \Z in regular expressions (GH-133314)
\Z was an error inherited from PCRE 0.95. It was fixed in PCRE 2.0.
In other engines, \Z means not “anchor at string end”, but
“anchor before optional newline at string end”.

\z means “anchor at string end” in most RE engines.
2025-05-03 07:54:33 +00:00
Yongzi Li
cd76eff26e
Docs: fix a couple typos in Doc/ (GH-132927)
fix minor typos
2025-04-27 15:56:58 -07:00
Stan Ulbrych
08e331d05e
PR 132638 typo fix (#132785)
Update remote_debugging.rst
2025-04-21 20:33:19 +00:00
ivonastojanovic
2b1dac6039
gh-131591: Add remote debugging attachment protocol documentation (#132638)
Add a developer-facing document describing the protocol used by
remote_exec(pid, script) to execute Python code in a running process.
This is intended to guide debugger and tool authors in reimplementing
the protocol.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2025-04-21 20:18:24 +00:00
Pablo Galindo Salgado
d134bd272f
gh-130861: Add clarification to the perf docs on optimization levels (#131098) 2025-04-18 14:42:20 +01:00
Neil Schemenauer
c6973eea13
Add Doc section in free-threaded extension howto for critical sections (GH-132531) 2025-04-16 12:43:01 -07:00
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
Jiayu Yi
5fbe23ee4e
Fix example code in curses tutorial (#126446) 2025-04-10 15:06:38 +03: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
stratakis
ecdf6b15b0
gh-118518: Minor improvements to perf docs (#130866)
Minor improvements to perf docs
2025-03-10 21:51:21 +00:00
Vinay Sajip
8cbcf51d61
[doc]: Update logging cookbook to mention domain socket configuration in a recipe. (GH-130348) 2025-02-20 14:09:15 +00:00
Serhiy Storchaka
078ab828b9
Use roles :data: and :const: for referencing module variables (GH-129507) 2025-02-04 16:16:41 +02:00
smelnikov
da310d209a
Docs: fix typo in Doc/howto/mro.rst (GH-129095) 2025-01-21 10:22:13 +01:00
Nathan Goldbaum
e7adeecc2b
gh-128426: Mention PySequence_Fast in free-threading C API HOWTO (#128428) 2025-01-03 13:10:24 +05:30
Alyssa Coghlan
831b6de6d7
gh-126180: Remove getopt and optparse deprecation notices (GH-126227)
* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-23 14:17:19 +10:00
Maciej Olko
657d0e99aa
[Docs] GDB howto: Fix block type of a cast example (#127621) 2024-12-05 22:52:58 +02:00
Neil Schemenauer
fc5a0dc224
gh-127271: Replace use of PyCell_GET/SET (gh-127272)
* Replace uses of `PyCell_GET` and `PyCell_SET`.  These macros are not
  safe to use in the free-threaded build.  Use `PyCell_GetRef()` and
  `PyCell_SetTakeRef()` instead. 

* Since `PyCell_GetRef()` returns a strong rather than borrowed ref, some
  code restructuring was required, e.g. `frame_get_var()` returns a strong
  ref now.

* Add critical sections to `PyCell_GET` and `PyCell_SET`.

* Move critical_section.h earlier in the Python.h file.

* Add `PyCell_GET` to the free-threading howto table of APIs that return
  borrowed refs.

* Add additional unit tests for free-threading.
2024-12-03 10:33:06 -08:00
Alexander Stepchenko
8c3fd1f245
docs(logging): fix phrasing from "operation on" to "operate on" (#127543) 2024-12-03 12:22:12 +05:30
Yuki Kobayashi
733fe59206
gh-101100: Fix sphinx warnings in howto/* (#127084) 2024-11-26 10:17:54 +02:00
Gregory P. Smith
1fe67df8e3
gh-48020: [docs] Remove the logging howto suggested future FileHandler multiprocessing support (GH-126531)
Docs: Remove the logging howto potential promise of multiprocessing support in the future.

Stick to the facts and suggestions, don't provide hope where we're not going to
implement complexity that we'd rather the user implement themselves when
needed.
2024-11-07 01:57:01 -08:00
Savannah Ostrowski
dbcc5ac470
gh-95836: Add custom type converter examples to argparse tutorial (GH-125376) 2024-10-17 14:41:22 +03:00
Savannah Ostrowski
37228bd16e
GH-124478: Cleanup argparse documentation (#124877)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-10-08 15:07:29 -07:00
Jan Kaliszewski
9047146e54
gh-75898: make use of thread more explicit in the "Socket Programming HOWTO" document (#125023) 2024-10-08 17:43:37 +05:30
Raymond Hettinger
165ed68c26
Sorting techniques edits (#124701) 2024-09-27 17:19:44 -07:00
Sam Gross
68e384c217
gh-124370: Add "howto" for free-threaded Python (#124371)
* gh-124370: Add "howto" for free-threaded Python

This is a guide aimed at people writing Python code, as oppposed to the
existing guide for C API extension authors.

* Add missing new line

* Update Doc/howto/free-threading-python.rst

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* interned -> immortalized

* Apply suggestions from code review

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

* Update Doc/howto/free-threading-python.rst

Co-authored-by: mpage <mpage@cs.stanford.edu>

* Update docs

* Apply suggestions from code review

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>

* A few more updates

* Additional comment on immortal objects

* Mention specializing adaptive interpreter

* Remove trailing whitespace

* Remove mention of C macro

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: mpage <mpage@cs.stanford.edu>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-09-25 17:31:53 -04:00
Alex Waygood
0d9d56c4e4
gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) 2024-09-25 19:29:58 +00:00
Raymond Hettinger
cd06f5e323
Minor edits to the descriptor guide (GH-123928) 2024-09-13 17:02:37 -05:00
Donghee Na
e6bb1a2b28
gh-119802: Update memory management docs for free-threaded build (gh-124006)
* gh-119802: Update memory management docs for free-threaded build

* nit

* nit

* Address code review

* nit

* Update Doc/c-api/memory.rst

Co-authored-by: Sam Gross <colesbury@gmail.com>

---------

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-09-13 15:15:44 +00:00
Savannah Ostrowski
e5b0185e43
GH-101599: Update docs to remove redundant option in argparse tutorial (#124025) 2024-09-13 09:14:52 +03:00
Jelle Zijlstra
5436d8b9c3
gh-119180: Documentation for PEP 649 and 749 (#122235)
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: Carol Willing <carolcode@willingconsulting.com>
2024-09-11 07:49:59 -07:00
Nathan Goldbaum
5a4fb7ea1c
gh-109975: Add links to py-free-threading.github.io (#123776)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-06 20:12:12 +03:00
Alexander Bessman
7d2c2f24da
gh-123463: Include logging_flow diagram in non-HTML docs (GH-123464) 2024-09-04 13:14:36 +02:00
Raymond Hettinger
e3f76e5cfb
Remove irrelevant detail from example code. (gh-123587) 2024-09-01 20:04:33 -05:00
Raymond Hettinger
cb6d25011e
Simplify Property() recipe to focus on the essentials (gh-123585) 2024-09-01 17:49:38 -05:00
Wei-Hsiang (Matt) Wang
cf472577e2
gh-123517: Remove unnecessary `:meth:` parentheses (#123518) 2024-09-01 05:59:42 +01:00
Wei-Hsiang (Matt) Wang
103a0470e3
gh-123492: Remove unnecessary :func: parentheses (#123493) 2024-08-30 14:34:09 +03:00
jianghuyiyuan
46f5a4f9e1
Fix typos in docs, error messages and comments (#122502)
Signed-off-by: jianghuyiyuan <shuangcui@live.com>
2024-08-01 00:26:09 +00:00
Jelle Zijlstra
7b7b90d1ce
gh-119180: Add annotationlib module to support PEP 649 (#119891)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-23 21:16:50 +00:00
Ville Skyttä
bc264eac3a
Docs: spelling and grammar fixes (#122084)
Corrected some grammar and spelling issues in documentation.

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-22 09:14:25 +08:00
Vinay Sajip
26d24eeb90
gh-121035: Update PNG image for logging flow diagram. (GH-121323) 2024-07-03 12:33:28 +01:00
Vinay Sajip
089835469d
gh-121035: Further improve logging flow diagram with respect to dark/light modes. (GH-121265) 2024-07-02 18:57:34 +01:00
Vinay Sajip
bfe0e4d769
gh-121035: Improve logging flow diagram for dark/light modes. (GH-121254) 2024-07-02 09:13:37 +01:00
Vinay Sajip
2a455bbe8f
[doc] Update element positions and styles in logging flow diagram. (GH-121182)
Update element positions and styles.
2024-06-30 14:38:49 +01:00
Alexander Bessman
237baf4d7a
gh-121035: Update logging flow chart to include the lastResort handler. (GH-121036) 2024-06-27 22:11:40 +01:00
Sam Gross
375b723d58
gh-120858: PyDict_Next should not lock the dict (#120859)
PyDict_Next no longer locks the dictionary in the free-threaded build. Locking
around individual PyDict_Next calls is not sufficient because the function
returns borrowed references and because it allows concurrent modifications
during the iteraiton loop.

The internal locking also interferes with correct external synchronization
because it may suspend outer critical sections created by the caller.
2024-06-24 14:15:15 -04:00
Nice Zombies
ed5ae6c4d7
gh-118820: Zero-valued flag enum has no name (GH-118848)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-19 13:09:53 -07:00
Petr Viktorin
45d5cab533
Add a link to free-threading HOWTO to the index (follow-up to GH-119366) (GH-120703) 2024-06-19 09:17:26 +02:00
Sam Gross
02b272b702
gh-119241: Add HOWTO for free-threaded C API extensions (#119877)
Some sections adapted from https://github.com/Quansight-Labs/free-threaded-compatibility/
written by Nathan Goldbaum.

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
2024-06-18 09:49:51 -04:00
Carol Willing
a26d27e7ee
Update the documentation howto index page and group docs into 3 logical sections (GH-119366)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-06-17 16:37:33 +02:00