Commit Graph

122317 Commits

Author SHA1 Message Date
Donghee Na ab4263a82a
gh-119053: Implement the fast path for list.__getitem__ (gh-119112) 2024-05-21 09:49:18 -04:00
Victor Stinner 73f4a58d36
gh-119102: Fix REPL for dumb terminal (#119269)
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide
if _pyrepl.write_history_file() can be used.
2024-05-21 13:53:20 +01:00
Nikita Sobolev b365332906
Use `fail-fast: false` in `mypy.yml` (#119297)
See docs about this setting: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
2024-05-21 07:52:43 -04:00
Alyssa Coghlan e870c852c0
gh-74929: PEP 667 general docs update (gh-119201)
* expand on What's New entry for PEP 667 (including porting notes)
* define 'optimized scope' as a glossary term
* cover comprehensions and generator expressions in locals() docs
* review all mentions of "locals" in documentation (updating if needed)
* review all mentions of "f_locals" in documentation (updating if needed)
2024-05-21 03:32:15 +00:00
Wulian233 538ed5e481
gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (#119175)
------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-05-20 23:32:00 -04:00
Melanie Arbor 172690227e
gh-102136: Add -m to options that work with -i (GH-119271)
* GH-102136: Add -m to options that work with -i

* Linting
2024-05-20 19:38:33 -04:00
Alex Waygood 423bbcbbc4
gh-108267 Fix another dataclasses docs typo (#119277) 2024-05-20 22:34:57 +00:00
Lysandros Nikolaou fe921931a3
gh-111201: Add tests for unix console class in pyrepl (#118653) 2024-05-20 23:57:32 +02:00
Victor Stinner 9257731f5d
gh-119050: Add XML support to libregrtest refleak checker (#119148)
regrtest test runner: Add XML support to the refleak checker
(-R option).

* run_unittest() now stores XML elements as string, rather than
  objects, in support.junit_xml_list.
* runtest_refleak() now saves/restores XML strings before/after
  checking for reference leaks. Save XML into a temporary file.
2024-05-20 17:05:39 -04:00
Shantanu bf17986096
gh-119253: use ImportError in _ios_support (#119254) 2024-05-20 16:39:30 -04:00
Mark Jason Dominus (陶敏修) 8231a24454
gh-94808: Add test coverage for "starred kind" in _PyPegen_set_expr_context (GH-119222)
Add test coverage for "starred kind" in _PyPegen_set_expr_context
2024-05-20 20:29:17 +00:00
Shauna 7e57640c7e
gh-118912: Remove description of issue fixed in 3.5 from autospeccing guide (#119232)
* Remove description of issue fixed in 3.5 from autospeccing guide

* Make autospeccing note text more succint and lint whitespace

* Add linting changes (missed in last commit)

---------

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-05-20 20:10:53 +00:00
Pablo Galindo Salgado a443e54281
gh-111201: Add more tests to test_pyrepl to cover key translation (#118705)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-20 22:04:52 +02:00
Serhiy Storchaka fe67af1963
gh-119189: Add more tests for mixed Fraction arithmetic (GH-119236) 2024-05-20 22:34:48 +03:00
Hugo van Kemenade 034cf0c316
Docs: Ensure no warnings are found in the NEWS file before a given line number (#119221) 2024-05-20 13:31:38 -06:00
Serhiy Storchaka e188527c34
gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-118784)
It was set to 2 in 65f5e586a1 (GH-98592).
2024-05-20 22:21:04 +03:00
Tialo 6b80a5b20f
Use correct markup in unittest.mock.reset_mock documentation (GH-119207) 2024-05-20 21:17:44 +02:00
Toshio Kuratomi a6fdb31b67
gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (#92281)
* Fix for email.generator.Generator with whitespace between encoded words.

email.generator.Generator currently does not handle whitespace between
encoded words correctly when the encoded words span multiple lines.  The
current generator will create an encoded word for each line.  If the end
of the line happens to correspond with the end real word in the
plaintext, the generator will place an unencoded space at the start of
the subsequent lines to represent the whitespace between the plaintext
words.

A compliant decoder will strip all the whitespace from between two
encoded words which leads to missing spaces in the round-tripped
output.

The fix for this is to make sure that whitespace between two encoded
words ends up inside of one or the other of the encoded words.  This
fix places the space inside of the second encoded word.

A second problem happens with continuation lines.  A continuation line that
starts with whitespace and is followed by a non-encoded word is fine because
the newline between such continuation lines is defined as condensing to
a single space character.  When the continuation line starts with whitespace
followed by an encoded word, however, the RFCs specify that the word is run
together with the encoded word on the previous line.  This is because normal
words are filded on syntactic breaks by encoded words are not.

The solution to this is to add the whitespace to the start of the encoded word
on the continuation line.

Test cases are from #92081

* Rename a variable so it's not confused with the final variable.
2024-05-20 19:10:47 +00:00
Daniel Hollas c0d81b2566
gh-118877: Fix AssertionError crash in pyrepl (#118936) 2024-05-20 20:21:56 +02:00
Hood Chatham 7e1a130b8f
DOCS: Suggest always calling exec with a globals argument and no locals argument (GH-119235)
Many users think they want a locals argument for various reasons but they do not
understand that it makes code be treated as a class definition. They do not want
their code treated as a class definition and get surprised. The reason not
to pass locals specifically is that the following code raises a `NameError`:

```py
exec("""
def f():
    print("hi")

f()

def g():
    f()
g()
""", {}, {})
```

The reason not to leave out globals is as follows:

```py
def t():
    exec("""
def f():
    print("hi")

f()

def g():
    f()
g()
    """)
```
2024-05-20 17:42:15 +00:00
Seth Michael Larson 1195c164da
gh-112844: Update CPE references for external dependencies (#118521) 2024-05-20 13:27:09 -04:00
Jeremy Hylton 19c11f244e
gh-119219: Remove two obsolete TODOs. (#119223)
Remove two obsolete TODOs.
2024-05-20 16:54:16 +00:00
Erlend E. Aasland 6f7dd0a426
Amend NEWS category for gh-119196 (#119218) 2024-05-20 15:32:05 +00:00
Sebastian Rittau e406b399f9
[docs] TypeVarTuple default is keyword-only (#119215) 2024-05-20 15:31:45 +00:00
Erlend E. Aasland 642b25b9a8
gh-115119: Fall back to bundled libmpdec if system libmpdec is not found (#119196) 2024-05-20 10:58:08 -04:00
David Foster 72d07dd30b
typing docs: Fix formatting issue (#119210) 2024-05-20 14:32:51 +00:00
Thanos 05e1dce76d
gh-119185: Fix typo in `_pyrepl.pager`: `tempfilepager` should be `tempfile_pager` (#118881)
Fix typo in `_pyrepl.pager`: `tempfilepager` should be `tempfile_pager`

The name with no underscore doesn't exist.
2024-05-20 10:31:43 -04:00
Roy Hyunjin Han bbb49888a7
gh-103134: Update multiprocessing.managers.ListProxy and DictProxy (GH-103133) 2024-05-20 14:28:36 +00:00
Erlend E. Aasland 1db4695644
gh-118928: Remove unneeded sqlite3 NEWS entry (#119208)
The regression in d8e0e0091 was never part of an official release.
2024-05-20 09:51:02 -04:00
Erlend E. Aasland af359cee75
gh-118928: sqlite3: correctly bail if sequences of params are used with named placeholders (#119197) 2024-05-20 09:44:42 -04:00
Alex Waygood 0883fd22e6
Enable some stricter mypy settings on `Lib/_pyrepl` (#119077) 2024-05-20 08:52:32 -04:00
Nikita Sobolev 16b46ebd2b
gh-119121: Fix and test `async.staggered.staggered_race` (#119173) 2024-05-20 14:06:50 +03:00
Terry Jan Reedy 357f5a1f73
IDLE: fix url in config.py comment (#119198) 2024-05-20 06:04:50 +00:00
pulkin 0abf997e75
gh-119105: difflib: improve recursion for degenerate cases (#119131)
Code from https://github.com/pulkin, in PR
https://github.com/python/cpython/pull/119131

Greatly speeds `Differ` when there are many identically scoring pairs, by splitting the recursion near the inputs' midpoints instead of degenerating (as now) into just peeling off the first two lines.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
2024-05-19 16:46:37 -05:00
Barney Gale 3c28510b98
GH-119113: Raise `TypeError` from `pathlib.PurePath.with_suffix(None)` (#119124)
Restore behaviour from 3.12 when `path.with_suffix(None)` is called.
2024-05-19 17:04:56 +01:00
Barney Gale 4b76671728
GH-118447: Fix FreeBSD test failures. (#119170)
Apparently only macOS requires read permission to call `readlink()` on a
symlink.
2024-05-19 16:39:00 +01:00
Savannah Ostrowski 5307f44fb9
GH-119146: Don't run JIT CI on unrelated changes (GH-119147)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-19 12:59:12 +00:00
Jelle Zijlstra 697465ff88
marshal docs: Remove reference to "Sun" (#119161)
Nobody has been using a Sun machine for a long time. When I saw
this sentence in a lightning talk just now, I thought it was talking
about sending Python code on a spacecraft.
2024-05-18 22:15:14 -04:00
Tim Peters ba8af84864
Try to repair oddball test bots timing out in test_int (#119166)
Various test bots (outside the ones GH normally runs) are timing out during test_int after ecd8664 (asymptotically faster str->int). Best guess is that they don't build the C _decimal module. So require that module in the most likely tests to time out then. Flying mostly blind, though!
2024-05-18 20:54:23 -05:00
Tim Peters ecd8664f11
gh-118750: Asymptotically faster `int(string)` (#118751)
Asymptotically faster (O(n log n)) str->int for very large strings, leveraging the faster multiplication scheme in the C-coded `_decimal` when available. This is used instead of the current Karatsuba-limited method starting at 2 million digits.

Lots of opportunity remains for fine-tuning. Good targets include changing BYTELIM, and possibly changing the internal output base (from 256 to a higher number of bytes).

Doing this was substantial work, and many of the new lines are actually comments giving correctness proofs. The obvious approaches sticking to integers were too slow to be useful, so this is doing variable-precision decimal floating-point arithmetic. Much faster, but worst-possible rounding errors have to be wholly accounted for, using as little precision as possible.

Special thanks to Serhiy Storchaka for asking many good questions in his code reviews!

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: sstandre <43125375+sstandre@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-18 19:19:57 -05:00
Barney Gale caf6064a1b
GH-118447: Fix handling of unreadable symlinks in `os.path.realpath()` (#118489)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-18 22:40:51 +00:00
Victor Stinner 30b4e9f9c4
gh-119050: Add type hints to libregrtest/results.py (#119144)
Sort also 'omitted' in TestResults.display_result().
2024-05-18 16:21:05 -04:00
Donghee Na c141d43937
gh-119132: Update sys.version to identify free-threaded or not. (gh-119134) 2024-05-18 19:44:40 +00:00
Rafael Fontenelle 691429702f
docs: make mimalloc license text literal (#119046) 2024-05-18 12:22:54 -04:00
Victor Stinner 74072a3ffc
gh-119132: Log sys._is_gil_enabled() in test.pythoninfo (#119140) 2024-05-18 09:24:22 -04:00
Nice Zombies 0f5e8bed63
gh-119078: Clarify venv tutorial (GH-119129) 2024-05-18 12:44:02 +01:00
Raymond Hettinger 81c3130c51
Minor improvements to the docs for itertools.tee() (gh-119135) 2024-05-18 01:32:34 -05:00
Kirill Podoprigora 31a28cbae0
gh-119049: Defer `import warnings` in `pathlib._local` (#119111) 2024-05-17 17:12:02 +01:00
Lysandros Nikolaou 447edb6e98
gh-112066: Fix versionadded in PyDict_SetDefaultRef docs (#118696) 2024-05-17 12:10:21 -04:00
Xie Yanbo 65de194dd8
Fix typos in documentation (#119092)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-17 10:37:35 +00:00