Commit Graph

28485 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) e6cca2e00b
gh-89745: Avoid exact match when comparing program_name in test_embed on Windows (GH-93888)
(cherry picked from commit ffc228dd4e)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2022-06-17 03:31:03 -07:00
Miss Islington (bot) 123e3be33b
test_logging: Fix BytesWarning in SysLogHandlerTest (GH-93920)
(cherry picked from commit 538f28921f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-06-17 02:53:35 -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) 62f72e4811
gh-91321: Fix test_cppext for C++03 (GH-93902) (#93904)
Don't build _testcppext.cpp with -Wzero-as-null-pointer-constant when
testing C++03: only use this compiler flag with C++11.
(cherry picked from commit a38c2a61d5)

Co-authored-by: Victor Stinner <vstinner@python.org>

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-06-16 15:17:35 +02: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) d1fd7393a2
GH-93850: Fix test_asyncio exception ignored tracebacks (GH-93854)
(cherry picked from commit b415c5f1aa)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-06-15 08:10:40 -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
Erlend Egeberg Aasland 7aa4038a6e
[3.11] gh-93795: Use test.support TESTFN/unlink in sqlite3 tests (GH-93796) (#93808) 2022-06-14 17:41:32 +02: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) 02ff1ccfb7
gh-84461: Fix parallel testing on WebAssembly (GH-93768)
(cherry picked from commit c2007573dd)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-13 11:15:46 -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) 34ef12a350
gh-90473: Skip test_queue when threading is not available (GH-93712)
(cherry picked from commit f0b7aa71c4)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-11 03:20:28 -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) 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
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) 06340f6226
gh-90473: Skip get_config_h() tests on WASI (GH-93645)
(cherry picked from commit 6099611af5)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-09 09:32:52 -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
Irit Katriel ce07de9059
[3.11] GH-93481: Suppress expected deprecation warning in test_pyclbr (GH-93483) (GH-93601)
(cherry picked from commit f8eae6f5c3)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-06-08 16:16:46 +01: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) 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
Christian Heimes 986ce4e613
[3.11] gh-90473: Skip POSIX tests that don't apply to WASI (GH-93536) (GH-93540)
(cherry picked from commit 80a39daecd)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-06 20:09:22 +02:00
Miss Islington (bot) 20be4a11fe
gh-90473: WASI requires proper open(2) flags (GH-93529)
(cherry picked from commit 4c71d22c4f)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-06 03:32:23 -07:00
Miss Islington (bot) a848a9894d
gh-93247: Fix assert function in asyncio locks test (GH-93248)
(cherry picked from commit 9081bbd036)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-06-05 18:47:07 -07: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) c21f2bdaf1
gh-93442: Add test for _Py_CAST(nullptr). (gh-93505) (gh-93509)
(cherry picked from commit 713eb184b5)

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

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2022-06-05 15:47:12 +09: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) e4113be63c
gh-84461: Skip dtrace/network tests that are enabled by -u all (GH-93473)
(cherry picked from commit 1a8a0ddb1c)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-03 13:40:20 -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) 71fae642c0
test.pythoninfo: Fix typo, Py_REF_DEBUG => Py_TRACE_REFS (GH-93467)
(cherry picked from commit d8f40ead92)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-06-03 07:18:49 -07:00
Miss Islington (bot) 1d2b766100
gh-90473: Skip and document more failing tests on WASI (GH-93436)
- Mark more ``umask()`` cases
- ``dup()`` is not supported
- ``/dev/null`` is not available
- document missing features
- mark more modules as not available
(cherry picked from commit 069c96f84c)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-02 23:50:44 -07:00