Skip to content

Commit 6a30dfc

Browse files
committed
update to python 3.14.8
1 parent 52d5fff commit 6a30dfc

248 files changed

Lines changed: 3744 additions & 1968 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.

‎.github/workflows/CI_build.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444
if: matrix.build_configuration == 'Release'
4545
working-directory: installer
4646
run: |
47-
$env:PYTHONBUILDDIR_ARM64='${{ github.workspace }}\packages\pythonarm64.3.14.7\tools'
48-
$env:PYTHONBUILDDIR_X64='${{ github.workspace }}\packages\python.3.14.7\tools'
49-
$env:PYTHONBUILDDIR='${{ github.workspace }}\packages\pythonx86.3.14.7\tools'
47+
$env:PYTHONBUILDDIR_ARM64='${{ github.workspace }}\packages\pythonarm64.3.14.8\tools'
48+
$env:PYTHONBUILDDIR_X64='${{ github.workspace }}\packages\python.3.14.8\tools'
49+
$env:PYTHONBUILDDIR='${{ github.workspace }}\packages\pythonx86.3.14.8\tools'
5050
Rename-Item -Path ".\buildPaths.bat.orig" -NewName "buildPaths.bat"
5151
dotnet tool install --global wix --version 7.0.0
5252
.\buildAll.bat ${{ matrix.build_platform }}

‎PythonLib/full/_ios_support.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
else:
1111
# ctypes is available. Load the ObjC library, and wrap the objc_getClass,
1212
# sel_registerName methods
13-
lib = util.find_library("objc")
14-
if lib is None:
15-
# Failed to load the objc library
16-
raise ImportError("ObjC runtime library couldn't be loaded")
13+
# find_library() resolves a system library through the dyld shared cache,
14+
# which needs _dyld_shared_cache_contains_path(); that is unavailable before
15+
# iOS 14, so fall back to the bare name, which dyld resolves by itself.
16+
lib = util.find_library("objc") or "libobjc.dylib"
1717

18-
objc = cdll.LoadLibrary(lib)
18+
try:
19+
objc = cdll.LoadLibrary(lib)
20+
except OSError:
21+
raise ImportError("ObjC runtime library couldn't be loaded")
1922
objc.objc_getClass.restype = c_void_p
2023
objc.objc_getClass.argtypes = [c_char_p]
2124
objc.sel_registerName.restype = c_void_p

‎PythonLib/full/_py_abc.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ def _abc_caches_clear(cls):
9292
def __instancecheck__(cls, instance):
9393
"""Override for isinstance(instance, cls)."""
9494
# Inline the cache checking
95-
subclass = instance.__class__
95+
try:
96+
subclass = instance.__class__
97+
except AttributeError:
98+
# Fall back to the type when the instance has no __class__,
99+
# matching the behaviour of the built-in isinstance() (gh-153772).
100+
subclass = type(instance)
96101
if subclass in cls._abc_cache:
97102
return True
98103
subtype = type(instance)

‎PythonLib/full/_pydatetime.py‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,19 +355,30 @@ def _find_isoformat_datetime_separator(dtstr):
355355
return 8
356356

357357

358+
def _read_isoformat_component(s, n):
359+
# The caller has verified the string is ASCII, so isdigit() matches only
360+
# the ASCII digits accepted by the C parser.
361+
if len(s) != n or not s.isdigit():
362+
raise ValueError("Invalid isoformat string")
363+
return int(s)
364+
365+
358366
def _parse_isoformat_date(dtstr):
359367
# It is assumed that this is an ASCII-only string of lengths 7, 8 or 10,
360368
# see the comment on Modules/_datetimemodule.c:_find_isoformat_datetime_separator
361369
if len(dtstr) not in (7, 8, 10):
362370
raise ValueError("Invalid isoformat string")
363-
year = int(dtstr[0:4])
371+
if not dtstr.isascii():
372+
raise ValueError("Invalid isoformat string")
373+
374+
year = _read_isoformat_component(dtstr[0:4], 4)
364375
has_sep = dtstr[4] == '-'
365376

366377
pos = 4 + has_sep
367378
if dtstr[pos:pos + 1] == "W":
368379
# YYYY-?Www-?D?
369380
pos += 1
370-
weekno = int(dtstr[pos:pos + 2])
381+
weekno = _read_isoformat_component(dtstr[pos:pos + 2], 2)
371382
pos += 2
372383

373384
dayno = 1
@@ -377,17 +388,17 @@ def _parse_isoformat_date(dtstr):
377388

