Commit Graph

124039 Commits

Author SHA1 Message Date
RUANG (Roy James) 546dddca43
gh-125234: Make PyInitConfig_Free(NULL) a no-op (#125266) 2024-10-15 09:21:16 +00:00
Serhiy Storchaka 92af191a6a
gh-53203: Fix strptime() tests for %X on glibc < 2.29 (#125469) 2024-10-15 11:05:40 +03:00
Hugo van Kemenade 66064c342c
gh-123299: Copyedit "What's New in Python 3.14" (#125438) 2024-10-15 10:39:15 +03:00
Mariusz Felisiak a2fe9ff11d
Doc: Update CVE URL (#125489) 2024-10-15 10:29:08 +03:00
Sam Gross 8d42e2d915
gh-125269: Use `AC_LINK_IF_ELSE` to detect if `-latomic` is needed (#125416)
We previously used `AC_RUN_IF_ELSE` with a short test program to detect
if `-latomic` is needed, but that requires choosing a specific default
value when cross-compiling because the test program is not run.
Some cross compilation targets like `wasm32-emscripten` do not support
`-latomic`, while other cross compilation targets, like
`arm-linux-gnueabi` require it.
2024-10-14 20:09:48 -04: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
Steven Jin 1bffd7a2a7
gh-124944: Add socket.SO_ORIGINAL_DST (#124945) 2024-10-15 00:36:38 +02:00
edson duarte 2a5cdb2516
gh-85453: Improve variable mark up for datetime.rst (#120702)
Variables and literals are marked up using backticks.
2024-10-15 00:02:58 +02: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
sobolevn 0c8c665581
gh-125470: Fix warning in `Python/generated_cases.c.h` (#125471)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-10-14 23:46:17 +03: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
Mikhail Efimov 187580d95c
gh-119786: [doc] broken link and typo fix in interpreter_definition.md (#125455) 2024-10-14 17:24:54 +00:00
Paul Hoffman 5dac0dceda
gh-125461: Remove Python 2 from identifiers in doc (GH-125462)
Remove Python 2 from identifiers in doc
2024-10-14 15:26:57 +00:00
Thomas Grainger d5dbbf4372
gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959) 2024-10-14 08:19:56 -07:00
Mikhail Efimov 45df264f3f
gh-112088: aclocal version is updated to 1.16.5 in docs (#125457) 2024-10-14 16:53:08 +02:00
Bénédikt Tran c77121e9f1
gh-111178: fix USAN failures for `partialobject` (#124733) 2024-10-14 16:23:05 +02: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
Mark Shannon 06ca33020e
GH-125323: Convert DECREF_INPUTS_AND_REUSE_FLOAT into a function that takes PyStackRefs. (GH-125439) 2024-10-14 14:18:57 +01:00
Kumar Aditya 67f6e08147
gh-125139: use `_PyRecursiveMutex` in `_thread.RLock` (#125144) 2024-10-14 14:06:31 +05:30
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
Ken Jin 4b358ee647
gh-125323: Remove some unsafe Py_DECREFs in bytecodes.c, replacing them with PyStackRef_CLOSEs (GH-125324) 2024-10-14 09:17:51 +01: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
Sergey B Kirpichev cfc27bc50f
gh-123133: clarify p=0 case for "f" and "e" formatting types (GH-125426)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-13 21:44:48 -07:00
Sam Gross f1d33dbddd
gh-125243: Fix ZoneInfo data race in free threading build (#125281)
Lock `ZoneInfoType` to protect accesses to `ZONEINFO_STRONG_CACHE`.
Refactor the `tp_new` handler to use Argument Clinic so that we can just
use `@critical_section` annotations on the relevant functions.

Also use `PyDict_SetDefaultRef` instead of `PyDict_SetDefault` when
inserting into the `TIMEDELTA_CACHE`.
2024-10-13 16:17:51 -04: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
Sergey B Kirpichev c6d7b644c2
gh-101291: Add versionadded directives for PyUnstable_Long_* (#125384) 2024-10-13 19:38:42 +02:00
Kumar Aditya e79bbd147f
add Kumar Aditya as codeowner for weakref (#125405) 2024-10-13 16:59:27 +00:00
partev 6c386b703d
gh-125403: fix console formatting in Chapter 12 of the tutorial (#125404) 2024-10-13 22:16:15 +05:30
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
Kumar Aditya 08489325d1
gh-125161: return non zero value in pthread_self on wasi (#125303) 2024-10-13 20:59:41 +05:30
Kumar Aditya 022c50d190
fix comment in _PyMutex_TryUnlock (#125319) 2024-10-13 20:59:07 +05:30
Wulian 283ea5f3b2
gh-125383: Update `fib` function comment for accuracy (#125386)
`Doc/tutorial/controlflow.rst`: fix comment for `fib` function
2024-10-13 14:10:59 +03:00
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
Ruoyu Zhong a8fa4ad9e9
Doc: Fix suggested usage of `-X gil=0` in the glossary (#125366)
Currently, the "global interpreter lock" entry in the glossary mentions
that `-X gil 0` can be used to disable the GIL [1]. However, this is
invalid; the correct usage should be `-X gil=0`.

    $ python -X gil 0 -c 'print("Hello, world")'
    Fatal Python error: config_read_gil: PYTHON_GIL / -X gil must be "0" or "1"
    Python runtime state: preinitialized

    $ python -X gil=0 -c 'print("Hello, world")'
    Hello, world

[1]: https://docs.python.org/3/using/cmdline.html#cmdoption-X

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2024-10-13 01:53:28 +01:00
Richard Hansen 330c527299
gh-124872: Change PyContext_WatchCallback to take PyObject (#124737)
The PyContext struct is not intended to be public, and users of the
API don't need anything more specific than PyObject.  Also see
gh-78943.
2024-10-12 13:57:27 -07:00
Ghorban M. Tavakoly fa52b82c91
gh-125289: Update sample code in asyncio-task.rst (GH-125292)
* Update sample code in asyncio-task.rst

This will change **coroutines** sample code in the **Awaitables** section and make the example clearer.

* Update Doc/library/asyncio-task.rst

Revert the added print

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>

* Update Doc/library/asyncio-task.rst

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>

---------

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-12 13:38:13 -07:00
Stephen Rosen 4a2282b067
Prefer "similar" over "equivalent" in tutorial (#125343)
In the datastructures tutorial doc, some operations are described as
"equivalent to" others. This has led to some user-confusion -- at
least in the Discourse forums -- about cases in which the operations
differ.

This change doesn't systematically eliminate the word "equivalent"
from the tutorial. It just substitutes "similar to" in several cases
in which "equivalent to" could mislead users into expecting exact
equivalence.
2024-10-12 16:21:55 -04:00
Richard Hansen 62d5a53a0b
gh-124872: Move PyThreadState to first argument for consistency (#124774) 2024-10-12 12:33:00 -07: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 07c2d15977
gh-85935: Explicitly document the case nargs=0 in argparse (GH-125302) 2024-10-12 11:53:00 +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