Commit Graph

115407 Commits

Author SHA1 Message Date
Mark Shannon b73e3b6d4a
GH-95589: Dont crash when subclassing extension classes with multiple inheritance (GH-96028)
* Treat tp_weakref and tp_dictoffset like other opaque slots for multiple inheritance.

* Document Py_TPFLAGS_MANAGED_DICT and Py_TPFLAGS_MANAGED_WEAKREF in what's new.
2022-08-17 12:50:53 +01:00
Petr Viktorin 0f2b469ce1
gh-95991: Add some infrastructure for testing Limited API in _testcapi (GH-95992)
- Limited API needs to be enabled per source file
- Some builds don't support Limited API, so Limited API tests must be skipped on those builds
  (currently this is `Py_TRACE_REFS`, but that may change.)
- `Py_LIMITED_API` must be defined before `<Python.h>` is included.

This puts the hoop-jumping in `testcapi/parts.h`, so individual
test files can be relatively simple. (Currently that's only
`vectorcall_limited.c`, imagine more.)
2022-08-17 13:48:43 +02:00
Ken Jin 7276ca25f5
GH-93911: Specialize `LOAD_ATTR` for custom `__getattribute__` (GH-93988) 2022-08-17 12:37:07 +01:00
Serhiy Storchaka 36517101dd
gh-95736: Fix event loop creation in IsolatedAsyncioTestCase (GH-96033)
It should be created before calling the setUp() method, but after
checking for skipping a test.

Automerge-Triggered-By: GH:tiran
2022-08-17 02:05:17 -07:00
Christian Heimes da0aa518bf
gh-96005: FreeBSD has ENOTCAPABLE, too (GH-96034) 2022-08-17 07:24:53 +02:00
Guido van Rossum f51f54f39d
GH-95704: Don't suppress errors from tasks when TG is cancelled (#95761)
When a task catches CancelledError and raises some other error,
the other error should not silently be suppressed.

Any scenario where a task crashes in cleanup upon cancellation
will now result in an ExceptionGroup wrapping the crash(es)
instead of propagating CancelledError and ignoring the side errors.

NOTE: This represents a change in behavior (hence the need to
change several tests).  But it is only an edge case.

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-08-16 18:23:06 -07:00
Kumar Aditya 9b30b965f0
GH-95909: Make `_PyArg_Parser` initialization thread safe (GH-95958) 2022-08-16 11:22:14 -07:00
Christian Heimes 48174fa0b9
gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006)
- On WASI `ENOTCAPABLE` is now mapped to `PermissionError`.
- The `errno` modules exposes the new error number.
- `getpath.py` now ignores `PermissionError` when it cannot open landmark
  files `pybuilddir.txt` and `pyenv.cfg`.
