Commit Graph

53487 Commits

Author SHA1 Message Date
Mikhail Efimov aac89b54c5
gh-125206: Bug in ctypes with old libffi is fixed (#125322)
Workaround for old libffi versions is added.
Module ctypes now supports C11 double complex only with libffi >= 3.3.0.

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-10-15 16:17:10 +00:00
Irit Katriel e97910cdb7
gh-125522 : add explicit exception types to bare excepts in tests (#125523) 2024-10-15 17:00:04 +01:00
Tian Gao bb9604b62a
gh-100141: Allow pdb to deal with empty file (#125425) 2024-10-15 11:45:23 -04:00
Victor Stinner c6e8ff86b2
gh-125451: Skip concurrent.futures test_processes_terminate() (#125533)
The test hangs randomly. It tries to serialize local lock and a local
function which are not possible.
2024-10-15 15:42:55 +00:00
Tian Gao 703227dd02
gh-125422: Don't set the caller's f_trace if it's botframe (#125427) 2024-10-15 10:51:37 -04:00
Kirill Podoprigora d3c82b9cce
gh-125512: Revert "gh-124872: Replace enter/exit events with "switched" (#124776)" (#125513) 2024-10-15 17:42:16 +03:00
Irit Katriel 55c4f4c30b
gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (#125516) 2024-10-15 15:11:02 +01:00
Petr Viktorin cc5a225cdc
gh-125041: test_zlib: For s390x HW acceleration, only skip checking the compressed bytes (#125042) 2024-10-15 11:29:43 +00:00
foreignmeloman fcef3fc9a5
gh-119535: Support 𝜋thon in Python 3.14 venvs (#125035) 2024-10-15 13:26:19 +03:00
Serhiy Storchaka 92af191a6a
gh-53203: Fix strptime() tests for %X on glibc < 2.29 (#125469) 2024-10-15 11:05:40 +03:00
Thomas Grainger 0b28ea4a35
gh-124958: Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ... (#125486)
* Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)"

This reverts commit e99650b80a.

* fix incompatability with gh-124392
2024-10-14 15:45:58 -07:00
Terry Jan Reedy 3fea1d000e
Fix idlelib typos (#125484)
Propagate fixes in Doc/library/idle.rst to help.html.
Change 'interruptable' to 'interruptible' in run.py.
The latter was reported by ember91 in PR 125473.
2024-10-14 17:11:58 -04:00
Richard Hansen 843d28f59d
gh-124872: Replace enter/exit events with "switched" (#124776)
Users want to know when the current context switches to a different
context object.  Right now this happens when and only when a context
is entered or exited, so the enter and exit events are synonymous with
"switched".  However, if the changes proposed for gh-99633 are
implemented, the current context will also switch for reasons other
than context enter or exit.  Since users actually care about context
switches and not enter or exit, replace the enter and exit events with
a single switched event.

The former exit event was emitted just before exiting the context.
The new switched event is emitted after the context is exited to match
the semantics users expect of an event with a past-tense name.  If
users need the ability to clean up before the switch takes effect,
another event type can be added in the future.  It is not added here
because YAGNI.

I skipped 0 in the enum as a matter of practice.  Skipping 0 makes it
easier to troubleshoot when code forgets to set zeroed memory, and it
aligns with best practices for other tools (e.g.,
https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).
2024-10-14 12:28:41 -07:00
Kirill Podoprigora e99650b80a
gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)
Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)"

This reverts commit d5dbbf4372.
2024-10-14 17:59:13 +00:00
Thomas Grainger d5dbbf4372
gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959) 2024-10-14 08:19:56 -07:00
Wulian 6a08a753b7
gh-124960: Fixed `barry_as_FLUFL` future flag does not work in new REPL (#124999)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-10-14 15:53:50 +02:00
Serhiy Storchaka 5f4e5b598c
gh-53203: Fix strptime() for %c, %x and %X formats on many locales (GH-125406)
Fixed most locales that use non-ASCII digits, like Persian, Burmese,
Odia and Shan.
2024-10-14 16:29:20 +03:00
Serhiy Storchaka 5217328f93
gh-121798: Add class method Decimal.from_number() (GH-121801)
It is an alternate constructor which only accepts a single numeric argument.
Unlike to Decimal.from_float() it accepts also Decimal.
Unlike to the standard constructor, it does not accept strings and tuples.
2024-10-14 08:24:01 +00:00
Serhiy Storchaka b52c7306ea
gh-121797: Add class method Fraction.from_number() (GH-121800)
It is an alternative constructor which only accepts a single numeric argument.
Unlike to Fraction.from_float() and Fraction.from_decimal() it accepts any
real numbers supported by the standard constructor (int, float, Decimal,
Rational numbers, objects with as_integer_ratio()).
Unlike to the standard constructor, it does not accept strings.
2024-10-14 07:54:59 +00:00
rindeal 66b3922b97
gh-86357: argparse: use str() consistently and explicitly to print choices (GH-117766)
Signed-off-by: Jan Chren ~rindeal <dev.rindeal@gmail.com>
2024-10-14 09:36:53 +03:00
Barney Gale cb8e5995d8
GH-125069: Fix inconsistent joining in `WindowsPath(PosixPath(...))` (#125156)
`PurePath.__init__()` incorrectly uses the `_raw_paths` of a given
`PurePath` object with a different flavour, even though the procedure to
join path segments can differ between flavours.

This change makes the `_raw_paths`-enabled deferred joining apply _only_
when the path flavours match.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-13 17:46:10 +00:00
Kumar Aditya cd0f9d111a
gh-89967: make WeakKeyDictionary and WeakValueDictionary thread safe (#125325)
Make `WeakKeyDictionary` and `WeakValueDictionary` thread safe by copying the underlying the dict before iterating over it.
2024-10-13 21:05:05 +05:30
Erlend E. Aasland ce740d4624
gh-61698: Use launchctl to detect macOS window manager in tests (#118390) 2024-10-13 10:22:31 +02:00
Erlend E. Aasland 4197a796ec
gh-86673: Loosen test_ttk.test_identify() requirements (#125335)
In aeca373b3 (PR gh-12011, issue gh-71500), test_identify() was changed to expect different results on Darwin. Ned's fix was later adjusted by e52f9bee8. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests.
2024-10-13 09:38:47 +02:00
Andrew Athan 82bcaf1589
Trivial change: Update comments in activate about what running hash -r does (GH-125385)
Update comments about what running hash -r does

The old comment said "hash -r" forgets "past commands." However, the documentation for "hash" states that it forgets past locations. The old comment was, in my opinion, confusing. This is because it could be interpreted to mean it does something to the command history (HISTORY/HISTFILE etc) vs the cache of locations.
2024-10-13 08:22:05 +01:00
Serhiy Storchaka c05f9dde8a
gh-53203: Fix strptime() for %c and %x formats on many locales (GH-124946)
In some locales (like French or Hebrew) the full or abbreviated names of
the default month and weekday used in __calc_date_time can be part of
other name or constant part of the %c format. The month name can also
match %m with constant suffix (like in Japanese). So the code failed to
correctly distinguish formats %a, %A, %b, %B and %m.

Cycle all month and all days of the week to find the variable part
and distinguish %a from %A and %b from %B or %m.

Fixed locales for the following languges:
Arabic, Bislama, Breton, Bodo, Kashubian, Chuvash, Estonian, French, Irish,
Ge'ez, Gurajati, Manx Gaelic, Hebrew, Hindi, Chhattisgarhi, Haitian Kreyol,
Japanese, Kannada, Korean, Marathi, Malay, Norwegian, Nynorsk, Punjabi,
Rajasthani, Tok Pisin, Yoruba, Yue Chinese, Yau/Nungon and Chinese.

Co-authored-by: Eli Bendersky <eliben@gmail.com>
2024-10-12 17:46:21 +00:00
Bernhard M. Wiedemann dcd58c5084
gh-125260: Change the default ``gzip.compress()`` mtime to 0 (#125261)
This follows GNU gzip, which defaults to using 0 as the mtime
for compressing stdin, where no file mtime is involved.

This makes the output of gzip.compress() deterministic by default,
greatly helping reproducible builds.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-10-12 18:18:48 +01:00
Serhiy Storchaka 9944ad388c
gh-85935: Check for nargs=0 for positional arguments in argparse (GH-124839)
Raise ValueError in add_argument() if either explicit nargs=0 or action
that does not consume arguments (like 'store_const' or 'store_true') is
specified for positional argument.
2024-10-12 16:04:17 +03:00
Serhiy Storchaka 63cf4e914f
gh-125254: Fix error report about ambiguous option in argparse (GH-125273)
This was a regression introduced in gh-58573. It was only tested for the
case when the ambiguous option is the last argument in the command line.
2024-10-12 12:15:37 +00:00
Serhiy Storchaka a6c0c64de0
gh-59330: Improve error message for dest= for positionals (GH-125215)
Also improve the documentation. Specify how dest and metavar are derived
from add_argument() positional arguments.

Co-authored-by: Simon Law <sfllaw@sfllaw.ca>
2024-10-12 14:46:28 +03:00
Serhiy Storchaka eb2d268ac7
gh-65865: Raise early errors for invalid help strings in argparse (GH-124899) 2024-10-12 13:10:50 +03:00
Thomas Grainger 979c0df7c0
gh-124309: fix staggered race on eager tasks (#124847)
This patch is entirely by Thomas and Peter

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-11 16:31:06 -07:00
Victorien 21ac0a7f4c
gh-116938: Clarify documentation of `dict` and `dict.update` regarding the positional argument they accept (#125213)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-10-11 23:05:13 +00:00
Jelle Zijlstra cc2938a189
gh-124917: Allow keyword args to os.path.exists/lexists on Windows (#124918) 2024-10-11 12:41:59 -07:00
sobolevn 2115d76acc
gh-124787: Fix `TypeAliasType` and incorrect `type_params` (#124795)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-11 17:39:18 +03:00
Serhiy Storchaka 18c7449768
gh-61011: Fix inheritance of nested mutually exclusive groups in argparse (GH-125210)
Previously, all nested mutually exclusive groups lost their connection
to the group containing them and were displayed as belonging directly
to the parser.

Co-authored-by: Danica J. Sutherland <djsutherland@users.noreply.github.com>
2024-10-11 11:43:29 +03:00
Mark Shannon c9014374c5
GH-125174: Make immortal objects more robust, following design from PEP 683 (GH-125251) 2024-10-10 18:19:08 +01:00
Petr Viktorin 01fc3b34cc
gh-124570: ctypes: Run some Structure tests on Union as well (GH-124976)
- Move some Structure tests to test_structunion; use a common base
  test class + two subclasses to run them on Union too
- Remove test_union for now as it's redundant

Note: `test_simple_structs` & `test_simple_unions` are in the common
file because they share `formats`.
2024-10-10 16:27:52 +02:00
Sergey B Kirpichev 87d7315ac5
gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-125169)
memcopy'ing arbitrary values to _Bool variable triggers undefined
behaviour. Avoid this.
We assume that `false` is represented by all zero bytes.

Credits to Alex Gaynor.

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-10 14:42:03 +02:00
Victor Stinner 942916378a
gh-125196: Use PyUnicodeWriter for repr(contextvars.Token) (#125220)
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
2024-10-09 23:37:14 +00:00
Serhiy Storchaka 9ad55e85d7
gh-124969: Skip the test for ALT_DIGITS also on iOS (#125177)
Skip the locale.ALT_DIGITS test on all Apple platforms, not just macOS.
2024-10-10 07:30:14 +08:00
Pablo Galindo Salgado c7d5d1d93b
gh-125140: Remove the current directory from sys.path when using pyrepl (GH-125212)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-09 22:30:56 +00:00
Savannah Ostrowski 0c5a48c1c9
GH-124693: Support parsing negative scientific and complex numbers argparse (GH-124823)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-09 21:56:50 +00:00
Serhiy Storchaka 7d2c39752f
gh-91818: Use default program name in the CLI of many modules (GH-124867)
As argparse now detects by default when the code was run as a module.

This leads to using the actual executable name instead of simply "python"
to display in the usage message ("usage: python -m ...").
2024-10-10 00:20:53 +03:00
Tomas R. 6b533a659b
gh-125039: Make `this_instr`/`prev_instr` const in cases generator (GH-125071) 2024-10-09 13:54:39 +01:00
Petr Viktorin d20c43d8e2
gh-107562: Update test certificates to expire far in the future (GH-125104)
Generated with Lib/test/certdata/make_ssl_certs.py
using openssl-3.2.2-3.fc40.x86_64 (Fedora 40).
2024-10-09 11:17:02 +02:00
Alexander Kanavin 53930cbe47
gh-107562: make_ssl_certs.py: produce test certificates that expire far in the future by default (GH-107594)
This allows testing Y2038 with system time set to after that,
so that actual Y2038 issues can be exposed, and not masked
by expired certificate errors.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
2024-10-09 11:16:08 +02:00
Serhiy Storchaka 21c04e1a97
gh-124969: Fix locale.nl_langinfo(locale.ALT_DIGITS) (GH-124974)
Now it returns a tuple of up to 100 strings (an empty tuple on most locales).
Previously it returned the first item of that tuple or an empty string.
2024-10-09 11:42:08 +03:00
Furkan Onder 92760bd85b
gh-125150: Skip test_fma_zero_result on NetBSD due to IEE 754-2008 implementation issues (#125151)
Skip test_fma_zero_result on NetBSD due to IEE 754-2008 implementation issues
2024-10-09 10:40:06 +02:00
Jelle Zijlstra 78406382c9
gh-101552: Allow pydoc to display signatures in source format (#124669)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-10-09 05:03:53 +00:00