Commit graph

29827 commits

Author SHA1 Message Date
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
Serhiy Storchaka 3f27153e07
gh-58573: Fix conflicts between abbreviated long options in the parent parser and subparsers in argparse (GH-124631)
Check for ambiguous options if the option is consumed, not when it is
parsed.
2024-09-29 12:01:03 +03:00
Serhiy Storchaka 95e92ef6c7
gh-116850: Fix argparse for namespaces with not directly writable dict (GH-124667)
It now always uses setattr() instead of setting the dict item to modify
the namespace. This allows to use a class as a namespace.
2024-09-29 11:01:10 +03: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 dac4ec5286
gh-53834: Fix support of arguments with choices in argparse (GH-124495)
Positional arguments with nargs equal to '?' or '*' no longer check
default against choices.
Optional arguments with nargs equal to '?' no longer check const
against choices.
2024-09-29 10:52:52 +03:00
Serhiy Storchaka 61180446ee
gh-124345: Support abbreviated single-dash long options with = in argparse (GH-124428) 2024-09-29 10:52:07 +03:00
Serhiy Storchaka 9bcadf589a
gh-80259: Fix conflict between type and default=SUPPRESS in argparse (GH-124519)
type() no longer called for SUPPRESS.

This only affects positional arguments with nargs='?'.
2024-09-29 10:47:06 +03:00
Serhiy Storchaka 49e105f948
gh-104860: Fix allow_abbrev=False for single-dash long options (GH-124340) 2024-09-29 10:44:34 +03:00
Kira 04c837d9d8
gh-124442: make __static_attributes__ deterministic by sorting (#124492)
Signed-off-by: kp2pml30 <kp2pml30@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-09-28 15:15:43 -07: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
Mark Shannon 0e21cc6cf8
GH-124547: Clear instance dictionary if memory error occurs during object dealloc (GH-124627) 2024-09-27 14:51:01 -07:00
Mariatta 6cba6e1df2
gh-124457: Remove coverity from CPython repo (GH-124460)
Remove coverity from CPython repo.
2024-09-27 13:42:32 -07:00
Tony Roberts 0881e2d3b1
gh-124609: Fix _Py_ThreadId for Windows builds using MinGW (#124663) 2024-09-27 18:52:23 +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
Malcolm Smith 0a3577bdfc
gh-123017: Add Android to the list of platforms where strftime doesn't support negative years (#124467)
Add Android to the list of platforms where `strftime` doesn't support negative years
2024-09-27 10:35:18 -04:00
Jelle Zijlstra 365dffbaad
gh-119180: No longer set __annotations__ in __main__ (#124634) 2024-09-27 05:49:43 -07:00
sobolevn 3a0e7f5762
gh-124176: Add special support for dataclasses to create_autospec (#124429) 2024-09-27 09:48:31 +03:00
Neil Schemenauer 6f9525dd3f
gh-116510: Fix crash during sub-interpreter shutdown (gh-124645)
Fix a bug that can cause a crash when sub-interpreters use "basic"
single-phase extension modules.  Shared objects could refer to PyGC_Head
nodes that had been freed as part of interpreter shutdown.
2024-09-26 19:33:07 -07:00
Neil Schemenauer 98b2ed7e23
gh-116510: Fix crash due to shared immortal interned strings. (gh-124646) 2024-09-26 19:16:51 -07:00
Savannah Ostrowski 65f1237098
GH-123516: Improve JIT memory consumption by invalidating cold executors (GH-124443)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-27 00:35:42 +00: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
sobolevn abe5f799e6
gh-124498: Fix TypeAliasType not to be generic, when type_params=() (#124499) 2024-09-26 17:15:38 +03:00
Peter Bierma f923605658
gh-124538: Fix crash when using gc.get_referents on an untracked capsule object (#124559) 2024-09-26 12:29:43 +02: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
Peter Bierma de929f353c
gh-124309: Modernize the staggered_race implementation to support eager task factories (#124390)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-09-26 05:11:17 +00:00
dgpb d9296529eb
gh-119127: functools.partial placeholders (gh-119827) 2024-09-26 01:04:38 +00: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
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
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
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
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
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
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
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
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