Commit Graph

29800 Commits

Author SHA1 Message Date
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
Serhiy Storchaka 3094cd17b0
gh-63143: Fix parsing mutually exclusive arguments in argparse (GH-124307)
Arguments with the value identical to the default value (e.g. booleans,
small integers, empty or 1-character strings) are no longer considered
"not present".
2024-09-24 10:23:07 +03:00
Victor Stinner 9d344fafc4
gh-124127: Make Py_REFCNT() opaque in limited C API 3.14 (#124128) 2024-09-24 08:42:58 +02:00
Xie Yanbo 536bc8a806
Fix typos (#124409) 2024-09-23 23:19:25 -07:00
Jason Fried d87482bc4e
gh-119333: Add C api to have contextvar enter/exit callbacks (#119335)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-09-23 20:40:17 -07:00
Donghee Na ad7c778546
gh-123990: Good bye WITH_FREELISTS macro (gh-124358) 2024-09-24 01:28:59 +00:00
Petr Viktorin be76e3f26e
gh-100980: ctypes: Test, document, and fix finalizing _fields_ (GH-124292)
- If setting `_fields_` fails, e.g. with AttributeError, don't set the attribute in `__dict__`
- Document the “finalization” behaviour
- Beef up tests: add `getattr`, test Union as well as Structure
- Put common functionality in a common function

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-09-24 02:40:53 +02:00
Bénédikt Tran 38a887dc3e
gh-119004: fix a crash in equality testing between `OrderedDict` (#121329) 2024-09-23 18:44:36 -05:00
Malcolm Smith e80dd3035f
gh-116622: Complete Android documentation (#124259)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-09-23 23:09:53 +00:00
Wulian 27a62e7371
gh-124102: Update internal PCbuild docs to accurately list build dependencies (GH-124103) 2024-09-23 23:09:22 +00:00
Brett Cannon 67201ad53f
GH-65961: Document the deprecation of `__package__` and `__cached__` (GH-124377)
The code changes for warning related to `__package__` landed in Python 3.12. `__cached__` doesn't have any changes as it isn't used but only set by the import system.
2024-09-23 14:14:33 -07:00
Savannah Ostrowski 7ee9921734
GH-87041: Fix incorrect indentation in argparse help (GH-124230)
In case of usage a long command along with max_help_position more than
the length of the command, the command's help was incorrectly started
on the new line.

Co-authored-by: Pavel Ditenbir <pavel.ditenbir@gmail.com>
2024-09-23 19:45:36 +00:00
Steve Dower df7228ce14
gh-124254: Detect freethreaded MSI component when doing an upgrade on Windows (GH-124279) 2024-09-23 16:27:46 +01:00
Terry Jan Reedy d5f95ec07b
gh-112938: IDLE - Fix uninteruptable hang when Shell gets rapid continuous output. (#124310)
https://github.com/python/cpython/issues/88496 replaced text.update with text.update_idletasks in colorizer.py and outwin.py to fix test failures on macOS.  While theoretically correct, the result was Shell freezing when receiving continuous short strings to print.  Test: `while 1: 1`.

The guess is that there is no idle time in which to do the screen update.  Reverting the change in one of the files,
outwin, fixes the issue.  Colorizer runs ever 1/20 second and seems to work fine.

When running test-outwin on macOS, alias 'update'
to 'update_idletasks on the text used for testing.
2024-09-22 15:51:09 -04:00
Michał Górny 342e654b8e
gh-124213: Skip tests failing inside systemd-nspawn --suppress-sync=true (#124215)
Add a helper function that checks whether the test suite is running
inside a systemd-nspawn container, and skip the few tests failing
with `--suppress-sync=true` in that case.  The tests are failing because
`--suppress-sync=true` stubs out `fsync()`, `fdatasync()` and `msync()`
calls, and therefore they always return success without checking for
invalid arguments.

Call `os.open(__file__, os.O_RDONLY | os.O_SYNC)` and check the errno to
detect whether `--suppress-sync=true` is actually used, and skip
the tests only in that scenario.
2024-09-20 13:37:49 +00:00
AN Long 1a577729e3
gh-111513: Improve datetime.fromtimestamp's error message (#124249) 2024-09-20 14:42:43 +02:00
Y5 db6eb3640a
gh-124217, ipaddress: Add RFC 9637 reserved IPv6 block `3fff::/20` (#124240)
Signed-off-by: y5c4l3 <y5c4l3@proton.me>
2024-09-20 11:01:28 +00:00
Brian Schubert 63f196090f
gh-124248: Fix crash in struct when processing 0p fields (#124251) 2024-09-20 12:08:59 +02:00
Petr Viktorin aee219f455
gh-123880: Allow recursive import of single-phase-init modules (GH-123950)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2024-09-20 10:27:34 +02:00
sobolevn 3e36e5aef1
gh-123797: Check for runtime availability of `ptsname_r` on macos (#123806) 2024-09-20 09:30:27 +03:00
Serhiy Storchaka aae126748f
gh-81691: Fix handling of multiple "--" (double dashes) in argparse (GH-124233)
Only the first one has now been removed, all subsequent ones are now
taken literally.
2024-09-20 09:20:47 +03:00
luk1337 7331d0f70b
gh-124160: Pass main_tstate to update_global_state_for_extension() (#124164) 2024-09-19 21:35:20 +05:30
Jakub Kulík 8f82d9aa21
bpo-41843: Reenable use of sendfile in shutil module on Solaris (GH-23893) 2024-09-19 14:47:05 +00:00
Stefano Rivera 426569eb8c
Support the "pager" binary in _pyrepl (#122878)
Debian (and derivatives) provide a /usr/bin/pager binary, managed by the
alternatives system, that always points to an available pager utility.
Allow _pyrepl to use it, to follow system policy.

This is a very trivial change, from a patch that Debian has been
carrying since 2.7 era. Seems appropriate to upstream.
https://bugs.debian.org/799555
2024-09-19 13:18:24 +00:00
sobolevn 7628f67d55
gh-123934: Fix `MagicMock` not to reset magic method return values (#124038) 2024-09-19 10:55:47 +03:00
Jacek ea7fe1fe2e
gh-124212: Fix undefined variable in error message in venv (GH-124211) 2024-09-18 22:05:18 +00:00
Tomas R 21d2a9ab2f
gh-116022: Improve `repr()` of AST nodes (#117046)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-18 10:28:22 -07:00
Bénédikt Tran 5cd50cb6eb
gh-122145: Handle an empty AST body when reporting tracebacks (#122161) 2024-09-18 18:42:33 +02:00