378389
pos += has_sep
379390

380-
dayno = int(dtstr[pos:pos + 1])
391+
dayno = _read_isoformat_component(dtstr[pos:pos + 1], 1)
381392

382393
return list(_isoweek_to_gregorian(year, weekno, dayno))
383394
else:
384-
month = int(dtstr[pos:pos + 2])
395+
month = _read_isoformat_component(dtstr[pos:pos + 2], 2)
385396
pos += 2
386397
if (dtstr[pos:pos + 1] == "-") != has_sep:
387398
raise ValueError("Inconsistent use of dash separator")
388399

389400
pos += has_sep
390-
day = int(dtstr[pos:pos + 2])
401+
day = _read_isoformat_component(dtstr[pos:pos + 2], 2)
391402

392403
return [year, month, day]
393404

@@ -402,10 +413,7 @@ def _parse_hh_mm_ss_ff(tstr):
402413
time_comps = [0, 0, 0, 0]
403414
pos = 0
404415
for comp in range(0, 3):
405-
if (len_str - pos) < 2:
406-
raise ValueError("Incomplete time component")
407-
408-
time_comps[comp] = int(tstr[pos:pos+2])
416+
time_comps[comp] = _read_isoformat_component(tstr[pos:pos+2], 2)
409417

410418
pos += 2
411419
next_char = tstr[pos:pos+1]
@@ -426,7 +434,7 @@ def _parse_hh_mm_ss_ff(tstr):
426434
raise ValueError("Invalid microsecond separator")
427435
else:
428436
pos += 1
429-
if not all(map(_is_ascii_digit, tstr[pos:])):
437+
if not tstr[pos:].isdigit():
430438
raise ValueError("Non-digit values in fraction")
431439

432440
len_remainder = len_str - pos
@@ -447,6 +455,8 @@ def _parse_isoformat_time(tstr):
447455
len_str = len(tstr)
448456
if len_str < 2:
449457
raise ValueError("Isoformat time too short")
458+
if not tstr.isascii():
459+
raise ValueError("Invalid isoformat string")
450460

451461
# This is equivalent to re.search('[+-Z]', tstr), but faster
452462
tz_pos = (tstr.find('-') + 1 or tstr.find('+') + 1 or tstr.find('Z') + 1)

