Commit graph

28414 commits

Author SHA1 Message Date
Matt Prodani 1ff212debd
gh-111699: Move smtpd note to dedicated section in What's New Python 3.12 doc (GH-112544)
Relocate smtpd deprecation notice to it's own section rather than under
'locale' in docs for What's New in Python 3.12 doc
2023-11-30 14:53:19 +02:00
Brett Cannon 37589d76bb
GH-103065, GH-106704, GH-105253: Provide a Tools/wasm/wasi.py script to simplify doing a WASI build (GH-112473) 2023-11-29 16:18:25 -08:00
Jelle Zijlstra d4a6229afe
gh-104003: Implement PEP 702 (#104004)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 09:38:29 -08:00
Jelle Zijlstra 4038869423
gh-112509: Fix keys being present in both required_keys and optional_keys in TypedDict (#112512)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 09:36:48 -08:00
Irit Katriel 2c68011780
gh-112332: Deprecate TracebackException.exc_type, add exc_type_str. (#112333) 2023-11-28 08:03:25 +00:00
Tian Gao 2df26d8348
gh-112105: Make completer delims work on libedit (gh-112106) 2023-11-28 06:23:23 +00:00
Anthony Shaw 154f099e61
gh-112292 : Catch import error conditions with readline hooks (gh-112313)
Prevents a segmentation fault in registered hooks for the readline library, but only when the readline module is loaded inside an isolated sub interpreter.  The module is single-phase init so loading it fails, but not until the module init function has already run, where the readline hooks get registered.

The readlinestate_global macro was error-prone to PyImport_FindModule returning NULL and crashing in about 18 places.  I could reproduce 1 easily, but this PR replaces the macro with a function and adds error conditions to the other functions.
2023-11-27 18:58:53 -07:00
Tian Gao b90a5cf11c
gh-99367: Do not mangle sys.path[0] in pdb if safe_path is set (#111762)
Co-authored-by: Christian Walther <cwalther@users.noreply.github.com>
2023-11-27 23:11:40 +00:00
apaz 8f71b349de
gh-112217: Add check to call result for do_raise() where cause is a type. (#112216) 2023-11-27 21:13:27 +00:00
Serhiy Storchaka 4dcfd02bed
gh-68166: Add support of "vsapi" in ttk.Style.element_create() (GH-111393) 2023-11-27 20:57:33 +02:00
Pablo Galindo Salgado 45d648597b
gh-112387: Fix error positions for decoded strings with backwards tokenize errors (#112409)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2023-11-27 18:37:48 +00:00
Pablo Galindo Salgado 2c8b191742
gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (#112410)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2023-11-27 18:36:11 +00:00
kale-smoothie 967f2a3052
bpo-41422: Visit the Pickler's and Unpickler's memo in tp_traverse (GH-21664)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-27 18:09:41 +00:00
Jacob Walls 99a73c3465
gh-76912: Raise OSError from any failure in getpass.getuser() (#29739)
* bpo-32731: Raise OSError from any failure in getpass.getuser()
Previously, if the username was not set in certain environment variables, ImportError escaped on Windows systems, and it was possible for KeyError to escape on other systems if getpwuid() failed.
2023-11-27 10:05:55 -08:00
Serhiy Storchaka 4eea1e8236
gh-112438: Fix support of format units with the "e" prefix in nested tuples in PyArg_Parse (gh-112439) 2023-11-27 18:32:55 +01:00
Zackery Spytz 812360fddd
gh-84443: SSLSocket.recv_into() now support buffer protocol with itemsize != 1 (GH-20310)
It is also no longer use __len__().

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-27 19:15:39 +02:00
Alex Waygood 22e411e1d1
gh-111874: Call __set_name__ on objects that define the method inside a typing.NamedTuple class dictionary as part of the creation of that class (#111876)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-11-27 16:34:44 +00:00
Alex Waygood 0622839cfe
gh-112414: Fix AttributeError when calling repr() on a namespace package imported with a custom loader (#112425) 2023-11-27 08:19:29 +00:00
Grant Ramsay e954ac7205
gh-63284: Add support for TLS-PSK (pre-shared key) to the ssl module (#103181)
Add support for TLS-PSK (pre-shared key) to the ssl module.

---------

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-11-27 04:01:44 +00:00
Irit Katriel fb202af447
gh-99606: Make code generated for an empty f-string identical to that of a normal empty string (#112407) 2023-11-26 17:13:57 +00:00
Alex Waygood 418d585feb
gh-112405: Optimise pathlib.Path.relative_to (#112406) 2023-11-26 15:56:03 +00:00
Mark Dickinson 9fe60340d7
gh-112358: Fix Python 3.12 regression with subclassing struct.Struct. (#112424)
Revert commit c8c0afc713 (PR #94532),
which moved `struct.Struct` initialisation from `Struct.__init__` to `Struct.__new__`.
This caused issues with code in the wild that subclasses `struct.Struct`.
2023-11-26 14:29:52 +00:00
Barney Gale bbb4367b55
GH-77621: Delay some imports from pathlib (#112244)
Import `contextlib`, `glob` and `re` only as required.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-25 17:41:05 +00:00
Irit Katriel fbb9027a03
gh-94722: fix DocTest.__eq__ for case of no line number on one side (#112385) 2023-11-25 17:23:43 +00:00
Barney Gale 19a1fc1b3d
GH-112361: Speed up pathlib by removing some temporary objects. (#112362)
Construct only one new list object (using `list.copy()`) when creating a
new path object with a modified tail. This slightly speeds up
`with_name()` and `with_suffix()`
2023-11-25 17:19:38 +00:00
Randolf Scholz e9d1360c9a
gh-112345: typing.Protocol: Let failed subclasscheck show non-method members (#112344)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-24 09:46:08 +00:00
Tian Gao dc0adb44d8
Add extra tests for random.binomialvariate (gh-112325) 2023-11-23 12:31:03 -06:00
Irit Katriel 89ddea4886
gh-112137: change dis output to show no-lineno as -- instead of None (#112335) 2023-11-23 14:34:27 +00:00
Irit Katriel 10e1a0c916
gh-112137: change dis output to display labels instead of offsets (#112138) 2023-11-22 22:36:55 +00:00
Thomas Wouters 9c4347ef8b Python 3.13.0a2 2023-11-22 12:20:24 +01:00
Junya Okabe 9d70831cb7
gh-110745: add a newline argument to pathlib.Path.read_text (#110880)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-11-21 22:32:38 +00:00
T. Wouters 4c483e0113
gh-111863: Rename blurb snippet placed in the wrong directory by accident. (#112300)
Rename blurb snippet placed in the wrong directory by accident.
2023-11-21 18:37:03 +01:00
Christopher Chavez d67f947c72
gh-110950: add upstream Tk fixes to macOS installer. (GH-111041)
Add upstream Tk patches for three problems affecting tkinter users:

- Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed. (gh-92603)

- Update macOS installer to include an upstream Tcl/Tk fix
for the ``ttk::ThemeChanged`` error encountered in Tkinter. (gh-71383)

- Update macOS installer to include an upstream Tcl/Tk fix for the
``Secure coding is not enabled for restorable state!`` warning
encountered in Tkinter on macOS 14 Sonoma. (gh-110950)

Co-authored-by: Ned Deily <nad@python.org>
2023-11-21 03:12:19 -05:00
AN Long de2715f086
gh-59703: use the system dladdr function in getpath.c for macOS framework builds (GH-111546)
Co-authored-by: Ned Deily <nad@python.org>
2023-11-21 00:15:25 -05:00
Guido van Rossum 8deb8bc2e5
gh-112287: Speed up Tier 2 (uop) interpreter a little (#112286)
This makes the Tier 2 interpreter a little faster.
I calculated by about 3%,
though I hesitate to claim an exact number.

This starts by doubling the trace size limit (to 512),
making it more likely that loops fit in a trace.

The rest of the approach is to only load
`oparg` and `operand` in cases that use them.
The code generator know when these are used.

For `oparg`, it will conditionally emit
```
oparg = CURRENT_OPARG();
```
at the top of the case block.
(The `oparg` variable may be referenced multiple times
by the instructions code block, so it must be in a variable.)

For `operand`, it will use `CURRENT_OPERAND()` directly
instead of referencing the `operand` variable,
which no longer exists.
(There is only one place where this will be used.)
2023-11-20 11:25:32 -08:00
Guido van Rossum 1995955173
gh-106529: Make FOR_ITER a viable uop (#112134)
This uses the new mechanism whereby certain uops
are replaced by others during translation,
using the `_PyUop_Replacements` table.
We further special-case the `_FOR_ITER_TIER_TWO` uop
to update the deoptimization target to point
just past the corresponding `END_FOR` opcode.

Two tiny code cleanups are also part of this PR.
2023-11-20 10:08:53 -08:00
Pablo Galindo Salgado d59feb5dbe
gh-112243: Don't include comments in f-string debug expressions (#112284) 2023-11-20 15:18:24 +00:00
Hugo van Kemenade 3b3ec0d77f
gh-111863: Rename Py_NOGIL to Py_GIL_DISABLED (#111864)
Rename Py_NOGIL to Py_GIL_DISABLED
2023-11-20 15:52:00 +02:00
Crowthebird 1c8f912ebd
bpo-45759: Better error messages for non-matching 'elif'/'else' statements (#29513) 2023-11-20 13:27:53 +00:00
Brett Cannon 56e59a49ae
GH-111807: Lower the parser stack depth under WASI debug builds (#112225) 2023-11-20 13:27:33 +00:00
Michael ce1096f974
gh-73561: Omit interface scope from IPv6 when used as Host header (#93324)
Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google LLC]
2023-11-19 22:37:13 +00:00
Nikita Sobolev f8129146ef
gh-112266: Remove (if defined) part from __dict__ and __weakref__ docstrings (#112268) 2023-11-19 18:30:07 +00:00
Anthony Shaw adedcfa06b
gh-79871: IDLE - Fix and test debugger module (#11451)
Add docstrings to the debugger module. Fix two bugs: initialize Idb.botframe (should be in Bdb); In Idb.in_rpc_code, check whether prev_frame is None before trying to use it. Make other code changes.

Expand test_debugger coverage from 19% to 66%.
---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-11-18 23:20:38 -05:00
Brett Cannon f489ace9e7
GH-111808: Make the default value for test.support.infinite_recursion() conditional on compiler optimizations (GH-112223)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-11-17 15:52:11 -08:00
Sam Gross 446f18a911
gh-111956: Add thread-safe one-time initialization. (gh-111960) 2023-11-16 12:19:54 -07:00
Victor Stinner bd89bca9e2
gh-111798: Use lower Py_C_RECURSION_LIMIT in debug mode (#112124)
* Run again test_ast_recursion_limit() on WASI platform.
* Add _testinternalcapi.get_c_recursion_remaining().
* Fix test_ast and test_sys_settrace: test_ast_recursion_limit() and
  test_trace_unpack_long_sequence() now adjust the maximum recursion
  depth depending on the the remaining C recursion.
2023-11-16 13:52:33 +00:00
Tomas R a6465605c1
gh-111916: Make hashlib related modules thread-safe without the GIL (#111981)
Always use an individual lock on hash objects when in free-threaded builds.

Fixes #111916
2023-11-15 23:53:38 +00:00
Victor Stinner d9fd33a869
gh-112088: Run autoreconf in GHA check_generated_files (#112090)
The "Check if generated files are up to date" job of GitHub Actions
now runs the "autoreconf -ivf -Werror" command instead of the "make
regen-configure" command to avoid depending on the external quay.io
server.

Add Tools/build/regen-configure.sh script to regenerate the configure
with an Ubuntu container image. The
"quay.io/tiran/cpython_autoconf:271" container image
(https://github.com/tiran/cpython_autoconf) is no longer used.
2023-11-15 21:47:14 +01:00
Victor Stinner 7e2308aaa2
gh-112026: Add again _PyThreadState_UncheckedGet() function (#112121)
Add again the private _PyThreadState_UncheckedGet() function as an
alias to the new public PyThreadState_GetUnchecked() function.
2023-11-15 19:15:03 +01:00
Victor Stinner bd2f1485b0
gh-112026: Restore removed _PyDict_GetItemStringWithError() (#112119)
Restore the removed _PyDict_GetItemStringWithError() function. It is
used by numpy.
2023-11-15 17:10:06 +00:00