Commit Graph

26223 Commits

Author SHA1 Message Date
Miss Islington (bot) 2eff55cd46
gh-92888: Fix memoryview bad `__index__` use after free (GH-92946)
Co-authored-by: chilaxan <35645806+chilaxan@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
(cherry picked from commit 11190c4ad0)

Co-authored-by: Ken Jin <kenjin@python.org>
2022-06-18 07:40:39 -07:00
Miss Islington (bot) 79d22694f2
GH-89858: Fix test_embed for out-of-tree builds (GH-93465)
(cherry picked from commit 96464e5401)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-06-17 22:11:59 -07:00
Miss Islington (bot) 2b7fc1bfe6
GH-83658: make multiprocessing.Pool raise an exception if maxtasksperchild is not None or a positive int (GH-93364) (GH-93923) 2022-06-17 23:31:42 +01:00
Brandt Bucher 05d83a706c
GH-91389: Fix dis position information for CACHEs (GH-93663) (GH-93921)
(cherry picked from commit f8e576be0a)
2022-06-17 10:26:20 -07:00
Miss Islington (bot) 029835d9d4
gh-91404: Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or allocation failure (GH-32283) (GH-93882)
Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure (GH-32283)"

This reverts commit 6e3eee5c11.

Manual fixups to increase the MAGIC number and to handle conflicts with
a couple of changes that landed after that.

