Commit Graph

48645 Commits

Author SHA1 Message Date
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
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) 008bcdec11
Grammar fix to socket error string (GH-93523) (GH-93560)
(cherry picked from commit 890c3be8fb)

Co-authored-by: Evorage <owner@evorage.com>
2022-06-07 10:10:24 +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
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) d779e5d16e
Remove the execution bit to some socket-related files. (GH-93368)
(cherry picked from commit 5247389369)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-06-01 00:35:15 -07: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
Miss Islington (bot) 00f8fe9564
[3.11] gh-91162: Fix substitution of unpacked tuples in generic aliases (GH-92335) (#92484)
* gh-91162: Fix substitution of unpacked tuples in generic aliases (GH-92335)
(cherry picked from commit 9d25db9db1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

* Regenerate ABI file

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2022-06-01 03:13:27 +01:00
Miss Islington (bot) b425d887aa
gh-92597: Ensure that AST nodes without explicit end positions can be compiled (GH-93359)
(cherry picked from commit 705eaec28f)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-05-31 16:26:16 -07:00
Pablo Galindo 72f00f420a
Python 3.11.0b2 2022-05-30 22:18:15 +01:00
Miss Islington (bot) 7f6e6abdc4
gh-93351: Ensure the position information in AST nodes created by the parser is always consistent (GH-93352)
(cherry picked from commit 5893b5db98)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-05-30 11:52:36 -07:00
Miss Islington (bot) da184517f5
Fix typo in Lib/idlelib/idle_test/test_parenmatch.py (GH-93332) (#93339)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 4f195f9db1)

Co-authored-by: luzpaz <luzpaz@users.noreply.github.com>
2022-05-29 23:02:23 -04:00
Miss Islington (bot) 85cb7f08ed
gh-92839: fixed typo in _bisectmodule.c (line 131) (GH-92849)
(cherry picked from commit 7fa9b7daa5)

Co-authored-by: oda-gitso <105083118+oda-gitso@users.noreply.github.com>
2022-05-28 11:31:06 -07:00
Miss Islington (bot) cf63b80bc4
gh-93297: Make asyncio task groups prevent child tasks from being GCed (GH-93299) (#93305)
(cherry picked from commit e6a57678ca)

Co-authored-by: Yury Selivanov <yury@edgedb.com>

Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-05-27 15:46:57 -07:00
Miss Islington (bot) 647426d4fa
gh-93250: [Enum] Change IntEnum boundary to KEEP for backwards compatibility (GH-93302) (GH-93304)
In previous versions of Python if an IntEnum member was combined with another integer type value using a bit-wise operation, the resulting value would still be the IntEnum type.  This change restores that behavior.
(cherry picked from commit 70cfe56caf)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-05-27 15:43:13 -07:00
Miss Islington (bot) 9303a5ac30
gh-92898: Enhance _testcppext test on cast to PyObject* (GH-93111)
* Add StrongRef class.
* Rename and reformat functions of the _Py_CAST() implementation.
(cherry picked from commit 20d30ba2cc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-05-26 16:39:28 -07:00
Miss Islington (bot) 9555d77953
test.pythoninfo logs more build info (GH-93225)
Log also test.support.check_sanitizer() values.
(cherry picked from commit 06dd26f89f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-05-26 07:33:50 -07:00
Miss Islington (bot) 4d863453f8
gh-93005: Fix py.exe launcher test to search for intended tag (GH-93190)
(cherry picked from commit ca58e4a2c5)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-05-25 15:29:36 -07:00
Miss Islington (bot) 83940c0766
gh-90817: Deprecate explicitly locale.resetlocale() (GH-93196)
The function was already deprecated in Python 3.11 since it calls
locale.getdefaultlocale() which was deprecated in Python 3.11.
(cherry picked from commit bf58cd01b3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-05-25 13:29:58 -07:00
Miss Islington (bot) 37a7f1b099
[3.11] gh-93035: [Enum] Fix IntFlag crash when no single-bit members (GH-93076) (GH-93197)
`EnumType` attempts to create a custom docstring for each enum/flag, but that was failing with pathological flags that had no members (only multi-bit aliases).
(cherry picked from commit 08cfc3dabf)

Co-authored-by: Tobin Yehle <tobinyehle@gmail.com>
2022-05-25 10:50:24 -07:00
Miss Islington (bot) 0fb70ce191
gh-90473: Misc test fixes for WASI (GH-93218)
* ``sys.executable`` is not set
* WASI does not support subprocess
* ``pwd`` module is not available
* WASI checks ``open`` syscall flags more strict, needs r, w, rw flag.
* ``umask`` is not available
* ``/dev/null`` may not be accessible
(cherry picked from commit 1f134e96ba)

Co-authored-by: Christian Heimes <christian@python.org>
2022-05-25 07:24:32 -07:00
Miss Islington (bot) 2ea3d3b847
test_threaded_import: Fix unittest.main spelling (GH-93114)
(cherry picked from commit 19710145b4)

Co-authored-by: Florian Bruhin <me@the-compiler.org>
2022-05-25 01:22:21 -07:00
Miss Islington (bot) e9d6ca4334
[3.11] gh-83245: Raise BadZipFile instead of ValueError when reading a corrupt ZIP file (GH-32291) (GH-93141)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 202ed2506c)


Co-authored-by: Sam Ezeh <sam.z.ezeh@gmail.com>

Automerge-Triggered-By: GH:serhiy-storchaka
2022-05-25 00:57:36 -07:00
Miss Islington (bot) 74b205b3eb
gh-92728: Restore re.template, but deprecate it (GH-93161)
Revert "bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)"

This reverts commit b09184bf05.
(cherry picked from commit 16a7e4a0b7)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2022-05-24 23:32:20 -07:00
Miss Islington (bot) 7a5f190c9f
test.pythoninfo no longer requires socket (GH-93191)
test.pythoninfo no longer fails if "import socket" fails: the socket
module is now optional.
(cherry picked from commit 4a31ed8a32)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-05-24 17:41:02 -07:00
Miss Islington (bot) a6ee7f99cc
GH-89369: test_contextlib_async finalizes event loop after each test (GH-93074)
Use asyncio.run().
(cherry picked from commit d2ef66a10b)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-05-24 07:07:59 -07:00
Miss Islington (bot) 719edfaf79
GH-93112: Fix missing ResourceDenied import in test_urllib2net (GH-93113)
The code was moved out of test.support in
311110abcd (GH-20812), thus making
ResourceDenied undefined.
(cherry picked from commit 37c9a351b1)

Co-authored-by: Florian Bruhin <me@the-compiler.org>
2022-05-24 05:37:06 -07:00
Miss Islington (bot) c771cbe8f9
gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) (GH-93145)
Also while there, clarify a few things about why we reduce the hash to 32 bits.

Co-authored-by: Eli Libman <eli@hyro.ai>
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>

(cherry picked from commit c1f5c903a7)
2022-05-24 10:52:06 +02:00
Miss Islington (bot) 97fe65a7be
gh-93099: Fix _pyio to use locale module properly (gh-93136)
(cherry picked from commit f7fabae75c)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-05-23 18:03:37 -07:00