‎PythonLib/full/_pydecimal.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,9 +1821,10 @@ def __round__(self, n=None):
18211821
Decimal('123.46')
18221822
>>> round(Decimal('123.456'), -2)
18231823
Decimal('1E+2')
1824-
>>> round(Decimal('-Infinity'), 37)
1824+
>>> with localcontext(ExtendedContext):
1825+
... round(Decimal('-Infinity'), 37)
1826+
... round(Decimal('sNaN123'), 0)
18251827
Decimal('NaN')
1826-
>>> round(Decimal('sNaN123'), 0)
18271828
Decimal('NaN123')
18281829
18291830
"""

‎PythonLib/full/_pyrepl/console.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def runsource(self, source, filename="<input>", symbol="single"):
195195
ast.PyCF_ONLY_AST,
196196
incomplete_input=False,
197197
)
198-
except (SyntaxError, OverflowError, ValueError):
198+
except Exception:
199199
self.showsyntaxerror(filename, source=source)
200200
return False
201201
if tree.body:
@@ -216,7 +216,7 @@ def runsource(self, source, filename="<input>", symbol="single"):
216216
)
217217
self.showsyntaxerror(filename, source=source)
218218
return False
219-
except (OverflowError, ValueError):
219+
except Exception:
220220
self.showsyntaxerror(filename, source=source)
221221
return False
222222

‎PythonLib/full/_pyrepl/simple_interact.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _more_lines(console: code.InteractiveConsole, unicodetext: str) -> bool:
8484
src = _strip_final_indent(unicodetext)
8585
try:
8686
code = console.compile(src, "<stdin>", "single")
87-
except (OverflowError, SyntaxError, ValueError):
87+
except Exception:
8888
lines = src.splitlines(keepends=True)
8989
if len(lines) == 1:
9090
return False

‎PythonLib/full/_pyrepl/unix_console.py‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import platform
3434
from fcntl import ioctl
3535

36+
from _colorize import ANSIColors
37+
3638
from . import terminfo
3739
from .console import Console, Event
3840
from .fancy_termios import tcgetattr, tcsetattr, TermState
@@ -356,6 +358,7 @@ def prepare(self):
356358
raw.cc[termios.VMIN] = 1
357359
raw.cc[termios.VTIME] = 0
358360
self.__input_fd_set(raw)
361+
self.__rawtermstate = raw
359362

360363
# In macOS terminal we need to deactivate line wrap via ANSI escape code
361364
if self.is_apple_terminal:
@@ -382,6 +385,8 @@ def restore(self):
382385
"""
383386
Restore the console to the default state
384387
"""
388+
trace("unix.restore")
389+
self.__write(ANSIColors.RESET)
385390
self.__disable_bracketed_paste()
386391
self.__maybe_write_code(self._rmkx)
387392
self.flushoutput()
@@ -518,6 +523,7 @@ def finish(self):
518523
while y >= 0 and not self.screen[y]:
519524
y -= 1
520525
self.__move(0, min(y, self.height + self.__offset - 1))
526+
self.__write(ANSIColors.RESET)
521527
self.__write("\n\r")
522528
self.flushoutput()
523529

@@ -590,7 +596,19 @@ def input_hook(self):
590596
# avoid inline imports here so the repl doesn't get flooded
591597
# with import logging from -X importtime=2
592598
if posix is not None and posix._is_inputhook_installed():
593-
return posix._inputhook
599+
return self.__run_input_hook
600+
601+
def __run_input_hook(self):
602+
# gh-152907: input hooks expect cooked output, but pyrepl runs with
603+
# OPOST disabled. Restore the saved output flags around the hook
604+
# (only oflag; input must stay raw at the prompt).
605+
cooked = self.__rawtermstate.copy()
606+
cooked.oflag = self.__svtermstate.oflag
607+
self.__input_fd_set(cooked)
608+
try:
609+
return posix._inputhook()
610+
finally:
611+
self.__input_fd_set(self.__rawtermstate)
594612

595613
def __enable_bracketed_paste(self) -> None:
596614
os.write(self.output_fd, b"\x1b[?2004h")

‎PythonLib/full/_pyrepl/windows_console.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
SHORT,
3838
)
3939
from ctypes import Structure, POINTER, Union
40+
41+
from _colorize import ANSIColors
42+
4043
from .console import Event, Console
4144
from .trace import trace
4245
from .utils import wlen
@@ -363,6 +366,7 @@ def prepare(self) -> None:
363366

364367
def restore(self) -> None:
365368
if self.__vt_support:
369+
self.__write(ANSIColors.RESET)
366370
# Recover to original mode before running REPL
367371
self._disable_bracketed_paste()
368372
SetConsoleMode(InHandle, self.__original_input_mode)
@@ -519,6 +523,7 @@ def finish(self) -> None:
519523
while y >= 0 and not self.screen[y]:
520524
y -= 1
521525
self._move_relative(0, min(y, self.height + self.__offset - 1))
526+
self.__write(ANSIColors.RESET)
522527
self.__write("\r\n")
523528

524529
def flushoutput(self) -> None:

‎PythonLib/full/asyncio/base_events.py‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,19 +1214,24 @@ async def _create_connection_transport(
12141214
ssl_handshake_timeout=None,
12151215
ssl_shutdown_timeout=None):
12161216

1217-
sock.setblocking(False)
1217+
try:
1218+
sock.setblocking(False)
12181219

1219-
protocol = protocol_factory()
1220-
waiter = self.create_future()
1221-
if ssl:
1222-
sslcontext = None if isinstance(ssl, bool) else ssl
1223-
transport = self._make_ssl_transport(
1224-
sock, protocol, sslcontext, waiter,
1225-
server_side=server_side, server_hostname=server_hostname,
1226-
ssl_handshake_timeout=ssl_handshake_timeout,
1227-
ssl_shutdown_timeout=ssl_shutdown_timeout)
1228-
else:
1229-
transport = self._make_socket_transport(sock, protocol, waiter)
1220+
protocol = protocol_factory()
1221+
waiter = self.create_future()
1222+
if ssl:
1223+
sslcontext = None if isinstance(ssl, bool) else ssl
1224+
transport = self._make_ssl_transport(
1225+
sock, protocol, sslcontext, waiter,
1226+
server_side=server_side, server_hostname=server_hostname,
1227+
ssl_handshake_timeout=ssl_handshake_timeout,
1228+
ssl_shutdown_timeout=ssl_shutdown_timeout)
1229+
else:
1230+
transport = self._make_socket_transport(sock, protocol, waiter)
1231+
except:
1232+
# gh-153133: close the socket if the transport is never created.
1233+
sock.close()
1234+
raise
12301235

12311236
try:
12321237
await waiter

0 commit comments

Comments
 (0)