Commit Graph

28636 Commits

Author SHA1 Message Date
Serhiy Storchaka 04bfea2d26
gh-66436: Improved prog default value for argparse.ArgumentParser (GH-124799)
It can now have one of three forms:

* basename(argv0) -- for simple scripts
* python arv0 -- for directories, ZIP files, etc
* python -m module -- for imported modules

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-10-01 22:51:40 +03:00
Gregory P. Smith d150e4abcf
Highlight `datetime.timedelta.seconds` vs `.total_seconds()` in docs. (GH-124811)
Thanks to the reviewers for suggesting the use of a "caution" section instead of "warning" or "note".
2024-10-01 18:10:13 +00:00
Tian Gao 5e0abb4788
gh-116750: Add clear_tool_id function to unregister events and callbacks (#124568) 2024-10-01 13:32:55 -04:00
Wulian da1e5526ae
gh-124487: Updated installer messages and internal docs regarding minimum Windows version (GH-124822) 2024-10-01 15:44:18 +01:00
Victorien 3e3a4d2315
gh-118974: Add `decorator` argument to `make_dataclass` (gh-122723)
This is to allow the `dataclasses.make_dataclass` infrastructure to be used with another decorator that's compliant with `typing.dataclass_transform`. The new `decorator` argument to `dataclasses.make_dataclass` is `dataclasses.dataclass`, which used to be hard coded.
2024-10-01 09:51:51 -04:00
Adam Turner 91e64be731
Doc: Fix archive filenames for standard builds (#124826) 2024-10-01 10:43:55 +01:00
Adam Turner 4129a74a37
GH-109975: Copyedit 3.13 What's New: Link to installing free-threaded binaries on macOS (#124831) 2024-10-01 08:27:59 +00:00
Adam Turner 8823690264
GH-109975: Copyedit 3.13 What's New: Note delayed expected release date for Python 3.13.0 (GH-124827)
Note delayed expected release date of 3.13.0
2024-10-01 07:18:59 +00:00
Adam Turner cce1125574
Doc: Run HTML and non-HTML daily builds separately (#124493) 2024-09-30 17:48:12 +01:00
Tian Gao b5774603a0
gh-124400: Use the normal command path for breakpoint commands (#124401)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-09-29 19:46:16 -04:00
Ned Deily 4b83c03ce9
gh-124720: Update "Using Python on a Mac" document (#124721)
Update "Using Python on a Mac" section of the "Python Setup and Usage"
document and include information on installing free-threading support.
2024-09-30 07:39:46 +08:00
CBerJun 76fbee642e
Docs: improve generic `typing.NamedTuple` example (#124739) 2024-09-29 12:07:05 +01:00
Serhiy Storchaka f1a2417b9e
gh-61181: Fix support of choices with string value in argparse (GH-124578)
Substrings of the specified string no longer considered valid values.
2024-09-29 10:57:21 +03:00
Serhiy Storchaka 69a4063ca5
gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in classes (GH-123613)
* Setting the __module__ attribute for a class now removes the
  __firstlineno__ item from the type's dict.
* The _collections_abc and _pydecimal modules now completely replace the
  collections.abc and decimal modules after importing them. This
  allows to get the source of classes and functions defined in these
  modules.
* inspect.findsource() now checks whether the first line number for a
  class is out of bound.
2024-09-28 20:51:49 +03:00
Jelle Zijlstra c976d789a9
docs: improve venv docs (#124540)
- Move "versionchanged" notes that apply to the whole class to the
  end of the class docs
- Remove or move notes next to the method list that apply to individual
  methods.
- Mark up parameters using the appropriate syntax
- Do not capitalize "boolean"
- Shorten some text
2024-09-28 05:50:09 -07:00
Jean-François B. fae5058ec1
Doc: Fix default ``latex_elements['papersize']`` (#124525)
https://www.sphinx-doc.org/en/master/latex.html#the-latex-elements-configuration-setting

It should be 'letterpaper' or 'a4paper' not 'letter' or 'a4'
(not to be confused with PAPER env variable).
2024-09-28 11:30:28 +01:00
Raymond Hettinger 165ed68c26
Sorting techniques edits (#124701) 2024-09-27 17:19:44 -07:00
Pablo Galindo Salgado 02b49c5150
gh-107954: Fix configuration type for the perf profiler (#124636) 2024-09-28 01:50:16 +02:00
Petr Viktorin 425587a110
gh-124385: Document and soft-deprecate PyLong_AS_LONG (GH-124386) 2024-09-27 23:40:50 +00:00
Jelle Zijlstra 1ba35ea385
gh-123299: Copy-edit the 3.14 What's New (#124670)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-28 01:25:33 +03:00
Matt Delengowski 2357d5ba48
gh-90190: Add doc for using `singledispatch` with precise collection type hints (#116544) 2024-09-27 21:10:29 +00:00
Emily Morehouse 626668912f
gh-81263: Add assignment expressions to `help` (#124641)
* Add assignment expression (:=) to `help`

* Update index for Assignment Expressions to include pair of `assignment; expression`
2024-09-27 13:59:26 -07:00
Petr Viktorin 3387f76b8f
gh-124520: What's New entry for ctypes metaclass __new__/__init__ change (GH-124546) 2024-09-27 22:13:53 +02:00
Victor Stinner d8cf587dc7
doc: PyUnicode_AsUTF8String() fails if string contains surrogates (#124605) 2024-09-27 20:13:29 +00:00
Raymond Hettinger 2e155536ca
Itertool docs: Minor clarifications, wording tweaks, spacing, and active voice. (gh-124690)
Minor clarifications, wording tweaks, spacing, and active voice.
2024-09-27 18:43:46 +00:00
Petr Viktorin e349f73a5a
gh-121277: Raise nice error on `next` as second argument to deprecated-removed (GH-124623) 2024-09-27 19:38:40 +02:00
Alex Waygood 6716dd1c33
Fixup indentation for docs on `ModuleSpec` attributes (#124681)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-27 17:35:09 +00:00
sobolevn 9c7657f099
gh-113878: Add `doc` parameter to `dataclasses.field` (gh-114051)
If using `slots=True`, the `doc` parameter ends up in the `__slots__` dict. The `doc` parameter is also in the corresponding `Field` object.
2024-09-27 12:20:49 -04:00
Max Bachmann b79a21ea42
GH-95079: document error behaviour for some unicode C APIs (#95080) 2024-09-27 12:35:55 +02:00
Ned Batchelder 5329d1b74a
Docs: for for/else clarify that return or raise also skip the else (#124591)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-27 06:17:25 -04:00
Hugo van Kemenade 23e812b84a
Docs: Update and proofread `library/venv.rst` (#124121)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-27 02:57:38 +03:00
Gregory P. Smith b65f2cdfa7
gh-84559: Change the multiprocessing start method default to `forkserver` (GH-101556)
Change the default multiprocessing start method away from fork to forkserver or spawn on the remaining platforms where it was fork.  See the issue for context.  This makes the default far more thread safe (other than for people spawning threads at import time... - don't do that!).

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-26 16:57:19 -07:00
Jelle Zijlstra 2c10832887
gh-119180: Rename SOURCE format to STRING (#124620) 2024-09-26 13:49:48 -07:00
Matthew Rahtz 7d3497f617
gh-115528: Update language reference for PEP 646 (#121181)
To recap: the objective is to make starred expressions valid in `subscription`,
which is used for generics: `Generic[...]`, `list[...]`, etc.

What _is_ gramatically valid in such contexts? Seemingly any of the following.
(At least, none of the following throw `SyntaxError` in a 3.12.3 REPL.)

    Generic[x]
    Generic[*x]
    Generic[*x, y]
    Generic[y, *x]
    Generic[x := 1]
    Generic[x := 1, y := 2]

So introducting

    flexible_expression: expression | assignment_expression | starred_item

end then switching `subscription` to use `flexible_expression` sorts that.

But then we need to field `yield` - for which any of the following are
apparently valid:

    yield x
    yield x,
    yield x, y
    yield *x,
    yield *x, *y

Introducing a separate `yield_list` is the simplest way I've been figure out to
do this - separating out the special case of `starred_item ,`.



Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-26 12:35:17 -07:00
Jelle Zijlstra 43979fad90
Programming FAQ: Mention object.__setattr__ as a technique for delegation (#124617)
This is used for example by threading.local in the stdlib.
2024-09-26 11:50:31 -07:00
Adam Turner 2c472d36b7
Doc: Use the short version for daily downloads (#124602) 2024-09-26 16:44:25 +01:00
Jelle Zijlstra cf2418076d
gh-119127: functools: Improve docs for partial and Placeholder (#124575) 2024-09-26 07:12:56 -07:00
Tomas R 09aebb1fbc
gh-118181: Fix parameter markup in AST docs (#124473) 2024-09-26 06:38:25 -07:00
Sergey B Kirpichev 274d9ab619
gh-123560: Correct docs for "empty" format type for floats (#123561) 2024-09-26 14:40:18 +02:00
sobolevn 19fed6cf6e
gh-124234: Improve docs for `Mock.reset_mock` (#124237) 2024-09-26 15:06:52 +03:00
Jelle Zijlstra 08a467b537
gh-101100: Make __subclasses__ doctest stable (#124577)
Using a standard library class makes this test difficult to maintain
as other tests and other parts of the stdlib may create subclasses,
which may still be alive when this test runs depending on GC timing.
2024-09-26 06:26:03 +00:00
Ron Frederick 1229cb8c14
gh-120284: Enhance `asyncio.run` to accept awaitable objects (#120566)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-09-26 11:45:08 +05:30
dgpb d9296529eb
gh-119127: functools.partial placeholders (gh-119827) 2024-09-26 01:04:38 +00:00
Jelle Zijlstra 4e829c0e6f
gh-124412: Add helpers for converting annotations to source format (#124551) 2024-09-26 00:01:09 +00:00
Ned Batchelder ffdc80e93d
For-else deserves its own section in the tutorial (#123946)
* For-else deserves its own section in the tutorial

* remove mention of unrolling the loop

* Update Doc/tutorial/controlflow.rst

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

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-25 19:18:18 -04:00
Jelle Zijlstra 99b23c64de
gh-123242: Note that type.__annotations__ may not exist (#124557)
Closes #123242. The real criterion is that the attribute does not
exist on heap types, but I don't think we should discuss heap vs.
static types in the language reference.
2024-09-25 16:08:14 -07:00
Savannah Ostrowski 4e2fb7bdf5
GH-58058: Add quick reference for `ArgumentParser` to argparse docs (gh-124227) 2024-09-25 15:22:17 -07:00
Nice Zombies 9968caa0cc
gh-41431: Add `datetime.time.strptime()` and `datetime.date.strptime()` (#120752)
* Python implementation

* C implementation

* Test `date.strptime`

* Test `time.strptime`

* 📜🤖 Added by blurb_it.

* Update whatsnew

* Update documentation

* Add leap year note

* Update 2024-06-19-19-53-42.gh-issue-41431.gnkUc5.rst

* Apply suggestions from code review

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Remove parentheses

* Use helper function

* Remove bad return

* Link to github issue

* Fix directive

* Apply suggestions from code review

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>

* Fix test cases

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2024-09-25 14:43:58 -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
Petr Viktorin 7d24ea9db3
gh-121277: Allow `.. versionadded:: next` in docs (GH-121278)
Make `versionchanged:: next`` expand to current (unreleased) version.

When a new CPython release is cut, the release manager will replace
all such occurences of "next" with the just-released version.
(See the issue for release-tools and devguide PRs.)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-25 23:30:40 +02:00