2022-08-16 20:20:15 +02:00
Michael Droettboom f215d7cac9
gh-94823: Improve coverage in tokenizer.c:valid_utf8 (GH-94856)
When loading a source file from disk, there is a separate UTF-8 validator
distinct from the one in `unicode_decode_utf8`. This exercises that code path
with the same set of invalid inputs as we use for testing the "other" UTF-8
decoder.
2022-08-16 08:54:13 -07:00
Kumar Aditya 9d515997f9
GH-95736: fix IsolatedAsyncioTestCase to initialize Runner before calling setup functions (#95898) 2022-08-16 08:52:06 -07:00
Mark Shannon 5a8c15819c
GH-95245: Move weakreflist into the pre-header. (GH-95996) 2022-08-16 13:57:18 +01:00
Irit Katriel 829aab8592
remove repetitive credit from what's new in 3.11 rst (GH-96024) 2022-08-16 13:47:07 +01:00
Christian Heimes ab4d72954f
gh-95957: Add instructions for Tcl/Tk and OpenSSL on RHEL/CentOS 7 (#95964)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-08-16 13:44:02 +02:00
Irit Katriel bfc2028df0
Change CODEOWNERS entries for iritkatriel (GH-96008) 2022-08-16 09:38:32 +01:00
Yury Selivanov b2afe482f2
gh-95808: Add missing early returns in _asynciomodule.c (#95809) 2022-08-15 16:32:40 -07:00
Terry Jan Reedy f6b811059a
gh-78143: IDLE - fix settings dialog page label. (#96009)
'/Tab' should have been removed from the font page label
when the tab-spaces setting was moved to the Windows page.
2022-08-15 19:03:56 -04:00
Michael Droettboom 3adb4d864b
GH-94808: Test __build_class__ inside non-dict __builtins__ (GH-95932) 2022-08-15 10:39:06 -07:00
Kumar Aditya 914f6367a0
GH-95899: fix asyncio.Runner to call set_event_loop only once (#95900) 2022-08-15 10:02:47 -07:00
Shreenidhi Shedi 2fa03b1b07
gh-95231: Disable md5 & crypt modules if FIPS is enabled (GH-94742)
If kernel fips is enabled, we get permission error upon doing
`import crypt`. So, if kernel fips is enabled, disable the
unallowed hashing methods.

Python 3.9.1 (default, May 10 2022, 11:36:26)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/crypt.py", line 117, in <module>
    _add_method('MD5', '1', 8, 34)
  File "/usr/lib/python3.9/crypt.py", line 94, in _add_method
    result = crypt('', salt)
  File "/usr/lib/python3.9/crypt.py", line 82, in crypt
    return _crypt.crypt(word, salt)
PermissionError: [Errno 1] Operation not permitted

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2022-08-15 07:48:07 -07:00
Christian Heimes 8621e6d43a
gh-95707: Fix function signature (GH-95995) 2022-08-15 15:06:28 +01:00
Mark Shannon 3ef3c6306d
GH-95707: Fix uses of `Py_TPFLAGS_MANAGED_DICT` (GH-95854)
* Make sure that tp_dictoffset is correct with Py_TPFLAGS_MANAGED_DICT is set.

* Avoid traversing managed dict twice when subclassing class with Py_TPFLAGS_MANAGED_DICT set.
2022-08-15 12:29:27 +01:00
Christian Heimes 4a7f5a55dc
gh-95853: Address wasm build and test issues (GH-95985) 2022-08-15 07:41:10 +02:00
Kumar Aditya e8259e047c
Clarify asyncio.Runner docs re: loop_factory (#95979) 2022-08-14 08:53:34 -07:00
Kumar Aditya f2afdf3352
GH-95977: Speed up calling pure python descriptor __get__ with vectorcall (gh-95978) 2022-08-15 00:13:42 +09:00
Pablo Galindo Salgado c26500224f
bpo-40222: Mark exception table function in the dis module as private (#95961) 2022-08-14 15:42:31 +01:00
Christian Heimes 32ac98e899
gh-95853: Add script to automate WASM build (GH-95828)
Automate WASM build with a new Python script. The script provides
several build profiles with configure flags for Emscripten flavors
and WASI. The script can detect and use Emscripten SDK and WASI SDK from
default locations or env vars.

``configure`` now detects Node arguments and creates HOSTRUNNER
arguments for Node 16. It also sets correct arguments for
``wasm64-emscripten``.

Co-authored-by: Brett Cannon <brett@python.org>
2022-08-13 21:56:08 +02:00
Christian Heimes 0b329f4f03
gh-89313: Add hashlib.file_digest to whatsnew 3.11 (GH-95965)
Automerge-Triggered-By: GH:pablogsal
2022-08-13 12:00:58 -07:00
Pablo Galindo Salgado 7552f237a2
bpo-25625: Document contextlib.chdir in the 3.11 what's new (#95962) 2022-08-13 19:27:44 +01:00
Irit Katriel 1402d2ceca
gh-95914: Add paragraph about PEP 654 in main body of 'What's New in 3.11' (GH-95937) 2022-08-13 12:49:04 +01:00
Erlend E. Aasland f07adf82f3
gh-90928: Improve static initialization of keywords tuple in AC (#95907) 2022-08-13 12:09:40 +02:00
Howie Zhao f235178bec
gh-94439: typing docs: Add minimum version to `__required_keys__` and `__optional_keys__` (#95373) 2022-08-12 21:23:33 -07:00
fluesvamp 8281cbddc6
Fix typo in internal/pycore_atomic.h (GH-95939) 2022-08-13 11:40:41 +08:00
Barney Gale 187949ebf2
gh-94909: fix joining of absolute and relative Windows paths in pathlib (GH-95450)
Have pathlib use `os.path.join()` to join arguments to the `PurePath` initialiser, which fixes a minor bug when handling relative paths with drives.

Previously:

```python
>>> from pathlib import PureWindowsPath
>>> a = 'C:/a/b'
>>> b = 'C:x/y'
>>> PureWindowsPath(a, b)
PureWindowsPath('C:x/y')
```

Now:

```python
>>> PureWindowsPath(a, b)
PureWindowsPath('C:/a/b/x/y')
```
2022-08-12 14:23:41 -07:00
Shantanu a965db37f2
gh-94996: Disallow lambda pos only params with feature_version < (3, 8) (GH-95934) 2022-08-12 20:41:02 +02:00
Shantanu b5e3ea2862
gh-94996: Disallow parsing pos only params with feature_version < (3, 8) (GH-94997) 2022-08-12 19:27:50 +02:00
Łukasz Langa d2373fcb49
gh-90300: [docs] Add whatsnew entry for new --help output (GH-95856) (GH-95928)
Co-authored-by: Éric <merwok@netwok.org>
2022-08-12 18:22:25 +02:00
Hugo van Kemenade 50bf5fafcc
gh-82180: Document support for non-integer arg removed from grp.getgrgid in 3.10 (GH-95346) 2022-08-12 18:22:06 +02:00
CAM Gerlach 6376433ac3
gh-95914: Add missing PEPs to the Summary section of 3.11 What's New (GH-95916) 2022-08-12 17:50:01 +02:00
Irit Katriel 41757bfabd
gh-95922: compiler's eliminate_empty_basic_blocks ignores the last block of the compilation unit (GH-95924) 2022-08-12 16:35:09 +01:00
Yury Selivanov 7da4937748
gh-95724: Clarify taskgroups.py license. (#95847) 2022-08-11 16:12:06 -07:00
Erlend E. Aasland e6623e7083
gh-95273: Improve sqlite3.complete_statement docs (#95840)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-08-12 01:05:12 +02:00
Eric Snow 6f6a4e6cc5
gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code (gh-95860)
We only statically initialize for core code and builtin modules.  Extension modules still create
the tuple at runtime.  We'll solve that part of interpreter isolation separately.

This change includes generated code. The non-generated changes are in:

* Tools/clinic/clinic.py
* Python/getargs.c
* Include/cpython/modsupport.h
* Makefile.pre.in (re-generate global strings after running clinic)
* very minor tweaks to Modules/_codecsmodule.c and Python/Python-tokenize.c

All other changes are generated code (clinic, global strings).
2022-08-11 15:25:49 -06:00
Terry Jan Reedy bdb2cf8e91
gh-95841: IDLE - Revise Windows local doc url (#95845)
#91242 replaced the Windows chm help file with a copy
of the html docs.  This PR replaces the IDLE code that
fetches the Windows local help url passed to os.startfile.
Co-authored-by: Steve Dower
2022-08-11 16:54:03 -04:00
Terry Jan Reedy 05a0f37029
gh-84910: Change 'IDLE Help' to 'IDLE Doc' (#95873)
'IDLE Help' was a plain text file.  It was superceded years ago
by a copy of the much more complete html doc.  .
2022-08-11 16:50:49 -04:00
Irit Katriel 9533b40cce
gh-87092: compiler's codegen stage uses int jump target labels, and the target pointer is only calculated just before optimization stage (GH-95655) 2022-08-11 17:40:49 +01:00
Mark Shannon 1b46d118e6
GH-95818: Skip incomplete frames in `PyThreadState_GetFrame` (GH-95886) 2022-08-11 14:06:32 +01:00
zhanpon 23a757f44f
Update _PyEval_AddPendingCall comment (#95817) 2022-08-11 13:32:52 +02:00
Christian Heimes 8b34e914bb
gh-95878: Fix format char in datetime CAPI tests (GH-95879) 2022-08-11 11:58:10 +02:00
Christian Heimes b4c857d0fd
gh-95876: Fix format string in pegen error location code (#95877) 2022-08-11 09:55:57 +01:00
Stanislav Zmiev 5ed584cb6b
gh-90385: Add pathlib.Path.walk what's new section (GH-95467)
Automerge-Triggered-By: GH:brettcannon
2022-08-11 00:31:46 -07:00