Commit graph

117085 commits

Author SHA1 Message Date
Gregory Szorc 5360cb3d56
gh-101282: Apply BOLT optimizations to libpython for shared builds (#104709)
Apply BOLT optimizations to libpython for shared builds. Most of the C
code is in libpython so it is critical to apply BOLT there fully realize
BOLT benefits.

This change also reworks how BOLT instrumentation is applied. It
effectively removes the readelf based logic added in gh-101525 and
replaces it with a mechanism that saves a copy of the pre-bolt binary
and restores that copy when necessary. This allows us to perform BOLT
optimizations without having to manually delete the output binary to
force a new bolt run.

Also:
- add a clean-bolt target for purging BOLT files and hook that up to the
  clean target
- .gitignore BOLT related files

Before and after this refactor, `make` will no-op after a previous run.
Both versions should also share common make DAG deficiencies where
targets fail to trigger as often as they need to or can trigger
prematurely in certain scenarios. e.g. after this change you may need to
`rm profile-bolt-stamp` to force a BOLT run because there aren't
appropriate non-phony targets for BOLT's make target to depend on.

To make it easier to iterate on custom BOLT settings, the flags to pass
to instrumentation and application are now defined in configure and can
be overridden by passing BOLT_INSTRUMENT_FLAGS and BOLT_APPLY_FLAGS.
2023-05-22 13:45:20 +02:00
Marta Gómez Macías 729b252241
gh-104741: Add line number attribute to indentation error exception (#104743) 2023-05-22 11:30:18 +00:00
Cristián Maureira-Fredes 0a7796052a
gh-102856: Allow comments inside multi-line f-string expresions (#104006) 2023-05-22 10:30:07 +00:00
Serhiy Storchaka 9bc80dac47
gh-94473: Flatten arguments in tkinter.Canvas.coords() (GH-98479)
It now accepts not only "x1, y1, x2, y2, ..." and "[x1, y1, x2, y2, ...]",
but also "(x1, y1), (x2, y2), ..." and "[(x1, y1), (x2, y2), ...]".
2023-05-22 11:54:41 +03:00
Ned Deily 6fba031476
Update macOS installer ReadMe and Welcome screens for 3.12.0b1. (GH-104739) 2023-05-22 06:43:43 +00:00
Ned Deily 13e460086b
gh-99834: Update macOS installer to Tcl/Tk 8.6.13. (GH-104738) 2023-05-22 06:33:50 +00:00
Jelle Zijlstra a5f244d627
gh-104656: Rename typeparams AST node to type_params (#104657) 2023-05-21 21:25:09 -07:00
Luccccifer ef5d00a592
gh-104536: Improve multiprocessing.process._cleanup logic (#104537)
Fix a race condition in the internal `multiprocessing.process` cleanup
logic that could manifest as an unintended `AttributeError` when calling
`BaseProcess.close()`.

---------

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-22 03:48:57 +00:00
Kumar Aditya b9c807a260
GH-103092: isolate _ssl (#104725) 2023-05-22 06:14:48 +05:30
Marta Gómez Macías 8817886ae5
gh-102856: Tokenize performance improvement (#104731) 2023-05-22 00:29:04 +00:00
Alex Waygood 4b107d86f3
gh-104683: clinic.py: Modernise parse_converter() using pattern-matching (#104696) 2023-05-21 23:29:43 +00:00
Jelle Zijlstra cd9748409a
gh-104686: Fix tracing for decorated classes (#104708) 2023-05-21 16:20:19 -07:00
Alex Waygood 64d1b44a54
gh-104683: clinic.py: Improve coverage for the parse_converter method (#104729) 2023-05-21 23:00:47 +00:00
Serhiy Storchaka f3466bc040
gh-98836: Extend PyUnicode_FromFormat() (GH-98838)
* Support for conversion specifiers o (octal) and X (uppercase hexadecimal).
* Support for length modifiers j (intmax_t) and t (ptrdiff_t).
* Length modifiers are now applied to all integer conversions.
* Support for wchar_t C strings (%ls and %lV).
* Support for variable width and precision (*).
* Support for flag - (left alignment).
2023-05-22 00:32:39 +03:00
Erlend E. Aasland 6ba8406cb6
gh-104050: Add more type annotations to Argument Clinic (#104631)
Annotate methods of the following classes:

- class Function
- class Parameter
- class LandMine
2023-05-21 21:24:26 +00:00
Erlend E. Aasland bf6dd8f5fd
gh-104050: Add basic type hints to Argument Clinic clinic class (#104705)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-21 20:49:34 +00:00
Erlend E. Aasland c482e9a4e6
gh-104050: Annotate Argument Clinic return converters (#104706)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-21 20:23:14 +00:00
Hugo van Kemenade 5841fbc1a2
gh-103857: Document utcnow and utcfromtimestamp deprecations in What's New (#104542)
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2023-05-21 13:45:44 -06:00
Terry Jan Reedy 0c5e79bcdf
gh-104719: IDLE - delete useless monkeypatch of tokenize (#104726) 2023-05-21 18:42:26 +00:00
Marta Gómez Macías ffe47cb623
gh-104719: Restore Tokenize module constants (#104722) 2023-05-21 17:07:28 +01:00
Mark Shannon 93923793f6
GH-101291: Add low level, unstable API for pylong (GH-101685)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2023-05-21 14:45:48 +01:00
Jelle Zijlstra ab71acd67b
typing docs: Move some classes out of the "Generics" section (#104707)
- AnyStr can be used in type annotations, contrary to the section header
- Unpack can also be used in annotations, and its use is not restricted
  to generics. It makes more sense with other building blocks like Required.
- Protocol is not necessarily generic.

Also fix the indentation for two notes associated with Concatenate.

Split off from #104642, but I think this change is independently an
improvement.
2023-05-21 06:00:50 -07:00
Dong-hee Na b9fcfa6024
gh-104717: Add comment about manual loop unrolling (gh-104718) 2023-05-21 21:08:28 +09:00
Zac Hatfield-Dodds 014dd301b5
gh-86275: improve Hypothesis configuration for CI and local runs (#104468) 2023-05-21 05:52:29 -06:00
gsallam be0c106789
gh-103295: expose API for writing perf map files (#103546)
Co-authored-by: Aniket Panse <aniketpanse@fb.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-21 11:12:24 +01:00
Dong-hee Na 2e91c7e626
gh-104469: Convert _testcapi/exceptions to use AC (gh-104502) 2023-05-21 18:39:45 +09:00
William Sawyer 60993ba8b4
Corrected identifier (#104713) 2023-05-21 01:57:50 -04:00
Kirill Podoprigora 99b641886a
gh-104698: Fix reference leak in mmapmodule.c (#104700)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-21 01:19:56 +01:00
Alex Waygood b870b1fa75
gh-74690: Make a typing test more resilient (#104691) 2023-05-20 17:13:37 -07:00
Marta Gómez Macías 6715f91edc
gh-102856: Python tokenizer implementation for PEP 701 (#104323)
This commit replaces the Python implementation of the tokenize module with an implementation
that reuses the real C tokenizer via a private extension module. The tokenize module now implements
a compatibility layer that transforms tokens from the C tokenizer into Python tokenize tokens for backward
compatibility.

As the C tokenizer does not emit some tokens that the Python tokenizer provides (such as comments and non-semantic newlines), a new special mode has been added to the C tokenizer mode that currently is only used via
the extension module that exposes it to the Python layer. This new mode forces the C tokenizer to emit these new extra tokens and add the appropriate metadata that is needed to match the old Python implementation.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2023-05-21 01:03:02 +01:00
Christian Heimes 3ed57e4995
gh-61460: Stronger HMAC in multiprocessing (#20380)
bpo-17258:  `multiprocessing` now supports stronger HMAC algorithms for inter-process connection authentication rather than only HMAC-MD5.

Signed-off-by: Christian Heimes <christian@python.org>

gpshead: I Reworked to be more robust while keeping the idea.

The protocol modification idea remains, but we now take advantage of the
message length as an indicator of legacy vs modern protocol version.  No
more regular expression usage.  We now default to HMAC-SHA256, but do so
in a way that will be compatible when communicating with older clients
or older servers. No protocol transition period is needed.

More integration tests to verify these claims remain true are required. I'm
unaware of anyone depending on multiprocessing connections between
different Python versions.

---------

Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
2023-05-20 23:33:09 +00:00
Prince Roshan 12f1581b0c
gh-103606: raise RuntimeError if config file is invalid or empty (#104701)
(this adjusts new code) raise RuntimeError if provided config file is invalid or empty, not ValueError.
2023-05-20 22:26:49 +00:00
Erlend E. Aasland 27a68be77f
gh-104050: Add basic type hints to Argument Clinic DSL parser (#104704)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-20 21:55:02 +00:00
Alex Waygood 19dd5aa89a
gh-104683: Modernise Tools/clinic/ (#104684)
- Make some string interpolations more readable using f-strings or
  explicit parametrisation
- Remove unneeded open() mode specifiers

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-20 20:16:49 +00:00
Irit Katriel 30488fa22a
gh-49174: document that the effect of calling gc.collect() during a collection is undefined (#104699) 2023-05-20 21:12:10 +01:00
Gregory P. Smith d1732feea0
gh-104372: Use non-Raw malloc for c_fds_to_keep in _posixsubprocess (#104697)
Use non-Raw malloc for c_fds_to_keep as the code could ask for 0 length.
2023-05-20 17:09:23 +00:00
Cheryl Sabella 68ee8b3f15
gh-56276: Add tests to test_compare (#3199)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-20 12:07:40 -04:00
han-solo 2c97878bb8
gh-104679 Fixed syntax highlighting in turtle docs (#104682) 2023-05-20 09:42:29 -06:00
Pablo Galindo Salgado ff7f731632
gh-104658: Fix location of unclosed quote error for multiline f-strings (#104660) 2023-05-20 14:07:05 +01:00
Alex Waygood 663c049ff7
gh-104683: Modernise clinic.py using str.removeprefix and str.removesuffix (#104685)
Both methods were new in Python 3.9.
2023-05-20 11:08:28 +00:00
Erlend E. Aasland ae147d01a0
gh-104146: Purge dead code from Argument Clinic (#104680)
The following local variables were assigned but never used:

- line 551:  result
- line 1341: groups
- line 1431: default_return_converter
- line 1529: ignore_self
- line 1809: input_checksum
- line 4224: new'

---

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-20 10:52:32 +00:00
Alex Waygood 02b60035ce
gh-104683: Argument clinic: use dict over OrderedDict (#104647)
For code readability. Instances of `builtins.dict` have been ordered since 3.6, and have been guaranteed by the language to be ordered since Python 3.7. Argument Clinic now requires Python 3.10+.
2023-05-20 11:24:00 +01:00
partev 06eeee97e3
Replace "OS X" with "macOS" (#104653) 2023-05-20 01:25:52 -07:00
Prince Roshan ceaa4c3476
gh-103987: fix several crashes in mmap module (#103990)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-19 20:34:12 -07:00
Nyakku Shigure 3bc94e678f
docs: fix wrong indentation causing rendering error in dis page (#104661) 2023-05-19 23:11:21 +03:00
Matthias Görgens 6e39fa1955
gh-94906: Support multiple steps in math.nextafter (#103881)
This PR updates `math.nextafter` to add a new `steps` argument. The behaviour is as though `math.nextafter` had been called `steps` times in succession.

---------

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2023-05-19 21:03:49 +01:00
chgnrdv c3f43bfb4b
gh-104472: Skip test_subprocess.ProcessTestCase.test_empty_env if ASAN is enabled (#104667)
Skip test_subprocess.ProcessTestCase.test_empty_env if ASAN is enabled.
2023-05-19 19:25:51 +00:00
Christopher Chavez 625887e6df
gh-103839: Allow building Tkinter against Tcl 8.7 without external libtommath (GH-103842) 2023-05-19 15:09:59 -04:00
Soumendra Ganguly 486bc8e030
gh-85984: New additions and improvements to the tty library. (#101832)
New additions to the tty library. Functions added: cfmakeraw(), and cfmakecbreak(). The
functions setcbreak() and setraw() now return original termios to save an extra tcgetattr() call.

---------

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-05-19 18:13:30 +00:00
Thomas Hisch 3ac856e697
gh-104659: Consolidate python examples in enum documentation (#104665) 2023-05-19 11:46:20 -06:00