Commit Graph

123878 Commits

Author SHA1 Message Date
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
Zachary Ware ede1504c4b
Add 3.13 as a version option to the crash issue template (#124560) 2024-09-25 23:09:37 +00: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
Jelle Zijlstra bc543936ab
gh-119180: Make FORWARDREF format look at __annotations__ first (#124479)
From discussion with Larry Hastings and Carl Meyer, this is the desired
behavior.
2024-09-25 15:32:45 -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
TizzySaurus b0c6cf5f17
gh-102450: Add ISO-8601 alternative for midnight to `fromisoformat()` calls. (#105856)
* Add NEWS.d entry

* Allow ISO-8601 24:00 alternative to midnight on datetime.time.fromisoformat()

* Allow ISO-8601 24:00 alternative to midnight on datetime.datetime.fromisoformat()

* Add NEWS.d entry

* Improve error message when hour is 24 and minute/second/microsecond is not 0

* Add tests for 24:00 fromisoformat

* Remove duplicate call to days_in_month() by storing in variable

* Add Python implementation

* Fix Lint

* Fix differing error msg in datetime.fromisoformat implementations when 24hrs has non-zero time component(s)

* Fix using time components inside tzinfo in Python implementation

* Don't parse tzinfo in C implementation when invalid iso midnight

* Remove duplicated variable in datetime test assertion line

* Add self to acknowledgements

* Remove duplicate NEWS entry

* Linting

* Add missing test case for when wrapping the year makes it invalid (too large)
2024-09-25 14:32:51 -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
Alexander Kanavin 1ff1b899ce
gh-119400: make_ssl_certs: update reference test data automatically, pass in expiration dates as parameters #119400 (GH-119401)
* Lib/test/certdata: do not hardcode reference cert data into tests

The script was simply printing the reference data and asking
users to update it by hand into the test suites. This can
be easily improved by writing the data into files and
having the test cases load the files.

* make_ssl_certs: make it possible to pass in expiration dates from command line

Note that in this commit, the defaults are same as they were,
so if nothing is specified the script works as before.

---------

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
2024-09-25 21:23:47 +00:00
Jelle Zijlstra 17a544b257
gh-119180: Avoid going through AST and eval() when possible in annotationlib (#124337)
Often, ForwardRefs represent a single simple name. In that case, we
can avoid going through the overhead of creating AST nodes and code
objects and calling eval(): we can simply look up the name directly
in the relevant namespaces.

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-25 21:14:03 +00:00
Zachary Ware 9d8f2d8e08
gh-124448: Update Windows builds to use Tcl/Tk 8.6.15 (GH-124449) 2024-09-25 21:00:25 +00:00
Raymond Hettinger 909c6f7189
gh-123884 Tee of tee was not producing n independent iterators (gh-124490) 2024-09-25 13:38:05 -07:00
Zachary Ware fb6bd31cb7
gh-124378: Update test_ttk for Tcl/Tk 8.6.15 (GH-124542)
Co-authored-by: Marc Culler <culler@users.noreply.github.com>
2024-09-25 20:16:32 +00:00
Victor Stinner d6954b6421
gh-124513: Check args in framelocalsproxy_new() (#124515)
Fix a crash in FrameLocalsProxy constructor: check the number of
arguments.
2024-09-25 21:41:09 +02: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
Adam Turner 6318ffcba2
Doc: Use ``major.minor`` for documentation distribution archive filenames (#124489) 2024-09-25 20:06:54 +01:00
Ken Jin 198756b0f6
gh-117376: Fix off-by-ones in conversion functions (GH-124301)
Fix off-by-ones in conversion function
2024-09-26 02:41:07 +08:00
Emily Morehouse c1600c78e4
gh-123856: Fix PyREPL failure when a keyboard interrupt is triggered after using a history search (#124396)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-25 20:22:03 +02:00
Tian Gao 28efeefab7
gh-123756: Disable restart command if pdb is in inline mode (#123757) 2024-09-25 11:18:01 -07:00
Petr Viktorin da5855e99a
gh-112301: Use literal format strings in unicode_fromformat_arg (GH-124203) 2024-09-25 19:46:01 +02:00
Thomas Grainger 162d152146
import: permit __name__ for use in __name__ = "__main__": (#124381)
permit __name__ for use in __name__ = "__main__":
2024-09-25 10:39:14 -07:00
Damien 828583a785
gh-123223: Adding hyperlink of argument in warnings.catch_warnings: (#123231)
* Adding hyperlink of argument

* Modify as reviewer suggested
2024-09-25 10:30:34 -07:00
Robert Wolff f8651a2988
gh-123968: fix -f/--float command line option description (#124517)
* fix -f/--float command line option description

See gh-123968 gh-124009

* Update Doc/library/random.rst

---------

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-09-25 09:47:45 -07:00
Irit Katriel 78aeb38f7d
gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression (#124394) 2024-09-25 15:51:25 +01:00
Malcolm Smith c58c572a65
gh-123014: Disable pidfd API on older Android versions (#124458) 2024-09-25 16:23:30 +02:00
Malcolm Smith 461c12b438
gh-116622: Make test_unzip_zipfile recognize Android error message format (#124462)
Make test_unzip_zipfile recognize Android error message format
2024-09-25 07:02:18 -07:00
Mat S 8447c933da
gh-123445: calendar: Improve descriptions for day and month attributes (#123483)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-25 10:24:47 +01:00
Tom Most 0d38409f42
Doc: Improve documentation for the ``path`` argument in ``shutil.which()`` (#124494) 2024-09-25 08:54:13 +01:00
Zachary Ware 54dd77fb8c
Adjust build_ubuntu_ssltests job to use cache for the correct OS version (GH-124403) 2024-09-24 20:27:23 -05:00
Eric V. Smith 5c6e3b7150
gh-90562: Support zero argument super with dataclasses when slots=True (gh-124455)
Co-authored-by: @wookie184
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-09-24 21:26:26 -04:00
Savannah Ostrowski b6471f4a39
GH-124408: Temporarily skip test_strftime_y2k for emulated Linux JIT CI (GH-124466) 2024-09-24 18:09:50 -07:00
Jelle Zijlstra 950fab46ad
dataclasses: Avoid using private class (#124465)
typing.get_origin() does what we need here, without reaching into
typing internals. This shouldn't change any behavior (so I am going
to skip news), but it sets a good example for other users introspecting
typing objects.
2024-09-24 14:02:18 -07:00
Victor Stinner 5a60566074
gh-124402: Require cpu resource in test_super slow method (#124434)
test___class___modification_multithreaded() now requires the 'cpu'
test resource on a Free Threaded build.
2024-09-24 22:36:45 +02:00
Jakub Kulík b169cf394f
gh-86009: Fix solaris detection in `_USE_CP_SENDFILE` check (GH-124289) 2024-09-24 22:23:17 +02:00
Sam Gross f4997bb3ac
gh-123923: Defer refcounting for `f_funcobj` in `_PyInterpreterFrame` (#124026)
Use a `_PyStackRef` and defer the reference to `f_funcobj` when
possible. This avoids some reference count contention in the common case
of executing the same code object from multiple threads concurrently in
the free-threaded build.
2024-09-24 20:08:18 +00:00
Jérémie Detrey d3c76dff44
bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers() (GH-27667)
Call _() on literal strings only.
2024-09-24 19:54:50 +00:00
Tian Gao af8403a58d
gh-120254: Add a `commands` argument to `pdb.set_trace` (#120255) 2024-09-24 12:52:15 -07:00
Ned Deily fc9e6bf53d
gh-124448: Update bundled Tcl/Tk in macOS installer to 8.6.15. (#124453) 2024-09-24 19:49:58 +00:00
sobolevn 17b3bc9cc7
gh-124405: Fix `NameError` in `openpty` (#124406) 2024-09-24 20:06:39 +02:00
Savannah Ostrowski b4d0d7de0f
GH-124398: Pin LLVM to 18.1.0 for Windows JIT CI (GH-124399) 2024-09-24 10:03:16 -07:00
Savannah Ostrowski 20ccda000b
GH-87358: Add clarification about nargs and default argparse behaviour (#124094) 2024-09-24 19:30:01 +03:00
Victor Stinner 38a5beb12a
gh-124402: Require cpu resource in test_free_threading (#124438)
Require the 'cpu' test resource on slow test_free_threading tests.
2024-09-24 16:33:27 +02:00
Payton d21b0b5d36
gh-113008: Correct argparse usage output for required, mutually exclusive groups (GH-113085) 2024-09-24 17:14:35 +03:00
Serhiy Storchaka 4a5e4aade4
gh-59317: Improve parsing optional positional arguments in argparse (GH-124303)
Fix parsing positional argument with nargs equal to '?' or '*' if it is
preceded by an option and another positional argument.
2024-09-24 15:46:41 +03:00
Stanley e69ff34e81
gh-65169: Clarify prog default in argparse (GH-31602) 2024-09-24 10:57:37 +00:00
Serhiy Storchaka e670a113b5
gh-123978: Remove broken time.thread_time() on NetBSD (GH-124116) 2024-09-24 08:26:25 +00:00
Serhiy Storchaka e2f710792b
gh-124188: Fix PyErr_ProgramTextObject() (GH-124189)
* Detect source file encoding.
* Use the "replace" error handler even for UTF-8 (default) encoding.
* Remove the BOM.
* Fix detection of too long lines if they contain NUL.
* Return the head rather than the tail for truncated long lines.
2024-09-24 11:01:37 +03:00
Serhiy Storchaka 3c83f9958c
gh-72795: Make positional arguments with nargs='*' or REMAINDER non-required (GH-124306)
This allows to use positional argument with nargs='*' and without default
in mutually exclusive group and improves error message about required
arguments.
2024-09-24 07:55:33 +00:00
Serhiy Storchaka c578271366
gh-53780: Ignore the first "--" (double dash) between an option and command in argparse (GH-124275) 2024-09-24 07:35:28 +00:00