Skip to content

Commit 21a2720

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.6+ stable branch (2026-07-01)
Summary: Imported python/cpython `3.14.6+` from upstream rev [`08e1772`](https://www.github.com/python/cpython/commit/08e17722227e372131a07b61fa8625dd3b224057) (committed 2026-07-01 03:18:34+00:00). # Commit Info - Base: (`3.14.6+`) - [`6f86288`](https://www.github.com/python/cpython/commit/6f8628842fcd4c16fc99e347abe8e3dca2645c9d) (commit date: 2026-06-29 02:30:22+00:00) - Imported: (`3.14.6+`) - [`08e1772`](https://www.github.com/python/cpython/commit/08e17722227e372131a07b61fa8625dd3b224057) (commit date: 2026-07-01 03:18:34+00:00) # Noteworthy file changes - Test files (1 added) - Low-signal files (12 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GNfY_SZruq2J8M4HAIH0Ut84E85abr0LAAAz Reviewed By: alexmalyshev Differential Revision: D110321511 fbshipit-source-id: ea5910336eb9f5ce4578498035511bd31b338262
1 parent 1ad5317 commit 21a2720

65 files changed

Lines changed: 974 additions & 198 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Android/android.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ def make_build_python(context):
204204
run(["make", "-j", str(os.cpu_count())])
205205

206206

207+
def pythoninfo_build_python(context):
208+
os.chdir(subdir("build"))
209+
run(["make", "pythoninfo"])
210+
211+
207212
# To create new builds of these dependencies, usually all that's necessary is to
208213
# push a tag to the cpython-android-source-deps repository, and GitHub Actions
209214
# will do the rest.
@@ -305,6 +310,7 @@ def build_targets(context):
305310
if context.target in {"all", "build"}:
306311
configure_build_python(context)
307312
make_build_python(context)
313+
pythoninfo_build_python(context)
308314

309315
for host in HOSTS:
310316
if context.target in {"all", "hosts", host}:
@@ -812,6 +818,7 @@ def ci(context):
812818
for step in [
813819
configure_build_python,
814820
make_build_python,
821+
pythoninfo_build_python,
815822
configure_host_python,
816823
make_host_python,
817824
package,
@@ -896,6 +903,8 @@ def add_parser(*args, **kwargs):
896903
"configure-build", help="Run `configure` for the build Python")
897904
add_parser(
898905
"make-build", help="Run `make` for the build Python")
906+
add_parser(
907+
"pythoninfo-build", help="Display build info of the build Python")
899908
configure_host = add_parser(
900909
"configure-host", help="Run `configure` for Android")
901910
make_host = add_parser(
@@ -1012,6 +1021,7 @@ def main():
10121021
dispatch = {
10131022
"configure-build": configure_build_python,
10141023
"make-build": make_build_python,
1024+
"pythoninfo-build": pythoninfo_build_python,
10151025
"configure-host": configure_host_python,
10161026
"make-host": make_host_python,
10171027
"build": build_targets,

Apple/__main__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,15 @@ def make_build_python(context: argparse.Namespace) -> None:
272272
run(["make", "-j", str(os.cpu_count())])
273273

274274

275+
def pythoninfo_build_python(context: argparse.Namespace) -> None:
276+
"""The implementation of the "pythoninfo-build" command."""
277+
with (
278+
group("Display build info of the build Python"),
279+
cwd(subdir("build")),
280+
):
281+
run(["make", "pythoninfo"])
282+
283+
275284
def apple_target(host: str) -> str:
276285
"""Return the Apple platform identifier for a given host triple."""
277286
for _, platform_slices in HOSTS.items():
@@ -751,6 +760,7 @@ def build(context: argparse.Namespace, host: str | None = None) -> None:
751760
for step in [
752761
configure_build_python,
753762
make_build_python,
763+
pythoninfo_build_python,
754764
]:
755765
step(context)
756766

@@ -905,6 +915,9 @@ def parse_args() -> argparse.Namespace:
905915
make_build = subcommands.add_parser(
906916
"make-build", help="Run `make` for the build Python"
907917
)
918+
pythoninfo_build = subcommands.add_parser(
919+
"pythoninfo-build", help="Display build info of the build Python"
920+
)
908921
configure_host = subcommands.add_parser(
909922
"configure-host",
910923
help="Run `configure` for a specific platform and target",
@@ -963,6 +976,7 @@ def parse_args() -> argparse.Namespace:
963976
clean,
964977
configure_build,
965978
make_build,
979+
pythoninfo_build,
966980
configure_host,
967981
make_host,
968982
build,
@@ -1074,6 +1088,7 @@ def signal_handler(*args):
10741088
"clean": clean,
10751089
"configure-build": configure_build_python,
10761090
"make-build": make_build_python,
1091+
"pythoninfo-build": pythoninfo_build_python,
10771092
"configure-host": configure_host_python,
10781093
"make-host": make_host_python,
10791094
"package": package,

Doc/faq/design.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ In general, structured switch statements execute one block of code
263263
when an expression has a particular value or set of values.
264264
Since Python 3.10 one can easily match literal values, or constants
265265
within a namespace, with a ``match ... case`` statement.
266+
See :ref:`the specification <match>` and :ref:`the tutorial <tut-match>`
267+
for more information about :keyword:`match` statements.
266268
An older alternative is a sequence of ``if... elif... elif... else``.
267269

268270
For cases where you need to choose from a very large number of possibilities,

Doc/howto/mro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The Python 2.3 Method Resolution Order
1010
The Method Resolution Order discussed here was *introduced* in Python 2.3,
1111
but it is still used in later versions -- including Python 3.
1212

13-
By `Michele Simionato <https://www.phyast.pitt.edu/~micheles/>`__.
13+
By `Michele Simionato <https://github.com/micheles>`__.
1414

1515
:Abstract:
1616

Doc/library/dialog.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ listed below:
131131
The below functions when called create a modal, native look-and-feel dialog,
132132
wait for the user's selection, and return it.
133133
The exact return value depends on the function (see below); when the dialog is
134-
cancelled it is an empty string, an empty tuple, an empty list or ``None``.
134+
cancelled it is an empty string, an empty tuple or ``None``.
135+
The precise type of this empty value may vary between platforms and Tk
136+
versions, so test the result for truth rather than comparing it with a
137+
specific value.
135138

136139
.. function:: askopenfile(mode="r", **options)
137140
askopenfiles(mode="r", **options)
@@ -140,7 +143,7 @@ cancelled it is an empty string, an empty tuple, an empty list or ``None``.
140143
:func:`askopenfile` returns the opened file object, or ``None`` if the
141144
dialog is cancelled.
142145
:func:`askopenfiles` returns a list of the opened file objects, or an empty
143-
list if cancelled.
146+
tuple if cancelled.
144147
The files are opened in mode *mode* (read-only ``'r'`` by default).
145148

146149
.. function:: asksaveasfile(mode="w", **options)

Doc/library/numbers.rst

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,7 @@ Notes for type implementers
9090

9191
Implementers should be careful to make equal numbers equal and hash
9292
them to the same values. This may be subtle if there are two different
93-
extensions of the real numbers. For example, :class:`fractions.Fraction`
94-
implements :func:`hash` as follows::
95-
96-
def __hash__(self):
97-
if self.denominator == 1:
98-
# Get integers right.
99-
return hash(self.numerator)
100-
# Expensive check, but definitely correct.
101-
if self == float(self):
102-
return hash(float(self))
103-
else:
104-
# Use tuple's hash to avoid a high collision rate on
105-
# simple fractions.
106-
return hash((self.numerator, self.denominator))
93+
extensions of the real numbers. See also :ref:`numeric-hash`.
10794

10895

10996
Adding More Numeric ABCs

Doc/library/tkinter.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,11 +1058,11 @@ Base and mixin classes
10581058
:class:`int`.
10591059
Raise :exc:`ValueError` if *s* is not a valid integer.
10601060

1061-
.. method:: getvar(name='PY_VAR')
1061+
.. method:: getvar(name)
10621062

10631063
Return the value of the Tcl global variable named *name*.
10641064

1065-
.. method:: setvar(name='PY_VAR', value='1')
1065+
.. method:: setvar(name, value)
10661066

10671067
Set the Tcl global variable named *name* to *value*.
10681068

@@ -1494,10 +1494,10 @@ Base and mixin classes
14941494
This updates the display of windows, for example after geometry changes,
14951495
but does not process events caused by the user.
14961496

1497-
.. method:: waitvar(name='PY_VAR')
1497+
.. method:: waitvar(name)
14981498
:no-typesetting:
14991499

1500-
.. method:: wait_variable(name='PY_VAR')
1500+
.. method:: wait_variable(name)
15011501

15021502
Wait until the Tcl variable *name* is modified, continuing to process
15031503
events in the meantime so that the application stays responsive.
@@ -2591,7 +2591,8 @@ Base and mixin classes
25912591
Make *widget* a stand-alone top-level window, decorated by the window
25922592
manager with a title bar and so on.
25932593
Only :class:`Frame`, :class:`LabelFrame` and :class:`Toplevel` widgets
2594-
may be used; passing any other widget type raises an error.
2594+
may be used (the :mod:`tkinter.ttk` versions are **not** accepted);
2595+
passing any other widget type raises an error.
25952596
:meth:`wm_manage` is an alias of :meth:`!manage`.
25962597

25972598
.. versionadded:: 3.3
@@ -3240,6 +3241,14 @@ Toplevel widgets
32403241
profile files is the :envvar:`HOME` environment variable or, if that
32413242
isn't defined, then :data:`os.curdir`.
32423243

3244+
.. note::
3245+
3246+
On Windows, creating a Tcl interpreter (by instantiating :class:`Tk` or
3247+
calling :func:`Tcl`) sets the :envvar:`HOME` environment variable for
3248+
the process, if it is not already set, to ``%HOMEDRIVE%%HOMEPATH%`` (or
3249+
:envvar:`USERPROFILE`, or ``c:\``). This is done by Tcl and can affect
3250+
other code that reads :envvar:`HOME`.
3251+
32433252
.. attribute:: tk
32443253

32453254
The Tk application object created by instantiating :class:`Tk`. This

Lib/curses/textpad.py

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,42 @@ def _update_max_yx(self):
5656
self.maxy = maxy - 1
5757
self.maxx = maxx - 1
5858

59+
def _decode(self, ch):
60+
# The text of a chtype cell or input byte, decoded with the window's
61+
# encoding. A_CHARTEXT keeps the character byte, dropping the attributes.
62+
return bytes([ch & curses.A_CHARTEXT]).decode(self.win.encoding, 'replace')
63+
64+
def _char_at(self, *yx):
65+
# The text of the cell at the given position (default: the cursor).
66+
# instr() re-encodes it to the window's encoding; inch() cannot
67+
# represent a non-ASCII 8-bit-locale character on a wide build.
68+
return self.win.instr(*yx, 1).decode(self.win.encoding, 'replace')
69+
70+
def _cell_at(self, *yx):
71+
# The cell at the given position (default: the cursor) as a chtype
72+
# addch() can write back with its rendition. inch() mangles a non-ASCII
73+
# character on a wide build, so take the byte from instr() and the
74+
# attributes from inch().
75+
return self.win.instr(*yx, 1)[0] | self.win.inch(*yx) & curses.A_ATTRIBUTES
76+
77+
def _isprint(self, cell):
78+
# Whether a chtype cell holds a printable character; _decode() drops the
79+
# attribute bits.
80+
return self._decode(cell).isprintable()
81+
82+
def _printable_key(self, ch):
83+
# Whether the integer keystroke is a printable character, not a key
84+
# code. 0..255 are character bytes (decoded with the window's encoding);
85+
# larger values are function and navigation keys.
86+
return ch <= 0xff and self._decode(ch).isprintable()
87+
5988
def _end_of_line(self, y):
6089
"""Go to the location of the first blank on the given line,
6190
returning the index of the last non-blank character."""
6291
self._update_max_yx()
6392
last = self.maxx
6493
while True:
65-
if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP:
94+
if self._char_at(y, last) != ' ':
6695
last = min(self.maxx, last+1)
6796
break
6897
elif last == 0:
@@ -76,15 +105,16 @@ def _insert_printable_char(self, ch):
76105
backyx = None
77106
while True:
78107
if self.insert_mode:
79-
oldch = self.win.inch()
108+
oldch = self._cell_at()
80109
if y >= self.maxy and x >= self.maxx:
81110
# Use insch() in the lower-right cell: addch() there would move
82111
# the cursor out of the window, raising an error and scrolling
83-
# a scrollable window.
84-
self.win.insch(ch)
112+
# a scrollable window. Pass it as text: insch() does not decode
113+
# an int byte through the locale on a wide build.
114+
self.win.insch(self._decode(ch), ch & curses.A_ATTRIBUTES)
85115
break
86116
self.win.addch(ch)
87-
if not self.insert_mode or not curses.ascii.isprint(oldch):
117+
if not self.insert_mode or not self._isprint(oldch):
88118
break
89119
ch = oldch
90120
(y, x) = self.win.getyx()
@@ -100,7 +130,7 @@ def do_command(self, ch):
100130
self._update_max_yx()
101131
(y, x) = self.win.getyx()
102132
self.lastcmd = ch
103-
if curses.ascii.isprint(ch):
133+
if self._printable_key(ch):
104134
self._insert_printable_char(ch)
105135
elif ch == curses.ascii.SOH: # ^a
106136
self.win.move(y, 0)
@@ -174,7 +204,7 @@ def gather(self):
174204
for x in range(self.maxx+1):
175205
if self.stripspaces and x > stop:
176206
break
177-
result = result + chr(curses.ascii.ascii(self.win.inch(y, x)))
207+
result = result + self._char_at(y, x)
178208
if self.maxy > 0:
179209
result = result + "\n"
180210
return result

Lib/idlelib/News3.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Released after 2025-10-07
44
=========================
55

66

7+
gh-85320: IDLE now reads and writes its configuration files and the
8+
breakpoints file using UTF-8 instead of the locale encoding.
9+
Files with non-ASCII characters and non-UTF-8 encoding may need
10+
to be opened in an editor and resaved with UTF-8 encoding.
11+
712
gh-143774: Better explain the operation of Format / Format Paragraph.
813
Patch by Terry J. Reedy.
914

Lib/idlelib/config.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ def GetOptionList(self, section):
7373

7474
def Load(self):
7575
"Load the configuration file from disk."
76-
if self.file:
77-
self.read(self.file)
76+
if self.file and os.path.exists(self.file):
77+
with open(self.file, encoding='utf-8', errors='replace') as f:
78+
self.read_file(f)
7879

7980
class IdleUserConfParser(IdleConfParser):
8081
"""
@@ -133,10 +134,10 @@ def Save(self):
133134
if fname and fname[0] != '#':
134135
if not self.IsEmpty():
135136
try:
136-
cfgFile = open(fname, 'w')
137+
cfgFile = open(fname, 'w', encoding='utf-8')
137138
except OSError:
138139
os.unlink(fname)
139-
cfgFile = open(fname, 'w')
140+
cfgFile = open(fname, 'w', encoding='utf-8')
140141
with cfgFile:
141142
self.write(cfgFile)
142143
elif os.path.exists(self.file):

0 commit comments

Comments
 (0)