Commit Graph

9698 Commits

Author SHA1 Message Date
Mikhail Efimov 079875e395
gh-125038: Fix crash after genexpr.gi_frame.f_locals manipulations (#125178) 2024-10-22 09:00:25 -07:00
Serhiy Storchaka 759a54d28f
gh-125355: Rewrite parse_intermixed_args() in argparse (GH-125356)
* The parser no longer changes temporarily during parsing.
* Default values are not processed twice.
* Required mutually exclusive groups containing positional arguments are
  now supported.
* The missing arguments report now includes the names of all required
  optional and positional arguments.
* Unknown options can be intermixed with positional arguments in
  parse_known_intermixed_args().
2024-10-22 10:57:25 +00:00
Y5 d48cc82ed2
gh-124651: Quote template strings in `venv` activation scripts (GH-124712)
This patch properly quotes template strings in `venv` activation
scripts. This mitigates potential command injection.
2024-10-21 21:48:04 +01:00
Serhiy Storchaka dcc4fb2c90
gh-124969: Make locale.nl_langinfo(locale.ALT_DIGITS) returning a string again (GH-125774)
This is a follow up of GH-124974. Only Glibc needed a fix.
Now the returned value is a string consisting of semicolon-separated
symbols on all Posix platforms.
2024-10-21 18:54:12 +00:00
Serhiy Storchaka 5ca4e34bc1
gh-125767: Fix pickling and copying of super objects (GH-125781)
Previously, copying a super object returned a copy of the instance
invoking super(). Pickling a super object could pickle the instance
invoking super() or fail, depending on its type and protocol.

Now deep copying returns a new super object and pickling pickles the super
object. Shallow copying returns the same super object.
2024-10-21 21:30:45 +03:00
Tian Gao 5b7a872b26
gh-125590: Allow FrameLocalsProxy to delete and pop keys from extra locals (#125616) 2024-10-21 11:43:08 -04:00
Sam Gross 5989eb7446
gh-125608: Trigger dictionary watchers when inline values change (#125611)
Dictionary watchers on an object's attributes dictionary
(`object.__dict__`) were not triggered when the managed dictionary used
the object's inline values.
2024-10-21 08:23:38 -04:00
Alex Waygood c5c21fee7a
gh-125519: Improve traceback if `importlib.reload()` is called with a non-module object (#125520) 2024-10-21 07:53:21 +01:00
Tian Gao 8f5e39d5c8
gh-125378: Trigger a repeat for the full multi-line statement for empty line command (#125717) 2024-10-19 17:46:57 -04:00
Peter Bierma 4c53b25775
gh-124984: Enhance `ssl` thread safety (#124993)
Make SSL objects thread safe in Free Theaded build by
using critical sections.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-19 23:16:36 +02:00
Julien 2a378dba98
gh-125398: Convert paths in venv activate script when using Git Bash under Windows (GH-125399)
* Convert paths in venv activate script when using Git Bash under Windows

With https://github.com/python/cpython/pull/112508 the check to converts paths when running on Windows was changed from using the non-posix environment variable `$OSTYPE` to using `uname` instead.

However this missed the fact that when running under Git Bash on Windows, uname reports `MINGW*` (`$OSTYPE` is still `msys`).

This results in `$PATH` being set to something like `D:\a\github-actions-shells\github-actions-shells\venv/Scripts:…`, instead of `/d/a/github-actions-shells/github-actions-shells/venv/Scripts`.

Notably, the Git Bash is the bash shell that’s used for GitHub Actions Windows runners, and ships with VSCode.
2024-10-19 18:34:41 +01:00
Serhiy Storchaka a7443a1735
gh-52551: Use wcsftime() to implement time.strftime() on Windows (GH-125658) 2024-10-19 11:29:51 +03:00
Adam Turner 2bb7ab7ad3
GH-125277: Increase minimum supported Sphinx to 7.2.6 (#125368) 2024-10-19 04:59:22 +01:00
Pablo Galindo Salgado f8ba9fb2ce
gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (#125704) 2024-10-18 17:09:34 +01:00
Nice Zombies df751363e3
gh-125660: Reject invalid unicode escapes for Python implementation of JSON decoder (GH-125683) 2024-10-18 15:29:47 +03:00
Nice Zombies d358425e69
gh-125682: Reject non-ASCII digits in the Python implementation of JSON decoder (GH-125687) 2024-10-18 15:26:29 +03:00
Tian Gao 77cebb1ce9
gh-125600: Only show stale code warning on source code display commands (#125601) 2024-10-17 20:29:11 -04:00
Sam Gross d8c8648161
gh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on Windows (#125546) 2024-10-17 20:10:55 +02:00
chrysn b454662921
gh-118986: expose `socket.IPV6_RECVERR` (#118987) 2024-10-17 20:49:12 +03:00
Jelle Zijlstra f203d1cb52
gh-125017: Fix crash on premature access to classmethod/staticmethod annotations (#125636) 2024-10-17 09:45:25 -07:00
George Pittock 04d6dd23e2
gh-113570: reprlib.repr does not use builtin __repr__ for reshadowed builtins (GH-113577) 2024-10-17 16:34:37 +00:00
Serhiy Storchaka ad3eac1963
gh-52551: Fix encoding issues in strftime() (GH-125193)
Fix time.strftime(), the strftime() method and formatting of the
datetime classes datetime, date and time.

* Characters not encodable in the current locale are now acceptable in
  the format string.
* Surrogate pairs and sequence of surrogatescape-encoded bytes are no
  longer recombinated.
* Embedded null character no longer terminates the format string.

This fixes also gh-78662 and gh-124531.
2024-10-17 15:46:59 +00:00
Wulian c124577ebe
gh-123370: Fix the canvas not clearing after running turtledemo.clock (#123457)
Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
2024-10-17 11:23:37 -04:00
Savannah Ostrowski 7b04496e5c
gh-125542: Deprecate prefix_chars in ArgumentParser.add_argument_group() (GH-125563) 2024-10-17 09:11:47 +00:00
Savannah Ostrowski 624be8699a
GH-99749: Add optional feature to suggest correct names (ArgumentParser) (GH-124456) 2024-10-17 10:07:37 +03:00
Eric Snow a5a7f5e16d
gh-124694: Add concurrent.futures.InterpreterPoolExecutor (gh-124548)
This is an implementation of InterpreterPoolExecutor that builds on ThreadPoolExecutor.

(Note that this is not tied to PEP 734, which is strictly about adding a new stdlib module.)

Possible future improvements:

* support passing a script for the initializer or to submit()
* support passing (most) arbitrary functions without pickling
* support passing closures
* optionally exec functions against __main__ instead of the their original module
2024-10-16 16:50:46 -06:00
Steve Dower 8e7b2a1161
gh-125550: Enable py.exe to detect Store installs of 3.14 (GH-125551) 2024-10-16 23:05:20 +01:00
Vincent Fazio aecbc2e6f4
gh-115382: Fix cross compiles when host and target use same SOABI
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-10-16 23:01:42 +01:00
Sam Gross 760872efec
gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (#125492)
There was a deadlock when `ProcessPoolExecutor` shuts down at the same
time that a queueing thread handles an error processing a task.

Don't use `_shutdown_lock` to protect the `_ThreadWakeup` pipes -- use
an internal lock instead. This fixes the ordering deadlock where the
`ExecutorManagerThread` holds the `_shutdown_lock` and joins the
queueing thread, while the queueing thread is attempting to acquire the
`_shutdown_lock` while closing the `_ThreadWakeup`.
2024-10-16 11:39:17 -04:00
Diego Russo feda9aa73a
gh-125444: Fix illegal instruction for older Arm architectures (#125574)
On Arm v5 it is not possible to get the thread ID via c13 register
hence the illegal instruction. The c13 register started to provide
thread ID since Arm v6K architecture variant. Other variants of
Arm v6 (T2, Z and base) don’t provide the thread ID via c13.
For the sake of simplicity we group v5 and v6 together and
consider that instructions for Arm v7 only.
2024-10-16 09:13:07 -04:00
Hugo van Kemenade 37e533a397 Merge remote-tracking branch 'upstream/main' 2024-10-16 01:13:48 +03:00
Tian Gao 12eaadc0ad
gh-58956: Set f_trace on frames with breakpoints after setting a new breakpoint (#124454) 2024-10-15 15:56:33 -04:00
Hugo van Kemenade 8cdaca8b25 Python 3.14.0a1 2024-10-15 22:34:54 +03:00
Tian Gao 9c2bb7d551
gh-125115: Pass unknown pdb command line args to script instead of fail (#125424)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-10-15 15:30:28 -04:00
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
Sam Gross 54c6fcbefd
gh-124375: Avoid calling `_PyMem_ProcessDelayed` on other thread states (#124459)
This fixes a crash when running the PyO3 test suite on the free-threaded
build. The `qsbr` field is initialized after the `PyThreadState` is
added to the interpreter's linked list -- it might still be NULL.

Instead, we "steal" the queue of to-be-freed memory blocks. This is
always initialized (possibly empty) and protected by the stop the world
pause.
2024-10-15 16:09:35 +00:00
Tian Gao bb9604b62a
gh-100141: Allow pdb to deal with empty file (#125425) 2024-10-15 11:45:23 -04: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
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
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
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
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
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
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 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
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
Y5 b3aa1b5fe2
gh-125235: Keep `_tkinter` TCL paths pointing to base installation on Windows (#125250)
Signed-off-by: y5c4l3 <y5c4l3@proton.me>
2024-10-11 11:08:03 +02: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
Sam Gross b12e99261e
gh-125221: Fix free-threading data race in `object.__reduce_ex__` (#125267) 2024-10-11 13:26:01 +05:30
Richard Hansen 2f8301cbfb
gh-124872: Rename blurb file to reference the correct issue (#125285) 2024-10-11 03:39:17 +01: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
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
Richard Hansen 99400930ac
gh-124872: Refine contextvars documentation (#124773)
* Add definitions for "context", "current context", and "context
    management protocol".
  * Update related definitions to be consistent with the new
    definitions.
  * Restructure the documentation for the `contextvars.Context` class
    to prepare for adding context manager support, and for consistency
    with the definitions.
  * Use `testcode` and `testoutput` to test the `Context.run` example.
  * Expand the documentation for the `Py_CONTEXT_EVENT_ENTER` and
    `Py_CONTEXT_EVENT_EXIT` events to clarify and to prepare for
    planned changes.
2024-10-09 16:44:03 -07: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
Eric Snow f2cb399470
gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865)
Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785.
2024-10-09 11:32:16 -06: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
Alex Waygood 3024b16d51
gh-101100: Consolidate documentation on `ModuleType` attributes (#124709)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-09 10:53:57 +00: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
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
Sergey B Kirpichev eafd14fbe0
gh-116110: remove extra processing for the __signature__ attribute (GH-116234)
This is an alternative to GH-100168.
2024-10-08 12:36:03 -07:00
Victor Stinner 65ce228d63
gh-125096: Don't import _pyrepl in site if PYTHON_BASIC_REPL (#125097)
If the PYTHON_BASIC_REPL environment variable is set, the site module
no longer imports the _pyrepl module.

Moreover, the site module now respects -E and -I command line
options: ignore PYTHON_BASIC_REPL in this case.
2024-10-08 15:48:40 +02:00
Bénédikt Tran e4292c0410
gh-123961: Convert _curses to a multi-phase init module (PEP-489) (#124965) 2024-10-08 13:42:44 +02:00
Bénédikt Tran ba14dfafd9
gh-123378: fix a crash in `UnicodeError.__str__` (#124935) 2024-10-08 13:37:59 +02:00
Alyssa Coghlan 7c4b6a68f2
bpo-34206: Improve docs and test coverage for pre-init functions (#8023)
- move the Py_Main documentation from the very high level API section
  to the initialization and finalization section
- make it clear that it encapsulates a full Py_Initialize/Finalize
  cycle of its own
- point out that exactly which settings will be read and applied
  correctly when Py_Main is called after a separate runtime
  initialization call is version dependent
- be explicit that Py_IsInitialized can be called prior to
  initialization
- actually test that Py_IsInitialized can be called prior to
  initialization
- flush stdout in the embedding tests that run code so it appears
  in the expected order when running with "-vv"
- make "-vv" on the subinterpreter embedding tests less spammy

---------

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-08 08:34:11 +00:00
Serhiy Storchaka 93b9e6bd7d
gh-69998: Fix decoding error in locale.nl_langinfo() (GH-124963)
The function now sets temporarily the LC_CTYPE locale to the locale
of the category that determines the requested value if the locales are
different and the resulting string is non-ASCII.
This temporary change affects other threads.
2024-10-08 11:27:49 +03:00
Alyssa Coghlan 27390990fa
gh-70870: Clarify dual usage of 'free variable' (#122545)
The term "free variable" has unfortunately become genuinely
ambiguous over the years (presumably due to the names of
some relevant code object instance attributes).

While we can't eliminate that ambiguity at this late date, we can
at least alert people to the potential ambiguity by describing
both the formal meaning of the term and the common
alternative use as a direct synonym for "closure variable".

---------

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-08 07:52:12 +00:00
Cody Maloney cc9b9bebb2
gh-90102: Remove isatty call during regular open (#124922)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-10-08 08:50:42 +02:00
Victor Stinner a7f0727ca5
gh-124502: Add PyUnicode_Equal() function (#124504) 2024-10-07 21:24:53 +00:00
Zhikang Yan c5df1cb7bd
gh-122392: IDLE - Fix overlapping lines in browsers (#122392) (#124975)
Increase currently inadequate vertical spacing for the IDLE browsers (path,
module, and stack) on high-resolution monitors.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-10-07 14:52:09 -04:00
Bénédikt Tran 7ffe94fb24
gh-124653: Relax (again) detection of queue API for logging handlers (GH-124897) 2024-10-07 19:42:19 +01:00
Alyssa Coghlan cda3b5a576
gh-125018: Add importlib.metadata semantic link targets (#125027)
This allows direct intersphinx references to APIs via references
like `` :func:`importlib.metadata.version` ``.

---------

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-10-07 23:44:18 +10:00
Sergey B Kirpichev 7487db4c7a
gh-121249: Support _Complex types in the struct module (#121613)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-10-07 13:53:02 +02:00
Tomas R. db23b8bb13
gh-125008: Fix `tokenize.untokenize` roundtrip for `\n{{` (#125013) 2024-10-06 15:16:41 +02:00
Tian Gao adfe7657a3
gh-124552 : Improve the accuracy of possible breakpoint check in bdb (#124553) 2024-10-04 21:32:57 -04:00
morotti 6efd95c465
gh-117151: increase default buffer size of shutil.copyfileobj() to 256k. (GH-119783)
* gh-117151: increase default buffer size of shutil.copyfileobj() to 256k.

it was set to 16k in the 1990s.
it was raised to 64k in 2019. the discussion at the time mentioned another 5% improvement by raising to 128k and settled for a very conservative setting.

it's 2024 now, I think it should be revisited to match modern hardware. I am measuring 0-15% performance improvement when raising to 256k on various types of disk. there is no downside as far as I can tell.

this function is only intended for sequential copy of full files (or file like objects). it's the typical use case that benefits from larger operations.

for reference, I came across this function while trying to profile pip that is using it to copy files when installing python packages.

* add news

---------

Co-authored-by: rmorotti <romain.morotti@man.com>
2024-10-04 16:51:22 -07:00
Irit Katriel f474391b26
gh-124871: fix 'visited' tracking in compiler's reachability analysis (#124952) 2024-10-04 17:37:38 +01:00
Bénédikt Tran f66d785861
gh-123961: Convert `curses.window` static type into a heap type (#124934) 2024-10-04 11:58:34 +02:00
Thomas Grainger c066bf5535
gh-124858: fix happy eyeballs refcyles (#124859) 2024-10-02 16:32:31 -07:00
Brandt Bucher 6810928927
GH-118093: Don't lose confidence when tracing through 100% biased branches (GH-124813) 2024-10-02 19:24:37 +00:00
Diego Russo b85923a0fe
GH-119726: Deduplicate AArch64 trampolines within a trace (GH-123872) 2024-10-02 12:07:20 -07:00
Jeremy Maitin-Shepard 8cc5aa47ee
gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805)
Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-10-02 09:17:49 -07:00
Peter Bierma c2ba931318
gh-120378: Fix crash caused by integer overflow in `curses` (#124555)
This is actually an upstream problem in curses, and has been reported
to them already:
https://lists.gnu.org/archive/html/bug-ncurses/2024-09/msg00101.html

This is a nice workaround in the meantime to prevent the segfault.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-02 14:31:23 +00:00
Serhiy Storchaka 9b31a2d83f
gh-58282: Fix support of tuple metavar for positional arguments in argparse (GH-124782)
Previously, formatting help output or error message for positional argument
with a tuple metavar raised exception.

Co-authored-by: Cyker Way <cykerway@gmail.com>
2024-10-02 11:28:02 +03:00