Commit Graph

29849 Commits

Author SHA1 Message Date
Zachary Ware d2eafe2f48
gh-123418: Update OpenSSL to 3.0.15 on Windows (GH-123673) 2024-09-04 17:08:02 +00:00
Bar Harel a4562fedad
gh-123321: Fix Parser/myreadline.c to prevent a segfault during a multi-threaded race (#123323) 2024-09-04 17:21:30 +02:00
Nice Zombies c530ce1e9d
gh-118710: Make IPv*Address.version & max_prefixlen available on the class (GH-120698) 2024-09-04 15:51:12 +02:00
Victor Stinner 0d6b6e34a2
gh-107954, PEP 741: Add PyInitConfig_AddModule() function (#123668) 2024-09-04 11:41:57 +00:00
Wulian 7bd964dbbe
gh-121423: Improve import time of `socket` (#121424)
Improve import time of `socket` by writing `socket.errorTab`
as a constant and lazy import modules.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-09-04 12:00:37 +02:00
Peter Bierma a8bc03696c
gh-123504: Fix reference leak in finalization of `_tkinter` (#123505) 2024-09-03 20:35:57 +00:00
devdanzin 782217f28f
gh-123572: Fix key codes in VK_MAP in windows_console.py (#122692) 2024-09-03 13:01:21 +00:00
Sergey B Kirpichev 6822cb23c6
gh-121804: always show error location for SyntaxError's in basic repl (#123202) 2024-09-03 12:37:29 +00:00
Victor Stinner ef9d54703f
gh-107954, PEP 741: Add PyInitConfig C API (#123502)
Add Doc/c-api/config.rst documentation.
2024-09-03 12:33:49 +00:00
Yorik Hansen 9684f40b9f
gh-123430: Add dark mode support to pages generated by http.server (#123475)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-03 09:32:11 +03:00
Inada Naoki 13f61bf7f1
gh-121313: multiprocessing: simplify by increasing the connection buffer size to 64KiB (GH-123559)
Increases the multiprocessing connection buffer size from 8k to 64k for efficiency, without overallocating.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-02 20:32:38 -07:00
Victor Stinner 33b790978d
gh-107954, PEP 741: Add PyConfig_Get()/Set() functions (#123472)
Add PyConfig_Get(), PyConfig_GetInt(), PyConfig_Set() and
PyConfig_Names() functions to get and set the current runtime Python
configuration.

Add visibility and "sys spec" to config and preconfig specifications.

_PyConfig_AsDict() now converts PyConfig.xoptions as a dictionary.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-02 23:25:08 +02:00
Barney Gale 5002f17794
GH-119518: Stop interning strings in pathlib GH-123356)
Remove `sys.intern(str(x))` calls when normalizing a path in pathlib. This
speeds up `str(Path('foo/bar'))` by about 10%.
2024-09-02 18:14:09 +02:00
Bénédikt Tran 77a2fb4bf1
gh-123409: fix `IPv6Address.reverse_pointer` for IPv4-mapped addresses (GH-123419)
Fix functionality that was broken with better textual representation for IPv4-mapped addresses (gh-87799)
2024-09-02 17:05:05 +02:00
Donghee Na f95fc4de11
gh-101525: Skip test_gdb if the binary is relocated by BOLT. (gh-118572) 2024-09-02 13:24:53 +00:00
sobolevn 23f159ae71
gh-123562: Improve `SyntaxError` message for `case ... as a.b` (#123563) 2024-09-02 13:11:44 +02:00
Yoda 42a818912b
gh-123341: Support `tkinter.Event` type subcript (#123353)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-09-01 12:47:07 +01:00
Wei-Hsiang (Matt) Wang cf472577e2
gh-123517: Remove unnecessary ``:meth:`` parentheses (#123518) 2024-09-01 05:59:42 +01:00
Seth Michael Larson 34ddb64d08
gh-121285: Remove backtracking when parsing tarfile headers (GH-121286)
* Remove backtracking when parsing tarfile headers
* Rewrite PAX header parsing to be stricter
* Optimize parsing of GNU extended sparse headers v0.0

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-08-31 15:17:05 -07:00
Serhiy Storchaka 5414b97ce2
gh-123309: Remove check for redefined memo entry in pickletools.dis() (GH-123374)
Such pickles are supported by the Unpickler even if the Pickler does not
produce them.
2024-08-31 16:21:49 +03:00
Serhiy Storchaka fc897fcc01
gh-76960: Fix urljoin() and urldefrag() for URIs with empty components (GH-123273)
* urljoin() with relative reference "?" sets empty query and removes fragment.
* Preserve empty components (authority, params, query, fragment) in urljoin().
* Preserve empty components (authority, params, query) in urldefrag().

Also refactor the code and get rid of double _coerce_args() and
_coerce_result() calls in urljoin(), urldefrag(), urlparse() and
urlunparse().
2024-08-31 12:42:08 +03:00
Oded Arbel 10bf615bab
gh-108172: do not override OS preferred browser if it is a super-string of a known browser (GH-113011)
When checking if the registering browser is the "OS preferred browser", do not use a substring search - that makes no sense: one can have a preferred browser that looks like a super-string of a known browser, e.g. "firefox-nightly" vs "firefox".

https://github.com/python/cpython/issues/108172 explains in more detail, and lays out a potential better future enhancement for this case of just using xdg-open.  We'll go with this for now.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-08-30 23:11:57 -07:00
Alexander P. 74bfb53e3a
gh-121313: Limit the reading size from pipes to their default buffer size on POSIX systems (GH-121315)
See https://github.com/python/cpython/issues/121313 for analysis, but this greatly reduces memory overallocation and overhead when multiprocessing is sending non-small data over its pipes between processes.
2024-08-30 22:57:22 -07:00
sobolevn e451a8937d
gh-123440: Improve error message for `except as` used with not a name (#123442) 2024-08-30 17:21:59 +01:00
Victor Stinner d8e69b2c1b
gh-122854: Add Py_HashBuffer() function (#122855) 2024-08-30 15:42:27 +00:00
Victor Stinner 3d60dfbe17
gh-121645: Add PyBytes_Join() function (#121646)
* Replace _PyBytes_Join() with PyBytes_Join().
* Keep _PyBytes_Join() as an alias to PyBytes_Join().
2024-08-30 12:57:33 +00:00
Matt Wozniski 7fca268bee
gh-123484: Fix the debug offsets for PyLongObject (#123485) 2024-08-30 12:39:28 +01:00
Wei-Hsiang (Matt) Wang 103a0470e3
gh-123492: Remove unnecessary `:func:` parentheses (#123493) 2024-08-30 14:34:09 +03:00
sobolevn f8a736b8e1
gh-123446: Fix empty function names in `TypeError`s in `typeobject` (#123470) 2024-08-30 10:36:51 +03:00
Serhiy Storchaka 32c7dbb2bc
gh-121485: Always use 64-bit integers for integers bits count (GH-121486)
Use 64-bit integers instead of platform specific size_t or Py_ssize_t
to represent the number of bits in Python integer.
2024-08-30 08:13:24 +03:00
sobolevn 303f92a9ce
gh-123446: Fix empty function names in `TypeError`s in `_csv` module (#123461) 2024-08-29 06:53:57 +00:00
Peter Bierma c9930f5022
gh-123448: Move `_PyNoDefault_Type` to the static types array (#123449) 2024-08-28 18:27:40 -07:00
Bogdan Romanyuk be083cee34
gh-123344: Add missing ast optimizations for PEP 696 (#123377)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-08-28 06:38:56 -07:00
Wulian 9e108b8719
Fix typos in docs, error messages and comments (#123336)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-08-28 14:41:04 +03:00
Victor Stinner 4c6dca8292
gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390)
Add new functions to convert C <stdint.h> numbers from/to Python int:

* PyLong_FromInt32()
* PyLong_FromUInt32()
* PyLong_FromInt64()
* PyLong_FromUInt64()
* PyLong_AsInt32()
* PyLong_AsUInt32()
* PyLong_AsInt64()
* PyLong_AsUInt64()
2024-08-28 10:16:13 +00:00
Alexandr Mitin 6a7765b9fa
gh-123363: Show string value of CONTAINS_OP oparg in dis (#123387)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-08-28 09:15:34 +03:00
Jason R. Coombs 2231286d78
gh-123270: Replaced SanitizedNames with a more surgical fix. (#123354)
Applies changes from zipp 3.20.1 and jaraco/zipp#124
2024-08-27 17:10:30 -04:00
Pieter Eendebak 7e38e6745d
gh-123271: Make builtin zip method safe under free-threading (#123272)
The `zip_next` function uses a common optimization technique for methods
that generate tuples. The iterator maintains an internal reference to
the returned tuple. When the method is called again, it checks if the
internal tuple's reference count is 1. If so, the tuple can be reused.
However, this approach is not safe under the free-threading build:
after checking the reference count, another thread may perform the same
check and also reuse the tuple. This can result in a double decref on
the items of the replaced tuple and a double incref (memory leak) on
the items of the tuple being set.

This adds a function, `_PyObject_IsUniquelyReferenced` that
encapsulates the stricter logic necessary for the free-threaded build:
the internal tuple must be owned by the current thread, have a local
refcount of one, and a shared refcount of zero.
2024-08-27 15:22:43 -04:00
Kumar Aditya 03f5abf15a
gh-123089: Make weakref.WeakSet safe against concurrent mutations while it is being iterated (#123279)
* Make `weakref.WeakSet` safe against concurrent mutations while it is being iterated.

`_IterationGuard` is no longer used for `WeakSet`, it now relies on copying the underlying set which is an atomic operation while iterating so that it can be modified by other threads.
2024-08-27 13:04:03 +00:00
sobolevn 1eed0f968f
gh-123340: Show string value of `IS_OP` oparg in `dis` (#123348) 2024-08-26 21:59:50 +03:00
Barney Gale 033d537cd4
GH-73991: Make `pathlib.Path.delete()` private. (#123315)
Per feedback from Paul Moore on GH-123158, it's better to defer making
`Path.delete()` public than ship it with under-designed error handling
capabilities.

We leave a remnant `_delete()` method, which is used by `move()`. Any
functionality not needed by `move()` is deleted.
2024-08-26 16:26:34 +01:00
Barney Gale c68a93c582
GH-73991: Add `pathlib.Path.copy_into()` and `move_into()` (#123314)
These two methods accept an *existing* directory path, onto which we join
the source path's base name to form the final target path.

A possible alternative implementation is to check for directories in
`copy()` and `move()` and adjust the target path, which is done in several
`shutil` functions. This behaviour is helpful in a shell context, but
less so in a stored program that explicitly specifies destinations. For
example, a user that calls `Path('foo.py').copy('bar.py')` might not
imagine that `bar.py/foo.py` would be created, but under the alternative
implementation this will happen if `bar.py` is an existing directory.
2024-08-26 14:14:23 +01:00
Matt Wozniski 602fcf97df
gh-123177: Fix prompt for wrapped lines in pyrepl (#123324)
When display lines above the cursor come from the cache, the first line
to not come from the cache may be a wrapped line, starting half way
through a logical line in the buffer. Detect and handle this case to
avoid accidentally drawing a stray prompt in the middle of a logical
line.
2024-08-25 22:54:06 +00:00
Pablo Galindo Salgado fdb3f9b588
gh-123177: Deactivate line wrap for Apple Terminal via scape codes in the new REPL (#123267) 2024-08-25 22:38:49 +01:00
Pablo Galindo Salgado c535a49e92
gh-123297: Propagate LD_FLAGS to LDCXXSHARED in sysconfig (#123298) 2024-08-25 21:01:58 +01:00
Kirill Podoprigora 249b083ed8
gh-122982: Extend the deprecation period for bool inversion by two years (#123306) 2024-08-25 12:24:44 -07:00
Barney Gale 625d0705b9
GH-73991: Add `pathlib.Path.move()` (#122073)
Add a `Path.move()` method that moves a file or directory tree, and returns a new `Path` instance pointing to the target.

This method is similar to `shutil.move()`, except that it doesn't accept a *copy_function* argument, and it doesn't check whether the destination is an existing directory.
2024-08-25 16:51:51 +01:00
Shantanu 52caaef6d0
Revert "GH-120754: Add a strace helper and test set of syscalls for o… (#123303)
Revert "GH-120754: Add a strace helper and test set of syscalls for open().read() (#121143)"

This reverts commit e38d0afe35.
2024-08-24 21:54:31 +00:00
Cody Maloney e38d0afe35
GH-120754: Add a strace helper and test set of syscalls for open().read() (#121143) 2024-08-24 13:42:41 -07:00
Sergey B Kirpichev ca18ff2a34
gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (#123281)
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
2024-08-24 17:46:05 +02:00
neonene 5ff638f1b5
gh-123243: Fix reference leak in `_decimal` (#123244) 2024-08-24 09:37:01 +05:30
blhsing 126910edba
gh-122272: Guarantee specifiers %F and %C for datetime.strftime to be 0-padded (GH-122436) 2024-08-23 18:45:03 +03:00
Mark Shannon 7cd3aa42f0
GH-122298: Restore printing of GC stats (GH-123261) 2024-08-23 16:39:08 +01:00
Pablo Galindo Salgado adc5190014
gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (#123263)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-08-23 12:33:45 +00:00
Bar Harel 90b6d0e0f8
gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214) 2024-08-23 12:12:58 +03:00
Donghee Na 297f2e093e
gh-123083: Fix a potential use-after-free in ``STORE_ATTR_WITH_HINT`` (gh-123092) 2024-08-22 23:49:09 +09:00
Sergey B Kirpichev 3d7b1a526d
gh-122546: use same filename for different exceptions in new repl (#123217)
* gh-122546: use same filename for different exceptions in new repl

* +1
2024-08-22 12:55:30 +01:00
Irit Katriel ec89620e5e
gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (#123173) 2024-08-21 19:12:05 +01:00
Mark Shannon a4fd7aa4a6
GH-115776: Allow any fixed sized object to have inline values (GH-123192) 2024-08-21 15:52:04 +01:00
Bénédikt Tran b1d3bd2e09
gh-123165: make `dis` functions render positions on demand (#123168) 2024-08-21 14:46:24 +01:00
Serhiy Storchaka 90c892efea
gh-85110: Preserve relative path in URL without netloc in urllib.parse.urlunsplit() (GH-123179) 2024-08-21 10:17:38 +03:00
Peter Bierma 9dbd123755
gh-123084: Turn `shutil.ExecError` into a deprecated alias of `RuntimeError` (#123125) 2024-08-21 00:39:24 +00:00
Serhiy Storchaka f88c14d412
gh-122981: Fix inspect.getsource() for generated classes with Python base classes (GH-123001)
Look up __firstlineno__ only in the class' dict, without searching in
base classes.
2024-08-20 20:10:15 +03:00
Mark Shannon bb1d30336e
GH-118093: Make `CALL_ALLOC_AND_ENTER_INIT` suitable for tier 2. (GH-123140)
* Convert CALL_ALLOC_AND_ENTER_INIT to micro-ops such that tier 2 supports it

* Allow inexact arguments for CALL_ALLOC_AND_ENTER_INIT.
2024-08-20 16:52:58 +01:00
Irit Katriel bffed80230
gh-123048: Fix missing source location in pattern matching code (#123167) 2024-08-20 11:39:41 +01:00
Jeremy Hylton 77133f570d
gh-122909: Pass ftp error strings to URLError constructor (#122913)
* pass the original string error message from the ftplib error to URLError()

* Update request.py

Change error string for ftp error to be consistent with other errors reported for ftp

* Add NEWS entry for change to urllib.request for ftp errors.

* Track the change in the ftp error message in the test.
2024-08-20 00:35:05 +00:00
Pablo Galindo Salgado 48856ead6a
gh-123123: Fix display of syntax errors covering multiple lines (#123131)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-08-19 15:09:03 +00:00
Sergey B Kirpichev 354d55eb1f
gh-121804: Always show error location for SyntaxError's in new repl (#121886) 2024-08-19 15:19:23 +01:00
Sergey B Kirpichev b9e10d1a0f
gh-122081: fixed crash in decimal.IEEEContext() (#122082)
* gh-122081: fixed crash in decimal.IEEEContext()

Now

$ ./configure CFLAGS=-DEXTRA_FUNCTIONALITY -q && make -s && \
     ./python -m test test_decimal

- PASS

* Apply suggestions from code review

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Update Misc/NEWS.d/next/Library/2024-07-21-10-45-24.gh-issue-122081.dNrYMq.rst

* Apply suggestions from code review

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-08-19 07:51:38 +00:00
Pedro Lacerda be257c5815
gh-123049: configparser: Allow to create the unnamed section from scratch. (#123077)
---------

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-08-18 15:52:25 -04:00
CF Bolz-Tereick 63603bca35
gh-82378 fix sys.tracebacklimit in pyrepl, approach 2 (#123062)
Make sure that pyrepl uses the same logic for sys.tracebacklimit as both
the basic repl and the standard sys.excepthook
2024-08-18 13:28:23 +02:00
Sam Gross d061ffea7b
gh-123022: Fix crash with `Py_Initialize` in background thread (#123052)
Check that the current default heap is initialized in
`_mi_os_get_aligned_hint` and `mi_os_claim_huge_pages`.

The mimalloc function `_mi_os_get_aligned_hint` assumes that there is an
initialized default heap. This is true for our main thread, but not for
background threads. The problematic code path is usually called during
initialization (i.e., `Py_Initialize`), but it may also be called if the
program allocates large amounts of memory in total.

The crash only affected the free-threaded build.
2024-08-17 16:04:08 -04:00
Serhiy Storchaka 44e458357f
gh-123067: Fix quadratic complexity in parsing "-quoted cookie values with backslashes (GH-123075)
This fixes CVE-2024-7592.
2024-08-17 16:30:52 +03:00
Cody Maloney 35d8ac7cd7
GH-120754: Disable buffering in Path.read_bytes (#122111)
`Path.read_bytes()` is used to read a whole file. buffering /
BufferedIO is focused around making small, possibly interleaved,
read/write efficient which doesn't add value in this case.

On my Mac, running the benchmark:

```python
import pyperf
from pathlib import Path

def read_all(all_paths):
    for p in all_paths:
        p.read_bytes()

def read_file(path_obj):
    path_obj.read_bytes()

all_rst = list(Path("Doc").glob("**/*.rst"))
all_py = list(Path(".").glob("**/*.py"))
assert all_rst, "Should have found rst files"
assert all_py, "Should have found python source files"

runner = pyperf.Runner()
runner.bench_func("read_file_small", read_file, Path("Doc/howto/clinic.rst"))
runner.bench_func("read_file_large", read_file, Path("Doc/c-api/typeobj.rst"))
```

before:
```python
.....................
read_file_small: Mean +- std dev: 6.80 us +- 0.07 us
.....................
read_file_large: Mean +- std dev: 10.8 us +- 0.2 us
````

after:
```python
.....................
read_file_small: Mean +- std dev: 5.67 us +- 0.05 us
.....................
read_file_large: Mean +- std dev: 9.77 us +- 0.52 us
```
2024-08-16 13:52:41 -07:00
Mateusz Nowak 8ef358dae1
gh-118658: Return consistent types from `get_un/verified_chain` in `SSLObject` and `SSLSocket` (#118669)
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2024-08-16 22:27:44 +02:00
Mark Shannon c13e7d98fb
GH-118093: Specialize `CALL_KW` (GH-123006) 2024-08-16 17:11:24 +01:00
Brett Cannon b15b81ed4f
GH-121634: have `wasi.py` accept the host target triple as an argument (GH-123030) 2024-08-15 10:30:08 -07:00
Eddie Elizondo 3203a74129
gh-113190: Reenable non-debug interned string cleanup (GH-113601) 2024-08-15 11:55:09 +00:00
Nate Ohlson 1cf624be6d
gh-112301: Add warning count to warning check tooling (#122711)
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-08-15 00:03:53 +03:00
Jonathan Protzenko 325e9b8ef4
gh-99108: Add HACL* Blake2 implementation to hashlib (GH-119316)
This replaces the existing hashlib Blake2 module with a single implementation that uses HACL\*'s Blake2b/Blake2s implementations. We added support for all the modes exposed by the Python API, including tree hashing, leaf nodes, and so on. We ported and merged all of these changes upstream in HACL\*, added test vectors based on Python's existing implementation, and exposed everything needed for hashlib.

This was joint work done with @R1kM.

See the PR for much discussion and benchmarking details.   TL;DR: On many systems, 8-50% faster (!) than `libb2`, on some systems it appeared 10-20% slower than `libb2`.
2024-08-13 21:42:19 +00:00
Eric Snow ee1b8ce26e
gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952)
As of 529a160 (gh-118204), building with HAVE_DYNAMIC_LOADING stopped working.  This is a minimal fix just to get builds working again.  There are actually a number of long-standing deficiencies with HAVE_DYNAMIC_LOADING builds that need to be resolved separately.
2024-08-13 14:44:57 -06:00
Trey Hunner 906b796af8
gh-122873: Allow "python -m json" to work (#122884)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-08-13 17:09:38 +01:00
Mark Shannon fe23f8ed97
GH-122821: Simplify compilation of while statements to ensure consistency of offsets for sys.monitoring (GH-122934) 2024-08-13 10:25:44 +01:00
Brett Cannon 0e207f3e7a
GH-122578: update to WASI SDK 24 (GH-122960) 2024-08-12 16:21:00 -07:00
Brandt Bucher 9621a7d017
GH-118093: Handle some polymorphism before requiring progress in tier two (GH-122843) 2024-08-12 12:39:31 -07:00
Jelle Zijlstra 53ebb6232a
gh-122888: Fix crash on certain calls to str() (#122889)
Fixes #122888
2024-08-12 09:20:09 -07:00
Jason R. Coombs 6aa35f3002
gh-122903: Honor directories in zipfile.Path.glob. (#122908) 2024-08-11 20:33:33 -04:00
Jason R. Coombs 9cd0326310
gh-122905: Sanitize names in zipfile.Path. (#122906)
Ported from zipp 3.19.1; ref jaraco/zipp#119.
2024-08-11 19:48:50 -04:00
Barney Gale a6644d4464
GH-73991: Rework `pathlib.Path.copytree()` into `copy()` (#122369)
Rename `pathlib.Path.copy()` to `_copy_file()` (i.e. make it private.)

Rename `pathlib.Path.copytree()` to `copy()`, and add support for copying
non-directories. This simplifies the interface for users, and nicely
complements the upcoming `move()` and `delete()` methods (which will also
accept any type of file.)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-08-11 22:43:18 +01:00
Wulian bc9d92c679
gh-122858: Deprecate `asyncio.iscoroutinefunction` (#122875)
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-08-11 16:35:51 +00:00
Nico Mexis 5580f31c56
gh-115808: Add ``is_none`` and ``is_not_none`` to ``operator`` (#115814)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-08-10 20:16:34 +01:00
Victor Stinner d3239976a8
gh-105376: Restore deprecated logging warn() method (#122775)
This reverts commit dcc028d924 and
commit 6c54e5d721.

Keep the deprecated logging warn() method in Python 3.13.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-08-09 15:13:24 +02:00
Sergey B Kirpichev b6e745a27e
gh-121268: Remove workarounds for non-IEEE 754 systems in cmath (#122716)
As now building Python now requires support of IEEE 754 floating point
numbers.
2024-08-09 11:17:40 +02:00
Malcolm Smith 2f5c3b09e4
gh-116622: Rename build variable MODULE_LDFLAGS back to LIBPYTHON (#122764)
(LIBPYTHON was renamed MODULE_LDFLAGS in commit 7f5e3f04f.)
2024-08-09 00:00:55 +02:00
Miro Hrončok 8c9d1742de
GH-118943: Remove regen-jit from the regen-all make target (GH-122602)
Co-authored-by: Éric <merwok@netwok.org>
2024-08-08 13:34:42 -07:00
Sam Gross 2d9d3a9f53
gh-122697: Fix free-threading memory leaks at shutdown (#122703)
We were not properly accounting for interpreter memory leaks at
shutdown and had two sources of leaks:

 * Objects that use deferred reference counting and were reachable via
   static types outlive the final GC. We now disable deferred reference
   counting on all objects if we are calling the GC due to interpreter
   shutdown.

 * `_PyMem_FreeDelayed` did not properly check for interpreter shutdown
   so we had some memory blocks that were enqueued to be freed, but
   never actually freed.

 * `_PyType_FinalizeIdPool` wasn't called at interpreter shutdown.
2024-08-08 12:48:17 -04:00
Serhiy Storchaka 6094c6fc2f
gh-116263: Do not rollover empty files in RotatingFileHandler (GH-122788) 2024-08-08 09:48:11 +03:00
Erlend E. Aasland e006c7371d
gh-105201: Add PyIter_NextItem() (#122331)
Return -1 and set an exception on error; return 0 if the iterator is
exhausted, and return 1 if the next item was fetched successfully.

Prefer this API to PyIter_Next(), which requires the caller to use
PyErr_Occurred() to differentiate between iterator exhaustion and errors.

Co-authered-by: Irit Katriel <iritkatriel@yahoo.com>
2024-08-08 00:47:15 +02:00
Serhiy Storchaka 540fcc62f5
gh-118814: Fix the TypeVar constructor when name is passed by keyword (GH-122664)
Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
2024-08-07 23:30:10 +03:00
Serhiy Storchaka e73e7a7abd
gh-122478: Remove internal frames from tracebacks in REPL (GH-122528)
Frames of methods in code and codeop modules was show with non-default
sys.excepthook.

Save correct tracebacks in sys.last_traceback and update __traceback__
attribute of sys.last_value and sys.last_exc.
2024-08-07 23:20:57 +03:00
Hugo van Kemenade 42d9bec98f
gh-118761: Improve import time of `pprint` (#122725)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-08-07 22:46:54 +03:00
Lucas Esposito 0bd93755f3
gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047) 2024-08-07 16:07:26 +01:00
Ali Hamdan 013a092975
gh-121151: argparse: Fix wrapping of long usage text of arguments inside a mutually exclusive groups (GH-121159) 2024-08-07 15:20:38 +02:00
pukkandan 9e551f9b35
gh-79846: Make ssl.create_default_context() ignore invalid certificates (GH-91740)
An error in one certificate should not cause the whole thing to fail.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-08-07 11:30:30 +03:00
Barney Gale 98dba73010
GH-73991: Rework `pathlib.Path.rmtree()` into `delete()` (#122368)
Rename `pathlib.Path.rmtree()` to `delete()`, and add support for deleting
non-directories. This simplifies the interface for users, and nicely
complements the upcoming `move()` and `copy()` methods (which will also
accept any type of file.)
2024-08-07 01:34:44 +01:00
Victor Stinner 4767a6e31c
gh-122728: Fix SystemError in PyEval_GetLocals() (#122735)
Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.

Add an unit test on PyEval_GetLocals().
2024-08-06 23:01:44 +02:00
Pradyun Gedam 5b8a6c5186
gh-122744: Bump bundled pip to 24.2 (#122745)
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2024-08-06 18:38:33 +00:00
Sam Gross dc09301067
gh-122417: Implement per-thread heap type refcounts (#122418)
The free-threaded build partially stores heap type reference counts in
distributed manner in per-thread arrays. This avoids reference count
contention when creating or destroying instances.

Co-authored-by: Ken Jin <kenjin@python.org>
2024-08-06 14:36:57 -04:00
Nate Ohlson 58be1c270f
gh-112301: Add macOS warning tracking tooling (#122211)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-08-06 20:26:37 +03:00
Serhiy Storchaka 4b66b6b7d6
gh-120104: IDLE: Fix padding in config and search dialogs (#120107) 2024-08-06 12:45:53 -04:00
Malcolm Smith b0c48b8fd8
gh-116622: Android logging fixes (#122698)
Modifies the handling of stdout/stderr redirection on Android to accomodate 
the rate and buffer size limits imposed by Android's logging infrastructure.
2024-08-06 12:28:58 +08:00
Miro Hrončok 44659d3927
GH-118943: Handle races when moving jit_stencils.h (GH-120690)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-08-05 16:10:40 -07:00
Serhiy Storchaka 1bb955a2fe
gh-122459: Optimize pickling by name objects without __module__ (GH-122460) 2024-08-05 16:21:32 +03:00
Jonathan Protzenko d0b92dd5ca
gh-122573: Require Python 3.10 or newer for Windows builds (GH-122574)
Match statements in tooling require a more recent Python. Tools/cases_generator/*.py (and `Tools/jit/*.py` in 3.13+).

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-08-04 23:22:51 +00:00
Sergey B Kirpichev e6fad7a0e3
gh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj (#122638)
As per C11 DR#471, ctanh (0 + i NaN) and ctanh (0 + i Inf) should return
0 + i NaN (with "invalid" exception in the second case).  This has
corresponding implications for ctan(z), as its errors and special cases
are handled as if the operation is implemented by -i*ctanh(i*z).
This patch fixes cmath's code to do same.

Glibs patch: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d15e83c5f5231d971472b5ffc9219d54056ca0f1
2024-08-04 10:05:30 +01:00
Sergey B Kirpichev 3462a80d2c
gh-121889: cmath.acosh(0+nanj) returns nan+pi/2j (#121892)
As per C11 DR#471 (adjusted resolution accepted for C17), cacosh (0 +
iNaN) should return NaN ± i pi/2, not NaN + iNaN.  This patch
fixes cmath's code to do same.
2024-08-04 09:53:17 +01:00
Sam Gross 4b63cd170e
gh-122527: Fix a crash on deallocation of `PyStructSequence` (GH-122577)
The `PyStructSequence` destructor would crash if it was deallocated after
its type's dictionary was cleared by the GC, because it couldn't compute
the "real size" of the instance. This could occur with relatively
straightforward code in the free-threaded build or with a reference
cycle involving the type in the default build, due to differing orders
in which `tp_clear()` was called.

Account for the non-sequence fields in `tp_basicsize` and use that,
along with `Py_SIZE()`, to compute the "real" size of a
`PyStructSequence` in the dealloc function. This avoids the accesses to
the type's dictionary during dealloc, which were unsafe.
2024-08-02 18:11:44 +02:00
Irit Katriel 498376d7a7
gh-122445: populate only modified fields in __static_attributes__ (#122446) 2024-08-02 15:40:42 +01:00
neonene 9fc1c992d6
gh-122334: Fix crash when importing ssl after re-initialization (#122481)
* Fix crash when importing ssl after re-initialization
2024-08-02 19:06:20 +05:30
Bénédikt Tran fb864c76cd
gh-121723: Relax constraints on queue objects for `logging.handlers.QueueHandler`. (GH-122154) 2024-08-02 12:16:32 +01:00
John Riggles 5a7f7c4864
gh-120083: Add IDLE Hovertip foreground color needed for recent macOS (#120605)
On recent versions of macOS (sometime between Catalina and Sonoma 14.5), the default Hovertip foreground color changed from black to white, thereby matching the background. This might be a matter of matching the white foreground of the dark-mode text. The unreadable result is shown here (#120083 (comment)).

The foreground and background colors were made parameters so we can pass different colors for future additional hovertips in IDLE.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-08-01 23:02:43 -04:00
Malcolm Smith 06656e259b
gh-116622: Don't expose `FICLONE` ioctl on Android (#122522)
Don't expose `FICLONE` ioctl on Android

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2024-08-01 00:23:10 +00:00
CF Bolz-Tereick bd3d31f380
gh-87320: In the code module, handle exceptions raised in sys.excepthook (GH-122456)
Before, the exception caused by calling non-default sys.excepthook
in code.InteractiveInterpreter bubbled up to the caller, ending the REPL.
2024-07-31 10:33:29 +00:00
Cody Maloney a9344cdffa
gh-121381 Remove subprocess._USE_VFORK escape hatch (#121383)
This flag was added as an escape hatch in gh-91401 and backported to
Python 3.10. The flag broke at some point between its addition and now.
As there is currently no publicly known environments that require this,
remove it rather than work on fixing it.

This leaves the flag in the subprocess module to not break code which
may have used / checked the flag itself.

discussion: https://discuss.python.org/t/subprocess-use-vfork-escape-hatch-broken-fix-or-remove/56915/2
2024-07-30 18:39:54 -07:00
Malcolm Smith 82db572813
gh-116622: Fix testPyObjectPrintOSError on Android (#122487)
Adds extra handling for way BSD/Android return errors from calls to fwrite.
2024-07-31 08:21:43 +08:00
Terry Jan Reedy 29c04dfa27
GH-122482: Make About IDLE direct discussion to DPO (#122483)
Currently, idle-dev@python.org and idle-dev mailing list
serve to collect spam (90+%).  Change About IDLE to direct
discussions to discuss.python.org.  Users are already
doing so.
2024-07-30 18:29:52 -04:00
Petr Viktorin 0976339818
gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233)
## Encode header parts that contain newlines

Per RFC 2047:

> [...] these encoding schemes allow the
> encoding of arbitrary octet values, mail readers that implement this
> decoding should also ensure that display of the decoded data on the
> recipient's terminal will not cause unwanted side-effects

It seems that the "quoted-word" scheme is a valid way to include
a newline character in a header value, just like we already allow
undecodable bytes or control characters.
They do need to be properly quoted when serialized to text, though.


## Verify that email headers are well-formed

This should fail for custom fold() implementations that aren't careful
about newlines.


Co-authored-by: Bas Bloemsaat <bas@bloemsaat.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-31 00:19:48 +02:00
Petr Viktorin 5912487938
gh-120906: Support arbitrary hashable keys in FrameLocalsProxy (GH-122309)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-07-30 22:11:00 +00:00
Clinton d27a53fc02
gh-121474: Add threading.Barrier parties arg sanity check. (GH-121480) 2024-07-30 11:53:07 +03:00
Bénédikt Tran 3a9b2aae61
gh-122400: Handle ValueError in filecmp (GH-122401) 2024-07-30 08:50:30 +00:00
Petr Viktorin 3833d27f98
gh-105733: Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it. (GH-122281)
Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it.

Partially reverts 2211454fe2
2024-07-30 09:37:58 +02:00
Seth Michael Larson 78df1043db
gh-122133: Authenticate socket connection for `socket.socketpair()` fallback (GH-122134)
* Authenticate socket connection for `socket.socketpair()` fallback when the platform does not have a native `socketpair` C API.  We authenticate in-process using `getsocketname` and `getpeername` (thanks to Nathaniel J Smith for that suggestion).

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-29 14:44:35 -07:00
Brandt Bucher 15d4cd0967
GH-116090: Fire RAISE events from _FOR_ITER_TIER_TWO (GH-122413) 2024-07-29 12:17:47 -07:00
Serhiy Storchaka 3b034d26eb
gh-122311: Fix some error messages in pickle (GH-122386) 2024-07-29 11:49:13 +03:00
Sergey B Kirpichev 169e7138ab
gh-122234: fix accuracy issues for sum() (#122236)
* Use compensated summation for complex sums with floating-point items.
  This amends #121176.

* sum() specializations for floats and complexes now use
  PyLong_AsDouble() instead of PyLong_AsLongAndOverflow() and
  compensated summation as well.
2024-07-29 05:56:40 +02:00
Jelle Zijlstra ae192262ad
gh-119180: Add evaluate functions for type params and type aliases (#122212) 2024-07-27 17:24:10 +00:00
Jelle Zijlstra 45614ecb2b
gh-119180: Use type descriptors to access annotations (PEP 749) (#122074) 2024-07-27 16:36:06 +00:00
Bénédikt Tran 7a6d4ccf0e
gh-122170: Handle ValueError raised by os.stat() in linecache (GH-122176) 2024-07-27 10:10:42 +00:00
Nate Ohlson 8ac5565be2
gh-112301: Compiler warning management tooling (#121730)
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-07-27 09:57:44 +00:00
Peter Bierma c08696286f
gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (#122338) 2024-07-27 11:57:48 +05:30
Irit Katriel d791b9815a
gh-122245: Add test case of generic type with __debug__ (#122322) 2024-07-26 18:40:36 +00:00
Pablo Galindo Salgado db2d8b6db1
gh-122300: Preserve AST nodes for format specifiers with single elements (#122308) 2024-07-26 16:29:41 +00:00
WilliamRoyNelson dcafb362f7
gh-121999: Change default tarfile filter to 'data' (GH-122002)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Co-authored-by: Scott Odle <scott@sjodle.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-26 16:34:13 +02:00
Irit Katriel bc94cf7e25
gh-122245: move checks for writes and shadowing of __debug__ to symtable (#122246) 2024-07-26 14:39:56 +01:00
Marc Mueller aef95eb107
gh-121489: Export private _PyBytes_Join() again (#122267) 2024-07-25 17:31:30 +02:00
Mark Shannon 2e14a52cce
GH-122160: Remove BUILD_CONST_KEY_MAP opcode. (GH-122164) 2024-07-25 16:24:29 +01:00
Serhiy Storchaka dc07f65a53
gh-82951: Fix serializing by name in pickle protocols < 4 (GH-122149)
Serializing objects with complex __qualname__ (such as unbound methods and
nested classes) by name no longer involves serializing parent objects by value
in pickle protocols < 4.
2024-07-25 08:45:19 +00:00
Mikołaj Kuranowski a3327dbfd4
gh-113785: csv: fields starting with escapechar are not quoted (GH-122110) 2024-07-25 10:04:47 +03:00
Dino Viehland 5592399313
gh-122208: Don't delivery PyDict_EVENT_ADDED until it can't fail (#122207)
Don't delivery PyDict_EVENT_ADDED until it can't fail
2024-07-24 10:58:28 -07:00
Xie Yanbo f067efa643
Fix typo in news document (GH-122209) 2024-07-24 06:49:58 +00:00
Tian Gao e91ef13861
gh-122029: Log call events in sys.setprofile when it's a method with c function (GH-122072)
Log call events in sys.setprofile when it is a method with a C function.
2024-07-23 15:25:26 -07:00
Jelle Zijlstra 7b7b90d1ce
gh-119180: Add `annotationlib` module to support PEP 649 (#119891)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-23 21:16:50 +00:00
Serhiy Storchaka 4606eff0aa
gh-122129: Improve support of method descriptors and wrappers in the help title (GH-122157) 2024-07-23 20:45:21 +03:00
Serhiy Storchaka e6b25e9a09
gh-122163: Add notes for JSON serialization errors (GH-122165)
This allows to identify the source of the error.
2024-07-23 20:02:54 +03:00
Sebastian Rittau 375c9f6dfb
gh-122088: Copy the coroutine status of the underlying callable in `@warnings.deprecated` (#122086)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-23 10:59:28 +01:00
Donghee Na a9bb3c7b3b
gh-121996: Introduce --disable-safety and --enable-slower-safety options (#122054)
* gh-121996: Introduce --disable-safty and --enable-slower-safty

* Update GA

* fix

* Address code review

* Update CI
2024-07-23 09:22:04 +09:00
Jelle Zijlstra 2762c6cc5e
gh-121637: Syntax error for optimized-away incorrect await (#121656)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-22 14:12:43 -07:00
HarryLHW 2408a8a22b
gh-121795: Improve performance of set membership testing from set arguments (#121796) 2024-07-22 10:05:23 -05:00
Bénédikt Tran c09d4c4a26
gh-119698: deprecate ``symtable.Class.get_methods`` (#121902) 2024-07-22 07:04:17 -07:00
Łukasz Langa dc93d1125f
gh-121957: Emit audit events for `python -i` and `python -m asyncio` (GH-121958)
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
2024-07-22 13:04:08 +02:00
Russell Keith-Magee 728432c804
gh-120522: Apply App Store compliance patch during installation (#121947)
Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.
2024-07-22 07:36:08 +08:00
Barney Gale 094375b9b7
GH-73991: Add `pathlib.Path.rmtree()` (#119060)
Add a `Path.rmtree()` method that removes an entire directory tree, like
`shutil.rmtree()`. The signature of the optional *on_error* argument
matches the `Path.walk()` argument of the same name, but differs from the
*onexc* and *onerror* arguments to `shutil.rmtree()`. Consistency within
pathlib is probably more important.

In the private pathlib ABCs, we add an implementation based on `walk()`.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-20 20:14:13 +00:00
Pablo Galindo Salgado 2009e25e26
gh-122026: Fix identification of mismatched parentheses inside f-strings (#122028) 2024-07-19 19:08:08 +02:00
Rodrigo Oliveira d66b06107b
gh-118830: Bump pickle.DEFAULT_PROTOCOL to 5 (GH-119340) 2024-07-19 16:47:10 +02:00
Serhiy Storchaka 1a0c7b9ba4
gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
Serhiy Storchaka c8d2630995
gh-82017: Support as_integer_ratio() in the Fraction constructor (GH-120271)
Any objects that have the as_integer_ratio() method (e.g. numpy.float128)
can now be converted to a fraction.
2024-07-19 08:06:53 +03:00
Tian Gao 1ab1778283
gh-120289: Disallow disable() and clear() in external timer to prevent use-after-free (#120297) 2024-07-18 12:47:22 -07:00
Nate Ohlson bdab67e1c7
gh-112301: Add fortify source level 3 to default compiler options (gh-121520) 2024-07-19 01:06:51 +09:00
Matthieu Caneill cecaceea31
gh-120930: Remove extra blank occuring in wrapped encoded words in email headers (GH-121747) 2024-07-18 14:48:05 +02:00
Jelle Zijlstra 63ddd28cf3
gh-121921: Make bogus_code_obj.py crash the interpreter (#121922) 2024-07-18 04:02:08 -04:00
Alex Waygood ac07451116
gh-120678: pyrepl: Include globals from modules passed with `-i` (GH-120904)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-17 16:18:42 +02:00
Terry Jan Reedy 58753f33e4
gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (#121876)
Problem occurred when attribute xyz could not be pickled.
Since this is not trivial to selectively fix, block all
attributes (other than 'width').  IDLE does not access them
and they are private implementation details.
2024-07-17 09:33:33 -04:00
Brett Cannon f589f263bc
GH-120371: Add WASI SDK 22 support (GH-121870)
Required disabling stub functions now provided by wasi-libc.
2024-07-16 20:00:39 +00:00
Tian Gao e65cb4c6f0
gh-118934: Make PyEval_GetLocals return borrowed reference (#119769)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-07-16 12:17:47 -07:00
Sam Gross 162b41f577
gh-121860: Fix crash when materializing managed dict (#121866)
The object's inline values may be marked invalid if the materialized
dict was already initialized and then deleted.
2024-07-16 14:58:36 -04:00
Pablo Galindo Salgado c46d64e0ef
gh-121130: Fix f-string format specifiers with debug expressions (#121150) 2024-07-16 19:57:22 +01:00
Andreas Stocker 8f2532168b
gh-59022: Added tests for `pkgutil.extend_path` (#59022) (GH-121673)
This adds tests for the documented behaviour of `pkgutil.extend_path`
regarding different argument types as well as for `*.pkg` files.
2024-07-16 17:14:26 +02:00
Petr Viktorin 263c7e611b
gh-121160: Add some tests for readline.set_history_length (GH-121326) 2024-07-16 16:09:08 +02:00
Petr Viktorin b4aedb23ae
gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (#121364)
* Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs

* Document immortality in some functions that take `const char *`

This is PyUnicode_InternFromString;
PyDict_SetItemString, PyObject_SetAttrString;
PyObject_DelAttrString; PyUnicode_InternFromString;
and the PyModule_Add convenience functions.

Always point out a non-immortalizing alternative.

* Don't immortalize user-provided attr names in _ctypes
2024-07-16 15:36:21 +02:00
Petr Viktorin 956270d08d
gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal (GH-121358)
Older stable ABI extensions are allowed to make immortal objects mortal.
Instead, use `_PyUnicode_STATE` (`interned` and `statically_allocated`).
2024-07-16 15:17:29 +02:00
Ned Deily f27593a87c
gh-120522: Revert "Add a `--with-app-store-compliance` configure option to patch out problematic code" (gh-120984) (#121844)
This reverts commit 48cd104b0c prior
to the release of 3.13.0b4 to allow for additional review time.
2024-07-16 06:49:36 -04:00
Russell Keith-Magee 7e91e0dcfe
gh-120831: Increase the default minimum supported iOS version to 13.0 (#121250)
Increases the default minimum iOS version to 13.0.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-16 12:23:35 +08:00
Marta Gómez Macías 498a94c198
gh-121295: Fix blocked console after interrupting a long paste (GH-121815) 2024-07-16 01:38:54 +02:00
Tian Gao 2b1b68939b
gh-121814: Only check f_trace_opcodes if Python frame exists (#121818)
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
2024-07-15 16:11:02 -07:00
Sam Gross d23be3947c
gh-121794: Don't set `ob_tid` to zero in fast-path dealloc (#121799)
We should maintain the invariant that a zero `ob_tid` implies the
refcount fields are merged.

* Move the assignment in `_Py_MergeZeroLocalRefcount` to immediately
  before the refcount merge.
* Update `_PyTrash_thread_destroy_chain` to set `ob_ref_shared` to
  `_Py_REF_MERGED` when setting `ob_tid` to zero.

Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
2024-07-15 17:50:10 -04:00
Sergey B Kirpichev 05d413764c
gh-121245: Refactor site.register_readline() (GH-121659)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:12:41 +02:00
Rodrigo Girão Serrão 6522f0e438
gh-121746: Bind Alt+Enter to "accept" in the REPL (GH-121754) 2024-07-15 19:47:56 +02:00
Serhiy Storchaka 94bee45dee
gh-84978: Add float.from_number() and complex.from_number() (GH-26827)
They are alternate constructors which only accept numbers
(including objects with special methods __float__, __complex__
and __index__), but not strings.
2024-07-15 16:07:00 +00:00
Dominic H 8303d32ff5
gh-117765: Improve documentation for `mocker.patch.dict` (#121755) 2024-07-15 07:14:17 +00:00
Jelle Zijlstra 50eec501fe
gh-57141: Make shallow argument to filecmp.dircmp keyword-only (#121767)
It is our general practice to make new optional parameters keyword-only,
even if the existing parameters are all positional-or-keyword. Passing
this parameter as positional would look confusing and could be error-prone
if additional parameters are added in the future.
2024-07-14 15:53:32 -07:00
Samuel Thibault d005f2c186
gh-121731: Fix mimalloc compile error on GNU/Hurd (#121732) 2024-07-14 12:50:25 -04:00
Dominic H 26dfb27712
gh-121749: Fix discrepancy in docs for `PyModule_AddObjectRef` (GH-121750) 2024-07-14 10:11:10 +00:00
Bruno Lima 04130b290b
gh-121562: optimized hex_from_char (#121563)
Performance improvement to `float.fromhex`: use a lookup table
for computing the hexadecimal value of a character, in place of the
previous switch-case construct. Patch by Bruno Lima.
2024-07-14 10:05:35 +01:00
Gregor 178e44de8f
gh-121657: Display correct error message for yield from outside of a function (GH-121680)
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>
2024-07-13 17:14:39 +02:00
Pablo Galindo Salgado 4b9e10d0ea
gh-121499: Fix multi-line history rendering in the REPL (#121531)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-07-13 12:54:10 +02:00
Marta Gómez Macías e745996b2d
gh-121609: Fix pasting of characters containing unicode character joiner (#121667) 2024-07-13 10:44:18 +00:00
Bas Bloemsaat 0759cecd9d
gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663)
Co-Authored-By: Kevin Diem <kg.diem@gmail.com>
2024-07-13 11:52:08 +02:00
Pablo Galindo Salgado 4e36dd7d87
gh-121497: Make Pyrepl respect correctly the history with input hook set (#121498) 2024-07-13 09:42:14 +00:00
Zachary Ware dc03ce797a
gh-95144: Improve error message of `... in None` (GH-119888) 2024-07-12 16:34:17 +00:00
Savannah Ostrowski 65fededf9c
Update retroactive comments from GH-117741 (segfault in `FutureIter_dealloc`) (GH-121638)
Address comments
2024-07-12 10:34:30 +02:00