Commit graph

28546 commits

Author SHA1 Message Date
Miss Islington (bot)
d9107aa015
gh-94731: Revert to C-style casts for _Py_CAST (GH-94782) (#94849)
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
(cherry picked from commit 6cbb57f62d)
2022-07-15 09:35:23 +02:00
Miss Islington (bot)
91f7914003
GH-89988: Fix memory leak in pickle.Pickler dispatch_table lookup (GH-94298)
(cherry picked from commit 01ef1f95da)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-14 09:47:17 -07:00
Miss Islington (bot)
ffbd6ae37c
gh-94751: Install, import and run the test C++ extension (MVP) (GH-94754) (#94780)
This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
(cherry picked from commit ec5db539b9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2022-07-13 11:09:06 +02:00
Miss Islington (bot)
a276833a7d
[3.11] GH-94736: mark SemLock test as linux only (GH-94750) (#94752)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 16:24:12 +01:00
Miss Islington (bot)
91176d3883
[3.11] bpo-45924: Fix asyncio incorrect traceback when future's exception is raised multiple times (GH-30274) (#94747)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 14:17:32 +01:00
Miss Islington (bot)
8464e4ae83
GH-94736: Fix _multiprocessing.SemLock subclassing (GH-94738)
* fix allocator and deallocator

* 📜🤖 Added by blurb_it.

* code review

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit f5b76330cf)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 05:40:02 -07:00
John Belmonte
45896f2a02
[3.11] gh-93883: elide traceback indicators when possible (GH-93994) (GH-94740)
Elide traceback column indicators when the entire line of the
frame is implicated.  This reduces traceback length and draws
more attention to the remaining (very relevant) indicators.

Example:
```
Traceback (most recent call last):
  File "query.py", line 99, in <module>
    bar()
  File "query.py", line 66, in bar
    foo()
  File "query.py", line 37, in foo
    magic_arithmetic('foo')
  File "query.py", line 18, in magic_arithmetic
    return add_counts(x) / 25
           ^^^^^^^^^^^^^
  File "query.py", line 24, in add_counts
    return 25 + query_user(user1) + query_user(user2)
                ^^^^^^^^^^^^^^^^^
  File "query.py", line 32, in query_user
    return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
                               ~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable
```

Automerge-Triggered-By: GH:pablogsal
2022-07-11 04:27:29 -07:00
Brandt Bucher
e5c8ad3e15
[3.11] GH-94694: Fix column offsets for multi-line method lookups (GH-94721)
(cherry picked from commit 264b3ddfd5)
2022-07-09 22:12:45 -07:00
Kumar Aditya
7a341724e4
[3.11] GH-93252: Fix error handling for failed Python calls (GH-94693) (GH-94708)
Automerge-Triggered-By: GH:tiran
2022-07-09 05:09:15 -07:00
Miss Islington (bot)
b4e232c4b5
gh-94607: Fix subclassing generics (GH-94610)
Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
(cherry picked from commit 6442a9dd21)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-07-08 22:20:43 -07:00
Christian Heimes
36a3372d51
[3.11] gh-94215: Fix error handling for line-tracing events (GH-94681) (GH-94688)
* Re-enable crasher
* Fix error handling for line-tracing events
* blurb add
(cherry picked from commit 23ee4a8067)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-07-08 15:25:53 +02:00
Miss Islington (bot)
65c431685b
gh-93910: Fix enum performance regression (GH-94614)
This removes the performance regression in 3.11, **at the expense of not fixing
the "bug" that allows accessing values from values** (e.g. `Color.RED.BLUE`).

Using the benchmark @markshannon [presented](https://github.com/python/cpython/issues/93910GH-issuecomment-1165503032), the results are:

| Version | Enum | Fast enum | Normal class |
| --- | --- | --- | --- |
| 3.10 | 2.04 | 0.59 | 0.56 |
| 3.11 | 2.78 | 0.31 | 0.15 |
| This PR | 1.30 | 0.32 | 0.16 |

I share this mostly as information about the source of the regression, as this may be useful. It may be that the lower-risk approach for the beta is just to revert to a previously-known working state.
(cherry picked from commit ed136b9673)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-07-07 05:01:09 -07:00
Miss Islington (bot)
421c4b0255
gh-94215: Add reproducer for segfault in frame_setlineno() (GH-94563)
(cherry picked from commit de5884295e)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-07 04:17:47 -07:00
Erlend Egeberg Aasland
c0b7868db2
[3.11] gh-94430: Allow params named module or self with custom C names in AC (GH-94431) (#94649)
(cherry picked from commit 8bbd70b4d1)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-07-07 12:12:47 +02:00
Christian Heimes
74c953d396
[3.11] gh-92228: disable the compiler's 'small exit block inlining' optimization for blocks that have a line number (GH-94592) (GH-94643)
Inlining of code that corresponds to source code lines, can make it hard to distinguish later between code which is only reachable from except handlers, and that which is reachable in normal control flow. This caused problems with the debugger's jump feature.

This PR turns off the inlining optimisation for code which has line numbers. We still inline things like the implicit "return None"..
(cherry picked from commit bde06e1b83)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-07-07 03:10:32 -07:00
Miss Islington (bot)
0187b60106
GH-93896: AAlways set event loop in asyncio.run and IsolatedAsyncioTestCase (GH-94593)
(cherry picked from commit 14fea6b4d2)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-06 08:48:37 -07:00
Łukasz Langa
5f4a16b291
[3.11] gh-94510: Raise on re-entrant calls to sys.setprofile and sys.settrace (GH-94511) (GH-94578)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 40d81fd63b)
2022-07-05 21:02:43 +02:00
Miss Islington (bot)
552fc9a9ac
gh-91330: Tests and docs for dataclass descriptor-typed fields (GH-94424) (GH-94576)
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 5f319308a8)
2022-07-05 20:44:31 +02:00
Vinay Sajip
49aeda989d
[3.11] gh-92897: Ensure venv --copies respects source build property of the creating interpreter (GH-92899) (GH-94567)
(cherry picked from commit 067597522a)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
2022-07-05 16:40:17 +01:00
Miss Islington (bot)
d49159bd9f
[3.11] bpo-46755: Don't log stack info twice in QueueHandler (GH-31355) (GH-94564)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-07-05 15:49:05 +01:00
Łukasz Langa
1bfe83a114
[3.11] gh-94485: Set line number of module's RESUME instruction to 0 as specified by PEP 626 (GH-94552) (GH-94562)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Mark Shannon <mark@hotpy.org>

(cherry picked from commit 324d01944d)
2022-07-05 16:01:24 +02:00
Miss Islington (bot)
68f5fa6683
[3.11] GH-94262: Don't create frame objects for frames that aren't yet complete. (GH-94371) (#94482)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-07-04 19:43:12 +01:00
Jason R. Coombs
c4f82ea0de
[3.11] gh-93975: Provide nicer error reporting from subprocesses in test_venv.EnsurePipTest.test_with_pip (GH-93959) (GH-94003)
This change does three things:

1. Extract a function for trapping output in subprocesses.
2. Emit both stdout and stderr when encountering an error.
3. Apply the change to `ensurepip._uninstall` check.
(cherry picked from commit 6066f450b9)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2022-07-01 17:32:56 +02:00
Mark Shannon
02b30a8ef8
[3.11] GH-94438: Backport GH-94444 (#94486)
* Account for NULLs on evaluation stack when jumping lines.
2022-07-01 15:44:30 +01:00
Miss Islington (bot)
9ebec7d46c
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (GH-94050) (GH-94460)
The inspect version was not working with unittest.mock.AsyncMock.

The fix introduces special-casing of AsyncMock in
`inspect.iscoroutinefunction` equivalent to the one
performed in `asyncio.iscoroutinefunction`.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 4261b6bffc)

Co-authored-by: Mehdi ABAAKOUK <sileht@sileht.net>
2022-06-30 20:04:42 +02:00
Miss Islington (bot)
7fe949e5ea
GH-94398: TaskGroup: Fail create_task() during shutdown (GH-94400) (GH-94463)
Once the task group is shutting down, it should not be possible to create a new task.
Here "shutting down" means `self._aborting` is set, indicating that at least one task
has failed and we have cancelled all others.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 594c369949)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-06-30 20:02:42 +02:00
Miss Islington (bot)
f58c366a73
GH-94329: Don't raise on excessive stack consumption (GH-94421) (GH-94446)
(cherry picked from commit b152bf448b)
2022-06-30 15:53:20 +01:00
Miss Islington (bot)
20b8c9eee0
gh-92336: linecache.getline should not raise exceptions on decoding errors (GH-94410)
(cherry picked from commit 21cbdae90f)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-06-30 02:59:33 -07:00
Miss Islington (bot)
c5ecfa0a1e
[3.11] GH-77403: Fix tests which fail when PYTHONUSERBASE is not normalized (GH-93917) (GH-93969)
(cherry picked from commit b1ae4af5e8)


Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>

Automerge-Triggered-By: GH:iritkatriel
2022-06-30 02:47:16 -07:00
Christian Heimes
0122ab235b
[3.11] gh-94026: Buffer regrtest worker stdout in temporary file (GH-94253) (GH-94408)
Co-authored-by: Victor Stinner <vstinner@python.org>.
Co-authored-by: Christian Heimes <christian@python.org>
2022-06-29 13:51:25 +02:00
Miss Islington (bot)
cf64db6d6d
gh-94208: Add more TLS version/protocol checks for FreeBSD (GH-94347)
Three test cases were failing on FreeBSD with latest OpenSSL.
(cherry picked from commit 1bc86c2625)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-28 00:59:57 -07:00
Miss Islington (bot)
5751530f51
gh-94315: Check for DAC override capability (GH-94316)
``os.geteuid() == 0`` is not a reliable check whether the current user
has the capability to bypass permission checks. Tests now probe for DAC
override.
(cherry picked from commit 7e0d98ecb3)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-27 11:51:45 -07:00
Christian Heimes
56f5f90496
[3.11] gh-90473: Reduce recursion limit on WASI even further (GH-94333) (GH-94334)
Co-authored-by: Christian Heimes <christian@python.org>
2022-06-27 18:33:01 +02:00
Miss Islington (bot)
442dd8ffa5
gh-94192: Fix error for dictionary literals with invalid expression as value. (GH-94304)
* Fix error for dictionary literals with invalid expression as value.

* Remove trailing whitespace
(cherry picked from commit 8c237a7a71)

Co-authored-by: wookie184 <wookie1840@gmail.com>
2022-06-26 12:07:02 -07:00
Serhiy Storchaka
1b27ec5ac6
[3.11] gh-93820: Pickle enum.Flag by name (GH-93891). (GH-94288)
(cherry picked from commit 536985814a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-26 14:24:04 +03:00
Miss Islington (bot)
5ce819f3c5
GH-94254: Make _struct module types immutable (GH-94269)
(cherry picked from commit 17ed560fcd)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-06-26 03:42:41 -07:00
Miss Islington (bot)
f0f3a424af
Run Tools/scripts/reindent.py (GH-94225)
Reindent files which were not properly formatted (PEP 8: 4 spaces).

Remove also some trailing spaces.
(cherry picked from commit e87ada48a9)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-06-26 01:56:55 -07:00
Miss Islington (bot)
68112c3f70
gh-83499: Fix closing file descriptors in tempfile (GH-93874)
(cherry picked from commit d4792ce916)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-26 01:38:06 -07:00
Miss Islington (bot)
125146771c
gh-94245: Test pickling and copying of typing.Tuple[()] (GH-94259)
(cherry picked from commit 75cb3abc3b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-25 09:10:08 -07:00
Miss Islington (bot)
4bc5f9fe8c
gh-94207: Fix struct module leak (GH-94239) (GH-94265)
Make _struct.Struct a GC type

This fixes a memory leak in the _struct module, where as soon
as a Struct object is stored in the cache, there's a cycle from
the _struct module to the cache to Struct objects to the Struct
type back to the module. If _struct.Struct is not gc-tracked, that
cycle is never collected.

This PR makes _struct.Struct GC-tracked, and adds a regression test.
(cherry picked from commit 6b865349aa)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2022-06-25 15:40:14 +01:00
Miss Islington (bot)
89ba660717
gh-94217: Skip import tests when _testcapi is a builtin (GH-94218)
(cherry picked from commit 0a40025b80)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-24 11:54:47 -07:00
Miss Islington (bot)
41e4b426ce
gh-94205: Ensures all required DLLs are copied on Windows for underpth tests (GH-94206)
(cherry picked from commit 51fd4de101)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-06-24 04:20:16 -07:00
Miss Islington (bot)
4d2c972ff7
gh-84461: Fix ctypes and test_ctypes on Emscripten (GH-94142)
- c_longlong and c_longdouble need experimental WASM bigint.
- Skip tests that need threading
- Define ``CTYPES_MAX_ARGCOUNT`` for Emscripten. libffi-emscripten 2022-06-23 supports up to 1000 args.
(cherry picked from commit 8625802d85)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-24 04:17:21 -07:00
Miss Islington (bot)
fbf31454e9
[Enum] Remove automatic docstring generation (GH-94188)
(cherry picked from commit 28a2ccfff2)

Co-authored-by: Sam Ezeh <sam.z.ezeh@gmail.com>
2022-06-23 14:18:20 -07:00
Pablo Galindo Salgado
65ed8b47ee
[3.11] gh-92858: Improve error message for some suites with syntax error before ':' (GH-92894) (#94180)
(cherry picked from commit 2fc83ac3af)

Co-authored-by: wookie184 <wookie1840@gmail.com>

Co-authored-by: wookie184 <wookie1840@gmail.com>
2022-06-23 18:38:06 +01:00
Miss Islington (bot)
1f00e8c55e
[3.11] GH-91742: Fix pdb crash after jump (GH-94171) (#94176)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-06-23 17:36:00 +01:00
Christian Heimes
cf3f8d4728
[3.11] gh-84461: Fix test_sqlite for Emscripten/WASI (GH-94125) (GH-94157)
(cherry picked from commit 15bfabd1aa)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-23 03:11:35 -07:00
Miss Islington (bot)
321acd4138
gh-91456: [Enum] Deprecate default auto() behavior with mixed value types (GH-91457)
When used with plain Enum, auto() returns the last numeric value assigned, skipping any incompatible member values (such as strings); starting in 3.13 the default auto() for plain Enums will require all the values to be of compatible types, and will return a new value that is 1 higher than any existing value.

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
(cherry picked from commit fb1e9506c1)

Co-authored-by: Oscar R <89599049+oscar-LT@users.noreply.github.com>
2022-06-22 23:46:33 -07:00
Miss Islington (bot)
e631d986a8
gh-93951: In test_bdb.StateTestCase.test_skip, avoid including auxiliary importers. (GH-93962) (GH-94118)
Co-authored-by: Brett Cannon <brett@python.org>
(cherry picked from commit c029b552f3)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2022-06-22 14:32:30 +02:00
Miss Islington (bot)
c1bfff4f6b
gh-74696: Do not change the current working directory in shutil.make_archive() if possible (GH-93160) (GH-94105)
It is no longer changed when create a zip or tar archive.

It is still changed for custom archivers registered with shutil.register_archive_format()
if root_dir is not None.

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit fda4b2f063)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-22 11:18:15 +02:00