Thanks for reviews by Ma Lin and Serhiy Storchaka.
(cherry picked from commit 4beee0c7b0)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-06-17 01:43:56 -07:00
Miss Islington (bot) 0319052090
gh-93847: Fix repr of enum of generic aliases (GH-93885)
(cherry picked from commit 138db8e48b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-16 22:00:22 -07:00
Miss Islington (bot) 3fbf5c6427
gh-93820: Fix copy() regression in enum.Flag (GH-93876) (#93886)
GH-26658 introduced a regression in copy / pickle protocol for combined
`enum.Flag`s. `copy.copy(re.A | re.I)` would fail with
`AttributeError: ASCII|IGNORECASE`.

`enum.Flag` now has a `__reduce_ex__()` method that reduces flags by
combined value, not by combined name.
(cherry picked from commit 05b32c1c79)

Co-authored-by: Christian Heimes <christian@python.org>

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-17 06:56:20 +03:00
Miss Islington (bot) 74561095d9
gh-91731: Don't define 'static_assert' in C++11 where is a keyword to avoid UB (GH-93700)
(cherry picked from commit 65ff27c7d3)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-06-16 07:50:15 -07:00
Miss Islington (bot) 0c49a09e67
gh-91577: SharedMemory move imports out of methods (GH-91579)
SharedMemory.unlink() uses the unregister() function from resource_tracker. Previously it was imported in the method, but this can fail if the method is called during interpreter shutdown, for example when unlink is part of a __del__() method.

Moving the import to the top of the file, means that the unregister() method is available during interpreter shutdown.

The register call in SharedMemory.__init__() can also use this imported resource_tracker.
(cherry picked from commit 9a458befdd)

Co-authored-by: samtygier <samtygier@yahoo.co.uk>
2022-06-16 07:07:32 -07:00
Irit Katriel df091e14d8
[3.11] GH-93662: Make sure that column offsets are correct in multi-line method calls. (GH-93673) (#93895)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-06-16 11:56:35 +01:00
Miss Islington (bot) 87864077de
gh-93824: Reenable installation of shell extension on Windows ARM64 (GH-93825)
(cherry picked from commit 99be1cbeb3)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-06-15 09:34:32 -07:00
Miss Islington (bot) 528569319f
gh-87260: Update sqlite3 signature docs to reflect actual implementation (GH-93840)
Align the docs for the following methods with the actual implementation:

- sqlite3.complete_statement()
- sqlite3.Connection.create_function()
- sqlite3.Connection.create_aggregate()
- sqlite3.Connection.set_progress_handler()
(cherry picked from commit d31834688b)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-06-15 03:35:48 -07:00
Miss Islington (bot) 73c8f3ff54
gh-92914: Round the allocated size for lists up to the even number (GH-92915)
(cherry picked from commit 8a6af5a346)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-14 12:16:21 -07:00
Miss Islington (bot) cbfbe248e3
gh-90300: split --help output into separate options (GH-30331)
Make --help output shorter and add new help options.

--help-env, --help-xoptions and --help-all command-line options are
added to complement --help.
(cherry picked from commit 8aa9d40b00)

Co-authored-by: Éric <earaujo@caravan.coop>
2022-06-14 12:15:42 -07:00
Miss Islington (bot) 29c7e815bc
gh-79512: Fixed names and __module__ value of weakref classes (GH-93719)
Classes ReferenceType, ProxyType and CallableProxyType have now correct
atrtributes __module__, __name__ and __qualname__.
It makes them (types, not instances) pickleable.
(cherry picked from commit 8352e322e8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-14 12:12:51 -07:00
Miss Islington (bot) 8dc5df4e21
[3.11] gh-91162: Support splitting of unpacked arbitrary-length tuple over TypeVar and TypeVarTuple parameters (alt) (GH-93412) (GH-93746)
For example:

  A[T, *Ts][*tuple[int, ...]] -> A[int, *tuple[int, ...]]
  A[*Ts, T][*tuple[int, ...]] -> A[*tuple[int, ...], int]
(cherry picked from commit 3473817106)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-14 21:15:56 +03:00
Victor Stinner ef591cf8e3
gh-91321: Fix compatibility with C++ older than C++11 (#93784) (#93802)
* Fix the compatibility of the Python C API with C++ older than C++11.
* _Py_NULL is only defined as nullptr on C++11 and newer.

(cherry picked from commit 4caf5c2753)

* test_cppext now builds the C++ extension with setuptools.
* Add @test.support.requires_venv_with_pip.

(cherry picked from commit ca0cc9c433)
2022-06-14 16:05:14 +02:00
Erlend Egeberg Aasland 871b1dc469
[3.11] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93800)
The fix involves using pysqlite_check_remaining_sql(), not only to check
for multiple statements, but now also to strip leading comments and
whitespace from SQL statements, so we can improve DML query detection.

pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more
accurately reflect its function, and hardened to handle more SQL comment
corner cases.
(cherry picked from commit 46740073ef)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-06-14 14:49:22 +02:00
Miss Islington (bot) dc6dd8ee87
gh-93353: Fix importlib.resources._tempfile() finalizer (GH-93377)
Fix the importlib.resources.as_file() context manager to remove the
temporary file if destroyed late during Python finalization: keep a
local reference to the os.remove() function. Patch by Victor Stinner.
(cherry picked from commit 443ca731d6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-06-13 10:49:48 -07:00
Miss Islington (bot) 3d1c080591
gh-93461: Invalidate sys.path_importer_cache entries with relative paths (GH-93653)
(cherry picked from commit 09243b898a)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-12 23:29:59 -07:00
Miss Islington (bot) 4c881049ef
gh-84461: Use HOSTRUNNER to run regression tests (GH-93694)
Co-authored-by: Brett Cannon <brett@python.org>
(cherry picked from commit dc5e02b2f4)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-11 00:04:35 -07:00
Miss Islington (bot) 54fe3d57bf
gh-92930: _pickle.c: Acquire strong references before calling save() (GH-92931)
(cherry picked from commit 4c496f1f11)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-06-10 20:52:41 -07:00
Miss Islington (bot) 0aa9ec9f5d
gh-92886: Fix tests that fail when running with optimizations (`-O`) in `test_zipimport.py` (GH-93236)
(cherry picked from commit 484a2357c8)

Co-authored-by: jackh-ncl <1750152+jackh-ncl@users.noreply.github.com>
2022-06-10 16:25:53 -07:00
Miss Islington (bot) 3a202de3bb
gh-91317: Document that Path does not collapse initial `//` (GH-32193)
Documentation for `pathlib` says:

> Spurious slashes and single dots are collapsed, but double dots ('..') are not, since this would change the meaning of a path in the face of symbolic links:

However, it omits that initial double slashes also aren't collapsed.

Later, in documentation of `PurePath.drive`, `PurePath.root`, and `PurePath.name` it mentions UNC but:

- this abbreviation says nothing to a person who is unaware about existence of UNC (Wikipedia doesn't help either by [giving a disambiguation page](https://en.wikipedia.org/wiki/UNC))
- it shows up only if a person needs to use a specific property or decides to fully learn what the module provides.

For context, see the BPO entry.
(cherry picked from commit 78f1a43694)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2022-06-10 16:07:19 -07:00
Miss Islington (bot) f9d0240db8
gh-93671: Avoid exponential backtracking in deeply nested sequence patterns in match statements (GH-93680)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 53a8b17895)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-06-10 09:21:04 -07:00
Miss Islington (bot) aee7d3df1c
gh-90549: Fix leak of global named resources using multiprocessing spawn (GH-30617)
Co-authored-by: XD Trol <milestonejxd@gmail.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
(cherry picked from commit 30610d2837)

Co-authored-by: Leo Trol <milestone.jxd@gmail.com>
2022-06-10 08:04:55 -07:00
Miss Islington (bot) c3045d809c
gh-90494: Reject 6th element of the __reduce__() tuple (GH-93609) (GH-93631)
copy.copy() and copy.deepcopy() now always raise a TypeError if
__reduce__() returns a tuple with length 6 instead of silently ignore
the 6th item or produce incorrect result.
(cherry picked from commit a365dd64c2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-10 16:00:19 +02:00
Miss Islington (bot) 516d90eb21
gh-93491: Add support tier detection to configure (GH-93492)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
(cherry picked from commit 3124d9a5aa)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-10 06:50:26 -07:00
Steve Dower 927b5afee7
bpo-42658: Use LCMapStringEx in ntpath.normcase to match OS behaviour for case-folding (GH-93591)
* bpo-42658: Use LCMapStringEx in ntpath.normcase to match OS behaviour for case-folding (GH-32010)

* Use AsWideCharString to avoid memory leaks in deprectated unicode converter

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2022-06-10 11:14:25 +01:00
Miss Islington (bot) 4c41f21153
gh-90473: disable user site packages on WASI/Emscripten (GH-93633)
(cherry picked from commit 5a4af3ab03)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-09 09:12:51 -07:00
Łukasz Langa 2084f9479c
[3.11] gh-79096: Protect cookie file created by {LWP,Mozilla}CookieJar.save() (GH-93463) (GH-93636)
Note: This change is not effective on Microsoft Windows.

Cookies can store sensitive information and should therefore be protected
against unauthorized third parties. This is also described in issue #79096.

The filesystem permissions are currently set to 644, everyone can read the
file. This commit changes the permissions to 600, only the creater of the file
can read and modify it. This improves security, because it reduces the attack
surface. Now the attacker needs control of the user that created the cookie or
a ways to circumvent the filesystems permissions.

This change is backwards incompatible. Systems that rely on world-readable
cookies will breake. However, one could argue that those are misconfigured in
the first place.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Pascal Wittmann <mail@pascal-wittmann.de>
Co-authored-by: Christian Heimes <christian@python.org>
2022-06-09 16:16:37 +02:00
Miss Islington (bot) 98bbbbe46d
gh-93616: Fix env changed issue in test_modulefinder (GH-93617)
(cherry picked from commit cffa4f7854)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-09 00:02:39 -07:00
Christian Heimes 47a7855f41
[3.11] gh-93575: Use correct way to calculate PyUnicode struct sizes (GH-93602) (GH-93613)
* gh-93575: Use correct way to calculate PyUnicode struct sizes

* Add comment to keep test_sys and test_unicode in sync

* Fix case code < 256.
(cherry picked from commit 5442561c1a)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-08 22:21:20 +02:00
Christian Heimes abd022383b
[3.11] gh-93584: Make all install+tests targets depends on all (GH-93589) (GH-93603)
All install targets use the "all" target as synchronization point to
prevent race conditions with PGO builds. PGO builds use recursive make,
which can lead to two parallel `./python setup.py build` processes that
step on each others toes.

"test" targets now correctly compile PGO build in a clean repo.
(cherry picked from commit 243ed5439c)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-08 17:24:30 +02:00
Miss Islington (bot) 68aae80159
gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (GH-93526)
(cherry picked from commit 875de61c29)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-06-08 04:07:15 -07:00
Miss Islington (bot) 121ab58e03
GH-93521: For dataclasses, filter out `__weakref__` slot if present in bases (GH-93535)
(cherry picked from commit 5849af7a80)

Co-authored-by: Bluenix <bluenixdev@gmail.com>
2022-06-07 18:17:56 -07:00
Miss Islington (bot) faf0cf7ac6
gh-57539: Increase calendar test coverage (GH-93468) (GH-93564)
(cherry picked from commit f0d0be3493)

Co-authored-by: Sean Fleming
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-06-07 12:21:04 +02:00
Miss Islington (bot) 2a24421054
gh-88831: In docs for asyncio.create_task, explain why strong references to tasks are needed (GH-93258) (GH-93566)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 75ceae05c1)

Co-authored-by: Andreas Grommek <76997441+agrommek@users.noreply.github.com>
2022-06-07 12:14:06 +02:00
Miss Islington (bot) 07c3cbad95
gh-86986: bump min sphinx version to 3.2 (GH-93337) (GH-93561)
(cherry picked from commit 57e8ee7086)

Co-authored-by: Davide Rizzo <sorcio@gmail.com>
2022-06-07 10:21:47 +02:00
Miss Islington (bot) 6787a8f146
gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534) (GH-93550)
WASI does not have the ``chmod(2)`` syscall yet.
(cherry picked from commit 22fed605e0)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-06 20:09:51 +02:00
Miss Islington (bot) 2220dc50df
gh-89973: Fix re.error in the fnmatch module. (GH-93072)
Character ranges with upper bound less that lower bound (e.g. [c-a])
are now interpreted as empty ranges, for compatibility with other glob
pattern implementations. Previously it was re.error.
(cherry picked from commit 0902c3d8ed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-05 02:39:11 -07:00
Miss Islington (bot) a8bd502e57
gh-90473: wasmtime does not support absolute symlinks (GH-93490)
(cherry picked from commit 6f8367d348)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-05 01:26:38 -07:00
Miss Islington (bot) d97e2c52d3
gh-93442: Make C++ version of _Py_CAST work with 0/NULL. (GH-93500) (gh-93507)
Add C++ overloads for _Py_CAST_impl() to handle 0/NULL.  This will allow
C++ extensions that pass 0 or NULL to macros using _Py_CAST() to
continue to compile.  Without this, you get an error like:

    invalid ‘static_cast’ from type ‘int’ to type ‘_object*’

The modern way to use a NULL value in C++ is to use nullptr.  However,
we want to not break extensions that do things the old way.

Co-authored-by: serge-sans-paille
(cherry picked from commit 8bcc3fa345)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2022-06-05 14:15:59 +09:00
Miss Islington (bot) 1497d7fdef
gh-92886: Fix test that fails when running with `-O` in `test_imaplib.py` (GH-93237)
(cherry picked from commit 8150b8cf7f)

Co-authored-by: jackh-ncl <1750152+jackh-ncl@users.noreply.github.com>
2022-06-03 20:38:16 -07:00
Miss Islington (bot) 9f101c23a4
gh-93156 - fix negative indexing into absolute `pathlib.PurePath().parents` (GH-93273)
When a `_PathParents` object has a drive or a root, the length of the
object is *one less* than than the length of `self._parts`, which resulted
in an off-by-one error when `path.parents[-n]` was fed through to
`self._parts[:-n - 1]`. In particular, `path.parents[-1]` was a malformed
path object with spooky properties.

This is addressed by adding `len(self)` to negative indices.
(cherry picked from commit f32e6b48d1)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2022-06-03 14:57:54 -07:00
Miss Islington (bot) fae93ab163
[3.11] gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993) (GH-93458)
(cherry picked from commit b9509ba7a9)


Co-authored-by: Petr Viktorin <encukou@gmail.com>

Automerge-Triggered-By: GH:encukou
2022-06-03 08:25:58 -07:00
Miss Islington (bot) e798f698e5
gh-92932: dis._unpack_opargs should handle EXTENDED_ARG_QUICK (gh-92945)
(cherry picked from commit b013804134)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-06-02 20:02:55 -07:00
Miss Islington (bot) 376d53771d
gh-93418: Fix an assert when an f-string expression is followed by an '=', but no closing brace. (gh-93419) (gh-93422)
(cherry picked from commit ee70c70aa9)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2022-06-01 21:04:27 -04:00
Pablo Galindo eb0004c271
Python 3.11.0b3 2022-06-01 14:07:53 +01:00
Miss Islington (bot) 3265ff9ccc
gh-93345: Fix a crash in substitution of nested TypeVar after TypeVarTuple (GH-93346)
For example: tuple[*Ts, list[T]][int, str, bool]
(cherry picked from commit f545fc955a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-31 23:43:38 -07:00