Commit Graph

116758 Commits

Author SHA1 Message Date
Shantanu 82ba6ce303
Improve assert_type phrasing (#104081)
I'd like to make the fact that this does nothing at runtime
really obvious, since I suspect this is unintuitive for users who are
unfamiliar with static type checking.

I thought of this because of
https://discuss.python.org/t/add-arg-check-type-to-types/26384
wherein I'm skeptical that the user really did want `assert_type`.
2023-05-01 23:05:25 -07:00
Mariusz Felisiak f0ad456731
gh-102997: Update macOS installer to SQLite 3.41.2. (GH-102998) 2023-05-02 00:30:43 -04:00
Thomas Grainger 9de0cf20fa
GH-103472: close response in HTTPConnection._tunnel (#103473)
Avoid a potential `ResourceWarning` in `http.client.HTTPConnection`
by closing the proxy / tunnel's CONNECT response explicitly.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-02 03:59:42 +00:00
Terry Jan Reedy 690df4c16c
gh-88496: IDLE - fix another test on macOS (#104075)
Needed for Catalina: test_sidebar add 'idletasks' and skip assert.
2023-05-02 02:53:16 +00:00
Eric Snow f73abf8e03
gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074)
This makes it much cleaner to move more PyTypeObject fields to PyInterpreterState.
2023-05-01 20:34:43 -06:00
Eric Snow fdd878650d
gh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (gh-104072)
Until now, we haven't been initializing nor finalizing the per-interpreter state properly.
2023-05-01 19:36:00 -06:00
Pablo Galindo Salgado b1ca34d4d5
gh-104016: Skip test for deeply neste f-strings on wasi (#104071) 2023-05-01 23:55:41 +00:00
Kirill Podoprigora 605f8785db
gh-104057: Fix direct invocation of test_super (#104064) 2023-05-01 16:14:49 -06:00
Irit Katriel 80b714835d
gh-87092: Expose assembler to unit tests (#103988) 2023-05-01 22:29:30 +01:00
Itamar Ostricher a474e04388
gh-97696: asyncio eager tasks factory (#102853)
Co-authored-by: Jacob Bower <jbower@meta.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2023-05-01 15:10:13 -06:00
Eric Snow 59bc36aacd
gh-84436: Immortalize in _PyStructSequence_InitBuiltinWithFlags() (gh-104054)
This also does some cleanup.
2023-05-01 15:08:34 -06:00
Kirill Podoprigora d448fcb032
gh-104057: Fix direct invocation of test_module (GH-104059) 2023-05-01 20:17:47 +00:00
Anže Pečar e665563f83
gh-100458: Clarify Enum.__format__() change of mixed-in types in the whatsnew/3.11.rst (GH-100387)
Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-05-01 12:49:54 -07:00
John Belmonte 3ed8c88290
gh-104018: disallow "z" format specifier in %-format of byte strings (GH-104033)
PEP-0682 specified that %-formatting would not support the "z" specifier,
but it was unintentionally allowed for bytes. This PR makes use of the "z"
flag an error for %-formatting in a bytestring.

Issue: #104018

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-05-01 20:47:14 +01:00
jx124 5078eedc5b
gh-104016: Fixed off by 1 error in f string tokenizer (#104047)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2023-05-01 19:15:47 +00:00
Franek Magiera 2d526cd32f
GH-103629: Update Unpack's repr in compliance with PEP 692 (#104048) 2023-05-01 17:58:50 +00:00
Irit Katriel a679c3d58d
gh-102799: replace sys.exc_info by sys.exception in inspect and traceback modules (#104032) 2023-05-01 18:19:47 +01:00
chgnrdv 2a884ceb36
Fix typo in "expected" word in few source files (#104034) 2023-05-01 09:45:50 -06:00
chgnrdv d5a97074d2
gh-103824: fix use-after-free error in Parser/tokenizer.c (#103993) 2023-05-01 15:26:43 +00:00
Nikita Sobolev 99aab61062 gh-104035: Do not ignore user-defined `__{get,set}state__` in slotted frozen dataclasses (#104041) 2023-05-01 09:19:06 -06:00
Dong-hee Na e147694252
gh-104028: Reduce object creation while calling callback function from gc (gh-104030) 2023-05-01 14:03:24 +00:00
Kirill Podoprigora 4181d078fc
gh-104036: Fix direct invocation of test_typing (#104037)
Previously, `python -m test test_typing` worked, but `python Lib/test/test_typing.py` did not.
2023-05-01 13:42:59 +00:00
sunmy2019 59c27fa5cb
gh-102213: Optimize the performance of `__getattr__` (GH-103761)
Co-authored-by: Kirill <80244920+Eclips4@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Xiang Wang <34048878+wangxiang-hz@users.noreply.github.com>
2023-05-01 18:10:35 +08:00
Carey Metcalfe 487f55d580
gh-103895: Improve how invalid `Exception.__notes__` are displayed (#103897) 2023-05-01 08:32:04 +01:00
Ben Faulhaber 93107aa2a4
Adjust expression from `==` to `!=` in alignment with the meaning of the paragraph. (GH-104021) 2023-05-01 06:47:34 +01:00
Terry Jan Reedy 4b27972f5f
gh-88496: Fix IDLE test hang on macOS (#104025)
Replace widget.update() with widget.update_idletasks in two places.
2023-04-30 21:36:27 -04:00
Shantanu 69bc86cb1a
Improve int test coverage (#104024)
Following discussion in https://discuss.python.org/t/bug-in-int-42/26360/5

This tests some of the things documented in https://github.com/python/cpython/pull/100436

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-30 17:16:38 -07:00
Liam Gersten 74a2b79c62
gh-88773: Added teleport method to Turtle library (#103974)
Add a `teleport` method to `turtle` module turtle instances that acts a lot like `goto`, _but_ ensures the pen is up while warping to the new position to and can control shape filling behavior as part of the jump.

Based on an educator user feature request.

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-30 13:17:36 -07:00
Nikita Sobolev 654d44b3a4
gh-104015: Fix direct invocation of `test_dataclasses` (#104017)
Previously, `python -m test test_dataclasses` passed, but `./python.exe Lib/test/test_dataclasses.py` failed
2023-04-30 17:16:55 +00:00
Alex Waygood 7d3931e94a
gh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_warning consistently passes (#104014) 2023-04-30 15:51:46 +00:00
Pieter Eendebak f186557dc3
gh-103977: compile re expressions in platform.py only if required (#103981)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-04-30 08:36:19 -07:00
Ken Jin ed95e8cbd4
gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004) 2023-04-30 21:08:26 +08:00
Hugo van Kemenade accb417c33
Replace Netlify with Read the Docs build previews (#103843)
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-04-29 23:02:03 -06:00
Amethyst Reese 4b10ecc29f
Update name in acknowledgements and add mailmap (#103696)
I changed my name last year, and would like to update my name in the
acknowledgements and git history accordingly.

git-mailmap reference: https://git-scm.com/docs/gitmailmap

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-04-30 03:21:20 +00:00
Joshua Herman 9e011e7c77
gh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (#103927)
This runs test_asyncio sub-tests in parallel using sharding from Cinder. This suite is typically the longest-pole in runs because it is a test package with a lot of further sub-tests otherwise run serially. By breaking out the sub-tests as independent modules we can run a lot more in parallel.

After porting we can see the direct impact on a multicore system.

Without this change:
  Running make test is 5 min 26 seconds
With this change:
  Running make test takes 3 min 39 seconds

That'll vary based on system and parallelism. On a `-j 4` run similar to what CI and buildbot systems often do, it reduced the overall test suite completion latency by 10%.

The drawbacks are that this implementation is hacky and due to the sorting of the tests it obscures when the asyncio tests occur and involves changing CPython test infrastructure but, the wall time saved it is worth it, especially in low-core count CI runs as it pulls a long tail. The win for productivity and reserved CI resource usage is significant.

Future tests that deserve to be refactored into split up suites to benefit from are test_concurrent_futures and the way the _test_multiprocessing suite gets run for all start methods. As exposed by passing the -o flag to python -m test to get a list of the 10 longest running tests.

---------

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google, LLC]
2023-04-29 18:26:24 -07:00
Oleg Iarygin 00e2c5960e
Remove non-existing tools from Sundry skiplist (#103991) 2023-04-29 12:11:15 -07:00
Itamar Ostricher 85c7bf5bce
gh-103793: Defer formatting task name (#103767)
The default task name is "Task-<counter>" (if no name is passed in during Task creation).
This is initialized in `Task.__init__` (C impl) using string formatting, which can be quite slow.
Actually using the task name in real world code is not very common, so this is wasted init.

Let's defer this string formatting to the first time the name is read (in `get_name` impl),
so we don't need to pay the string formatting cost if the task name is never read.

We don't change the order in which tasks are assigned numbers (if they are) --
the number is set on task creation, as a PyLong instead of a formatted string.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-29 08:20:09 -07:00
Irit Katriel fbf3596c3e
gh-87092: change assembler to use instruction sequence instead of CFG (#103933) 2023-04-29 12:06:04 +01:00
Prince Roshan 84e7d0f0c7
gh-103636: issue warning for deprecated calendar constants (#103833)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-04-29 01:16:46 -06:00
Jelle Zijlstra ed29f524cf
Various small fixes to dis docs (#103923)
- Fix description of MAKE_CELL, which appeared to be inverted from the
  actual behavior
- Fix stray ".:" (sphinx-contrib/sphinx-lint#63)
- Fix inconsistent indentation
- Add some missing code blocks
- Slight style improvements
2023-04-29 00:02:21 -07:00
Mark Shannon 738c226786
GH-103082: Code cleanup in instrumentation code (#103474) 2023-04-29 04:51:55 +00:00
Barry Warsaw e1f14643dc
gh-98040: Remove just the `imp` module (#98573) 2023-04-28 16:17:58 -07:00
Tian Gao 79b9db9295
GH-103971: Forward-port test from GH-103980 (GH-103984) 2023-04-28 20:25:48 +00:00
Paul Ganssle 689723a4ab
GH-103944: Check error status when raising DeprecationWarning (#103949) 2023-04-28 15:44:13 -04:00
Carl Meyer ebf97c50f2
gh-103978: avoid using 'class' as an identifier (#103979) 2023-04-28 19:20:50 +00:00
Olga Matoula 83aa496f81
gh-101100: Add reference doc for __post_init__ (#103818)
Signed-off-by: Olga Matoula <olgamatoula@gmail.com>
2023-04-28 13:10:26 -06:00
Raymond Hettinger c3453fbb11
Update itertool recipe: polynomial_from_roots() (GH-103973) 2023-04-28 12:25:50 -05:00
Juhi Chandalia 81387fe36e
GH-103804: Add test for dis.disco (#103901) 2023-04-28 12:11:21 +01:00
Erlend E. Aasland 30216b69a2
gh-100021: Document that sqlite3's executemany() discards resulting rows (#103939) 2023-04-28 10:02:23 +02:00
Wes Turner 52cedc5c10
Fix typo in math.log docstring (#103943) 2023-04-28 00:31:31 -07:00