aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-07 09:25:06 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-02-09 19:18:32 +0300
commitf0785dc88eee3da0f1514f5b4cafa931571e669d (patch)
tree44165310ad6023cd29776f9b1b4477364cd2b5bb /contrib/tools/python3/src
parent2c0985fb513cb5b352324abf223bf749c6c2bd24 (diff)
downloadydb-f0785dc88eee3da0f1514f5b4cafa931571e669d.tar.gz
Update Python 3 to 3.11.8
Diffstat (limited to 'contrib/tools/python3/src')
-rw-r--r--contrib/tools/python3/src/Include/internal/pycore_ast_state.h4
-rw-r--r--contrib/tools/python3/src/Include/patchlevel.h4
-rw-r--r--contrib/tools/python3/src/Lib/_osx_support.py5
-rw-r--r--contrib/tools/python3/src/Lib/_pyio.py10
-rw-r--r--contrib/tools/python3/src/Lib/_strptime.py27
-rw-r--r--contrib/tools/python3/src/Lib/argparse.py2
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/base_events.py24
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/constants.py4
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/events.py4
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/selector_events.py4
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/sslproto.py18
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/streams.py3
-rw-r--r--contrib/tools/python3/src/Lib/calendar.py2
-rw-r--r--contrib/tools/python3/src/Lib/ctypes/_endian.py4
-rw-r--r--contrib/tools/python3/src/Lib/ctypes/util.py7
-rw-r--r--contrib/tools/python3/src/Lib/doctest.py2
-rw-r--r--contrib/tools/python3/src/Lib/email/_header_value_parser.py7
-rw-r--r--contrib/tools/python3/src/Lib/email/message.py29
-rw-r--r--contrib/tools/python3/src/Lib/email/policy.py9
-rw-r--r--contrib/tools/python3/src/Lib/email/utils.py4
-rw-r--r--contrib/tools/python3/src/Lib/ensurepip/__init__.py2
-rw-r--r--contrib/tools/python3/src/Lib/fractions.py20
-rw-r--r--contrib/tools/python3/src/Lib/ftplib.py27
-rw-r--r--contrib/tools/python3/src/Lib/hmac.py2
-rw-r--r--contrib/tools/python3/src/Lib/http/client.py4
-rw-r--r--contrib/tools/python3/src/Lib/mailbox.py5
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/managers.py2
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py54
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/resource_sharer.py2
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/util.py13
-rw-r--r--contrib/tools/python3/src/Lib/pickle.py24
-rw-r--r--contrib/tools/python3/src/Lib/pickletools.py31
-rw-r--r--contrib/tools/python3/src/Lib/pprint.py3
-rw-r--r--contrib/tools/python3/src/Lib/pydoc_data/topics.py956
-rw-r--r--contrib/tools/python3/src/Lib/shutil.py48
-rw-r--r--contrib/tools/python3/src/Lib/signal.py6
-rw-r--r--contrib/tools/python3/src/Lib/site.py12
-rw-r--r--contrib/tools/python3/src/Lib/socket.py2
-rw-r--r--contrib/tools/python3/src/Lib/ssl.py107
-rw-r--r--contrib/tools/python3/src/Lib/subprocess.py11
-rwxr-xr-xcontrib/tools/python3/src/Lib/tarfile.py12
-rw-r--r--contrib/tools/python3/src/Lib/tempfile.py61
-rw-r--r--contrib/tools/python3/src/Lib/threading.py5
-rwxr-xr-xcontrib/tools/python3/src/Lib/trace.py3
-rw-r--r--contrib/tools/python3/src/Lib/traceback.py6
-rw-r--r--contrib/tools/python3/src/Lib/typing.py4
-rw-r--r--contrib/tools/python3/src/Lib/warnings.py7
-rwxr-xr-xcontrib/tools/python3/src/Lib/webbrowser.py1
-rw-r--r--contrib/tools/python3/src/Lib/xml/etree/ElementTree.py25
-rw-r--r--contrib/tools/python3/src/Lib/ya.make4
-rw-r--r--contrib/tools/python3/src/Lib/zipfile.py12
-rw-r--r--contrib/tools/python3/src/Modules/_asynciomodule.c3
-rw-r--r--contrib/tools/python3/src/Modules/_csv.c3
-rw-r--r--contrib/tools/python3/src/Modules/_ctypes/_ctypes.c10
-rw-r--r--contrib/tools/python3/src/Modules/_ctypes/stgdict.c54
-rw-r--r--contrib/tools/python3/src/Modules/_io/textio.c12
-rw-r--r--contrib/tools/python3/src/Modules/_lzmamodule.c4
-rw-r--r--contrib/tools/python3/src/Modules/_posixsubprocess.c21
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/ya.make4
-rw-r--r--contrib/tools/python3/src/Modules/_sre/clinic/sre.c.h6
-rw-r--r--contrib/tools/python3/src/Modules/_winapi.c218
-rw-r--r--contrib/tools/python3/src/Modules/audioop.c46
-rw-r--r--contrib/tools/python3/src/Modules/binascii.c18
-rw-r--r--contrib/tools/python3/src/Modules/cjkcodecs/clinic/multibytecodec.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/_lsprof.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/_queuemodule.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/_winapi.c.h15
-rw-r--r--contrib/tools/python3/src/Modules/clinic/arraymodule.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/md5module.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/posixmodule.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/sha1module.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/sha256module.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/sha512module.c.h4
-rw-r--r--contrib/tools/python3/src/Modules/clinic/zlibmodule.c.h10
-rw-r--r--contrib/tools/python3/src/Modules/gcmodule.c6
-rw-r--r--contrib/tools/python3/src/Modules/mmapmodule.c47
-rw-r--r--contrib/tools/python3/src/Modules/posixmodule.c9
-rw-r--r--contrib/tools/python3/src/Modules/socketmodule.c16
-rw-r--r--contrib/tools/python3/src/Modules/termios.c2
-rw-r--r--contrib/tools/python3/src/Modules/ya.make4
-rw-r--r--contrib/tools/python3/src/Modules/zlibmodule.c18
-rw-r--r--contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h8
-rw-r--r--contrib/tools/python3/src/Objects/setobject.c12
-rw-r--r--contrib/tools/python3/src/Objects/unicodeobject.c6
-rw-r--r--contrib/tools/python3/src/Parser/pegen_errors.c4
-rw-r--r--contrib/tools/python3/src/Python/Python-ast.c638
-rw-r--r--contrib/tools/python3/src/Python/ceval.c14
-rw-r--r--contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c347
-rw-r--r--contrib/tools/python3/src/Python/import.c2
-rw-r--r--contrib/tools/python3/src/Python/pythonrun.c33
-rw-r--r--contrib/tools/python3/src/Python/specialize.c28
-rw-r--r--contrib/tools/python3/src/Python/structmember.c85
-rw-r--r--contrib/tools/python3/src/Python/symtable.c6
-rw-r--r--contrib/tools/python3/src/Python/sysmodule.c2
-rw-r--r--contrib/tools/python3/src/README.rst2
-rw-r--r--contrib/tools/python3/src/ya.make4
96 files changed, 2161 insertions, 1236 deletions
diff --git a/contrib/tools/python3/src/Include/internal/pycore_ast_state.h b/contrib/tools/python3/src/Include/internal/pycore_ast_state.h
index f15b4905ee..d354822e1d 100644
--- a/contrib/tools/python3/src/Include/internal/pycore_ast_state.h
+++ b/contrib/tools/python3/src/Include/internal/pycore_ast_state.h
@@ -12,8 +12,8 @@ extern "C" {
struct ast_state {
int initialized;
- int recursion_depth;
- int recursion_limit;
+ int unused_recursion_depth;
+ int unused_recursion_limit;
PyObject *AST_type;
PyObject *Add_singleton;
PyObject *Add_type;
diff --git a/contrib/tools/python3/src/Include/patchlevel.h b/contrib/tools/python3/src/Include/patchlevel.h
index 7acea93703..a4cb683c47 100644
--- a/contrib/tools/python3/src/Include/patchlevel.h
+++ b/contrib/tools/python3/src/Include/patchlevel.h
@@ -18,12 +18,12 @@
/*--start constants--*/
#define PY_MAJOR_VERSION 3
#define PY_MINOR_VERSION 11
-#define PY_MICRO_VERSION 7
+#define PY_MICRO_VERSION 8
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL 0
/* Version as a string */
-#define PY_VERSION "3.11.7"
+#define PY_VERSION "3.11.8"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/contrib/tools/python3/src/Lib/_osx_support.py b/contrib/tools/python3/src/Lib/_osx_support.py
index aa66c8b9f4..0cb064fcd7 100644
--- a/contrib/tools/python3/src/Lib/_osx_support.py
+++ b/contrib/tools/python3/src/Lib/_osx_support.py
@@ -507,6 +507,11 @@ def get_platform_osx(_config_vars, osname, release, machine):
# MACOSX_DEPLOYMENT_TARGET.
macver = _config_vars.get('MACOSX_DEPLOYMENT_TARGET', '')
+ if macver and '.' not in macver:
+ # Ensure that the version includes at least a major
+ # and minor version, even if MACOSX_DEPLOYMENT_TARGET
+ # is set to a single-label version like "14".
+ macver += '.0'
macrelease = _get_system_version() or macver
macver = macver or macrelease
diff --git a/contrib/tools/python3/src/Lib/_pyio.py b/contrib/tools/python3/src/Lib/_pyio.py
index 0bfdeaafae..16d025b170 100644
--- a/contrib/tools/python3/src/Lib/_pyio.py
+++ b/contrib/tools/python3/src/Lib/_pyio.py
@@ -2224,8 +2224,9 @@ class TextIOWrapper(TextIOBase):
self.buffer.write(b)
if self._line_buffering and (haslf or "\r" in s):
self.flush()
- self._set_decoded_chars('')
- self._snapshot = None
+ if self._snapshot is not None:
+ self._set_decoded_chars('')
+ self._snapshot = None
if self._decoder:
self._decoder.reset()
return length
@@ -2539,8 +2540,9 @@ class TextIOWrapper(TextIOBase):
# Read everything.
result = (self._get_decoded_chars() +
decoder.decode(self.buffer.read(), final=True))
- self._set_decoded_chars('')
- self._snapshot = None
+ if self._snapshot is not None:
+ self._set_decoded_chars('')
+ self._snapshot = None
return result
else:
# Keep reading chunks until we have size characters to return.
diff --git a/contrib/tools/python3/src/Lib/_strptime.py b/contrib/tools/python3/src/Lib/_strptime.py
index b97dfcce1e..602059fb0e 100644
--- a/contrib/tools/python3/src/Lib/_strptime.py
+++ b/contrib/tools/python3/src/Lib/_strptime.py
@@ -358,8 +358,6 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
tz = -1
gmtoff = None
gmtoff_fraction = 0
- # Default to -1 to signify that values not known; not critical to have,
- # though
iso_week = week_of_year = None
week_of_year_start = None
# weekday and julian defaulted to None so as to signal need to calculate
@@ -485,17 +483,17 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
break
# Deal with the cases where ambiguities arize
# don't assume default values for ISO week/year
- if year is None and iso_year is not None:
- if iso_week is None or weekday is None:
- raise ValueError("ISO year directive '%G' must be used with "
- "the ISO week directive '%V' and a weekday "
- "directive ('%A', '%a', '%w', or '%u').")
+ if iso_year is not None:
if julian is not None:
raise ValueError("Day of the year directive '%j' is not "
"compatible with ISO year directive '%G'. "
"Use '%Y' instead.")
- elif week_of_year is None and iso_week is not None:
- if weekday is None:
+ elif iso_week is None or weekday is None:
+ raise ValueError("ISO year directive '%G' must be used with "
+ "the ISO week directive '%V' and a weekday "
+ "directive ('%A', '%a', '%w', or '%u').")
+ elif iso_week is not None:
+ if year is None or weekday is None:
raise ValueError("ISO week directive '%V' must be used with "
"the ISO year directive '%G' and a weekday "
"directive ('%A', '%a', '%w', or '%u').")
@@ -505,11 +503,12 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
"instead.")
leap_year_fix = False
- if year is None and month == 2 and day == 29:
- year = 1904 # 1904 is first leap year of 20th century
- leap_year_fix = True
- elif year is None:
- year = 1900
+ if year is None:
+ if month == 2 and day == 29:
+ year = 1904 # 1904 is first leap year of 20th century
+ leap_year_fix = True
+ else:
+ year = 1900
# If we know the week of the year and what day of that week, we can figure
diff --git a/contrib/tools/python3/src/Lib/argparse.py b/contrib/tools/python3/src/Lib/argparse.py
index 9962e61a67..a999ea6061 100644
--- a/contrib/tools/python3/src/Lib/argparse.py
+++ b/contrib/tools/python3/src/Lib/argparse.py
@@ -2464,7 +2464,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# ========================
def _get_values(self, action, arg_strings):
# for everything but PARSER, REMAINDER args, strip out first '--'
- if action.nargs not in [PARSER, REMAINDER]:
+ if not action.option_strings and action.nargs not in [PARSER, REMAINDER]:
try:
arg_strings.remove('--')
except ValueError:
diff --git a/contrib/tools/python3/src/Lib/asyncio/base_events.py b/contrib/tools/python3/src/Lib/asyncio/base_events.py
index d4c8238ba5..5fa28cae9c 100644
--- a/contrib/tools/python3/src/Lib/asyncio/base_events.py
+++ b/contrib/tools/python3/src/Lib/asyncio/base_events.py
@@ -16,6 +16,7 @@ to modify the meaning of the API call itself.
import collections
import collections.abc
import concurrent.futures
+import errno
import functools
import heapq
import itertools
@@ -1280,9 +1281,9 @@ class BaseEventLoop(events.AbstractEventLoop):
allow_broadcast=None, sock=None):
"""Create datagram connection."""
if sock is not None:
- if sock.type != socket.SOCK_DGRAM:
+ if sock.type == socket.SOCK_STREAM:
raise ValueError(
- f'A UDP Socket was expected, got {sock!r}')
+ f'A datagram socket was expected, got {sock!r}')
if (local_addr or remote_addr or
family or proto or flags or
reuse_port or allow_broadcast):
@@ -1522,9 +1523,22 @@ class BaseEventLoop(events.AbstractEventLoop):
try:
sock.bind(sa)
except OSError as err:
- raise OSError(err.errno, 'error while attempting '
- 'to bind on address %r: %s'
- % (sa, err.strerror.lower())) from None
+ msg = ('error while attempting '
+ 'to bind on address %r: %s'
+ % (sa, err.strerror.lower()))
+ if err.errno == errno.EADDRNOTAVAIL:
+ # Assume the family is not enabled (bpo-30945)
+ sockets.pop()
+ sock.close()
+ if self._debug:
+ logger.warning(msg)
+ continue
+ raise OSError(err.errno, msg) from None
+
+ if not sockets:
+ raise OSError('could not bind on any address out of %r'
+ % ([info[4] for info in infos],))
+
completed = True
finally:
if not completed:
diff --git a/contrib/tools/python3/src/Lib/asyncio/constants.py b/contrib/tools/python3/src/Lib/asyncio/constants.py
index f171ead28f..0ad997a921 100644
--- a/contrib/tools/python3/src/Lib/asyncio/constants.py
+++ b/contrib/tools/python3/src/Lib/asyncio/constants.py
@@ -1,3 +1,7 @@
+# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0
+# SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0)
+# SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io
+
import enum
# After the connection is lost, log warnings after this many write()s.
diff --git a/contrib/tools/python3/src/Lib/asyncio/events.py b/contrib/tools/python3/src/Lib/asyncio/events.py
index 5fe4074faf..cfc62156e4 100644
--- a/contrib/tools/python3/src/Lib/asyncio/events.py
+++ b/contrib/tools/python3/src/Lib/asyncio/events.py
@@ -1,5 +1,9 @@
"""Event loop and event loop policy."""
+# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0
+# SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0)
+# SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io
+
__all__ = (
'AbstractEventLoopPolicy',
'AbstractEventLoop', 'AbstractServer',
diff --git a/contrib/tools/python3/src/Lib/asyncio/selector_events.py b/contrib/tools/python3/src/Lib/asyncio/selector_events.py
index 96e61f7c3a..40df1b7da5 100644
--- a/contrib/tools/python3/src/Lib/asyncio/selector_events.py
+++ b/contrib/tools/python3/src/Lib/asyncio/selector_events.py
@@ -222,6 +222,10 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
await waiter
except BaseException:
transport.close()
+ # gh-109534: When an exception is raised by the SSLProtocol object the
+ # exception set in this future can keep the protocol object alive and
+ # cause a reference cycle.
+ waiter = None
raise
# It's now up to the protocol to handle the connection.
diff --git a/contrib/tools/python3/src/Lib/asyncio/sslproto.py b/contrib/tools/python3/src/Lib/asyncio/sslproto.py
index 488e17d8bc..e51669a2ab 100644
--- a/contrib/tools/python3/src/Lib/asyncio/sslproto.py
+++ b/contrib/tools/python3/src/Lib/asyncio/sslproto.py
@@ -1,3 +1,7 @@
+# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0
+# SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0)
+# SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io
+
import collections
import enum
import warnings
@@ -243,13 +247,12 @@ class _SSLProtocolTransport(transports._FlowControlMixin,
The protocol's connection_lost() method will (eventually) be
called with None as its argument.
"""
- self._closed = True
- if self._ssl_protocol is not None:
- self._ssl_protocol._abort()
+ self._force_close(None)
def _force_close(self, exc):
self._closed = True
- self._ssl_protocol._abort(exc)
+ if self._ssl_protocol is not None:
+ self._ssl_protocol._abort(exc)
def _test__append_write_backlog(self, data):
# for test only
@@ -576,6 +579,7 @@ class SSLProtocol(protocols.BufferedProtocol):
peercert = sslobj.getpeercert()
except Exception as exc:
+ handshake_exc = None
self._set_state(SSLProtocolState.UNWRAPPED)
if isinstance(exc, ssl.CertificateError):
msg = 'SSL handshake failed on verifying the certificate'
@@ -614,7 +618,7 @@ class SSLProtocol(protocols.BufferedProtocol):
if self._app_transport is not None:
self._app_transport._closed = True
if self._state == SSLProtocolState.DO_HANDSHAKE:
- self._abort()
+ self._abort(None)
else:
self._set_state(SSLProtocolState.FLUSHING)
self._shutdown_timeout_handle = self._loop.call_later(
@@ -661,10 +665,10 @@ class SSLProtocol(protocols.BufferedProtocol):
else:
self._loop.call_soon(self._transport.close)
- def _abort(self):
+ def _abort(self, exc):
self._set_state(SSLProtocolState.UNWRAPPED)
if self._transport is not None:
- self._transport.abort()
+ self._transport._force_close(exc)
# Outgoing flow
diff --git a/contrib/tools/python3/src/Lib/asyncio/streams.py b/contrib/tools/python3/src/Lib/asyncio/streams.py
index 23b6e4c32f..26ffc86584 100644
--- a/contrib/tools/python3/src/Lib/asyncio/streams.py
+++ b/contrib/tools/python3/src/Lib/asyncio/streams.py
@@ -246,6 +246,9 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
self._stream_writer)
if coroutines.iscoroutine(res):
def callback(task):
+ if task.cancelled():
+ transport.close()
+ return
exc = task.exception()
if exc is not None:
self._loop.call_exception_handler({
diff --git a/contrib/tools/python3/src/Lib/calendar.py b/contrib/tools/python3/src/Lib/calendar.py
index 7cdf9311b5..27a1e09362 100644
--- a/contrib/tools/python3/src/Lib/calendar.py
+++ b/contrib/tools/python3/src/Lib/calendar.py
@@ -709,7 +709,7 @@ def main(args):
parser.add_argument(
"year",
nargs='?', type=int,
- help="year number (1-9999)"
+ help="year number"
)
parser.add_argument(
"month",
diff --git a/contrib/tools/python3/src/Lib/ctypes/_endian.py b/contrib/tools/python3/src/Lib/ctypes/_endian.py
index 34dee64b1a..6f674b2137 100644
--- a/contrib/tools/python3/src/Lib/ctypes/_endian.py
+++ b/contrib/tools/python3/src/Lib/ctypes/_endian.py
@@ -15,8 +15,8 @@ def _other_endian(typ):
# if typ is array
if isinstance(typ, _array_type):
return _other_endian(typ._type_) * typ._length_
- # if typ is structure
- if issubclass(typ, Structure):
+ # if typ is structure or union
+ if issubclass(typ, (Structure, Union)):
return typ
raise TypeError("This type does not support other endian: %s" % typ)
diff --git a/contrib/tools/python3/src/Lib/ctypes/util.py b/contrib/tools/python3/src/Lib/ctypes/util.py
index a1f045e62c..e6d14ef6eb 100644
--- a/contrib/tools/python3/src/Lib/ctypes/util.py
+++ b/contrib/tools/python3/src/Lib/ctypes/util.py
@@ -96,8 +96,11 @@ elif os.name == "posix":
def _is_elf(filename):
"Return True if the given file is an ELF file"
elf_header = b'\x7fELF'
- with open(filename, 'br') as thefile:
- return thefile.read(4) == elf_header
+ try:
+ with open(filename, 'br') as thefile:
+ return thefile.read(4) == elf_header
+ except FileNotFoundError:
+ return False
def _findLib_gcc(name):
# Run GCC's linker with the -t (aka --trace) option and examine the
diff --git a/contrib/tools/python3/src/Lib/doctest.py b/contrib/tools/python3/src/Lib/doctest.py
index 2a855929ae..e39c1cdddc 100644
--- a/contrib/tools/python3/src/Lib/doctest.py
+++ b/contrib/tools/python3/src/Lib/doctest.py
@@ -1117,6 +1117,8 @@ class DocTestFinder:
# Find the line number for functions & methods.
if inspect.ismethod(obj): obj = obj.__func__
+ if isinstance(obj, property):
+ obj = obj.fget
if inspect.isfunction(obj) and getattr(obj, '__doc__', None):
# We don't use `docstring` var here, because `obj` can be changed.
obj = obj.__code__
diff --git a/contrib/tools/python3/src/Lib/email/_header_value_parser.py b/contrib/tools/python3/src/Lib/email/_header_value_parser.py
index e637e6df06..f4334f1fe6 100644
--- a/contrib/tools/python3/src/Lib/email/_header_value_parser.py
+++ b/contrib/tools/python3/src/Lib/email/_header_value_parser.py
@@ -2768,6 +2768,7 @@ def _refold_parse_tree(parse_tree, *, policy):
encoding = 'utf-8' if policy.utf8 else 'us-ascii'
lines = ['']
last_ew = None
+ last_charset = None
wrap_as_ew_blocked = 0
want_encoding = False
end_ew_not_allowed = Terminal('', 'wrap_as_ew_blocked')
@@ -2822,8 +2823,14 @@ def _refold_parse_tree(parse_tree, *, policy):
else:
# It's a terminal, wrap it as an encoded word, possibly
# combining it with previously encoded words if allowed.
+ if (last_ew is not None and
+ charset != last_charset and
+ (last_charset == 'unknown-8bit' or
+ last_charset == 'utf-8' and charset != 'us-ascii')):
+ last_ew = None
last_ew = _fold_as_ew(tstr, lines, maxlen, last_ew,
part.ew_combine_allowed, charset)
+ last_charset = charset
want_encoding = False
continue
if len(tstr) <= maxlen - len(lines[-1]):
diff --git a/contrib/tools/python3/src/Lib/email/message.py b/contrib/tools/python3/src/Lib/email/message.py
index 65fda50725..4e9536b856 100644
--- a/contrib/tools/python3/src/Lib/email/message.py
+++ b/contrib/tools/python3/src/Lib/email/message.py
@@ -289,25 +289,26 @@ class Message:
# cte might be a Header, so for now stringify it.
cte = str(self.get('content-transfer-encoding', '')).lower()
# payload may be bytes here.
- if isinstance(payload, str):
- if utils._has_surrogates(payload):
- bpayload = payload.encode('ascii', 'surrogateescape')
- if not decode:
+ if not decode:
+ if isinstance(payload, str) and utils._has_surrogates(payload):
+ try:
+ bpayload = payload.encode('ascii', 'surrogateescape')
try:
payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
except LookupError:
payload = bpayload.decode('ascii', 'replace')
- elif decode:
- try:
- bpayload = payload.encode('ascii')
- except UnicodeError:
- # This won't happen for RFC compliant messages (messages
- # containing only ASCII code points in the unicode input).
- # If it does happen, turn the string into bytes in a way
- # guaranteed not to fail.
- bpayload = payload.encode('raw-unicode-escape')
- if not decode:
+ except UnicodeEncodeError:
+ pass
return payload
+ if isinstance(payload, str):
+ try:
+ bpayload = payload.encode('ascii', 'surrogateescape')
+ except UnicodeEncodeError:
+ # This won't happen for RFC compliant messages (messages
+ # containing only ASCII code points in the unicode input).
+ # If it does happen, turn the string into bytes in a way
+ # guaranteed not to fail.
+ bpayload = payload.encode('raw-unicode-escape')
if cte == 'quoted-printable':
return quopri.decodestring(bpayload)
elif cte == 'base64':
diff --git a/contrib/tools/python3/src/Lib/email/policy.py b/contrib/tools/python3/src/Lib/email/policy.py
index 611deb50bb..8816c84ed1 100644
--- a/contrib/tools/python3/src/Lib/email/policy.py
+++ b/contrib/tools/python3/src/Lib/email/policy.py
@@ -210,8 +210,15 @@ class EmailPolicy(Policy):
self.refold_source == 'long' and
(lines and len(lines[0])+len(name)+2 > maxlen or
any(len(x) > maxlen for x in lines[1:])))
- if refold or refold_binary and _has_surrogates(value):
+
+ if not refold:
+ if not self.utf8:
+ refold = not value.isascii()
+ elif refold_binary:
+ refold = _has_surrogates(value)
+ if refold:
return self.header_factory(name, ''.join(lines)).fold(policy=self)
+
return name + ': ' + self.linesep.join(lines) + self.linesep
diff --git a/contrib/tools/python3/src/Lib/email/utils.py b/contrib/tools/python3/src/Lib/email/utils.py
index cfdfeb3f1a..8993858ab4 100644
--- a/contrib/tools/python3/src/Lib/email/utils.py
+++ b/contrib/tools/python3/src/Lib/email/utils.py
@@ -49,10 +49,10 @@ specialsre = re.compile(r'[][\\()<>@,:;".]')
escapesre = re.compile(r'[\\"]')
def _has_surrogates(s):
- """Return True if s contains surrogate-escaped binary data."""
+ """Return True if s may contain surrogate-escaped binary data."""
# This check is based on the fact that unless there are surrogates, utf8
# (Python's default encoding) can encode any string. This is the fastest
- # way to check for surrogates, see issue 11454 for timings.
+ # way to check for surrogates, see bpo-11454 (moved to gh-55663) for timings.
try:
s.encode()
return False
diff --git a/contrib/tools/python3/src/Lib/ensurepip/__init__.py b/contrib/tools/python3/src/Lib/ensurepip/__init__.py
index 81db9fa922..165f3963a6 100644
--- a/contrib/tools/python3/src/Lib/ensurepip/__init__.py
+++ b/contrib/tools/python3/src/Lib/ensurepip/__init__.py
@@ -11,7 +11,7 @@ from importlib import resources
__all__ = ["version", "bootstrap"]
_PACKAGE_NAMES = ('setuptools', 'pip')
_SETUPTOOLS_VERSION = "65.5.0"
-_PIP_VERSION = "23.2.1"
+_PIP_VERSION = "24.0"
_PROJECTS = [
("setuptools", _SETUPTOOLS_VERSION, "py3"),
("pip", _PIP_VERSION, "py3"),
diff --git a/contrib/tools/python3/src/Lib/fractions.py b/contrib/tools/python3/src/Lib/fractions.py
index f9ac882ec0..a7a7fea5ca 100644
--- a/contrib/tools/python3/src/Lib/fractions.py
+++ b/contrib/tools/python3/src/Lib/fractions.py
@@ -21,17 +21,17 @@ _PyHASH_MODULUS = sys.hash_info.modulus
_PyHASH_INF = sys.hash_info.inf
_RATIONAL_FORMAT = re.compile(r"""
- \A\s* # optional whitespace at the start,
- (?P<sign>[-+]?) # an optional sign, then
- (?=\d|\.\d) # lookahead for digit or .digit
- (?P<num>\d*|\d+(_\d+)*) # numerator (possibly empty)
- (?: # followed by
- (?:/(?P<denom>\d+(_\d+)*))? # an optional denominator
- | # or
- (?:\.(?P<decimal>d*|\d+(_\d+)*))? # an optional fractional part
- (?:E(?P<exp>[-+]?\d+(_\d+)*))? # and optional exponent
+ \A\s* # optional whitespace at the start,
+ (?P<sign>[-+]?) # an optional sign, then
+ (?=\d|\.\d) # lookahead for digit or .digit
+ (?P<num>\d*|\d+(_\d+)*) # numerator (possibly empty)
+ (?: # followed by
+ (?:/(?P<denom>\d+(_\d+)*))? # an optional denominator
+ | # or
+ (?:\.(?P<decimal>\d*|\d+(_\d+)*))? # an optional fractional part
+ (?:E(?P<exp>[-+]?\d+(_\d+)*))? # and optional exponent
)
- \s*\Z # and optional whitespace to finish
+ \s*\Z # and optional whitespace to finish
""", re.VERBOSE | re.IGNORECASE)
diff --git a/contrib/tools/python3/src/Lib/ftplib.py b/contrib/tools/python3/src/Lib/ftplib.py
index 7c5a50715f..40a76c9ca4 100644
--- a/contrib/tools/python3/src/Lib/ftplib.py
+++ b/contrib/tools/python3/src/Lib/ftplib.py
@@ -922,11 +922,17 @@ def ftpcp(source, sourcename, target, targetname = '', type = 'I'):
def test():
'''Test program.
- Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...
+ Usage: ftplib [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...
- -d dir
- -l list
- -p password
+ Options:
+ -d increase debugging level
+ -r[file] set alternate ~/.netrc file
+
+ Commands:
+ -l[dir] list directory
+ -d[dir] change the current directory
+ -p toggle passive and active mode
+ file retrieve the file and write it to stdout
'''
if len(sys.argv) < 2:
@@ -952,15 +958,14 @@ def test():
netrcobj = netrc.netrc(rcfile)
except OSError:
if rcfile is not None:
- sys.stderr.write("Could not open account file"
- " -- using anonymous login.")
+ print("Could not open account file -- using anonymous login.",
+ file=sys.stderr)
else:
try:
userid, acct, passwd = netrcobj.authenticators(host)
- except KeyError:
+ except (KeyError, TypeError):
# no account for host
- sys.stderr.write(
- "No account -- using anonymous login.")
+ print("No account -- using anonymous login.", file=sys.stderr)
ftp.login(userid, passwd, acct)
for file in sys.argv[2:]:
if file[:2] == '-l':
@@ -973,7 +978,9 @@ def test():
ftp.set_pasv(not ftp.passiveserver)
else:
ftp.retrbinary('RETR ' + file, \
- sys.stdout.write, 1024)
+ sys.stdout.buffer.write, 1024)
+ sys.stdout.buffer.flush()
+ sys.stdout.flush()
ftp.quit()
diff --git a/contrib/tools/python3/src/Lib/hmac.py b/contrib/tools/python3/src/Lib/hmac.py
index 8b4f920db9..8b4eb2fe74 100644
--- a/contrib/tools/python3/src/Lib/hmac.py
+++ b/contrib/tools/python3/src/Lib/hmac.py
@@ -53,7 +53,7 @@ class HMAC:
raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)
if not digestmod:
- raise TypeError("Missing required parameter 'digestmod'.")
+ raise TypeError("Missing required argument 'digestmod'.")
if _hashopenssl and isinstance(digestmod, (str, _functype)):
try:
diff --git a/contrib/tools/python3/src/Lib/http/client.py b/contrib/tools/python3/src/Lib/http/client.py
index 87bca4d76a..1ee22989ae 100644
--- a/contrib/tools/python3/src/Lib/http/client.py
+++ b/contrib/tools/python3/src/Lib/http/client.py
@@ -663,6 +663,8 @@ class HTTPResponse(io.BufferedIOBase):
self._close_conn()
elif self.length is not None:
self.length -= len(result)
+ if not self.length:
+ self._close_conn()
return result
def peek(self, n=-1):
@@ -687,6 +689,8 @@ class HTTPResponse(io.BufferedIOBase):
self._close_conn()
elif self.length is not None:
self.length -= len(result)
+ if not self.length:
+ self._close_conn()
return result
def _read1_chunked(self, n):
diff --git a/contrib/tools/python3/src/Lib/mailbox.py b/contrib/tools/python3/src/Lib/mailbox.py
index 70da07ed2e..334c7d5a95 100644
--- a/contrib/tools/python3/src/Lib/mailbox.py
+++ b/contrib/tools/python3/src/Lib/mailbox.py
@@ -778,10 +778,11 @@ class _mboxMMDF(_singlefileMailbox):
"""Return a Message representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
- from_line = self._file.readline().replace(linesep, b'')
+ from_line = self._file.readline().replace(linesep, b'').decode('ascii')
string = self._file.read(stop - self._file.tell())
msg = self._message_factory(string.replace(linesep, b'\n'))
- msg.set_from(from_line[5:].decode('ascii'))
+ msg.set_unixfrom(from_line)
+ msg.set_from(from_line[5:])
return msg
def get_string(self, key, from_=False):
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/managers.py b/contrib/tools/python3/src/Lib/multiprocessing/managers.py
index 3f6479b7e3..245b15f227 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/managers.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/managers.py
@@ -153,7 +153,7 @@ class Server(object):
Listener, Client = listener_client[serializer]
# do authentication later
- self.listener = Listener(address=address, backlog=16)
+ self.listener = Listener(address=address, backlog=128)
self.address = self.listener.address
self.id_to_obj = {'0': (None, ())}
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py b/contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py
index f968968189..2640086124 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py
@@ -102,18 +102,20 @@ class Popen(object):
return reduction.duplicate(handle, self.sentinel)
def wait(self, timeout=None):
- if self.returncode is None:
- if timeout is None:
- msecs = _winapi.INFINITE
- else:
- msecs = max(0, int(timeout * 1000 + 0.5))
-
- res = _winapi.WaitForSingleObject(int(self._handle), msecs)
- if res == _winapi.WAIT_OBJECT_0:
- code = _winapi.GetExitCodeProcess(self._handle)
- if code == TERMINATE:
- code = -signal.SIGTERM
- self.returncode = code
+ if self.returncode is not None:
+ return self.returncode
+
+ if timeout is None:
+ msecs = _winapi.INFINITE
+ else:
+ msecs = max(0, int(timeout * 1000 + 0.5))
+
+ res = _winapi.WaitForSingleObject(int(self._handle), msecs)
+ if res == _winapi.WAIT_OBJECT_0:
+ code = _winapi.GetExitCodeProcess(self._handle)
+ if code == TERMINATE:
+ code = -signal.SIGTERM
+ self.returncode = code
return self.returncode
@@ -121,18 +123,22 @@ class Popen(object):
return self.wait(timeout=0)
def terminate(self):
- if self.returncode is None:
- try:
- _winapi.TerminateProcess(int(self._handle), TERMINATE)
- except PermissionError:
- # ERROR_ACCESS_DENIED (winerror 5) is received when the
- # process already died.
- code = _winapi.GetExitCodeProcess(int(self._handle))
- if code == _winapi.STILL_ACTIVE:
- raise
- self.returncode = code
- else:
- self.returncode = -signal.SIGTERM
+ if self.returncode is not None:
+ return
+
+ try:
+ _winapi.TerminateProcess(int(self._handle), TERMINATE)
+ except PermissionError:
+ # ERROR_ACCESS_DENIED (winerror 5) is received when the
+ # process already died.
+ code = _winapi.GetExitCodeProcess(int(self._handle))
+ if code == _winapi.STILL_ACTIVE:
+ raise
+
+ # gh-113009: Don't set self.returncode. Even if GetExitCodeProcess()
+ # returns an exit code different than STILL_ACTIVE, the process can
+ # still be running. Only set self.returncode once WaitForSingleObject()
+ # returns WAIT_OBJECT_0 in wait().
kill = terminate
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/resource_sharer.py b/contrib/tools/python3/src/Lib/multiprocessing/resource_sharer.py
index 66076509a1..b8afb0fbed 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/resource_sharer.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/resource_sharer.py
@@ -123,7 +123,7 @@ class _ResourceSharer(object):
from .connection import Listener
assert self._listener is None, "Already have Listener"
util.debug('starting listener and thread for sending handles')
- self._listener = Listener(authkey=process.current_process().authkey)
+ self._listener = Listener(authkey=process.current_process().authkey, backlog=128)
self._address = self._listener.address
t = threading.Thread(target=self._serve)
t.daemon = True
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/util.py b/contrib/tools/python3/src/Lib/multiprocessing/util.py
index 96ec798a67..eb2cea07e1 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/util.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/util.py
@@ -43,19 +43,19 @@ _log_to_stderr = False
def sub_debug(msg, *args):
if _logger:
- _logger.log(SUBDEBUG, msg, *args)
+ _logger.log(SUBDEBUG, msg, *args, stacklevel=2)
def debug(msg, *args):
if _logger:
- _logger.log(DEBUG, msg, *args)
+ _logger.log(DEBUG, msg, *args, stacklevel=2)
def info(msg, *args):
if _logger:
- _logger.log(INFO, msg, *args)
+ _logger.log(INFO, msg, *args, stacklevel=2)
def sub_warning(msg, *args):
if _logger:
- _logger.log(SUBWARNING, msg, *args)
+ _logger.log(SUBWARNING, msg, *args, stacklevel=2)
def get_logger():
'''
@@ -130,7 +130,10 @@ abstract_sockets_supported = _platform_supports_abstract_sockets()
#
def _remove_temp_dir(rmtree, tempdir):
- rmtree(tempdir)
+ def onerror(func, path, err_info):
+ if not issubclass(err_info[0], FileNotFoundError):
+ raise
+ rmtree(tempdir, onerror=onerror)
current_process = process.current_process()
# current_process() can be None if the finalizer is called
diff --git a/contrib/tools/python3/src/Lib/pickle.py b/contrib/tools/python3/src/Lib/pickle.py
index f027e04320..f760bcdcba 100644
--- a/contrib/tools/python3/src/Lib/pickle.py
+++ b/contrib/tools/python3/src/Lib/pickle.py
@@ -861,13 +861,13 @@ class _Pickler:
else:
self.write(BINUNICODE + pack("<I", n) + encoded)
else:
- obj = obj.replace("\\", "\\u005c")
- obj = obj.replace("\0", "\\u0000")
- obj = obj.replace("\n", "\\u000a")
- obj = obj.replace("\r", "\\u000d")
- obj = obj.replace("\x1a", "\\u001a") # EOF on DOS
- self.write(UNICODE + obj.encode('raw-unicode-escape') +
- b'\n')
+ # Escape what raw-unicode-escape doesn't, but memoize the original.
+ tmp = obj.replace("\\", "\\u005c")
+ tmp = tmp.replace("\0", "\\u0000")
+ tmp = tmp.replace("\n", "\\u000a")
+ tmp = tmp.replace("\r", "\\u000d")
+ tmp = tmp.replace("\x1a", "\\u001a") # EOF on DOS
+ self.write(UNICODE + tmp.encode('raw-unicode-escape') + b'\n')
self.memoize(obj)
dispatch[str] = save_str
@@ -1799,7 +1799,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='display contents of the pickle files')
parser.add_argument(
- 'pickle_file', type=argparse.FileType('br'),
+ 'pickle_file',
nargs='*', help='the pickle file')
parser.add_argument(
'-t', '--test', action='store_true',
@@ -1815,6 +1815,10 @@ if __name__ == "__main__":
parser.print_help()
else:
import pprint
- for f in args.pickle_file:
- obj = load(f)
+ for fn in args.pickle_file:
+ if fn == '-':
+ obj = load(sys.stdin.buffer)
+ else:
+ with open(fn, 'rb') as f:
+ obj = load(f)
pprint.pprint(obj)
diff --git a/contrib/tools/python3/src/Lib/pickletools.py b/contrib/tools/python3/src/Lib/pickletools.py
index 95706e746c..95a77aeb2a 100644
--- a/contrib/tools/python3/src/Lib/pickletools.py
+++ b/contrib/tools/python3/src/Lib/pickletools.py
@@ -2848,10 +2848,10 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='disassemble one or more pickle files')
parser.add_argument(
- 'pickle_file', type=argparse.FileType('br'),
+ 'pickle_file',
nargs='*', help='the pickle file')
parser.add_argument(
- '-o', '--output', default=sys.stdout, type=argparse.FileType('w'),
+ '-o', '--output',
help='the file where the output should be written')
parser.add_argument(
'-m', '--memo', action='store_true',
@@ -2876,15 +2876,26 @@ if __name__ == "__main__":
if args.test:
_test()
else:
- annotate = 30 if args.annotate else 0
if not args.pickle_file:
parser.print_help()
- elif len(args.pickle_file) == 1:
- dis(args.pickle_file[0], args.output, None,
- args.indentlevel, annotate)
else:
+ annotate = 30 if args.annotate else 0
memo = {} if args.memo else None
- for f in args.pickle_file:
- preamble = args.preamble.format(name=f.name)
- args.output.write(preamble + '\n')
- dis(f, args.output, memo, args.indentlevel, annotate)
+ if args.output is None:
+ output = sys.stdout
+ else:
+ output = open(args.output, 'w')
+ try:
+ for arg in args.pickle_file:
+ if len(args.pickle_file) > 1:
+ name = '<stdin>' if arg == '-' else arg
+ preamble = args.preamble.format(name=name)
+ output.write(preamble + '\n')
+ if arg == '-':
+ dis(sys.stdin.buffer, output, memo, args.indentlevel, annotate)
+ else:
+ with open(arg, 'rb') as f:
+ dis(f, output, memo, args.indentlevel, annotate)
+ finally:
+ if output is not sys.stdout:
+ output.close()
diff --git a/contrib/tools/python3/src/Lib/pprint.py b/contrib/tools/python3/src/Lib/pprint.py
index 575688d8eb..d638794004 100644
--- a/contrib/tools/python3/src/Lib/pprint.py
+++ b/contrib/tools/python3/src/Lib/pprint.py
@@ -128,6 +128,9 @@ class PrettyPrinter:
sort_dicts
If true, dict keys are sorted.
+ underscore_numbers
+ If true, digit groups are separated with underscores.
+
"""
indent = int(indent)
width = int(width)
diff --git a/contrib/tools/python3/src/Lib/pydoc_data/topics.py b/contrib/tools/python3/src/Lib/pydoc_data/topics.py
index 9cdf477d44..d43b5c6b19 100644
--- a/contrib/tools/python3/src/Lib/pydoc_data/topics.py
+++ b/contrib/tools/python3/src/Lib/pydoc_data/topics.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Autogenerated by Sphinx on Mon Dec 4 17:55:07 2023
+# Autogenerated by Sphinx on Tue Feb 6 21:21:08 2024
# as part of the release process.
topics = {'assert': 'The "assert" statement\n'
'**********************\n'
@@ -934,19 +934,25 @@ topics = {'assert': 'The "assert" statement\n'
'*instance* of the\n'
' owner class.\n'
'\n'
- 'The attribute "__objclass__" is interpreted by the '
- '"inspect" module as\n'
- 'specifying the class where this object was defined '
+ 'Instances of descriptors may also have the '
+ '"__objclass__" attribute\n'
+ 'present:\n'
+ '\n'
+ 'object.__objclass__\n'
+ '\n'
+ ' The attribute "__objclass__" is interpreted by the '
+ '"inspect" module\n'
+ ' as specifying the class where this object was defined '
'(setting this\n'
- 'appropriately can assist in runtime introspection of '
+ ' appropriately can assist in runtime introspection of '
'dynamic class\n'
- 'attributes). For callables, it may indicate that an '
+ ' attributes). For callables, it may indicate that an '
'instance of the\n'
- 'given type (or a subclass) is expected or required as '
+ ' given type (or a subclass) is expected or required as '
'the first\n'
- 'positional argument (for example, CPython sets this '
+ ' positional argument (for example, CPython sets this '
'attribute for\n'
- 'unbound methods that are implemented in C).\n'
+ ' unbound methods that are implemented in C).\n'
'\n'
'\n'
'Invoking Descriptors\n'
@@ -3112,8 +3118,7 @@ topics = {'assert': 'The "assert" statement\n'
'standard\n'
'Python grammar. Triple-quoted strings are supported. Raw '
'strings and\n'
- 'byte strings are supported. Formatted string literals are not\n'
- 'supported.\n'
+ 'byte strings are supported. f-strings are not supported.\n'
'\n'
'The forms "signed_number \'+\' NUMBER" and "signed_number \'-\' '
'NUMBER"\n'
@@ -3754,7 +3759,7 @@ topics = {'assert': 'The "assert" statement\n'
' **PEP 526** - Syntax for Variable Annotations\n'
' Ability to type hint variable declarations, including '
'class\n'
- ' variables and instance variables\n'
+ ' variables and instance variables.\n'
'\n'
' **PEP 563** - Postponed Evaluation of Annotations\n'
' Support for forward references within annotations by '
@@ -3762,6 +3767,11 @@ topics = {'assert': 'The "assert" statement\n'
' annotations in a string form at runtime instead of eager\n'
' evaluation.\n'
'\n'
+ ' **PEP 318** - Decorators for Functions and Methods\n'
+ ' Function and method decorators were introduced. Class '
+ 'decorators\n'
+ ' were introduced in **PEP 3129**.\n'
+ '\n'
'\n'
'Class definitions\n'
'=================\n'
@@ -4599,8 +4609,8 @@ topics = {'assert': 'The "assert" statement\n'
'denial-of-service caused\n'
' by carefully chosen inputs that exploit the worst '
'case\n'
- ' performance of a dict insertion, O(n^2) complexity. '
- 'See\n'
+ ' performance of a dict insertion, *O*(*n*^2) '
+ 'complexity. See\n'
' http://ocert.org/advisories/ocert-2011-003.html for\n'
' details.Changing hash values affects the iteration '
'order of sets.\n'
@@ -4679,7 +4689,7 @@ topics = {'assert': 'The "assert" statement\n'
'and continue running without the debugger using the "continue"\n'
'command.\n'
'\n'
- 'New in version 3.7: The built-in "breakpoint()", when called '
+ 'Changed in version 3.7: The built-in "breakpoint()", when called '
'with\n'
'defaults, can be used instead of "import pdb; pdb.set_trace()".\n'
'\n'
@@ -4723,11 +4733,11 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
'debugger upon program’s exit.\n'
'\n'
- 'New in version 3.2: "-c" option is introduced to execute '
+ 'Changed in version 3.2: Added the "-c" option to execute '
'commands as\n'
- 'if given in a ".pdbrc" file, see Debugger Commands.\n'
+ 'if given in a ".pdbrc" file; see Debugger Commands.\n'
'\n'
- 'New in version 3.7: "-m" option is introduced to execute '
+ 'Changed in version 3.7: Added the "-m" option to execute '
'modules\n'
'similar to the way "python -m" does. As with a script, the '
'debugger\n'
@@ -4873,11 +4883,11 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Raises an auditing event "pdb.Pdb" with no arguments.\n'
'\n'
- ' New in version 3.1: The *skip* argument.\n'
+ ' Changed in version 3.1: Added the *skip* parameter.\n'
'\n'
- ' New in version 3.2: The *nosigint* argument. Previously, a '
- 'SIGINT\n'
- ' handler was never set by Pdb.\n'
+ ' Changed in version 3.2: Added the *nosigint* parameter. '
+ 'Previously,\n'
+ ' a SIGINT handler was never set by Pdb.\n'
'\n'
' Changed in version 3.6: The *readrc* argument.\n'
'\n'
@@ -5197,7 +5207,7 @@ topics = {'assert': 'The "assert" statement\n'
'differs\n'
' from the current line.\n'
'\n'
- ' New in version 3.2: The ">>" marker.\n'
+ ' Changed in version 3.2: Added the ">>" marker.\n'
'\n'
'll | longlist\n'
'\n'
@@ -5975,15 +5985,15 @@ topics = {'assert': 'The "assert" statement\n'
'originally\n'
'proposed by **PEP 448**.\n'
'\n'
- 'The trailing comma is required only to create a single tuple '
- '(a.k.a. a\n'
- '*singleton*); it is optional in all other cases. A single '
- 'expression\n'
- 'without a trailing comma doesn’t create a tuple, but rather '
- 'yields the\n'
- 'value of that expression. (To create an empty tuple, use an '
- 'empty pair\n'
- 'of parentheses: "()".)\n',
+ 'A trailing comma is required only to create a one-item tuple, '
+ 'such as\n'
+ '"1,"; it is optional in all other cases. A single expression '
+ 'without a\n'
+ 'trailing comma doesn’t create a tuple, but rather yields the '
+ 'value of\n'
+ 'that expression. (To create an empty tuple, use an empty pair '
+ 'of\n'
+ 'parentheses: "()".)\n',
'floating': 'Floating point literals\n'
'***********************\n'
'\n'
@@ -6097,7 +6107,7 @@ topics = {'assert': 'The "assert" statement\n'
' index_string ::= <any source character except "]"> '
'+\n'
' conversion ::= "r" | "s" | "a"\n'
- ' format_spec ::= <described in the next section>\n'
+ ' format_spec ::= format-spec:format_spec\n'
'\n'
'In less formal terms, the replacement field can start with '
'a\n'
@@ -6232,12 +6242,11 @@ topics = {'assert': 'The "assert" statement\n'
'contained\n'
'within a format string to define how individual values are '
'presented\n'
- '(see Format String Syntax and Formatted string literals). '
- 'They can\n'
- 'also be passed directly to the built-in "format()" '
- 'function. Each\n'
- 'formattable type may define how the format specification is '
- 'to be\n'
+ '(see Format String Syntax and f-strings). They can also be '
+ 'passed\n'
+ 'directly to the built-in "format()" function. Each '
+ 'formattable type\n'
+ 'may define how the format specification is to be '
'interpreted.\n'
'\n'
'Most built-in types implement the following options for '
@@ -7039,13 +7048,18 @@ topics = {'assert': 'The "assert" statement\n'
' **PEP 526** - Syntax for Variable Annotations\n'
' Ability to type hint variable declarations, including '
'class\n'
- ' variables and instance variables\n'
+ ' variables and instance variables.\n'
'\n'
' **PEP 563** - Postponed Evaluation of Annotations\n'
' Support for forward references within annotations by '
'preserving\n'
' annotations in a string form at runtime instead of eager\n'
- ' evaluation.\n',
+ ' evaluation.\n'
+ '\n'
+ ' **PEP 318** - Decorators for Functions and Methods\n'
+ ' Function and method decorators were introduced. Class '
+ 'decorators\n'
+ ' were introduced in **PEP 3129**.\n',
'global': 'The "global" statement\n'
'**********************\n'
'\n'
@@ -8594,15 +8608,13 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'A traceback object is normally created automatically when an '
'exception\n'
- 'is raised and attached to it as the "__traceback__" attribute, '
- 'which\n'
- 'is writable. You can create an exception and set your own traceback '
- 'in\n'
- 'one step using the "with_traceback()" exception method (which '
- 'returns\n'
- 'the same exception instance, with its traceback set to its '
- 'argument),\n'
- 'like so:\n'
+ 'is raised and attached to it as the "__traceback__" attribute. You '
+ 'can\n'
+ 'create an exception and set your own traceback in one step using '
+ 'the\n'
+ '"with_traceback()" exception method (which returns the same '
+ 'exception\n'
+ 'instance, with its traceback set to its argument), like so:\n'
'\n'
' raise Exception("foo occurred").with_traceback(tracebackobj)\n'
'\n'
@@ -8628,6 +8640,8 @@ topics = {'assert': 'The "assert" statement\n'
' ...\n'
' Traceback (most recent call last):\n'
' File "<stdin>", line 2, in <module>\n'
+ ' print(1 / 0)\n'
+ ' ~~^~~\n'
' ZeroDivisionError: division by zero\n'
'\n'
' The above exception was the direct cause of the following '
@@ -8635,6 +8649,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Traceback (most recent call last):\n'
' File "<stdin>", line 4, in <module>\n'
+ ' raise RuntimeError("Something bad happened") from exc\n'
' RuntimeError: Something bad happened\n'
'\n'
'A similar mechanism works implicitly if a new exception is raised '
@@ -8653,6 +8668,8 @@ topics = {'assert': 'The "assert" statement\n'
' ...\n'
' Traceback (most recent call last):\n'
' File "<stdin>", line 2, in <module>\n'
+ ' print(1 / 0)\n'
+ ' ~~^~~\n'
' ZeroDivisionError: division by zero\n'
'\n'
' During handling of the above exception, another exception '
@@ -8660,6 +8677,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Traceback (most recent call last):\n'
' File "<stdin>", line 4, in <module>\n'
+ ' raise RuntimeError("Something bad happened")\n'
' RuntimeError: Something bad happened\n'
'\n'
'Exception chaining can be explicitly suppressed by specifying '
@@ -8848,23 +8866,20 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Called to implement evaluation of "self[key]". For '
'*sequence*\n'
- ' types, the accepted keys should be integers and slice '
- 'objects.\n'
- ' Note that the special interpretation of negative '
- 'indexes (if the\n'
- ' class wishes to emulate a *sequence* type) is up to '
- 'the\n'
- ' "__getitem__()" method. If *key* is of an inappropriate '
- 'type,\n'
- ' "TypeError" may be raised; if of a value outside the '
- 'set of indexes\n'
- ' for the sequence (after any special interpretation of '
- 'negative\n'
- ' values), "IndexError" should be raised. For *mapping* '
- 'types, if\n'
- ' *key* is missing (not in the container), "KeyError" '
- 'should be\n'
- ' raised.\n'
+ ' types, the accepted keys should be integers. '
+ 'Optionally, they may\n'
+ ' support "slice" objects as well. Negative index '
+ 'support is also\n'
+ ' optional. If *key* is of an inappropriate type, '
+ '"TypeError" may be\n'
+ ' raised; if *key* is a value outside the set of indexes '
+ 'for the\n'
+ ' sequence (after any special interpretation of negative '
+ 'values),\n'
+ ' "IndexError" should be raised. For *mapping* types, if '
+ '*key* is\n'
+ ' missing (not in the container), "KeyError" should be '
+ 'raised.\n'
'\n'
' Note:\n'
'\n'
@@ -9578,8 +9593,8 @@ topics = {'assert': 'The "assert" statement\n'
' intended to provide protection against a '
'denial-of-service caused\n'
' by carefully chosen inputs that exploit the worst case\n'
- ' performance of a dict insertion, O(n^2) complexity. '
- 'See\n'
+ ' performance of a dict insertion, *O*(*n*^2) '
+ 'complexity. See\n'
' http://ocert.org/advisories/ocert-2011-003.html for\n'
' details.Changing hash values affects the iteration '
'order of sets.\n'
@@ -9857,19 +9872,25 @@ topics = {'assert': 'The "assert" statement\n'
'of the\n'
' owner class.\n'
'\n'
- 'The attribute "__objclass__" is interpreted by the "inspect" '
- 'module as\n'
- 'specifying the class where this object was defined (setting '
- 'this\n'
- 'appropriately can assist in runtime introspection of dynamic '
- 'class\n'
- 'attributes). For callables, it may indicate that an instance '
- 'of the\n'
- 'given type (or a subclass) is expected or required as the '
+ 'Instances of descriptors may also have the "__objclass__" '
+ 'attribute\n'
+ 'present:\n'
+ '\n'
+ 'object.__objclass__\n'
+ '\n'
+ ' The attribute "__objclass__" is interpreted by the '
+ '"inspect" module\n'
+ ' as specifying the class where this object was defined '
+ '(setting this\n'
+ ' appropriately can assist in runtime introspection of '
+ 'dynamic class\n'
+ ' attributes). For callables, it may indicate that an '
+ 'instance of the\n'
+ ' given type (or a subclass) is expected or required as the '
'first\n'
- 'positional argument (for example, CPython sets this '
+ ' positional argument (for example, CPython sets this '
'attribute for\n'
- 'unbound methods that are implemented in C).\n'
+ ' unbound methods that are implemented in C).\n'
'\n'
'\n'
'Invoking Descriptors\n'
@@ -10116,7 +10137,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Keyword arguments which are given to a new class are '
'passed to the\n'
- ' parent’s class "__init_subclass__". For compatibility '
+ ' parent class’s "__init_subclass__". For compatibility '
'with other\n'
' classes using "__init_subclass__", one should take out '
'the needed\n'
@@ -10798,22 +10819,20 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Called to implement evaluation of "self[key]". For '
'*sequence*\n'
- ' types, the accepted keys should be integers and slice '
- 'objects.\n'
- ' Note that the special interpretation of negative indexes '
- '(if the\n'
- ' class wishes to emulate a *sequence* type) is up to the\n'
- ' "__getitem__()" method. If *key* is of an inappropriate '
- 'type,\n'
- ' "TypeError" may be raised; if of a value outside the set '
- 'of indexes\n'
- ' for the sequence (after any special interpretation of '
- 'negative\n'
- ' values), "IndexError" should be raised. For *mapping* '
- 'types, if\n'
- ' *key* is missing (not in the container), "KeyError" '
- 'should be\n'
- ' raised.\n'
+ ' types, the accepted keys should be integers. Optionally, '
+ 'they may\n'
+ ' support "slice" objects as well. Negative index support '
+ 'is also\n'
+ ' optional. If *key* is of an inappropriate type, '
+ '"TypeError" may be\n'
+ ' raised; if *key* is a value outside the set of indexes '
+ 'for the\n'
+ ' sequence (after any special interpretation of negative '
+ 'values),\n'
+ ' "IndexError" should be raised. For *mapping* types, if '
+ '*key* is\n'
+ ' missing (not in the container), "KeyError" should be '
+ 'raised.\n'
'\n'
' Note:\n'
'\n'
@@ -11913,7 +11932,7 @@ topics = {'assert': 'The "assert" statement\n'
'followed by\n'
' the string itself.\n'
'\n'
- 'str.rsplit(sep=None, maxsplit=- 1)\n'
+ 'str.rsplit(sep=None, maxsplit=-1)\n'
'\n'
' Return a list of the words in the string, using *sep* '
'as the\n'
@@ -11954,7 +11973,7 @@ topics = {'assert': 'The "assert" statement\n'
" >>> 'Monty Python'.removesuffix(' Python')\n"
" 'Monty'\n"
'\n'
- 'str.split(sep=None, maxsplit=- 1)\n'
+ 'str.split(sep=None, maxsplit=-1)\n'
'\n'
' Return a list of the words in the string, using *sep* '
'as the\n'
@@ -12347,12 +12366,11 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'A string literal with "\'f\'" or "\'F\'" in its prefix is a '
'*formatted\n'
- 'string literal*; see Formatted string literals. The "\'f\'" may '
- 'be\n'
- 'combined with "\'r\'", but not with "\'b\'" or "\'u\'", therefore '
- 'raw\n'
- 'formatted strings are possible, but formatted bytes literals are '
- 'not.\n'
+ 'string literal*; see f-strings. The "\'f\'" may be combined with '
+ '"\'r\'",\n'
+ 'but not with "\'b\'" or "\'u\'", therefore raw formatted strings '
+ 'are\n'
+ 'possible, but formatted bytes literals are not.\n'
'\n'
'In triple-quoted literals, unescaped newlines and quotes are '
'allowed\n'
@@ -12361,6 +12379,10 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
'literal, i.e. either "\'" or """.)\n'
'\n'
+ '\n'
+ 'Escape sequences\n'
+ '================\n'
+ '\n'
'Unless an "\'r\'" or "\'R\'" prefix is present, escape sequences '
'in string\n'
'and bytes literals are interpreted according to rules similar to '
@@ -13250,123 +13272,112 @@ topics = {'assert': 'The "assert" statement\n'
'function’s\n'
'formal parameter list.\n'
'\n'
- 'Special attributes:\n'
'\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| Attribute | Meaning '
- '| |\n'
- '|===========================|=================================|=============|\n'
- '| "__doc__" | The function’s documentation | '
- 'Writable |\n'
- '| | string, or "None" if '
- '| |\n'
- '| | unavailable; not inherited by '
- '| |\n'
- '| | subclasses. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__name__" | The function’s name. | '
- 'Writable |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__qualname__" | The function’s *qualified | '
- 'Writable |\n'
- '| | name*. New in version 3.3. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__module__" | The name of the module the | '
- 'Writable |\n'
- '| | function was defined in, or '
- '| |\n'
- '| | "None" if unavailable. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__defaults__" | A tuple containing default | '
- 'Writable |\n'
- '| | argument values for those '
- '| |\n'
- '| | arguments that have defaults, '
- '| |\n'
- '| | or "None" if no arguments have '
- '| |\n'
- '| | a default value. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__code__" | The code object representing | '
- 'Writable |\n'
- '| | the compiled function body. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__globals__" | A reference to the dictionary | '
- 'Read-only |\n'
- '| | that holds the function’s '
- '| |\n'
- '| | global variables — the global '
- '| |\n'
- '| | namespace of the module in '
- '| |\n'
- '| | which the function was defined. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__dict__" | The namespace supporting | '
- 'Writable |\n'
- '| | arbitrary function attributes. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__closure__" | "None" or a tuple of cells that | '
- 'Read-only |\n'
- '| | contain bindings for the '
- '| |\n'
- '| | function’s free variables. See '
- '| |\n'
- '| | below for information on the '
- '| |\n'
- '| | "cell_contents" attribute. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__annotations__" | A dict containing annotations | '
- 'Writable |\n'
- '| | of parameters. The keys of the '
- '| |\n'
- '| | dict are the parameter names, '
- '| |\n'
- '| | and "\'return\'" for the return '
- '| |\n'
- '| | annotation, if provided. For '
- '| |\n'
- '| | more information on working '
- '| |\n'
- '| | with this attribute, see '
- '| |\n'
- '| | Annotations Best Practices. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '| "__kwdefaults__" | A dict containing defaults for | '
- 'Writable |\n'
- '| | keyword-only parameters. '
- '| |\n'
- '+---------------------------+---------------------------------+-------------+\n'
- '\n'
- 'Most of the attributes labelled “Writable” check the type of the\n'
- 'assigned value.\n'
+ 'Special read-only attributes\n'
+ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
+ '\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| Attribute | '
+ 'Meaning |\n'
+ '|====================================================|====================================================|\n'
+ '| function.__globals__ | A reference '
+ 'to the "dictionary" that holds the |\n'
+ '| | function’s '
+ 'global variables – the global namespace |\n'
+ '| | of the '
+ 'module in which the function was defined. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__closure__ | "None" or a '
+ '"tuple" of cells that contain bindings |\n'
+ '| | for the '
+ 'function’s free variables. A cell object |\n'
+ '| | has the '
+ 'attribute "cell_contents". This can be |\n'
+ '| | used to get '
+ 'the value of the cell, as well as set |\n'
+ '| | the '
+ 'value. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '\n'
+ '\n'
+ 'Special writable attributes\n'
+ '~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
+ '\n'
+ 'Most of these attributes check the type of the assigned value:\n'
+ '\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| Attribute | '
+ 'Meaning |\n'
+ '|====================================================|====================================================|\n'
+ '| function.__doc__ | The '
+ 'function’s documentation string, or "None" if |\n'
+ '| | unavailable. '
+ 'Not inherited by subclasses. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__name__ | The '
+ 'function’s name. See also: "__name__ |\n'
+ '| | '
+ 'attributes". |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__qualname__ | The '
+ 'function’s *qualified name*. See also: |\n'
+ '| | '
+ '"__qualname__ attributes". New in version 3.3. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__module__ | The name of '
+ 'the module the function was defined |\n'
+ '| | in, or '
+ '"None" if unavailable. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__defaults__ | A "tuple" '
+ 'containing default *parameter* values |\n'
+ '| | for those '
+ 'parameters that have defaults, or "None" |\n'
+ '| | if no '
+ 'parameters have a default value. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__code__ | The code '
+ 'object representing the compiled function |\n'
+ '| | '
+ 'body. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__dict__ | The '
+ 'namespace supporting arbitrary function |\n'
+ '| | attributes. '
+ 'See also: "__dict__ attributes". |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__annotations__ | A '
+ '"dictionary" containing annotations of |\n'
+ '| | '
+ '*parameters*. The keys of the dictionary are the |\n'
+ '| | parameter '
+ 'names, and "\'return\'" for the return |\n'
+ '| | annotation, '
+ 'if provided. See also: Annotations |\n'
+ '| | Best '
+ 'Practices. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| function.__kwdefaults__ | A '
+ '"dictionary" containing defaults for keyword- |\n'
+ '| | only '
+ '*parameters*. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
'\n'
'Function objects also support getting and setting arbitrary\n'
'attributes, which can be used, for example, to attach metadata to\n'
'functions. Regular attribute dot-notation is used to get and set '
'such\n'
- 'attributes. *Note that the current implementation only supports\n'
- 'function attributes on user-defined functions. Function attributes '
- 'on\n'
- 'built-in functions may be supported in the future.*\n'
+ 'attributes.\n'
'\n'
- 'A cell object has the attribute "cell_contents". This can be used '
- 'to\n'
- 'get the value of the cell, as well as set the value.\n'
+ '**CPython implementation detail:** CPython’s current '
+ 'implementation\n'
+ 'only supports function attributes on user-defined functions. '
+ 'Function\n'
+ 'attributes on built-in functions may be supported in the future.\n'
'\n'
'Additional information about a function’s definition can be '
'retrieved\n'
- 'from its code object; see the description of internal types below. '
- 'The\n'
- '"cell" type can be accessed in the "types" module.\n'
+ 'from its code object (accessible via the "__code__" attribute).\n'
'\n'
'\n'
'Instance methods\n'
@@ -13376,14 +13387,34 @@ topics = {'assert': 'The "assert" statement\n'
'any\n'
'callable object (normally a user-defined function).\n'
'\n'
- 'Special read-only attributes: "__self__" is the class instance '
- 'object,\n'
- '"__func__" is the function object; "__doc__" is the method’s\n'
- 'documentation (same as "__func__.__doc__"); "__name__" is the '
- 'method\n'
- 'name (same as "__func__.__name__"); "__module__" is the name of '
- 'the\n'
- 'module the method was defined in, or "None" if unavailable.\n'
+ 'Special read-only attributes:\n'
+ '\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| method.__self__ | Refers to '
+ 'the class instance object to which the |\n'
+ '| | method is '
+ 'bound |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| method.__func__ | Refers to '
+ 'the original function object |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| method.__doc__ | The method’s '
+ 'documentation (same as |\n'
+ '| | '
+ '"method.__func__.__doc__"). A "string" if the |\n'
+ '| | original '
+ 'function had a docstring, else "None". |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| method.__name__ | The name of '
+ 'the method (same as |\n'
+ '| | '
+ '"method.__func__.__name__") |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| method.__module__ | The name of '
+ 'the module the method was defined in, |\n'
+ '| | or "None" if '
+ 'unavailable. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
'\n'
'Methods also support accessing (but not setting) the arbitrary\n'
'function attributes on the underlying function object.\n'
@@ -13392,24 +13423,20 @@ topics = {'assert': 'The "assert" statement\n'
'attribute\n'
'of a class (perhaps via an instance of that class), if that '
'attribute\n'
- 'is a user-defined function object or a class method object.\n'
+ 'is a user-defined function object or a "classmethod" object.\n'
'\n'
'When an instance method object is created by retrieving a '
'user-defined\n'
'function object from a class via one of its instances, its '
'"__self__"\n'
- 'attribute is the instance, and the method object is said to be '
- 'bound.\n'
- 'The new method’s "__func__" attribute is the original function '
- 'object.\n'
+ 'attribute is the instance, and the method object is said to be\n'
+ '*bound*. The new method’s "__func__" attribute is the original\n'
+ 'function object.\n'
'\n'
- 'When an instance method object is created by retrieving a class '
- 'method\n'
- 'object from a class or instance, its "__self__" attribute is the '
- 'class\n'
- 'itself, and its "__func__" attribute is the function object '
- 'underlying\n'
- 'the class method.\n'
+ 'When an instance method object is created by retrieving a\n'
+ '"classmethod" object from a class or instance, its "__self__"\n'
+ 'attribute is the class itself, and its "__func__" attribute is the\n'
+ 'function object underlying the class method.\n'
'\n'
'When an instance method object is called, the underlying function\n'
'("__func__") is called, inserting the class instance ("__self__") '
@@ -13420,7 +13447,7 @@ topics = {'assert': 'The "assert" statement\n'
'of\n'
'"C", calling "x.f(1)" is equivalent to calling "C.f(x, 1)".\n'
'\n'
- 'When an instance method object is derived from a class method '
+ 'When an instance method object is derived from a "classmethod" '
'object,\n'
'the “class instance” stored in "__self__" will actually be the '
'class\n'
@@ -13508,13 +13535,18 @@ topics = {'assert': 'The "assert" statement\n'
'of built-in functions are "len()" and "math.sin()" ("math" is a\n'
'standard built-in module). The number and type of the arguments '
'are\n'
- 'determined by the C function. Special read-only attributes: '
- '"__doc__"\n'
- 'is the function’s documentation string, or "None" if unavailable;\n'
- '"__name__" is the function’s name; "__self__" is set to "None" '
- '(but\n'
- 'see the next item); "__module__" is the name of the module the\n'
- 'function was defined in or "None" if unavailable.\n'
+ 'determined by the C function. Special read-only attributes:\n'
+ '\n'
+ '* "__doc__" is the function’s documentation string, or "None" if\n'
+ ' unavailable. See "function.__doc__".\n'
+ '\n'
+ '* "__name__" is the function’s name. See "function.__name__".\n'
+ '\n'
+ '* "__self__" is set to "None" (but see the next item).\n'
+ '\n'
+ '* "__module__" is the name of the module the function was defined '
+ 'in\n'
+ ' or "None" if unavailable. See "function.__module__".\n'
'\n'
'\n'
'Built-in methods\n'
@@ -13526,7 +13558,9 @@ topics = {'assert': 'The "assert" statement\n'
'argument. An example of a built-in method is "alist.append()",\n'
'assuming *alist* is a list object. In this case, the special '
'read-only\n'
- 'attribute "__self__" is set to the object denoted by *alist*.\n'
+ 'attribute "__self__" is set to the object denoted by *alist*. (The\n'
+ 'attribute has the same semantics as it does with "other instance\n'
+ 'methods".)\n'
'\n'
'\n'
'Classes\n'
@@ -13558,16 +13592,15 @@ topics = {'assert': 'The "assert" statement\n'
'statement, or by calling functions such as '
'"importlib.import_module()"\n'
'and built-in "__import__()". A module object has a namespace\n'
- 'implemented by a dictionary object (this is the dictionary '
- 'referenced\n'
- 'by the "__globals__" attribute of functions defined in the '
- 'module).\n'
- 'Attribute references are translated to lookups in this dictionary,\n'
- 'e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object '
- 'does\n'
- 'not contain the code object used to initialize the module (since '
- 'it\n'
- 'isn’t needed once the initialization is done).\n'
+ 'implemented by a "dictionary" object (this is the dictionary\n'
+ 'referenced by the "__globals__" attribute of functions defined in '
+ 'the\n'
+ 'module). Attribute references are translated to lookups in this\n'
+ 'dictionary, e.g., "m.x" is equivalent to "m.__dict__["x"]". A '
+ 'module\n'
+ 'object does not contain the code object used to initialize the '
+ 'module\n'
+ '(since it isn’t needed once the initialization is done).\n'
'\n'
'Attribute assignment updates the module’s namespace dictionary, '
'e.g.,\n'
@@ -13641,14 +13674,13 @@ topics = {'assert': 'The "assert" statement\n'
'a\n'
'class method object, it is transformed into an instance method '
'object\n'
- 'whose "__self__" attribute is "C". When it would yield a static\n'
- 'method object, it is transformed into the object wrapped by the '
- 'static\n'
- 'method object. See section Implementing Descriptors for another way '
- 'in\n'
- 'which attributes retrieved from a class may differ from those '
- 'actually\n'
- 'contained in its "__dict__".\n'
+ 'whose "__self__" attribute is "C". When it would yield a\n'
+ '"staticmethod" object, it is transformed into the object wrapped '
+ 'by\n'
+ 'the static method object. See section Implementing Descriptors for\n'
+ 'another way in which attributes retrieved from a class may differ '
+ 'from\n'
+ 'those actually contained in its "__dict__".\n'
'\n'
'Class attribute assignments update the class’s dictionary, never '
'the\n'
@@ -13768,40 +13800,102 @@ topics = {'assert': 'The "assert" statement\n'
'code objects are immutable and contain no references (directly or\n'
'indirectly) to mutable objects.\n'
'\n'
- 'Special read-only attributes: "co_name" gives the function name;\n'
- '"co_qualname" gives the fully qualified function name; '
- '"co_argcount"\n'
- 'is the total number of positional arguments (including '
- 'positional-only\n'
- 'arguments and arguments with default values); "co_posonlyargcount" '
- 'is\n'
- 'the number of positional-only arguments (including arguments with\n'
- 'default values); "co_kwonlyargcount" is the number of keyword-only\n'
- 'arguments (including arguments with default values); "co_nlocals" '
- 'is\n'
- 'the number of local variables used by the function (including\n'
- 'arguments); "co_varnames" is a tuple containing the names of the '
- 'local\n'
- 'variables (starting with the argument names); "co_cellvars" is a '
- 'tuple\n'
- 'containing the names of local variables that are referenced by '
- 'nested\n'
- 'functions; "co_freevars" is a tuple containing the names of free\n'
- 'variables; "co_code" is a string representing the sequence of '
- 'bytecode\n'
- 'instructions; "co_consts" is a tuple containing the literals used '
- 'by\n'
- 'the bytecode; "co_names" is a tuple containing the names used by '
- 'the\n'
- 'bytecode; "co_filename" is the filename from which the code was\n'
- 'compiled; "co_firstlineno" is the first line number of the '
- 'function;\n'
- '"co_lnotab" is a string encoding the mapping from bytecode offsets '
- 'to\n'
- 'line numbers (for details see the source code of the interpreter);\n'
- '"co_stacksize" is the required stack size; "co_flags" is an '
- 'integer\n'
- 'encoding a number of flags for the interpreter.\n'
+ '\n'
+ 'Special read-only attributes\n'
+ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
+ '\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_name | The function '
+ 'name |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_qualname | The fully '
+ 'qualified function name |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_argcount | The total '
+ 'number of positional *parameters* |\n'
+ '| | (including '
+ 'positional-only parameters and |\n'
+ '| | parameters '
+ 'with default values) that the function |\n'
+ '| | '
+ 'has |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_posonlyargcount | The number '
+ 'of positional-only *parameters* |\n'
+ '| | (including '
+ 'arguments with default values) that the |\n'
+ '| | function '
+ 'has |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_kwonlyargcount | The number '
+ 'of keyword-only *parameters* (including |\n'
+ '| | arguments '
+ 'with default values) that the function |\n'
+ '| | '
+ 'has |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_nlocals | The number '
+ 'of local variables used by the function |\n'
+ '| | (including '
+ 'parameters) |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_varnames | A "tuple" '
+ 'containing the names of the local |\n'
+ '| | variables in '
+ 'the function (starting with the |\n'
+ '| | parameter '
+ 'names) |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_cellvars | A "tuple" '
+ 'containing the names of local variables |\n'
+ '| | that are '
+ 'referenced by nested functions inside the |\n'
+ '| | '
+ 'function |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_freevars | A "tuple" '
+ 'containing the names of free variables |\n'
+ '| | in the '
+ 'function |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_code | A string '
+ 'representing the sequence of *bytecode* |\n'
+ '| | instructions '
+ 'in the function |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_consts | A "tuple" '
+ 'containing the literals used by the |\n'
+ '| | *bytecode* '
+ 'in the function |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_names | A "tuple" '
+ 'containing the names used by the |\n'
+ '| | *bytecode* '
+ 'in the function |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_filename | The name of '
+ 'the file from which the code was |\n'
+ '| | '
+ 'compiled |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_firstlineno | The line '
+ 'number of the first line of the function |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_lnotab | A string '
+ 'encoding the mapping from *bytecode* |\n'
+ '| | offsets to '
+ 'line numbers. For details, see the |\n'
+ '| | source code '
+ 'of the interpreter. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_stacksize | The required '
+ 'stack size of the code object |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| codeobject.co_flags | An "integer" '
+ 'encoding a number of flags for the |\n'
+ '| | '
+ 'interpreter. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
'\n'
'The following flag bits are defined for "co_flags": bit "0x04" is '
'set\n'
@@ -13810,7 +13904,9 @@ topics = {'assert': 'The "assert" statement\n'
'number of positional arguments; bit "0x08" is set if the function '
'uses\n'
'the "**keywords" syntax to accept arbitrary keyword arguments; bit\n'
- '"0x20" is set if the function is a generator.\n'
+ '"0x20" is set if the function is a generator. See Code Objects Bit\n'
+ 'Flags for details on the semantics of each flags that might be\n'
+ 'present.\n'
'\n'
'Future feature declarations ("from __future__ import division") '
'also\n'
@@ -13829,16 +13925,19 @@ topics = {'assert': 'The "assert" statement\n'
'is the documentation string of the function, or "None" if '
'undefined.\n'
'\n'
+ '\n'
+ 'Methods on code objects\n'
+ '~~~~~~~~~~~~~~~~~~~~~~~\n'
+ '\n'
'codeobject.co_positions()\n'
'\n'
- ' Returns an iterable over the source code positions of each '
- 'bytecode\n'
- ' instruction in the code object.\n'
+ ' Returns an iterable over the source code positions of each\n'
+ ' *bytecode* instruction in the code object.\n'
'\n'
- ' The iterator returns tuples containing the "(start_line, '
- 'end_line,\n'
- ' start_column, end_column)". The *i-th* tuple corresponds to the\n'
- ' position of the source code that compiled to the *i-th*\n'
+ ' The iterator returns "tuple"s containing the "(start_line,\n'
+ ' end_line, start_column, end_column)". The *i-th* tuple '
+ 'corresponds\n'
+ ' to the position of the source code that compiled to the *i-th*\n'
' instruction. Column information is 0-indexed utf-8 byte offsets '
'on\n'
' the given source line.\n'
@@ -13876,51 +13975,153 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
' "PYTHONNODEBUGRANGES" environment variable can be used.\n'
'\n'
+ 'codeobject.co_lines()\n'
'\n'
- 'Frame objects\n'
- '-------------\n'
+ ' Returns an iterator that yields information about successive '
+ 'ranges\n'
+ ' of *bytecode*s. Each item yielded is a "(start, end, lineno)"\n'
+ ' "tuple":\n'
'\n'
- 'Frame objects represent execution frames. They may occur in '
- 'traceback\n'
- 'objects (see below), and are also passed to registered trace\n'
- 'functions.\n'
+ ' * "start" (an "int") represents the offset (inclusive) of the '
+ 'start\n'
+ ' of the *bytecode* range\n'
'\n'
- 'Special read-only attributes: "f_back" is to the previous stack '
- 'frame\n'
- '(towards the caller), or "None" if this is the bottom stack frame;\n'
- '"f_code" is the code object being executed in this frame; '
- '"f_locals"\n'
- 'is the dictionary used to look up local variables; "f_globals" is '
- 'used\n'
- 'for global variables; "f_builtins" is used for built-in '
- '(intrinsic)\n'
- 'names; "f_lasti" gives the precise instruction (this is an index '
- 'into\n'
- 'the bytecode string of the code object).\n'
+ ' * "end" (an "int") represents the offset (exclusive) of the end '
+ 'of\n'
+ ' the *bytecode* range\n'
'\n'
- 'Accessing "f_code" raises an auditing event "object.__getattr__" '
- 'with\n'
- 'arguments "obj" and ""f_code"".\n'
+ ' * "lineno" is an "int" representing the line number of the\n'
+ ' *bytecode* range, or "None" if the bytecodes in the given '
+ 'range\n'
+ ' have no line number\n'
'\n'
- 'Special writable attributes: "f_trace", if not "None", is a '
- 'function\n'
- 'called for various events during code execution (this is used by '
+ ' The items yielded will have the following properties:\n'
+ '\n'
+ ' * The first range yielded will have a "start" of 0.\n'
+ '\n'
+ ' * The "(start, end)" ranges will be non-decreasing and '
+ 'consecutive.\n'
+ ' That is, for any pair of "tuple"s, the "start" of the second '
+ 'will\n'
+ ' be equal to the "end" of the first.\n'
+ '\n'
+ ' * No range will be backwards: "end >= start" for all triples.\n'
+ '\n'
+ ' * The last "tuple" yielded will have "end" equal to the size of '
'the\n'
- 'debugger). Normally an event is triggered for each new source line '
- '-\n'
- 'this can be disabled by setting "f_trace_lines" to "False".\n'
- '\n'
- 'Implementations *may* allow per-opcode events to be requested by\n'
- 'setting "f_trace_opcodes" to "True". Note that this may lead to\n'
- 'undefined interpreter behaviour if exceptions raised by the trace\n'
- 'function escape to the function being traced.\n'
- '\n'
- '"f_lineno" is the current line number of the frame — writing to '
- 'this\n'
- 'from within a trace function jumps to the given line (only for the\n'
- 'bottom-most frame). A debugger can implement a Jump command (aka '
- 'Set\n'
- 'Next Statement) by writing to f_lineno.\n'
+ ' *bytecode*.\n'
+ '\n'
+ ' Zero-width ranges, where "start == end", are allowed. '
+ 'Zero-width\n'
+ ' ranges are used for lines that are present in the source code, '
+ 'but\n'
+ ' have been eliminated by the *bytecode* compiler.\n'
+ '\n'
+ ' New in version 3.10.\n'
+ '\n'
+ ' See also:\n'
+ '\n'
+ ' **PEP 626** - Precise line numbers for debugging and other '
+ 'tools.\n'
+ ' The PEP that introduced the "co_lines()" method.\n'
+ '\n'
+ '\n'
+ 'Frame objects\n'
+ '-------------\n'
+ '\n'
+ 'Frame objects represent execution frames. They may occur in '
+ 'traceback\n'
+ 'objects, and are also passed to registered trace functions.\n'
+ '\n'
+ '\n'
+ 'Special read-only attributes\n'
+ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
+ '\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_back | Points to '
+ 'the previous stack frame (towards the |\n'
+ '| | caller), or '
+ '"None" if this is the bottom stack |\n'
+ '| | '
+ 'frame |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_code | The code '
+ 'object being executed in this frame. |\n'
+ '| | Accessing '
+ 'this attribute raises an auditing event |\n'
+ '| | '
+ '"object.__getattr__" with arguments "obj" and |\n'
+ '| | '
+ '""f_code"". |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_locals | The '
+ 'dictionary used by the frame to look up local |\n'
+ '| | '
+ 'variables |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_globals | The '
+ 'dictionary used by the frame to look up global |\n'
+ '| | '
+ 'variables |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_builtins | The '
+ 'dictionary used by the frame to look up built- |\n'
+ '| | in '
+ '(intrinsic) names |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_lasti | The “precise '
+ 'instruction” of the frame object |\n'
+ '| | (this is an '
+ 'index into the *bytecode* string of |\n'
+ '| | the code '
+ 'object) |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '\n'
+ '\n'
+ 'Special writable attributes\n'
+ '~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
+ '\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_trace | If not '
+ '"None", this is a function called for |\n'
+ '| | various '
+ 'events during code execution (this is used |\n'
+ '| | by '
+ 'debuggers). Normally an event is triggered for |\n'
+ '| | each new '
+ 'source line (see "f_trace_lines"). |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_trace_lines | Set this '
+ 'attribute to "False" to disable |\n'
+ '| | triggering a '
+ 'tracing event for each source line. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_trace_opcodes | Set this '
+ 'attribute to "True" to allow per-opcode |\n'
+ '| | events to be '
+ 'requested. Note that this may lead to |\n'
+ '| | undefined '
+ 'interpreter behaviour if exceptions |\n'
+ '| | raised by '
+ 'the trace function escape to the |\n'
+ '| | function '
+ 'being traced. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| frame.f_lineno | The current '
+ 'line number of the frame – writing to |\n'
+ '| | this from '
+ 'within a trace function jumps to the |\n'
+ '| | given line '
+ '(only for the bottom-most frame). A |\n'
+ '| | debugger can '
+ 'implement a Jump command (aka Set |\n'
+ '| | Next '
+ 'Statement) by writing to this attribute. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '\n'
+ '\n'
+ 'Frame object methods\n'
+ '~~~~~~~~~~~~~~~~~~~~\n'
'\n'
'Frame objects support one method:\n'
'\n'
@@ -13928,7 +14129,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' This method clears all references to local variables held by '
'the\n'
- ' frame. Also, if the frame belonged to a generator, the '
+ ' frame. Also, if the frame belonged to a *generator*, the '
'generator\n'
' is finalized. This helps break reference cycles involving '
'frame\n'
@@ -13943,11 +14144,14 @@ topics = {'assert': 'The "assert" statement\n'
'Traceback objects\n'
'-----------------\n'
'\n'
- 'Traceback objects represent a stack trace of an exception. A\n'
+ 'Traceback objects represent the stack trace of an exception. A\n'
'traceback object is implicitly created when an exception occurs, '
'and\n'
'may also be explicitly created by calling "types.TracebackType".\n'
'\n'
+ 'Changed in version 3.7: Traceback objects can now be explicitly\n'
+ 'instantiated from Python code.\n'
+ '\n'
'For implicitly created tracebacks, when the search for an '
'exception\n'
'handler unwinds the execution stack, at each unwound level a '
@@ -13970,30 +14174,40 @@ topics = {'assert': 'The "assert" statement\n'
'linked\n'
'to form a full stack trace.\n'
'\n'
- 'Special read-only attributes: "tb_frame" points to the execution '
- 'frame\n'
- 'of the current level; "tb_lineno" gives the line number where the\n'
- 'exception occurred; "tb_lasti" indicates the precise instruction. '
- 'The\n'
- 'line number and last instruction in the traceback may differ from '
+ 'Special read-only attributes:\n'
+ '\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| traceback.tb_frame | Points to '
+ 'the execution frame of the current |\n'
+ '| | level. '
+ 'Accessing this attribute raises an |\n'
+ '| | auditing '
+ 'event "object.__getattr__" with arguments |\n'
+ '| | "obj" and '
+ '""tb_frame"". |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| traceback.tb_lineno | Gives the '
+ 'line number where the exception occurred |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '| traceback.tb_lasti | Indicates '
+ 'the “precise instruction”. |\n'
+ '+----------------------------------------------------+----------------------------------------------------+\n'
+ '\n'
+ 'The line number and last instruction in the traceback may differ '
+ 'from\n'
+ 'the line number of its frame object if the exception occurred in a\n'
+ '"try" statement with no matching except clause or with a "finally"\n'
+ 'clause.\n'
+ '\n'
+ 'traceback.tb_next\n'
+ '\n'
+ ' The special writable attribute "tb_next" is the next level in '
'the\n'
- 'line number of its frame object if the exception occurred in a '
- '"try"\n'
- 'statement with no matching except clause or with a finally clause.\n'
- '\n'
- 'Accessing "tb_frame" raises an auditing event "object.__getattr__"\n'
- 'with arguments "obj" and ""tb_frame"".\n'
- '\n'
- 'Special writable attribute: "tb_next" is the next level in the '
- 'stack\n'
- 'trace (towards the frame where the exception occurred), or "None" '
- 'if\n'
- 'there is no next level.\n'
+ ' stack trace (towards the frame where the exception occurred), '
+ 'or\n'
+ ' "None" if there is no next level.\n'
'\n'
- 'Changed in version 3.7: Traceback objects can now be explicitly\n'
- 'instantiated from Python code, and the "tb_next" attribute of '
- 'existing\n'
- 'instances can be updated.\n'
+ ' Changed in version 3.7: This attribute is now writable\n'
'\n'
'\n'
'Slice objects\n'
@@ -14050,8 +14264,8 @@ topics = {'assert': 'The "assert" statement\n'
'around another object that alters the way in which that object is\n'
'retrieved from classes and class instances. The behaviour of class\n'
'method objects upon such retrieval is described above, under '
- '“User-\n'
- 'defined methods”. Class method objects are created by the built-in\n'
+ '“instance\n'
+ 'methods”. Class method objects are created by the built-in\n'
'"classmethod()" constructor.\n',
'typesfunctions': 'Functions\n'
'*********\n'
@@ -14562,7 +14776,7 @@ topics = {'assert': 'The "assert" statement\n'
'notation.\n'
'There are two flavors: built-in methods (such as "append()" '
'on lists)\n'
- 'and class instance methods. Built-in methods are described '
+ 'and class instance method. Built-in methods are described '
'with the\n'
'types that support them.\n'
'\n'
@@ -14570,8 +14784,8 @@ topics = {'assert': 'The "assert" statement\n'
'namespace)\n'
'through an instance, you get a special object: a *bound '
'method* (also\n'
- 'called *instance method*) object. When called, it will add '
- 'the "self"\n'
+ 'called instance method) object. When called, it will add the '
+ '"self"\n'
'argument to the argument list. Bound methods have two '
'special read-\n'
'only attributes: "m.__self__" is the object on which the '
@@ -14586,7 +14800,7 @@ topics = {'assert': 'The "assert" statement\n'
'arbitrary\n'
'attributes. However, since method attributes are actually '
'stored on\n'
- 'the underlying function object ("meth.__func__"), setting '
+ 'the underlying function object ("method.__func__"), setting '
'method\n'
'attributes on bound methods is disallowed. Attempting to '
'set an\n'
@@ -14611,7 +14825,7 @@ topics = {'assert': 'The "assert" statement\n'
' >>> c.method.whoami\n'
" 'my name is method'\n"
'\n'
- 'See The standard type hierarchy for more information.\n',
+ 'See Instance methods for more information.\n',
'typesmodules': 'Modules\n'
'*******\n'
'\n'
diff --git a/contrib/tools/python3/src/Lib/shutil.py b/contrib/tools/python3/src/Lib/shutil.py
index d108986d13..79b38cf456 100644
--- a/contrib/tools/python3/src/Lib/shutil.py
+++ b/contrib/tools/python3/src/Lib/shutil.py
@@ -298,11 +298,15 @@ def copymode(src, dst, *, follow_symlinks=True):
sys.audit("shutil.copymode", src, dst)
if not follow_symlinks and _islink(src) and os.path.islink(dst):
- if hasattr(os, 'lchmod'):
+ if os.name == 'nt':
+ stat_func, chmod_func = os.lstat, os.chmod
+ elif hasattr(os, 'lchmod'):
stat_func, chmod_func = os.lstat, os.lchmod
else:
return
else:
+ if os.name == 'nt' and os.path.islink(dst):
+ dst = os.path.realpath(dst, strict=True)
stat_func, chmod_func = _stat, os.chmod
st = stat_func(src)
@@ -378,8 +382,16 @@ def copystat(src, dst, *, follow_symlinks=True):
# We must copy extended attributes before the file is (potentially)
# chmod()'ed read-only, otherwise setxattr() will error with -EACCES.
_copyxattr(src, dst, follow_symlinks=follow)
+ _chmod = lookup("chmod")
+ if os.name == 'nt':
+ if follow:
+ if os.path.islink(dst):
+ dst = os.path.realpath(dst, strict=True)
+ else:
+ def _chmod(*args, **kwargs):
+ os.chmod(*args)
try:
- lookup("chmod")(dst, mode, follow_symlinks=follow)
+ _chmod(dst, mode, follow_symlinks=follow)
except NotImplementedError:
# if we got a NotImplementedError, it's because
# * follow_symlinks=False,
@@ -660,7 +672,12 @@ def _rmtree_safe_fd(topfd, path, onerror):
_rmtree_safe_fd(dirfd, fullname, onerror)
try:
os.close(dirfd)
+ except OSError:
+ # close() should not be retried after an error.
dirfd_closed = True
+ onerror(os.close, fullname, sys.exc_info())
+ dirfd_closed = True
+ try:
os.rmdir(entry.name, dir_fd=topfd)
except OSError:
onerror(os.rmdir, fullname, sys.exc_info())
@@ -675,7 +692,10 @@ def _rmtree_safe_fd(topfd, path, onerror):
onerror(os.path.islink, fullname, sys.exc_info())
finally:
if not dirfd_closed:
- os.close(dirfd)
+ try:
+ os.close(dirfd)
+ except OSError:
+ onerror(os.close, fullname, sys.exc_info())
else:
try:
os.unlink(entry.name, dir_fd=topfd)
@@ -732,7 +752,12 @@ def rmtree(path, ignore_errors=False, onerror=None, *, dir_fd=None):
_rmtree_safe_fd(fd, path, onerror)
try:
os.close(fd)
+ except OSError:
+ # close() should not be retried after an error.
fd_closed = True
+ onerror(os.close, path, sys.exc_info())
+ fd_closed = True
+ try:
os.rmdir(path, dir_fd=dir_fd)
except OSError:
onerror(os.rmdir, path, sys.exc_info())
@@ -744,7 +769,10 @@ def rmtree(path, ignore_errors=False, onerror=None, *, dir_fd=None):
onerror(os.path.islink, path, sys.exc_info())
finally:
if not fd_closed:
- os.close(fd)
+ try:
+ os.close(fd)
+ except OSError:
+ onerror(os.close, path, sys.exc_info())
else:
if dir_fd is not None:
raise NotImplementedError("dir_fd unavailable on this platform")
@@ -785,12 +813,12 @@ def move(src, dst, copy_function=copy2):
similar to the Unix "mv" command. Return the file or directory's
destination.
- If the destination is a directory or a symlink to a directory, the source
- is moved inside the directory. The destination path must not already
- exist.
+ If dst is an existing directory or a symlink to a directory, then src is
+ moved inside that directory. The destination path in that directory must
+ not already exist.
- If the destination already exists but is not a directory, it may be
- overwritten depending on os.rename() semantics.
+ If dst already exists but is not a directory, it may be overwritten
+ depending on os.rename() semantics.
If the destination is on our current filesystem, then rename() is used.
Otherwise, src is copied to the destination and then removed. Symlinks are
@@ -809,7 +837,7 @@ def move(src, dst, copy_function=copy2):
sys.audit("shutil.move", src, dst)
real_dst = dst
if os.path.isdir(dst):
- if _samefile(src, dst):
+ if _samefile(src, dst) and not os.path.islink(src):
# We might be on a case insensitive filesystem,
# perform the rename anyway.
os.rename(src, dst)
diff --git a/contrib/tools/python3/src/Lib/signal.py b/contrib/tools/python3/src/Lib/signal.py
index 50b215b29d..c8cd3d4f59 100644
--- a/contrib/tools/python3/src/Lib/signal.py
+++ b/contrib/tools/python3/src/Lib/signal.py
@@ -22,9 +22,11 @@ if 'pthread_sigmask' in _globals:
def _int_to_enum(value, enum_klass):
- """Convert a numeric value to an IntEnum member.
- If it's not a known member, return the numeric value itself.
+ """Convert a possible numeric value to an IntEnum member.
+ If it's not a known member, return the value itself.
"""
+ if not isinstance(value, int):
+ return value
try:
return enum_klass(value)
except ValueError:
diff --git a/contrib/tools/python3/src/Lib/site.py b/contrib/tools/python3/src/Lib/site.py
index 7a45a185c1..bce2841b60 100644
--- a/contrib/tools/python3/src/Lib/site.py
+++ b/contrib/tools/python3/src/Lib/site.py
@@ -74,6 +74,7 @@ import os
import builtins
import _sitebuiltins
import io
+import stat
# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = [sys.prefix, sys.exec_prefix]
@@ -168,6 +169,14 @@ def addpackage(sitedir, name, known_paths):
else:
reset = False
fullname = os.path.join(sitedir, name)
+ try:
+ st = os.lstat(fullname)
+ except OSError:
+ return
+ if ((getattr(st, 'st_flags', 0) & stat.UF_HIDDEN) or
+ (getattr(st, 'st_file_attributes', 0) & stat.FILE_ATTRIBUTE_HIDDEN)):
+ _trace(f"Skipping hidden .pth file: {fullname!r}")
+ return
_trace(f"Processing .pth file: {fullname!r}")
try:
# locale encoding is not ideal especially on Windows. But we have used
@@ -221,7 +230,8 @@ def addsitedir(sitedir, known_paths=None):
names = os.listdir(sitedir)
except OSError:
return
- names = [name for name in names if name.endswith(".pth")]
+ names = [name for name in names
+ if name.endswith(".pth") and not name.startswith(".")]
for name in sorted(names):
addpackage(sitedir, name, known_paths)
if reset:
diff --git a/contrib/tools/python3/src/Lib/socket.py b/contrib/tools/python3/src/Lib/socket.py
index b5d46eb32b..a0567b76bc 100644
--- a/contrib/tools/python3/src/Lib/socket.py
+++ b/contrib/tools/python3/src/Lib/socket.py
@@ -381,7 +381,7 @@ class socket(_socket.socket):
if timeout and not selector_select(timeout):
raise TimeoutError('timed out')
if count:
- blocksize = count - total_sent
+ blocksize = min(count - total_sent, blocksize)
if blocksize <= 0:
break
try:
diff --git a/contrib/tools/python3/src/Lib/ssl.py b/contrib/tools/python3/src/Lib/ssl.py
index e7990a95dd..ba4e47acf9 100644
--- a/contrib/tools/python3/src/Lib/ssl.py
+++ b/contrib/tools/python3/src/Lib/ssl.py
@@ -1048,71 +1048,67 @@ class SSLSocket(socket):
if context.check_hostname and not server_hostname:
raise ValueError("check_hostname requires server_hostname")
+ sock_timeout = sock.gettimeout()
kwargs = dict(
family=sock.family, type=sock.type, proto=sock.proto,
fileno=sock.fileno()
)
self = cls.__new__(cls, **kwargs)
super(SSLSocket, self).__init__(**kwargs)
- sock_timeout = sock.gettimeout()
sock.detach()
-
- self._context = context
- self._session = session
- self._closed = False
- self._sslobj = None
- self.server_side = server_side
- self.server_hostname = context._encode_hostname(server_hostname)
- self.do_handshake_on_connect = do_handshake_on_connect
- self.suppress_ragged_eofs = suppress_ragged_eofs
-
- # See if we are connected
+ # Now SSLSocket is responsible for closing the file descriptor.
try:
- self.getpeername()
- except OSError as e:
- if e.errno != errno.ENOTCONN:
- raise
- connected = False
- blocking = self.getblocking()
- self.setblocking(False)
+ self._context = context
+ self._session = session
+ self._closed = False
+ self._sslobj = None
+ self.server_side = server_side
+ self.server_hostname = context._encode_hostname(server_hostname)
+ self.do_handshake_on_connect = do_handshake_on_connect
+ self.suppress_ragged_eofs = suppress_ragged_eofs
+
+ # See if we are connected
try:
- # We are not connected so this is not supposed to block, but
- # testing revealed otherwise on macOS and Windows so we do
- # the non-blocking dance regardless. Our raise when any data
- # is found means consuming the data is harmless.
- notconn_pre_handshake_data = self.recv(1)
+ self.getpeername()
except OSError as e:
- # EINVAL occurs for recv(1) on non-connected on unix sockets.
- if e.errno not in (errno.ENOTCONN, errno.EINVAL):
+ if e.errno != errno.ENOTCONN:
raise
- notconn_pre_handshake_data = b''
- self.setblocking(blocking)
- if notconn_pre_handshake_data:
- # This prevents pending data sent to the socket before it was
- # closed from escaping to the caller who could otherwise
- # presume it came through a successful TLS connection.
- reason = "Closed before TLS handshake with data in recv buffer."
- notconn_pre_handshake_data_error = SSLError(e.errno, reason)
- # Add the SSLError attributes that _ssl.c always adds.
- notconn_pre_handshake_data_error.reason = reason
- notconn_pre_handshake_data_error.library = None
- try:
- self.close()
- except OSError:
- pass
+ connected = False
+ blocking = self.getblocking()
+ self.setblocking(False)
try:
- raise notconn_pre_handshake_data_error
- finally:
- # Explicitly break the reference cycle.
- notconn_pre_handshake_data_error = None
- else:
- connected = True
+ # We are not connected so this is not supposed to block, but
+ # testing revealed otherwise on macOS and Windows so we do
+ # the non-blocking dance regardless. Our raise when any data
+ # is found means consuming the data is harmless.
+ notconn_pre_handshake_data = self.recv(1)
+ except OSError as e:
+ # EINVAL occurs for recv(1) on non-connected on unix sockets.
+ if e.errno not in (errno.ENOTCONN, errno.EINVAL):
+ raise
+ notconn_pre_handshake_data = b''
+ self.setblocking(blocking)
+ if notconn_pre_handshake_data:
+ # This prevents pending data sent to the socket before it was
+ # closed from escaping to the caller who could otherwise
+ # presume it came through a successful TLS connection.
+ reason = "Closed before TLS handshake with data in recv buffer."
+ notconn_pre_handshake_data_error = SSLError(e.errno, reason)
+ # Add the SSLError attributes that _ssl.c always adds.
+ notconn_pre_handshake_data_error.reason = reason
+ notconn_pre_handshake_data_error.library = None
+ try:
+ raise notconn_pre_handshake_data_error
+ finally:
+ # Explicitly break the reference cycle.
+ notconn_pre_handshake_data_error = None
+ else:
+ connected = True
- self.settimeout(sock_timeout) # Must come after setblocking() calls.
- self._connected = connected
- if connected:
- # create the SSL object
- try:
+ self.settimeout(sock_timeout) # Must come after setblocking() calls.
+ self._connected = connected
+ if connected:
+ # create the SSL object
self._sslobj = self._context._wrap_socket(
self, server_side, self.server_hostname,
owner=self, session=self._session,
@@ -1123,9 +1119,12 @@ class SSLSocket(socket):
# non-blocking
raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
self.do_handshake()
- except (OSError, ValueError):
+ except:
+ try:
self.close()
- raise
+ except OSError:
+ pass
+ raise
return self
@property
diff --git a/contrib/tools/python3/src/Lib/subprocess.py b/contrib/tools/python3/src/Lib/subprocess.py
index 6df5dd551e..3264d9afc7 100644
--- a/contrib/tools/python3/src/Lib/subprocess.py
+++ b/contrib/tools/python3/src/Lib/subprocess.py
@@ -1938,16 +1938,21 @@ class Popen:
SubprocessError)
if issubclass(child_exception_type, OSError) and hex_errno:
errno_num = int(hex_errno, 16)
- child_exec_never_called = (err_msg == "noexec")
- if child_exec_never_called:
+ if err_msg == "noexec:chdir":
err_msg = ""
# The error must be from chdir(cwd).
err_filename = cwd
+ elif err_msg == "noexec":
+ err_msg = ""
+ err_filename = None
else:
err_filename = orig_executable
if errno_num != 0:
err_msg = os.strerror(errno_num)
- raise child_exception_type(errno_num, err_msg, err_filename)
+ if err_filename is not None:
+ raise child_exception_type(errno_num, err_msg, err_filename)
+ else:
+ raise child_exception_type(errno_num, err_msg)
raise child_exception_type(err_msg)
diff --git a/contrib/tools/python3/src/Lib/tarfile.py b/contrib/tools/python3/src/Lib/tarfile.py
index 2808e7efc5..612217b1ad 100755
--- a/contrib/tools/python3/src/Lib/tarfile.py
+++ b/contrib/tools/python3/src/Lib/tarfile.py
@@ -332,10 +332,11 @@ class _LowLevelFile:
class _Stream:
"""Class that serves as an adapter between TarFile and
a stream-like object. The stream-like object only
- needs to have a read() or write() method and is accessed
- blockwise. Use of gzip or bzip2 compression is possible.
- A stream-like object could be for example: sys.stdin,
- sys.stdout, a socket, a tape device etc.
+ needs to have a read() or write() method that works with bytes,
+ and the method is accessed blockwise.
+ Use of gzip or bzip2 compression is possible.
+ A stream-like object could be for example: sys.stdin.buffer,
+ sys.stdout.buffer, a socket, a tape device etc.
_Stream is intended to be used only internally.
"""
@@ -2444,7 +2445,8 @@ class TarFile(object):
# later in _extract_member().
os.mkdir(targetpath, 0o700)
except FileExistsError:
- pass
+ if not os.path.isdir(targetpath):
+ raise
def makefile(self, tarinfo, targetpath):
"""Make a file called targetpath.
diff --git a/contrib/tools/python3/src/Lib/tempfile.py b/contrib/tools/python3/src/Lib/tempfile.py
index 480c17232e..abb5f45103 100644
--- a/contrib/tools/python3/src/Lib/tempfile.py
+++ b/contrib/tools/python3/src/Lib/tempfile.py
@@ -41,6 +41,7 @@ import warnings as _warnings
import io as _io
import os as _os
import shutil as _shutil
+import stat as _stat
import errno as _errno
from random import Random as _Random
import sys as _sys
@@ -269,6 +270,22 @@ def _mkstemp_inner(dir, pre, suf, flags, output_type):
raise FileExistsError(_errno.EEXIST,
"No usable temporary file name found")
+def _dont_follow_symlinks(func, path, *args):
+ # Pass follow_symlinks=False, unless not supported on this platform.
+ if func in _os.supports_follow_symlinks:
+ func(path, *args, follow_symlinks=False)
+ elif _os.name == 'nt' or not _os.path.islink(path):
+ func(path, *args)
+
+def _resetperms(path):
+ try:
+ chflags = _os.chflags
+ except AttributeError:
+ pass
+ else:
+ _dont_follow_symlinks(chflags, path, 0)
+ _dont_follow_symlinks(_os.chmod, path, 0o700)
+
# User visible interfaces.
@@ -859,26 +876,48 @@ class TemporaryDirectory:
ignore_errors=self._ignore_cleanup_errors)
@classmethod
- def _rmtree(cls, name, ignore_errors=False):
+ def _rmtree(cls, name, ignore_errors=False, repeated=False):
def onerror(func, path, exc_info):
if issubclass(exc_info[0], PermissionError):
- def resetperms(path):
- try:
- _os.chflags(path, 0)
- except AttributeError:
- pass
- _os.chmod(path, 0o700)
+ if repeated and path == name:
+ if ignore_errors:
+ return
+ raise
try:
if path != name:
- resetperms(_os.path.dirname(path))
- resetperms(path)
+ _resetperms(_os.path.dirname(path))
+ _resetperms(path)
try:
_os.unlink(path)
- # PermissionError is raised on FreeBSD for directories
- except (IsADirectoryError, PermissionError):
+ except IsADirectoryError:
cls._rmtree(path, ignore_errors=ignore_errors)
+ except PermissionError:
+ # The PermissionError handler was originally added for
+ # FreeBSD in directories, but it seems that it is raised
+ # on Windows too.
+ # bpo-43153: Calling _rmtree again may
+ # raise NotADirectoryError and mask the PermissionError.
+ # So we must re-raise the current PermissionError if
+ # path is not a directory.
+ try:
+ st = _os.lstat(path)
+ except OSError:
+ if ignore_errors:
+ return
+ raise
+ if (_stat.S_ISLNK(st.st_mode) or
+ not _stat.S_ISDIR(st.st_mode) or
+ (hasattr(st, 'st_file_attributes') and
+ st.st_file_attributes & _stat.FILE_ATTRIBUTE_REPARSE_POINT and
+ st.st_reparse_tag == _stat.IO_REPARSE_TAG_MOUNT_POINT)
+ ):
+ if ignore_errors:
+ return
+ raise
+ cls._rmtree(path, ignore_errors=ignore_errors,
+ repeated=(path == name))
except FileNotFoundError:
pass
elif issubclass(exc_info[0], FileNotFoundError):
diff --git a/contrib/tools/python3/src/Lib/threading.py b/contrib/tools/python3/src/Lib/threading.py
index 70601fc0d5..29b8ec7465 100644
--- a/contrib/tools/python3/src/Lib/threading.py
+++ b/contrib/tools/python3/src/Lib/threading.py
@@ -1651,6 +1651,11 @@ def _after_fork():
# its new value since it can have changed.
thread._reset_internal_locks(True)
ident = get_ident()
+ if isinstance(thread, _DummyThread):
+ thread.__class__ = _MainThread
+ thread._name = 'MainThread'
+ thread._daemonic = False
+ thread._set_tstate_lock()
thread._ident = ident
new_active[ident] = thread
else:
diff --git a/contrib/tools/python3/src/Lib/trace.py b/contrib/tools/python3/src/Lib/trace.py
index fb9a423ea0..761916b180 100755
--- a/contrib/tools/python3/src/Lib/trace.py
+++ b/contrib/tools/python3/src/Lib/trace.py
@@ -258,8 +258,7 @@ class CoverageResults:
modulename = _modname(filename)
else:
dir = coverdir
- if not os.path.exists(dir):
- os.makedirs(dir)
+ os.makedirs(dir, exist_ok=True)
modulename = _fullmodname(filename)
# If desired, get a list of the line numbers which represent
diff --git a/contrib/tools/python3/src/Lib/traceback.py b/contrib/tools/python3/src/Lib/traceback.py
index ea045e2761..e7026e545c 100644
--- a/contrib/tools/python3/src/Lib/traceback.py
+++ b/contrib/tools/python3/src/Lib/traceback.py
@@ -733,7 +733,11 @@ class TracebackException:
# Capture now to permit freeing resources: only complication is in the
# unofficial API _format_final_exc_line
self._str = _safe_string(exc_value, 'exception')
- self.__notes__ = getattr(exc_value, '__notes__', None)
+ try:
+ self.__notes__ = getattr(exc_value, '__notes__', None)
+ except Exception as e:
+ self.__notes__ = [
+ f'Ignored error getting __notes__: {_safe_string(e, "__notes__", repr)}']
if exc_type and issubclass(exc_type, SyntaxError):
# Handle SyntaxError's specially
diff --git a/contrib/tools/python3/src/Lib/typing.py b/contrib/tools/python3/src/Lib/typing.py
index 85166dfd94..5289818950 100644
--- a/contrib/tools/python3/src/Lib/typing.py
+++ b/contrib/tools/python3/src/Lib/typing.py
@@ -3419,7 +3419,7 @@ sys.modules[re.__name__] = re
def reveal_type(obj: T, /) -> T:
- """Reveal the inferred type of a variable.
+ """Ask a static type checker to reveal the inferred type of an expression.
When a static type checker encounters a call to ``reveal_type()``,
it will emit the inferred type of the argument::
@@ -3431,7 +3431,7 @@ def reveal_type(obj: T, /) -> T:
will produce output similar to 'Revealed type is "builtins.int"'.
At runtime, the function prints the runtime type of the
- argument and returns it unchanged.
+ argument and returns the argument unchanged.
"""
print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr)
return obj
diff --git a/contrib/tools/python3/src/Lib/warnings.py b/contrib/tools/python3/src/Lib/warnings.py
index 7d8c440012..7c8a0943b8 100644
--- a/contrib/tools/python3/src/Lib/warnings.py
+++ b/contrib/tools/python3/src/Lib/warnings.py
@@ -58,15 +58,16 @@ def _formatwarnmsg_impl(msg):
# catch Exception, not only ImportError and RecursionError.
except Exception:
# don't suggest to enable tracemalloc if it's not available
- tracing = True
+ suggest_tracemalloc = False
tb = None
else:
- tracing = tracemalloc.is_tracing()
try:
+ suggest_tracemalloc = not tracemalloc.is_tracing()
tb = tracemalloc.get_object_traceback(msg.source)
except Exception:
# When a warning is logged during Python shutdown, tracemalloc
# and the import machinery don't work anymore
+ suggest_tracemalloc = False
tb = None
if tb is not None:
@@ -85,7 +86,7 @@ def _formatwarnmsg_impl(msg):
if line:
line = line.strip()
s += ' %s\n' % line
- elif not tracing:
+ elif suggest_tracemalloc:
s += (f'{category}: Enable tracemalloc to get the object '
f'allocation traceback\n')
return s
diff --git a/contrib/tools/python3/src/Lib/webbrowser.py b/contrib/tools/python3/src/Lib/webbrowser.py
index 44974d433b..5d72524c08 100755
--- a/contrib/tools/python3/src/Lib/webbrowser.py
+++ b/contrib/tools/python3/src/Lib/webbrowser.py
@@ -688,6 +688,7 @@ if sys.platform == 'darwin':
self.name = val
def open(self, url, new=0, autoraise=True):
+ sys.audit("webbrowser.open", url)
if self.name == 'default':
script = 'open location "%s"' % url.replace('"', '%22') # opens in default browser
else:
diff --git a/contrib/tools/python3/src/Lib/xml/etree/ElementTree.py b/contrib/tools/python3/src/Lib/xml/etree/ElementTree.py
index 1dc80351bf..fce0c2963a 100644
--- a/contrib/tools/python3/src/Lib/xml/etree/ElementTree.py
+++ b/contrib/tools/python3/src/Lib/xml/etree/ElementTree.py
@@ -99,6 +99,7 @@ import io
import collections
import collections.abc
import contextlib
+import weakref
from . import ElementPath
@@ -1238,13 +1239,14 @@ def iterparse(source, events=None, parser=None):
# parser argument of iterparse is removed, this can be killed.
pullparser = XMLPullParser(events=events, _parser=parser)
- def iterator(source):
+ if not hasattr(source, "read"):
+ source = open(source, "rb")
+ close_source = True
+ else:
close_source = False
+
+ def iterator(source):
try:
- if not hasattr(source, "read"):
- source = open(source, "rb")
- close_source = True
- yield None
while True:
yield from pullparser.read_events()
# load event buffer
@@ -1254,18 +1256,23 @@ def iterparse(source, events=None, parser=None):
pullparser.feed(data)
root = pullparser._close_and_return_root()
yield from pullparser.read_events()
- it.root = root
+ it = wr()
+ if it is not None:
+ it.root = root
finally:
if close_source:
source.close()
class IterParseIterator(collections.abc.Iterator):
__next__ = iterator(source).__next__
+
+ def __del__(self):
+ if close_source:
+ source.close()
+
it = IterParseIterator()
it.root = None
- del iterator, IterParseIterator
-
- next(it)
+ wr = weakref.ref(it)
return it
diff --git a/contrib/tools/python3/src/Lib/ya.make b/contrib/tools/python3/src/Lib/ya.make
index bf379aabbf..f69f57310e 100644
--- a/contrib/tools/python3/src/Lib/ya.make
+++ b/contrib/tools/python3/src/Lib/ya.make
@@ -4,9 +4,9 @@ ENABLE(PYBUILD_NO_PY)
PY3_LIBRARY()
-VERSION(3.11.7)
+VERSION(3.11.8)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.7.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.8.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/src/Lib/zipfile.py b/contrib/tools/python3/src/Lib/zipfile.py
index 6189db5e3e..058d7163ea 100644
--- a/contrib/tools/python3/src/Lib/zipfile.py
+++ b/contrib/tools/python3/src/Lib/zipfile.py
@@ -367,6 +367,7 @@ class ZipInfo (object):
'compress_size',
'file_size',
'_raw_time',
+ '_end_offset',
)
def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
@@ -408,6 +409,7 @@ class ZipInfo (object):
self.external_attr = 0 # External file attributes
self.compress_size = 0 # Size of the compressed file
self.file_size = 0 # Size of the uncompressed file
+ self._end_offset = None # Start of the next local header or central directory
# Other attributes are set by class ZipFile:
# header_offset Byte offset to the file header
# CRC CRC-32 of the uncompressed file
@@ -1437,6 +1439,12 @@ class ZipFile:
if self.debug > 2:
print("total", total)
+ end_offset = self.start_dir
+ for zinfo in sorted(self.filelist,
+ key=lambda zinfo: zinfo.header_offset,
+ reverse=True):
+ zinfo._end_offset = end_offset
+ end_offset = zinfo.header_offset
def namelist(self):
"""Return a list of file names in the archive."""
@@ -1590,6 +1598,10 @@ class ZipFile:
'File name in directory %r and header %r differ.'
% (zinfo.orig_filename, fname))
+ if (zinfo._end_offset is not None and
+ zef_file.tell() + zinfo.compress_size > zinfo._end_offset):
+ raise BadZipFile(f"Overlapped entries: {zinfo.orig_filename!r} (possible zip bomb)")
+
# check for encrypted flag & handle password
is_encrypted = zinfo.flag_bits & _MASK_ENCRYPTED
if is_encrypted:
diff --git a/contrib/tools/python3/src/Modules/_asynciomodule.c b/contrib/tools/python3/src/Modules/_asynciomodule.c
index b2fef01705..a92feebcdb 100644
--- a/contrib/tools/python3/src/Modules/_asynciomodule.c
+++ b/contrib/tools/python3/src/Modules/_asynciomodule.c
@@ -1377,6 +1377,9 @@ static PyObject *
FutureObj_repr(FutureObj *fut)
{
ENSURE_FUTURE_ALIVE(fut)
+ if (asyncio_future_repr_func == NULL) {
+ return PyUnicode_FromFormat("<Future at %p>", fut);
+ }
return PyObject_CallOneArg(asyncio_future_repr_func, (PyObject *)fut);
}
diff --git a/contrib/tools/python3/src/Modules/_csv.c b/contrib/tools/python3/src/Modules/_csv.c
index 7314d9c705..407d6f0354 100644
--- a/contrib/tools/python3/src/Modules/_csv.c
+++ b/contrib/tools/python3/src/Modules/_csv.c
@@ -841,7 +841,8 @@ parse_process_char(ReaderObj *self, _csvstate *module_state, Py_UCS4 c)
self->state = START_RECORD;
else {
PyErr_Format(module_state->error_obj,
- "new-line character seen in unquoted field - do you need to open the file in universal-newline mode?");
+ "new-line character seen in unquoted field - "
+ "do you need to open the file with newline=''?");
return -1;
}
break;
diff --git a/contrib/tools/python3/src/Modules/_ctypes/_ctypes.c b/contrib/tools/python3/src/Modules/_ctypes/_ctypes.c
index 573132021d..e3fbe26425 100644
--- a/contrib/tools/python3/src/Modules/_ctypes/_ctypes.c
+++ b/contrib/tools/python3/src/Modules/_ctypes/_ctypes.c
@@ -4388,10 +4388,10 @@ _init_pos_args(PyObject *self, PyTypeObject *type,
return index;
}
- for (i = 0;
- i < dict->length && (i+index) < PyTuple_GET_SIZE(args);
+ for (i = index;
+ i < dict->length && i < PyTuple_GET_SIZE(args);
++i) {
- PyObject *pair = PySequence_GetItem(fields, i);
+ PyObject *pair = PySequence_GetItem(fields, i - index);
PyObject *name, *val;
int res;
if (!pair)
@@ -4401,7 +4401,7 @@ _init_pos_args(PyObject *self, PyTypeObject *type,
Py_DECREF(pair);
return -1;
}
- val = PyTuple_GET_ITEM(args, i + index);
+ val = PyTuple_GET_ITEM(args, i);
if (kwds) {
res = PyDict_Contains(kwds, name);
if (res != 0) {
@@ -4422,7 +4422,7 @@ _init_pos_args(PyObject *self, PyTypeObject *type,
if (res == -1)
return -1;
}
- return index + dict->length;
+ return dict->length;
}
static int
diff --git a/contrib/tools/python3/src/Modules/_ctypes/stgdict.c b/contrib/tools/python3/src/Modules/_ctypes/stgdict.c
index 2eb02a4db4..06bc97af2a 100644
--- a/contrib/tools/python3/src/Modules/_ctypes/stgdict.c
+++ b/contrib/tools/python3/src/Modules/_ctypes/stgdict.c
@@ -661,31 +661,49 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
stgdict->size = size;
stgdict->align = total_align;
- stgdict->length = len; /* ADD ffi_ofs? */
+ stgdict->length = ffi_ofs + len;
-#define MAX_STRUCT_SIZE 16
+/*
+ * The value of MAX_STRUCT_SIZE depends on the platform Python is running on.
+ */
+#if defined(__aarch64__) || defined(__arm__) || defined(_M_ARM64)
+# define MAX_STRUCT_SIZE 32
+#elif defined(__powerpc64__)
+# define MAX_STRUCT_SIZE 64
+#else
+# define MAX_STRUCT_SIZE 16
+#endif
if (arrays_seen && (size <= MAX_STRUCT_SIZE)) {
/*
- * See bpo-22273. Arrays are normally treated as pointers, which is
- * fine when an array name is being passed as parameter, but not when
- * passing structures by value that contain arrays. On 64-bit Linux,
- * small structures passed by value are passed in registers, and in
+ * See bpo-22273 and gh-110190. Arrays are normally treated as
+ * pointers, which is fine when an array name is being passed as
+ * parameter, but not when passing structures by value that contain
+ * arrays.
+ * Small structures passed by value are passed in registers, and in
* order to do this, libffi needs to know the true type of the array
* members of structs. Treating them as pointers breaks things.
*
- * By small structures, we mean ones that are 16 bytes or less. In that
- * case, there can't be more than 16 elements after unrolling arrays,
- * as we (will) disallow bitfields. So we can collect the true ffi_type
- * values in a fixed-size local array on the stack and, if any arrays
- * were seen, replace the ffi_type_pointer.elements with a more
- * accurate set, to allow libffi to marshal them into registers
- * correctly. It means one more loop over the fields, but if we got
- * here, the structure is small, so there aren't too many of those.
+ * Small structures have different sizes depending on the platform
+ * where Python is running on:
*
- * Although the passing in registers is specific to 64-bit Linux, the
- * array-in-struct vs. pointer problem is general. But we restrict the
- * type transformation to small structs nonetheless.
+ * * x86-64: 16 bytes or less
+ * * Arm platforms (both 32 and 64 bit): 32 bytes or less
+ * * PowerPC 64 Little Endian: 64 bytes or less
+ *
+ * In that case, there can't be more than 16, 32 or 64 elements after
+ * unrolling arrays, as we (will) disallow bitfields.
+ * So we can collect the true ffi_type values in a fixed-size local
+ * array on the stack and, if any arrays were seen, replace the
+ * ffi_type_pointer.elements with a more accurate set, to allow
+ * libffi to marshal them into registers correctly.
+ * It means one more loop over the fields, but if we got here,
+ * the structure is small, so there aren't too many of those.
+ *
+ * Although the passing in registers is specific to the above
+ * platforms, the array-in-struct vs. pointer problem is general.
+ * But we restrict the type transformation to small structs
+ * nonetheless.
*
* Note that although a union may be small in terms of memory usage, it
* could contain many overlapping declarations of arrays, e.g.
@@ -711,6 +729,8 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
* struct { uint_32 e1; uint_32 e2; ... uint_32 e_4; } f6;
* }
*
+ * The same principle applies for a struct 32 or 64 bytes in size.
+ *
* So the struct/union needs setting up as follows: all non-array
* elements copied across as is, and all array elements replaced with
* an equivalent struct which has as many fields as the array has
diff --git a/contrib/tools/python3/src/Modules/_io/textio.c b/contrib/tools/python3/src/Modules/_io/textio.c
index b994dc3d7c..3de4c06704 100644
--- a/contrib/tools/python3/src/Modules/_io/textio.c
+++ b/contrib/tools/python3/src/Modules/_io/textio.c
@@ -1745,8 +1745,10 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
Py_DECREF(ret);
}
- textiowrapper_set_decoded_chars(self, NULL);
- Py_CLEAR(self->snapshot);
+ if (self->snapshot != NULL) {
+ textiowrapper_set_decoded_chars(self, NULL);
+ Py_CLEAR(self->snapshot);
+ }
if (self->decoder) {
ret = PyObject_CallMethodNoArgs(self->decoder, &_Py_ID(reset));
@@ -1979,8 +1981,10 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
if (result == NULL)
goto fail;
- textiowrapper_set_decoded_chars(self, NULL);
- Py_CLEAR(self->snapshot);
+ if (self->snapshot != NULL) {
+ textiowrapper_set_decoded_chars(self, NULL);
+ Py_CLEAR(self->snapshot);
+ }
return result;
}
else {
diff --git a/contrib/tools/python3/src/Modules/_lzmamodule.c b/contrib/tools/python3/src/Modules/_lzmamodule.c
index b572d8cd90..97453a2808 100644
--- a/contrib/tools/python3/src/Modules/_lzmamodule.c
+++ b/contrib/tools/python3/src/Modules/_lzmamodule.c
@@ -494,7 +494,9 @@ build_filter_spec(const lzma_filter *f)
case LZMA_FILTER_ARMTHUMB:
case LZMA_FILTER_SPARC: {
lzma_options_bcj *options = f->options;
- ADD_FIELD(options, start_offset);
+ if (options) {
+ ADD_FIELD(options, start_offset);
+ }
break;
}
default:
diff --git a/contrib/tools/python3/src/Modules/_posixsubprocess.c b/contrib/tools/python3/src/Modules/_posixsubprocess.c
index 072519c91a..d91bf214b4 100644
--- a/contrib/tools/python3/src/Modules/_posixsubprocess.c
+++ b/contrib/tools/python3/src/Modules/_posixsubprocess.c
@@ -566,9 +566,10 @@ child_exec(char *const exec_array[],
PyObject *preexec_fn,
PyObject *preexec_fn_args_tuple)
{
- int i, saved_errno, reached_preexec = 0;
+ int i, saved_errno;
PyObject *result;
- const char* err_msg = "";
+ /* Indicate to the parent that the error happened before exec(). */
+ const char *err_msg = "noexec";
/* Buffer large enough to hold a hex integer. We can't malloc. */
char hex_errno[sizeof(saved_errno)*2+1];
@@ -628,8 +629,12 @@ child_exec(char *const exec_array[],
/* We no longer manually close p2cread, c2pwrite, and errwrite here as
* _close_open_fds takes care when it is not already non-inheritable. */
- if (cwd)
- POSIX_CALL(chdir(cwd));
+ if (cwd) {
+ if (chdir(cwd) == -1) {
+ err_msg = "noexec:chdir";
+ goto error;
+ }
+ }
if (child_umask >= 0)
umask(child_umask); /* umask() always succeeds. */
@@ -672,7 +677,7 @@ child_exec(char *const exec_array[],
#endif /* HAVE_SETREUID */
- reached_preexec = 1;
+ err_msg = "";
if (preexec_fn != Py_None && preexec_fn_args_tuple) {
/* This is where the user has asked us to deadlock their program. */
result = PyObject_Call(preexec_fn, preexec_fn_args_tuple, NULL);
@@ -730,16 +735,12 @@ error:
}
_Py_write_noraise(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur);
_Py_write_noraise(errpipe_write, ":", 1);
- if (!reached_preexec) {
- /* Indicate to the parent that the error happened before exec(). */
- _Py_write_noraise(errpipe_write, "noexec", 6);
- }
/* We can't call strerror(saved_errno). It is not async signal safe.
* The parent process will look the error message up. */
} else {
_Py_write_noraise(errpipe_write, "SubprocessError:0:", 18);
- _Py_write_noraise(errpipe_write, err_msg, strlen(err_msg));
}
+ _Py_write_noraise(errpipe_write, err_msg, strlen(err_msg));
}
diff --git a/contrib/tools/python3/src/Modules/_sqlite/ya.make b/contrib/tools/python3/src/Modules/_sqlite/ya.make
index 4f539fcbb8..f9aac2dab3 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/ya.make
+++ b/contrib/tools/python3/src/Modules/_sqlite/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(3.11.7)
+VERSION(3.11.8)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.7.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.8.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/src/Modules/_sre/clinic/sre.c.h b/contrib/tools/python3/src/Modules/_sre/clinic/sre.c.h
index 048a494f1b..c63cdad9e3 100644
--- a/contrib/tools/python3/src/Modules/_sre/clinic/sre.c.h
+++ b/contrib/tools/python3/src/Modules/_sre/clinic/sre.c.h
@@ -1089,7 +1089,7 @@ _sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls);
static PyObject *
_sre_SRE_Scanner_match(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "match() takes no arguments");
return NULL;
}
@@ -1110,10 +1110,10 @@ _sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls);
static PyObject *
_sre_SRE_Scanner_search(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "search() takes no arguments");
return NULL;
}
return _sre_SRE_Scanner_search_impl(self, cls);
}
-/*[clinic end generated code: output=fd2f45c941620e6e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d4ed753aa4c9dc0a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_winapi.c b/contrib/tools/python3/src/Modules/_winapi.c
index dcfe3e1873..19cfa75bbe 100644
--- a/contrib/tools/python3/src/Modules/_winapi.c
+++ b/contrib/tools/python3/src/Modules/_winapi.c
@@ -39,12 +39,13 @@
#include "structmember.h" // PyMemberDef
-#define WINDOWS_LEAN_AND_MEAN
#include "windows.h"
#include <winioctl.h>
#include <crtdbg.h>
#include "winreparse.h"
+#include "pycore_runtime.h" // _Py_ID
+
#if defined(MS_WIN32) && !defined(MS_WIN64)
#define HANDLE_TO_PYNUM(handle) \
PyLong_FromUnsignedLong((unsigned long) handle)
@@ -451,7 +452,7 @@ _winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle,
/*[clinic input]
_winapi.CreateFile -> HANDLE
- file_name: LPCTSTR
+ file_name: LPCWSTR
desired_access: DWORD
share_mode: DWORD
security_attributes: LPSECURITY_ATTRIBUTES
@@ -462,12 +463,12 @@ _winapi.CreateFile -> HANDLE
[clinic start generated code]*/
static HANDLE
-_winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name,
+_winapi_CreateFile_impl(PyObject *module, LPCWSTR file_name,
DWORD desired_access, DWORD share_mode,
LPSECURITY_ATTRIBUTES security_attributes,
DWORD creation_disposition,
DWORD flags_and_attributes, HANDLE template_file)
-/*[clinic end generated code: output=417ddcebfc5a3d53 input=6423c3e40372dbd5]*/
+/*[clinic end generated code: output=818c811e5e04d550 input=1fa870ed1c2e3d69]*/
{
HANDLE handle;
@@ -478,14 +479,15 @@ _winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name,
}
Py_BEGIN_ALLOW_THREADS
- handle = CreateFile(file_name, desired_access,
- share_mode, security_attributes,
- creation_disposition,
- flags_and_attributes, template_file);
+ handle = CreateFileW(file_name, desired_access,
+ share_mode, security_attributes,
+ creation_disposition,
+ flags_and_attributes, template_file);
Py_END_ALLOW_THREADS
- if (handle == INVALID_HANDLE_VALUE)
+ if (handle == INVALID_HANDLE_VALUE) {
PyErr_SetFromWindowsErr(0);
+ }
return handle;
}
@@ -542,7 +544,12 @@ _winapi_CreateJunction_impl(PyObject *module, LPCWSTR src_path,
{
/* Privilege adjustment */
HANDLE token = NULL;
- TOKEN_PRIVILEGES tp;
+ struct {
+ TOKEN_PRIVILEGES base;
+ /* overallocate by a few array elements */
+ LUID_AND_ATTRIBUTES privs[4];
+ } tp, previousTp;
+ int previousTpSize = 0;
/* Reparse data buffer */
const USHORT prefix_len = 4;
@@ -566,17 +573,21 @@ _winapi_CreateJunction_impl(PyObject *module, LPCWSTR src_path,
/* Adjust privileges to allow rewriting directory entry as a
junction point. */
- if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token))
+ if (!OpenProcessToken(GetCurrentProcess(),
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) {
goto cleanup;
+ }
- if (!LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &tp.Privileges[0].Luid))
+ if (!LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &tp.base.Privileges[0].Luid)) {
goto cleanup;
+ }
- tp.PrivilegeCount = 1;
- tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- if (!AdjustTokenPrivileges(token, FALSE, &tp, sizeof(TOKEN_PRIVILEGES),
- NULL, NULL))
+ tp.base.PrivilegeCount = 1;
+ tp.base.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ if (!AdjustTokenPrivileges(token, FALSE, &tp.base, sizeof(previousTp),
+ &previousTp.base, &previousTpSize)) {
goto cleanup;
+ }
if (GetFileAttributesW(src_path) == INVALID_FILE_ATTRIBUTES)
goto cleanup;
@@ -657,8 +668,15 @@ _winapi_CreateJunction_impl(PyObject *module, LPCWSTR src_path,
cleanup:
ret = GetLastError();
- CloseHandle(token);
- CloseHandle(junction);
+ if (previousTpSize) {
+ AdjustTokenPrivileges(token, FALSE, &previousTp.base, previousTpSize,
+ NULL, NULL);
+ }
+
+ if (token != NULL)
+ CloseHandle(token);
+ if (junction != NULL)
+ CloseHandle(junction);
PyMem_RawFree(rdb);
if (ret != 0)
@@ -782,12 +800,162 @@ gethandle(PyObject* obj, const char* name)
return ret;
}
+static PyObject *
+sortenvironmentkey(PyObject *module, PyObject *item)
+{
+ PyObject *result = NULL;
+ PyObject *locale = PyUnicode_FromWideChar(LOCALE_NAME_INVARIANT, -1);
+ if (locale) {
+ result = _winapi_LCMapStringEx_impl(NULL, locale, LCMAP_UPPERCASE, item);
+ Py_DECREF(locale);
+ }
+ return result;
+}
+
+static PyMethodDef sortenvironmentkey_def = {
+ "sortenvironmentkey", _PyCFunction_CAST(sortenvironmentkey), METH_O, "",
+};
+
+static int
+sort_environment_keys(PyObject *keys)
+{
+ PyObject *keyfunc = PyCFunction_New(&sortenvironmentkey_def, NULL);
+ if (keyfunc == NULL) {
+ return -1;
+ }
+ PyObject *kwnames = Py_BuildValue("(s)", "key");
+ if (kwnames == NULL) {
+ Py_DECREF(keyfunc);
+ return -1;
+ }
+ PyObject *args[] = { keys, keyfunc };
+ PyObject *ret = PyObject_VectorcallMethod(&_Py_ID(sort), args, 1, kwnames);
+ Py_DECREF(keyfunc);
+ Py_DECREF(kwnames);
+ if (ret == NULL) {
+ return -1;
+ }
+ Py_DECREF(ret);
+
+ return 0;
+}
+
+static int
+compare_string_ordinal(PyObject *str1, PyObject *str2, int *result)
+{
+ wchar_t *s1 = PyUnicode_AsWideCharString(str1, NULL);
+ if (s1 == NULL) {
+ return -1;
+ }
+ wchar_t *s2 = PyUnicode_AsWideCharString(str2, NULL);
+ if (s2 == NULL) {
+ PyMem_Free(s1);
+ return -1;
+ }
+ *result = CompareStringOrdinal(s1, -1, s2, -1, TRUE);
+ PyMem_Free(s1);
+ PyMem_Free(s2);
+ return 0;
+}
+
+static PyObject *
+dedup_environment_keys(PyObject *keys)
+{
+ PyObject *result = PyList_New(0);
+ if (result == NULL) {
+ return NULL;
+ }
+
+ // Iterate over the pre-ordered keys, check whether the current key is equal
+ // to the next key (ignoring case), if different, insert the current value
+ // into the result list. If they are equal, do nothing because we always
+ // want to keep the last inserted one.
+ for (Py_ssize_t i = 0; i < PyList_GET_SIZE(keys); i++) {
+ PyObject *key = PyList_GET_ITEM(keys, i);
+
+ // The last key will always be kept.
+ if (i + 1 == PyList_GET_SIZE(keys)) {
+ if (PyList_Append(result, key) < 0) {
+ Py_DECREF(result);
+ return NULL;
+ }
+ continue;
+ }
+
+ PyObject *next_key = PyList_GET_ITEM(keys, i + 1);
+ int compare_result;
+ if (compare_string_ordinal(key, next_key, &compare_result) < 0) {
+ Py_DECREF(result);
+ return NULL;
+ }
+ if (compare_result == CSTR_EQUAL) {
+ continue;
+ }
+ if (PyList_Append(result, key) < 0) {
+ Py_DECREF(result);
+ return NULL;
+ }
+ }
+
+ return result;
+}
+
+static PyObject *
+normalize_environment(PyObject *environment)
+{
+ PyObject *keys = PyMapping_Keys(environment);
+ if (keys == NULL) {
+ return NULL;
+ }
+
+ if (sort_environment_keys(keys) < 0) {
+ Py_DECREF(keys);
+ return NULL;
+ }
+
+ PyObject *normalized_keys = dedup_environment_keys(keys);
+ Py_DECREF(keys);
+ if (normalized_keys == NULL) {
+ return NULL;
+ }
+
+ PyObject *result = PyDict_New();
+ if (result == NULL) {
+ Py_DECREF(normalized_keys);
+ return NULL;
+ }
+
+ for (int i = 0; i < PyList_GET_SIZE(normalized_keys); i++) {
+ PyObject *key = PyList_GET_ITEM(normalized_keys, i);
+ PyObject *value = PyObject_GetItem(environment, key);
+ if (value == NULL) {
+ Py_DECREF(normalized_keys);
+ Py_DECREF(result);
+ return NULL;
+ }
+
+ int ret = PyObject_SetItem(result, key, value);
+ Py_DECREF(value);
+ if (ret < 0) {
+ Py_DECREF(normalized_keys);
+ Py_DECREF(result);
+ return NULL;
+ }
+ }
+
+ Py_DECREF(normalized_keys);
+
+ return result;
+}
+
static wchar_t *
getenvironment(PyObject* environment)
{
Py_ssize_t i, envsize, totalsize;
wchar_t *buffer = NULL, *p, *end;
- PyObject *keys, *values;
+ PyObject *normalized_environment = NULL;
+ PyObject *keys = NULL;
+ PyObject *values = NULL;
/* convert environment dictionary to windows environment string */
if (! PyMapping_Check(environment)) {
@@ -796,11 +964,16 @@ getenvironment(PyObject* environment)
return NULL;
}
- keys = PyMapping_Keys(environment);
- if (!keys) {
+ normalized_environment = normalize_environment(environment);
+ if (normalize_environment == NULL) {
return NULL;
}
- values = PyMapping_Values(environment);
+
+ keys = PyMapping_Keys(normalized_environment);
+ if (!keys) {
+ goto error;
+ }
+ values = PyMapping_Values(normalized_environment);
if (!values) {
goto error;
}
@@ -892,6 +1065,7 @@ getenvironment(PyObject* environment)
cleanup:
error:
+ Py_XDECREF(normalized_environment);
Py_XDECREF(keys);
Py_XDECREF(values);
return buffer;
diff --git a/contrib/tools/python3/src/Modules/audioop.c b/contrib/tools/python3/src/Modules/audioop.c
index b764dd97d5..88bb4c17eb 100644
--- a/contrib/tools/python3/src/Modules/audioop.c
+++ b/contrib/tools/python3/src/Modules/audioop.c
@@ -1,33 +1,31 @@
/* The audioop module uses the code base in g777.c file of the Sox project.
- * Source: https://web.archive.org/web/19970716121258/http://www.spies.com/Sox/Archive/soxgamma.tar.gz
- * Programming the AdLib/Sound Blaster
- * FM Music Chips
- * Version 2.0 (24 Feb 1992)
- *
- * Copyright (c) 1991, 1992 by Jeffrey S. Lee
- *
- * jlee@smylex.uucp
+ Source: https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz
+
+ Copyright of g771.c:
+
+ * This source code is a product of Sun Microsystems, Inc. and is provided
+ * for unrestricted use. Users may copy or modify this source code without
+ * charge.
*
+ * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
+ * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
+ * Sun source code is provided with no support and without any obligation on
+ * the part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
*
- * Warranty and Copyright Policy
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
+ * OR ANY PART THEREOF.
*
- * This document is provided on an "as-is" basis, and its author makes
- * no warranty or representation, express or implied, with respect to
- * its quality performance or fitness for a particular purpose. In no
- * event will the author of this document be liable for direct, indirect,
- * special, incidental, or consequential damages arising out of the use
- * or inability to use the information contained within. Use of this
- * document is at your own risk.
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
*
- * This file may be used and copied freely so long as the applicable
- * copyright notices are retained, and no modifications are made to the
- * text of the document. No money shall be charged for its distribution
- * beyond reasonable shipping, handling and duplication costs, nor shall
- * proprietary changes be made to this document so that it cannot be
- * distributed freely. This document may not be included in published
- * material or commercial packages without the written consent of its
- * author. */
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043 */
/* audioopmodule - Module to detect peak values in arrays */
diff --git a/contrib/tools/python3/src/Modules/binascii.c b/contrib/tools/python3/src/Modules/binascii.c
index afe4988549..de3c2d8895 100644
--- a/contrib/tools/python3/src/Modules/binascii.c
+++ b/contrib/tools/python3/src/Modules/binascii.c
@@ -780,12 +780,20 @@ binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc)
Py_BEGIN_ALLOW_THREADS
/* Avoid truncation of length for very large buffers. crc32() takes
- length as an unsigned int, which may be narrower than Py_ssize_t. */
- while ((size_t)len > UINT_MAX) {
- crc = crc32(crc, buf, UINT_MAX);
- buf += (size_t) UINT_MAX;
- len -= (size_t) UINT_MAX;
+ length as an unsigned int, which may be narrower than Py_ssize_t.
+ We further limit size due to bugs in Apple's macOS zlib.
+ See https://github.com/python/cpython/issues/105967
+ */
+#define ZLIB_CRC_CHUNK_SIZE 0x40000000
+#if ZLIB_CRC_CHUNK_SIZE > INT_MAX
+# error "unsupported less than 32-bit platform?"
+#endif
+ while ((size_t)len > ZLIB_CRC_CHUNK_SIZE) {
+ crc = crc32(crc, buf, ZLIB_CRC_CHUNK_SIZE);
+ buf += (size_t) ZLIB_CRC_CHUNK_SIZE;
+ len -= (size_t) ZLIB_CRC_CHUNK_SIZE;
}
+#undef ZLIB_CRC_CHUNK_SIZE
crc = crc32(crc, buf, (unsigned int)len);
Py_END_ALLOW_THREADS
} else {
diff --git a/contrib/tools/python3/src/Modules/cjkcodecs/clinic/multibytecodec.c.h b/contrib/tools/python3/src/Modules/cjkcodecs/clinic/multibytecodec.c.h
index 8f850aa819..009284217f 100644
--- a/contrib/tools/python3/src/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/contrib/tools/python3/src/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -556,7 +556,7 @@ _multibytecodec_MultibyteStreamWriter_reset_impl(MultibyteStreamWriterObject *se
static PyObject *
_multibytecodec_MultibyteStreamWriter_reset(MultibyteStreamWriterObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "reset() takes no arguments");
return NULL;
}
@@ -570,4 +570,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
-/*[clinic end generated code: output=9e4e3da5ca3c8288 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3c007afbf48aa07a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/_lsprof.c.h b/contrib/tools/python3/src/Modules/clinic/_lsprof.c.h
index dfc003eb54..b3b7fda566 100644
--- a/contrib/tools/python3/src/Modules/clinic/_lsprof.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/_lsprof.c.h
@@ -39,10 +39,10 @@ _lsprof_Profiler_getstats_impl(ProfilerObject *self, PyTypeObject *cls);
static PyObject *
_lsprof_Profiler_getstats(ProfilerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "getstats() takes no arguments");
return NULL;
}
return _lsprof_Profiler_getstats_impl(self, cls);
}
-/*[clinic end generated code: output=0615a53cce828f06 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5c9d87d89863dc83 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/_queuemodule.c.h b/contrib/tools/python3/src/Modules/clinic/_queuemodule.c.h
index b0b00f8199..f5acf21a5d 100644
--- a/contrib/tools/python3/src/Modules/clinic/_queuemodule.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/_queuemodule.c.h
@@ -195,7 +195,7 @@ _queue_SimpleQueue_get_nowait_impl(simplequeueobject *self,
static PyObject *
_queue_SimpleQueue_get_nowait(simplequeueobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "get_nowait() takes no arguments");
return NULL;
}
@@ -257,4 +257,4 @@ _queue_SimpleQueue_qsize(simplequeueobject *self, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=88ec8033aeb7241c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=edb5653095ef0eb8 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/_winapi.c.h b/contrib/tools/python3/src/Modules/clinic/_winapi.c.h
index 5364d9a2d6..861b74f4b0 100644
--- a/contrib/tools/python3/src/Modules/clinic/_winapi.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/_winapi.c.h
@@ -132,7 +132,7 @@ PyDoc_STRVAR(_winapi_CreateFile__doc__,
{"CreateFile", _PyCFunction_CAST(_winapi_CreateFile), METH_FASTCALL, _winapi_CreateFile__doc__},
static HANDLE
-_winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name,
+_winapi_CreateFile_impl(PyObject *module, LPCWSTR file_name,
DWORD desired_access, DWORD share_mode,
LPSECURITY_ATTRIBUTES security_attributes,
DWORD creation_disposition,
@@ -142,7 +142,7 @@ static PyObject *
_winapi_CreateFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- LPCTSTR file_name;
+ LPCWSTR file_name = NULL;
DWORD desired_access;
DWORD share_mode;
LPSECURITY_ATTRIBUTES security_attributes;
@@ -151,8 +151,8 @@ _winapi_CreateFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
HANDLE template_file;
HANDLE _return_value;
- if (!_PyArg_ParseStack(args, nargs, "skk" F_POINTER "kk" F_HANDLE ":CreateFile",
- &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) {
+ if (!_PyArg_ParseStack(args, nargs, "O&kk" F_POINTER "kk" F_HANDLE ":CreateFile",
+ _PyUnicode_WideCharString_Converter, &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) {
goto exit;
}
_return_value = _winapi_CreateFile_impl(module, file_name, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file);
@@ -165,6 +165,11 @@ _winapi_CreateFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
return_value = HANDLE_TO_PYNUM(_return_value);
exit:
+ /* Cleanup for file_name */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)file_name);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -1242,4 +1247,4 @@ _winapi__mimetypes_read_windows_registry(PyObject *module, PyObject *const *args
exit:
return return_value;
}
-/*[clinic end generated code: output=9c08a7371fcf5dd4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6b1ee5351cdc5386 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/arraymodule.c.h b/contrib/tools/python3/src/Modules/clinic/arraymodule.c.h
index 6358ba2f81..f58bd06a0c 100644
--- a/contrib/tools/python3/src/Modules/clinic/arraymodule.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/arraymodule.c.h
@@ -615,7 +615,7 @@ array_arrayiterator___reduce___impl(arrayiterobject *self, PyTypeObject *cls);
static PyObject *
array_arrayiterator___reduce__(arrayiterobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "__reduce__() takes no arguments");
return NULL;
}
@@ -630,4 +630,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=85a5fec90d9615b9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=62cb180955450ca3 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/md5module.c.h b/contrib/tools/python3/src/Modules/clinic/md5module.c.h
index 999406ba13..eff2c70d6a 100644
--- a/contrib/tools/python3/src/Modules/clinic/md5module.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/md5module.c.h
@@ -17,7 +17,7 @@ MD5Type_copy_impl(MD5object *self, PyTypeObject *cls);
static PyObject *
MD5Type_copy(MD5object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
return NULL;
}
@@ -119,4 +119,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=e5dac1237beb2788 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=662764b684599176 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/posixmodule.c.h b/contrib/tools/python3/src/Modules/clinic/posixmodule.c.h
index 8d5a5fecbb..27f12c02a8 100644
--- a/contrib/tools/python3/src/Modules/clinic/posixmodule.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/posixmodule.c.h
@@ -8341,7 +8341,7 @@ os_DirEntry_is_symlink(DirEntry *self, PyTypeObject *defining_class, PyObject *c
PyObject *return_value = NULL;
int _return_value;
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "is_symlink() takes no arguments");
goto exit;
}
@@ -9388,4 +9388,4 @@ exit:
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
-/*[clinic end generated code: output=b649ad9a4e1f2427 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b5e292ce15f5e19e input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/sha1module.c.h b/contrib/tools/python3/src/Modules/clinic/sha1module.c.h
index e2338e4a12..03b61aa7a3 100644
--- a/contrib/tools/python3/src/Modules/clinic/sha1module.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/sha1module.c.h
@@ -17,7 +17,7 @@ SHA1Type_copy_impl(SHA1object *self, PyTypeObject *cls);
static PyObject *
SHA1Type_copy(SHA1object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
return NULL;
}
@@ -119,4 +119,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=322d77ba0a4282fc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2a6c1586342dd24c input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/sha256module.c.h b/contrib/tools/python3/src/Modules/clinic/sha256module.c.h
index b94c1c548a..5212378f85 100644
--- a/contrib/tools/python3/src/Modules/clinic/sha256module.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/sha256module.c.h
@@ -17,7 +17,7 @@ SHA256Type_copy_impl(SHAobject *self, PyTypeObject *cls);
static PyObject *
SHA256Type_copy(SHAobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
return NULL;
}
@@ -170,4 +170,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=58b48051890d3fde input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a4965a9b3f3b388d input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/sha512module.c.h b/contrib/tools/python3/src/Modules/clinic/sha512module.c.h
index b7227480c3..4bde6742a3 100644
--- a/contrib/tools/python3/src/Modules/clinic/sha512module.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/sha512module.c.h
@@ -17,7 +17,7 @@ SHA512Type_copy_impl(SHAobject *self, PyTypeObject *cls);
static PyObject *
SHA512Type_copy(SHAobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
return NULL;
}
@@ -170,4 +170,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=60a0a1a28c07f391 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b6148bd0dc27e33b input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/clinic/zlibmodule.c.h b/contrib/tools/python3/src/Modules/clinic/zlibmodule.c.h
index ad6a7d470c..d2c9b210a9 100644
--- a/contrib/tools/python3/src/Modules/clinic/zlibmodule.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/zlibmodule.c.h
@@ -513,7 +513,7 @@ zlib_Compress_copy_impl(compobject *self, PyTypeObject *cls);
static PyObject *
zlib_Compress_copy(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
return NULL;
}
@@ -538,7 +538,7 @@ zlib_Compress___copy___impl(compobject *self, PyTypeObject *cls);
static PyObject *
zlib_Compress___copy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "__copy__() takes no arguments");
return NULL;
}
@@ -600,7 +600,7 @@ zlib_Decompress_copy_impl(compobject *self, PyTypeObject *cls);
static PyObject *
zlib_Decompress_copy(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
return NULL;
}
@@ -625,7 +625,7 @@ zlib_Decompress___copy___impl(compobject *self, PyTypeObject *cls);
static PyObject *
zlib_Decompress___copy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "__copy__() takes no arguments");
return NULL;
}
@@ -855,4 +855,4 @@ exit:
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
-/*[clinic end generated code: output=757804b3ad33454f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=aa12a3c71b1bc156 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/gcmodule.c b/contrib/tools/python3/src/Modules/gcmodule.c
index 95f5085edb..ff0188da1d 100644
--- a/contrib/tools/python3/src/Modules/gcmodule.c
+++ b/contrib/tools/python3/src/Modules/gcmodule.c
@@ -2349,14 +2349,18 @@ PyObject_GC_Del(void *op)
size_t presize = _PyType_PreHeaderSize(((PyObject *)op)->ob_type);
PyGC_Head *g = AS_GC(op);
if (_PyObject_GC_IS_TRACKED(op)) {
+ gc_list_remove(g);
#ifdef Py_DEBUG
+ PyObject *exc, *exc_value, *exc_tb;
+ PyErr_Fetch(&exc, &exc_value, &exc_tb);
if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0,
"gc", NULL, "Object of type %s is not untracked before destruction",
((PyObject*)op)->ob_type->tp_name)) {
PyErr_WriteUnraisable(NULL);
}
+ if (exc != NULL)
+ PyErr_Restore(exc, exc_value, exc_tb);
#endif
- gc_list_remove(g);
}
GCState *gcstate = get_gc_state();
if (gcstate->generations[0].count > 0) {
diff --git a/contrib/tools/python3/src/Modules/mmapmodule.c b/contrib/tools/python3/src/Modules/mmapmodule.c
index a8d48ec6f3..b315becc48 100644
--- a/contrib/tools/python3/src/Modules/mmapmodule.c
+++ b/contrib/tools/python3/src/Modules/mmapmodule.c
@@ -109,7 +109,7 @@ typedef struct {
#ifdef MS_WINDOWS
HANDLE map_handle;
HANDLE file_handle;
- char * tagname;
+ wchar_t * tagname;
#endif
#ifdef UNIX
@@ -539,7 +539,7 @@ mmap_resize_method(mmap_object *self,
CloseHandle(self->map_handle);
/* if the file mapping still exists, it cannot be resized. */
if (self->tagname) {
- self->map_handle = OpenFileMapping(FILE_MAP_WRITE, FALSE,
+ self->map_handle = OpenFileMappingW(FILE_MAP_WRITE, FALSE,
self->tagname);
if (self->map_handle) {
PyErr_SetFromWindowsErr(ERROR_USER_MAPPED_FILE);
@@ -568,7 +568,7 @@ mmap_resize_method(mmap_object *self,
/* create a new file mapping and map a new view */
/* FIXME: call CreateFileMappingW with wchar_t tagname */
- self->map_handle = CreateFileMapping(
+ self->map_handle = CreateFileMappingW(
self->file_handle,
NULL,
PAGE_READWRITE,
@@ -843,12 +843,11 @@ mmap__repr__method(PyObject *self)
static PyObject *
mmap__sizeof__method(mmap_object *self, void *unused)
{
- Py_ssize_t res;
-
- res = _PyObject_SIZE(Py_TYPE(self));
- if (self->tagname)
- res += strlen(self->tagname) + 1;
- return PyLong_FromSsize_t(res);
+ size_t res = _PyObject_SIZE(Py_TYPE(self));
+ if (self->tagname) {
+ res += (wcslen(self->tagname) + 1) * sizeof(self->tagname[0]);
+ }
+ return PyLong_FromSize_t(res);
}
#endif
@@ -1400,7 +1399,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
DWORD off_lo; /* lower 32 bits of offset */
DWORD size_hi; /* upper 32 bits of size */
DWORD size_lo; /* lower 32 bits of size */
- const char *tagname = "";
+ PyObject *tagname = Py_None;
DWORD dwErr = 0;
int fileno;
HANDLE fh = 0;
@@ -1410,7 +1409,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
"tagname",
"access", "offset", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwdict, "in|ziL", keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwdict, "in|OiL", keywords,
&fileno, &map_size,
&tagname, &access, &offset)) {
return NULL;
@@ -1543,17 +1542,19 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
m_obj->weakreflist = NULL;
m_obj->exports = 0;
/* set the tag name */
- if (tagname != NULL && *tagname != '\0') {
- m_obj->tagname = PyMem_Malloc(strlen(tagname)+1);
+ if (!Py_IsNone(tagname)) {
+ if (!PyUnicode_Check(tagname)) {
+ Py_DECREF(m_obj);
+ return PyErr_Format(PyExc_TypeError, "expected str or None for "
+ "'tagname', not %.200s",
+ Py_TYPE(tagname)->tp_name);
+ }
+ m_obj->tagname = PyUnicode_AsWideCharString(tagname, NULL);
if (m_obj->tagname == NULL) {
- PyErr_NoMemory();
Py_DECREF(m_obj);
return NULL;
}
- strcpy(m_obj->tagname, tagname);
}
- else
- m_obj->tagname = NULL;
m_obj->access = (access_mode)access;
size_hi = (DWORD)(size >> 32);
@@ -1562,12 +1563,12 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
off_lo = (DWORD)(offset & 0xFFFFFFFF);
/* For files, it would be sufficient to pass 0 as size.
For anonymous maps, we have to pass the size explicitly. */
- m_obj->map_handle = CreateFileMapping(m_obj->file_handle,
- NULL,
- flProtect,
- size_hi,
- size_lo,
- m_obj->tagname);
+ m_obj->map_handle = CreateFileMappingW(m_obj->file_handle,
+ NULL,
+ flProtect,
+ size_hi,
+ size_lo,
+ m_obj->tagname);
if (m_obj->map_handle != NULL) {
m_obj->data = (char *) MapViewOfFile(m_obj->map_handle,
dwDesiredAccess,
diff --git a/contrib/tools/python3/src/Modules/posixmodule.c b/contrib/tools/python3/src/Modules/posixmodule.c
index b494cb56e6..49b6815111 100644
--- a/contrib/tools/python3/src/Modules/posixmodule.c
+++ b/contrib/tools/python3/src/Modules/posixmodule.c
@@ -221,15 +221,16 @@ corresponding Unix manual entries for more information on calls.");
# include <sys/uio.h>
#endif
+#ifdef HAVE_SYS_TYPES_H
+/* Should be included before <sys/sysmacros.h> on HP-UX v3 */
+# include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
#ifdef HAVE_SYS_SYSMACROS_H
/* GNU C Library: major(), minor(), makedev() */
# include <sys/sysmacros.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
-
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif /* HAVE_SYS_STAT_H */
diff --git a/contrib/tools/python3/src/Modules/socketmodule.c b/contrib/tools/python3/src/Modules/socketmodule.c
index 997df43f20..f0c9b4691c 100644
--- a/contrib/tools/python3/src/Modules/socketmodule.c
+++ b/contrib/tools/python3/src/Modules/socketmodule.c
@@ -6943,17 +6943,23 @@ Returns the interface index corresponding to the interface name if_name.");
static PyObject *
socket_if_indextoname(PyObject *self, PyObject *arg)
{
+ unsigned long index_long = PyLong_AsUnsignedLong(arg);
+ if (index_long == (unsigned long) -1 && PyErr_Occurred()) {
+ return NULL;
+ }
+
#ifdef MS_WINDOWS
- NET_IFINDEX index;
+ NET_IFINDEX index = (NET_IFINDEX)index_long;
#else
- unsigned long index;
+ unsigned int index = (unsigned int)index_long;
#endif
- char name[IF_NAMESIZE + 1];
- index = PyLong_AsUnsignedLong(arg);
- if (index == (unsigned long) -1)
+ if ((unsigned long)index != index_long) {
+ PyErr_SetString(PyExc_OverflowError, "index is too large");
return NULL;
+ }
+ char name[IF_NAMESIZE + 1];
if (if_indextoname(index, name) == NULL) {
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
diff --git a/contrib/tools/python3/src/Modules/termios.c b/contrib/tools/python3/src/Modules/termios.c
index be5d099072..23771b2ce9 100644
--- a/contrib/tools/python3/src/Modules/termios.c
+++ b/contrib/tools/python3/src/Modules/termios.c
@@ -84,6 +84,8 @@ termios_tcgetattr_impl(PyObject *module, int fd)
struct termios mode;
int r;
+ /* Alpine Linux can leave some fields uninitialized. */
+ memset(&mode, 0, sizeof(mode));
Py_BEGIN_ALLOW_THREADS
r = tcgetattr(fd, &mode);
Py_END_ALLOW_THREADS
diff --git a/contrib/tools/python3/src/Modules/ya.make b/contrib/tools/python3/src/Modules/ya.make
index e578584b6e..09cda2ea8f 100644
--- a/contrib/tools/python3/src/Modules/ya.make
+++ b/contrib/tools/python3/src/Modules/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(3.11.7)
+VERSION(3.11.8)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.7.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.8.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/src/Modules/zlibmodule.c b/contrib/tools/python3/src/Modules/zlibmodule.c
index 2fc39a3bd5..f11210d0e7 100644
--- a/contrib/tools/python3/src/Modules/zlibmodule.c
+++ b/contrib/tools/python3/src/Modules/zlibmodule.c
@@ -1444,12 +1444,20 @@ zlib_crc32_impl(PyObject *module, Py_buffer *data, unsigned int value)
Py_BEGIN_ALLOW_THREADS
/* Avoid truncation of length for very large buffers. crc32() takes
- length as an unsigned int, which may be narrower than Py_ssize_t. */
- while ((size_t)len > UINT_MAX) {
- value = crc32(value, buf, UINT_MAX);
- buf += (size_t) UINT_MAX;
- len -= (size_t) UINT_MAX;
+ length as an unsigned int, which may be narrower than Py_ssize_t.
+ We further limit size due to bugs in Apple's macOS zlib.
+ See https://github.com/python/cpython/issues/105967.
+ */
+#define ZLIB_CRC_CHUNK_SIZE 0x40000000
+#if ZLIB_CRC_CHUNK_SIZE > INT_MAX
+# error "unsupported less than 32-bit platform?"
+#endif
+ while ((size_t)len > ZLIB_CRC_CHUNK_SIZE) {
+ value = crc32(value, buf, ZLIB_CRC_CHUNK_SIZE);
+ buf += (size_t) ZLIB_CRC_CHUNK_SIZE;
+ len -= (size_t) ZLIB_CRC_CHUNK_SIZE;
}
+#undef ZLIB_CRC_CHUNK_SIZE
value = crc32(value, buf, (unsigned int)len);
Py_END_ALLOW_THREADS
} else {
diff --git a/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h b/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h
index 7a42cd8ffc..0f1dd7c2b9 100644
--- a/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h
+++ b/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h
@@ -885,9 +885,11 @@ PyDoc_STRVAR(unicode_split__doc__,
" character (including \\n \\r \\t \\f and spaces) and will discard\n"
" empty strings from the result.\n"
" maxsplit\n"
-" Maximum number of splits (starting from the left).\n"
+" Maximum number of splits.\n"
" -1 (the default value) means no limit.\n"
"\n"
+"Splitting starts at the front of the string and works to the end.\n"
+"\n"
"Note, str.split() is mainly useful for data that has been intentionally\n"
"delimited. With natural text that includes punctuation, consider using\n"
"the regular expression module.");
@@ -986,7 +988,7 @@ PyDoc_STRVAR(unicode_rsplit__doc__,
" character (including \\n \\r \\t \\f and spaces) and will discard\n"
" empty strings from the result.\n"
" maxsplit\n"
-" Maximum number of splits (starting from the left).\n"
+" Maximum number of splits.\n"
" -1 (the default value) means no limit.\n"
"\n"
"Splitting starts at the end of the string and works to the front.");
@@ -1353,4 +1355,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=11519887c1619a4e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c25ec2c388409c94 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Objects/setobject.c b/contrib/tools/python3/src/Objects/setobject.c
index 4b6a8b8dfb..5fcc957f49 100644
--- a/contrib/tools/python3/src/Objects/setobject.c
+++ b/contrib/tools/python3/src/Objects/setobject.c
@@ -1761,7 +1761,11 @@ set_issubset(PySetObject *so, PyObject *other)
Py_RETURN_TRUE;
}
-PyDoc_STRVAR(issubset_doc, "Report whether another set contains this set.");
+PyDoc_STRVAR(issubset_doc,
+"issubset($self, other, /)\n\
+--\n\
+\n\
+Test whether every element in the set is in other.");
static PyObject *
set_issuperset(PySetObject *so, PyObject *other)
@@ -1793,7 +1797,11 @@ set_issuperset(PySetObject *so, PyObject *other)
Py_RETURN_TRUE;
}
-PyDoc_STRVAR(issuperset_doc, "Report whether this set contains another set.");
+PyDoc_STRVAR(issuperset_doc,
+"issuperset($self, other, /)\n\
+--\n\
+\n\
+Test whether every element in other is in the set.");
static PyObject *
set_richcompare(PySetObject *v, PyObject *w, int op)
diff --git a/contrib/tools/python3/src/Objects/unicodeobject.c b/contrib/tools/python3/src/Objects/unicodeobject.c
index 0e3e6ccd1b..b5510fc1c8 100644
--- a/contrib/tools/python3/src/Objects/unicodeobject.c
+++ b/contrib/tools/python3/src/Objects/unicodeobject.c
@@ -13175,11 +13175,13 @@ str.split as unicode_split
character (including \n \r \t \f and spaces) and will discard
empty strings from the result.
maxsplit: Py_ssize_t = -1
- Maximum number of splits (starting from the left).
+ Maximum number of splits.
-1 (the default value) means no limit.
Return a list of the substrings in the string, using sep as the separator string.
+Splitting starts at the front of the string and works to the end.
+
Note, str.split() is mainly useful for data that has been intentionally
delimited. With natural text that includes punctuation, consider using
the regular expression module.
@@ -13188,7 +13190,7 @@ the regular expression module.
static PyObject *
unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
-/*[clinic end generated code: output=3a65b1db356948dc input=07b9040d98c5fe8d]*/
+/*[clinic end generated code: output=3a65b1db356948dc input=a29bcc0c7a5af0eb]*/
{
if (sep == Py_None)
return split(self, NULL, maxsplit);
diff --git a/contrib/tools/python3/src/Parser/pegen_errors.c b/contrib/tools/python3/src/Parser/pegen_errors.c
index fb9fa29097..ccb0d37406 100644
--- a/contrib/tools/python3/src/Parser/pegen_errors.c
+++ b/contrib/tools/python3/src/Parser/pegen_errors.c
@@ -299,6 +299,10 @@ _PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
Py_ssize_t end_lineno, Py_ssize_t end_col_offset,
const char *errmsg, va_list va)
{
+ // Bail out if we already have an error set.
+ if (p->error_indicator && PyErr_Occurred()) {
+ return NULL;
+ }
PyObject *value = NULL;
PyObject *errstr = NULL;
PyObject *error_line = NULL;
diff --git a/contrib/tools/python3/src/Python/Python-ast.c b/contrib/tools/python3/src/Python/Python-ast.c
index 9139f6e54f..d5a62b9a1e 100644
--- a/contrib/tools/python3/src/Python/Python-ast.c
+++ b/contrib/tools/python3/src/Python/Python-ast.c
@@ -9,6 +9,11 @@
#include "structmember.h"
#include <stddef.h>
+struct validator {
+ int recursion_depth; /* current recursion depth */
+ int recursion_limit; /* recursion limit */
+};
+
// Forward declaration
static int init_types(struct ast_state *state);
@@ -373,7 +378,8 @@ GENERATE_ASDL_SEQ_CONSTRUCTOR(match_case, match_case_ty)
GENERATE_ASDL_SEQ_CONSTRUCTOR(pattern, pattern_ty)
GENERATE_ASDL_SEQ_CONSTRUCTOR(type_ignore, type_ignore_ty)
-static PyObject* ast2obj_mod(struct ast_state *state, void*);
+static PyObject* ast2obj_mod(struct ast_state *state, struct validator *vstate,
+ void*);
static const char * const Module_fields[]={
"body",
"type_ignores",
@@ -394,7 +400,8 @@ static const char * const stmt_attributes[] = {
"end_lineno",
"end_col_offset",
};
-static PyObject* ast2obj_stmt(struct ast_state *state, void*);
+static PyObject* ast2obj_stmt(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const FunctionDef_fields[]={
"name",
"args",
@@ -521,7 +528,8 @@ static const char * const expr_attributes[] = {
"end_lineno",
"end_col_offset",
};
-static PyObject* ast2obj_expr(struct ast_state *state, void*);
+static PyObject* ast2obj_expr(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const BoolOp_fields[]={
"op",
"values",
@@ -634,12 +642,18 @@ static const char * const Slice_fields[]={
"upper",
"step",
};
-static PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty);
-static PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty);
-static PyObject* ast2obj_operator(struct ast_state *state, operator_ty);
-static PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty);
-static PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty);
-static PyObject* ast2obj_comprehension(struct ast_state *state, void*);
+static PyObject* ast2obj_expr_context(struct ast_state *state, struct validator
+ *vstate, expr_context_ty);
+static PyObject* ast2obj_boolop(struct ast_state *state, struct validator
+ *vstate, boolop_ty);
+static PyObject* ast2obj_operator(struct ast_state *state, struct validator
+ *vstate, operator_ty);
+static PyObject* ast2obj_unaryop(struct ast_state *state, struct validator
+ *vstate, unaryop_ty);
+static PyObject* ast2obj_cmpop(struct ast_state *state, struct validator
+ *vstate, cmpop_ty);
+static PyObject* ast2obj_comprehension(struct ast_state *state, struct
+ validator *vstate, void*);
static const char * const comprehension_fields[]={
"target",
"iter",
@@ -652,13 +666,15 @@ static const char * const excepthandler_attributes[] = {
"end_lineno",
"end_col_offset",
};
-static PyObject* ast2obj_excepthandler(struct ast_state *state, void*);
+static PyObject* ast2obj_excepthandler(struct ast_state *state, struct
+ validator *vstate, void*);
static const char * const ExceptHandler_fields[]={
"type",
"name",
"body",
};
-static PyObject* ast2obj_arguments(struct ast_state *state, void*);
+static PyObject* ast2obj_arguments(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const arguments_fields[]={
"posonlyargs",
"args",
@@ -668,7 +684,8 @@ static const char * const arguments_fields[]={
"kwarg",
"defaults",
};
-static PyObject* ast2obj_arg(struct ast_state *state, void*);
+static PyObject* ast2obj_arg(struct ast_state *state, struct validator *vstate,
+ void*);
static const char * const arg_attributes[] = {
"lineno",
"col_offset",
@@ -680,7 +697,8 @@ static const char * const arg_fields[]={
"annotation",
"type_comment",
};
-static PyObject* ast2obj_keyword(struct ast_state *state, void*);
+static PyObject* ast2obj_keyword(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const keyword_attributes[] = {
"lineno",
"col_offset",
@@ -691,7 +709,8 @@ static const char * const keyword_fields[]={
"arg",
"value",
};
-static PyObject* ast2obj_alias(struct ast_state *state, void*);
+static PyObject* ast2obj_alias(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const alias_attributes[] = {
"lineno",
"col_offset",
@@ -702,12 +721,14 @@ static const char * const alias_fields[]={
"name",
"asname",
};
-static PyObject* ast2obj_withitem(struct ast_state *state, void*);
+static PyObject* ast2obj_withitem(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const withitem_fields[]={
"context_expr",
"optional_vars",
};
-static PyObject* ast2obj_match_case(struct ast_state *state, void*);
+static PyObject* ast2obj_match_case(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const match_case_fields[]={
"pattern",
"guard",
@@ -719,7 +740,8 @@ static const char * const pattern_attributes[] = {
"end_lineno",
"end_col_offset",
};
-static PyObject* ast2obj_pattern(struct ast_state *state, void*);
+static PyObject* ast2obj_pattern(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const MatchValue_fields[]={
"value",
};
@@ -750,7 +772,8 @@ static const char * const MatchAs_fields[]={
static const char * const MatchOr_fields[]={
"patterns",
};
-static PyObject* ast2obj_type_ignore(struct ast_state *state, void*);
+static PyObject* ast2obj_type_ignore(struct ast_state *state, struct validator
+ *vstate, void*);
static const char * const TypeIgnore_fields[]={
"lineno",
"tag",
@@ -973,7 +996,8 @@ add_attributes(struct ast_state *state, PyObject *type, const char * const *attr
/* Conversion AST -> Python */
-static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq, PyObject* (*func)(struct ast_state *state, void*))
+static PyObject* ast2obj_list(struct ast_state *state, struct validator *vstate, asdl_seq *seq,
+ PyObject* (*func)(struct ast_state *state, struct validator *vstate, void*))
{
Py_ssize_t i, n = asdl_seq_LEN(seq);
PyObject *result = PyList_New(n);
@@ -981,7 +1005,7 @@ static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq, PyObject*
if (!result)
return NULL;
for (i = 0; i < n; i++) {
- value = func(state, asdl_seq_GET_UNTYPED(seq, i));
+ value = func(state, vstate, asdl_seq_GET_UNTYPED(seq, i));
if (!value) {
Py_DECREF(result);
return NULL;
@@ -991,7 +1015,7 @@ static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq, PyObject*
return result;
}
-static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
+static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), struct validator *Py_UNUSED(vstate), void *o)
{
if (!o)
o = Py_None;
@@ -1002,7 +1026,7 @@ static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
#define ast2obj_identifier ast2obj_object
#define ast2obj_string ast2obj_object
-static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b)
+static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), struct validator *Py_UNUSED(vstate), long b)
{
return PyLong_FromLong(b);
}
@@ -1851,8 +1875,6 @@ init_types(struct ast_state *state)
"TypeIgnore(int lineno, string tag)");
if (!state->TypeIgnore_type) return 0;
- state->recursion_depth = 0;
- state->recursion_limit = 0;
state->initialized = 1;
return 1;
}
@@ -3604,7 +3626,7 @@ _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena)
PyObject*
-ast2obj_mod(struct ast_state *state, void* _o)
+ast2obj_mod(struct ast_state *state, struct validator *vstate, void* _o)
{
mod_ty o = (mod_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -3612,7 +3634,7 @@ ast2obj_mod(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -3622,12 +3644,14 @@ ast2obj_mod(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Module_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Module.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.Module.type_ignores,
ast2obj_type_ignore);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
@@ -3638,7 +3662,7 @@ ast2obj_mod(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Interactive_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Interactive.body,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
@@ -3649,7 +3673,7 @@ ast2obj_mod(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Expression_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Expression.body);
+ value = ast2obj_expr(state, vstate, o->v.Expression.body);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
@@ -3659,29 +3683,31 @@ ast2obj_mod(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->FunctionType_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.FunctionType.argtypes,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.FunctionType.argtypes,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->argtypes, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.FunctionType.returns);
+ value = ast2obj_expr(state, vstate, o->v.FunctionType.returns);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->returns, value) == -1)
goto failed;
Py_DECREF(value);
break;
}
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_stmt(struct ast_state *state, void* _o)
+ast2obj_stmt(struct ast_state *state, struct validator *vstate, void* _o)
{
stmt_ty o = (stmt_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -3689,7 +3715,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -3699,34 +3725,35 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->FunctionDef_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(state, o->v.FunctionDef.name);
+ value = ast2obj_identifier(state, vstate, o->v.FunctionDef.name);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arguments(state, o->v.FunctionDef.args);
+ value = ast2obj_arguments(state, vstate, o->v.FunctionDef.args);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.FunctionDef.body,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.FunctionDef.decorator_list,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.FunctionDef.returns);
+ value = ast2obj_expr(state, vstate, o->v.FunctionDef.returns);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->returns, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.FunctionDef.type_comment);
+ value = ast2obj_string(state, vstate, o->v.FunctionDef.type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
@@ -3736,35 +3763,36 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->AsyncFunctionDef_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(state, o->v.AsyncFunctionDef.name);
+ value = ast2obj_identifier(state, vstate, o->v.AsyncFunctionDef.name);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arguments(state, o->v.AsyncFunctionDef.args);
+ value = ast2obj_arguments(state, vstate, o->v.AsyncFunctionDef.args);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.AsyncFunctionDef.body,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state,
+ value = ast2obj_list(state, vstate,
(asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.AsyncFunctionDef.returns);
+ value = ast2obj_expr(state, vstate, o->v.AsyncFunctionDef.returns);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->returns, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.AsyncFunctionDef.type_comment);
+ value = ast2obj_string(state, vstate, o->v.AsyncFunctionDef.type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
@@ -3774,30 +3802,31 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->ClassDef_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(state, o->v.ClassDef.name);
+ value = ast2obj_identifier(state, vstate, o->v.ClassDef.name);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.ClassDef.bases,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->bases, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.ClassDef.keywords,
ast2obj_keyword);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->keywords, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.ClassDef.body,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.ClassDef.decorator_list,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
@@ -3808,7 +3837,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Return_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Return.value);
+ value = ast2obj_expr(state, vstate, o->v.Return.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -3818,7 +3847,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Delete_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Delete.targets,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->targets, value) == -1)
@@ -3829,18 +3858,18 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Assign_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Assign.targets,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->targets, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.Assign.value);
+ value = ast2obj_expr(state, vstate, o->v.Assign.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.Assign.type_comment);
+ value = ast2obj_string(state, vstate, o->v.Assign.type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
@@ -3850,17 +3879,17 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->AugAssign_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.AugAssign.target);
+ value = ast2obj_expr(state, vstate, o->v.AugAssign.target);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_operator(state, o->v.AugAssign.op);
+ value = ast2obj_operator(state, vstate, o->v.AugAssign.op);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.AugAssign.value);
+ value = ast2obj_expr(state, vstate, o->v.AugAssign.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -3870,22 +3899,22 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->AnnAssign_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.AnnAssign.target);
+ value = ast2obj_expr(state, vstate, o->v.AnnAssign.target);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.AnnAssign.annotation);
+ value = ast2obj_expr(state, vstate, o->v.AnnAssign.annotation);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->annotation, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.AnnAssign.value);
+ value = ast2obj_expr(state, vstate, o->v.AnnAssign.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->v.AnnAssign.simple);
+ value = ast2obj_int(state, vstate, o->v.AnnAssign.simple);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->simple, value) == -1)
goto failed;
@@ -3895,27 +3924,29 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->For_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.For.target);
+ value = ast2obj_expr(state, vstate, o->v.For.target);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.For.iter);
+ value = ast2obj_expr(state, vstate, o->v.For.iter);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.For.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.For.orelse,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.For.type_comment);
+ value = ast2obj_string(state, vstate, o->v.For.type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
@@ -3925,29 +3956,29 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->AsyncFor_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.AsyncFor.target);
+ value = ast2obj_expr(state, vstate, o->v.AsyncFor.target);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.AsyncFor.iter);
+ value = ast2obj_expr(state, vstate, o->v.AsyncFor.iter);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.AsyncFor.body,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.AsyncFor.orelse,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.AsyncFor.type_comment);
+ value = ast2obj_string(state, vstate, o->v.AsyncFor.type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
@@ -3957,17 +3988,19 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->While_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.While.test);
+ value = ast2obj_expr(state, vstate, o->v.While.test);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.While.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.While.orelse,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
@@ -3977,17 +4010,19 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->If_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.If.test);
+ value = ast2obj_expr(state, vstate, o->v.If.test);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.If.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.If.orelse,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
@@ -3997,18 +4032,19 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->With_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.With.items,
ast2obj_withitem);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->items, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.With.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.With.type_comment);
+ value = ast2obj_string(state, vstate, o->v.With.type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
@@ -4018,19 +4054,19 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->AsyncWith_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.AsyncWith.items,
ast2obj_withitem);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->items, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.AsyncWith.body,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.AsyncWith.type_comment);
+ value = ast2obj_string(state, vstate, o->v.AsyncWith.type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
@@ -4040,12 +4076,12 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Match_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Match.subject);
+ value = ast2obj_expr(state, vstate, o->v.Match.subject);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->subject, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Match.cases,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Match.cases,
ast2obj_match_case);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->cases, value) == -1)
@@ -4056,12 +4092,12 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Raise_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Raise.exc);
+ value = ast2obj_expr(state, vstate, o->v.Raise.exc);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->exc, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.Raise.cause);
+ value = ast2obj_expr(state, vstate, o->v.Raise.cause);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->cause, value) == -1)
goto failed;
@@ -4071,23 +4107,25 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Try_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Try.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Try.handlers,
ast2obj_excepthandler);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->handlers, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Try.orelse,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Try.finalbody,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->finalbody, value) == -1)
@@ -4098,24 +4136,25 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->TryStar_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.TryStar.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.handlers,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.TryStar.handlers,
ast2obj_excepthandler);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->handlers, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.orelse,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.TryStar.orelse,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.finalbody,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.TryStar.finalbody,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->finalbody, value) == -1)
@@ -4126,12 +4165,12 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Assert_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Assert.test);
+ value = ast2obj_expr(state, vstate, o->v.Assert.test);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.Assert.msg);
+ value = ast2obj_expr(state, vstate, o->v.Assert.msg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->msg, value) == -1)
goto failed;
@@ -4141,7 +4180,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Import_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Import.names,
ast2obj_alias);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
@@ -4152,18 +4191,18 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->ImportFrom_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(state, o->v.ImportFrom.module);
+ value = ast2obj_identifier(state, vstate, o->v.ImportFrom.module);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->module, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.ImportFrom.names,
ast2obj_alias);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->v.ImportFrom.level);
+ value = ast2obj_int(state, vstate, o->v.ImportFrom.level);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->level, value) == -1)
goto failed;
@@ -4173,7 +4212,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Global_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Global.names,
ast2obj_identifier);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
@@ -4184,7 +4223,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Nonlocal_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Nonlocal.names,
ast2obj_identifier);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
@@ -4195,7 +4234,7 @@ ast2obj_stmt(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Expr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Expr.value);
+ value = ast2obj_expr(state, vstate, o->v.Expr.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -4217,36 +4256,37 @@ ast2obj_stmt(struct ast_state *state, void* _o)
if (!result) goto failed;
break;
}
- value = ast2obj_int(state, o->lineno);
+ value = ast2obj_int(state, vstate, o->lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->col_offset);
+ value = ast2obj_int(state, vstate, o->col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_lineno);
+ value = ast2obj_int(state, vstate, o->end_lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_col_offset);
+ value = ast2obj_int(state, vstate, o->end_col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_expr(struct ast_state *state, void* _o)
+ast2obj_expr(struct ast_state *state, struct validator *vstate, void* _o)
{
expr_ty o = (expr_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4254,7 +4294,7 @@ ast2obj_expr(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -4264,12 +4304,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->BoolOp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_boolop(state, o->v.BoolOp.op);
+ value = ast2obj_boolop(state, vstate, o->v.BoolOp.op);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.BoolOp.values,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->values, value) == -1)
@@ -4280,12 +4320,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->NamedExpr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.NamedExpr.target);
+ value = ast2obj_expr(state, vstate, o->v.NamedExpr.target);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.NamedExpr.value);
+ value = ast2obj_expr(state, vstate, o->v.NamedExpr.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -4295,17 +4335,17 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->BinOp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.BinOp.left);
+ value = ast2obj_expr(state, vstate, o->v.BinOp.left);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->left, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_operator(state, o->v.BinOp.op);
+ value = ast2obj_operator(state, vstate, o->v.BinOp.op);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.BinOp.right);
+ value = ast2obj_expr(state, vstate, o->v.BinOp.right);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->right, value) == -1)
goto failed;
@@ -4315,12 +4355,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->UnaryOp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_unaryop(state, o->v.UnaryOp.op);
+ value = ast2obj_unaryop(state, vstate, o->v.UnaryOp.op);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.UnaryOp.operand);
+ value = ast2obj_expr(state, vstate, o->v.UnaryOp.operand);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->operand, value) == -1)
goto failed;
@@ -4330,12 +4370,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Lambda_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_arguments(state, o->v.Lambda.args);
+ value = ast2obj_arguments(state, vstate, o->v.Lambda.args);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.Lambda.body);
+ value = ast2obj_expr(state, vstate, o->v.Lambda.body);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
@@ -4345,17 +4385,17 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->IfExp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.IfExp.test);
+ value = ast2obj_expr(state, vstate, o->v.IfExp.test);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.IfExp.body);
+ value = ast2obj_expr(state, vstate, o->v.IfExp.body);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.IfExp.orelse);
+ value = ast2obj_expr(state, vstate, o->v.IfExp.orelse);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
@@ -4365,12 +4405,14 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Dict_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Dict.keys,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->keys, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Dict.values,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->values, value) == -1)
goto failed;
@@ -4380,7 +4422,8 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Set_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Set.elts,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
@@ -4390,12 +4433,13 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->ListComp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.ListComp.elt);
+ value = ast2obj_expr(state, vstate, o->v.ListComp.elt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.ListComp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4406,12 +4450,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->SetComp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.SetComp.elt);
+ value = ast2obj_expr(state, vstate, o->v.SetComp.elt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.SetComp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4422,17 +4466,18 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->DictComp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.DictComp.key);
+ value = ast2obj_expr(state, vstate, o->v.DictComp.key);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->key, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.DictComp.value);
+ value = ast2obj_expr(state, vstate, o->v.DictComp.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.DictComp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4443,12 +4488,13 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->GeneratorExp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.GeneratorExp.elt);
+ value = ast2obj_expr(state, vstate, o->v.GeneratorExp.elt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.GeneratorExp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4459,7 +4505,7 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Await_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Await.value);
+ value = ast2obj_expr(state, vstate, o->v.Await.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -4469,7 +4515,7 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Yield_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Yield.value);
+ value = ast2obj_expr(state, vstate, o->v.Yield.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -4479,7 +4525,7 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->YieldFrom_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.YieldFrom.value);
+ value = ast2obj_expr(state, vstate, o->v.YieldFrom.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -4489,7 +4535,7 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Compare_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Compare.left);
+ value = ast2obj_expr(state, vstate, o->v.Compare.left);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->left, value) == -1)
goto failed;
@@ -4499,14 +4545,14 @@ ast2obj_expr(struct ast_state *state, void* _o)
value = PyList_New(n);
if (!value) goto failed;
for(i = 0; i < n; i++)
- PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
+ PyList_SET_ITEM(value, i, ast2obj_cmpop(state, vstate, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
}
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ops, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
- ast2obj_expr);
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.Compare.comparators, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->comparators, value) == -1)
goto failed;
@@ -4516,17 +4562,18 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Call_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Call.func);
+ value = ast2obj_expr(state, vstate, o->v.Call.func);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->func, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Call.args,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Call.keywords,
ast2obj_keyword);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->keywords, value) == -1)
@@ -4537,17 +4584,17 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->FormattedValue_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.FormattedValue.value);
+ value = ast2obj_expr(state, vstate, o->v.FormattedValue.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->v.FormattedValue.conversion);
+ value = ast2obj_int(state, vstate, o->v.FormattedValue.conversion);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->conversion, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.FormattedValue.format_spec);
+ value = ast2obj_expr(state, vstate, o->v.FormattedValue.format_spec);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->format_spec, value) == -1)
goto failed;
@@ -4557,7 +4604,7 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->JoinedStr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.JoinedStr.values,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->values, value) == -1)
@@ -4568,12 +4615,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Constant_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_constant(state, o->v.Constant.value);
+ value = ast2obj_constant(state, vstate, o->v.Constant.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.Constant.kind);
+ value = ast2obj_string(state, vstate, o->v.Constant.kind);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kind, value) == -1)
goto failed;
@@ -4583,17 +4630,17 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Attribute_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Attribute.value);
+ value = ast2obj_expr(state, vstate, o->v.Attribute.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(state, o->v.Attribute.attr);
+ value = ast2obj_identifier(state, vstate, o->v.Attribute.attr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->attr, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(state, o->v.Attribute.ctx);
+ value = ast2obj_expr_context(state, vstate, o->v.Attribute.ctx);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
@@ -4603,17 +4650,17 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Subscript_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Subscript.value);
+ value = ast2obj_expr(state, vstate, o->v.Subscript.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.Subscript.slice);
+ value = ast2obj_expr(state, vstate, o->v.Subscript.slice);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->slice, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(state, o->v.Subscript.ctx);
+ value = ast2obj_expr_context(state, vstate, o->v.Subscript.ctx);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
@@ -4623,12 +4670,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Starred_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Starred.value);
+ value = ast2obj_expr(state, vstate, o->v.Starred.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(state, o->v.Starred.ctx);
+ value = ast2obj_expr_context(state, vstate, o->v.Starred.ctx);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
@@ -4638,12 +4685,12 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Name_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(state, o->v.Name.id);
+ value = ast2obj_identifier(state, vstate, o->v.Name.id);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->id, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(state, o->v.Name.ctx);
+ value = ast2obj_expr_context(state, vstate, o->v.Name.ctx);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
@@ -4653,12 +4700,13 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->List_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.List.elts,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(state, o->v.List.ctx);
+ value = ast2obj_expr_context(state, vstate, o->v.List.ctx);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
@@ -4668,12 +4716,13 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Tuple_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.Tuple.elts,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(state, o->v.Tuple.ctx);
+ value = ast2obj_expr_context(state, vstate, o->v.Tuple.ctx);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
@@ -4683,52 +4732,54 @@ ast2obj_expr(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->Slice_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.Slice.lower);
+ value = ast2obj_expr(state, vstate, o->v.Slice.lower);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lower, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.Slice.upper);
+ value = ast2obj_expr(state, vstate, o->v.Slice.upper);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->upper, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->v.Slice.step);
+ value = ast2obj_expr(state, vstate, o->v.Slice.step);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->step, value) == -1)
goto failed;
Py_DECREF(value);
break;
}
- value = ast2obj_int(state, o->lineno);
+ value = ast2obj_int(state, vstate, o->lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->col_offset);
+ value = ast2obj_int(state, vstate, o->col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_lineno);
+ value = ast2obj_int(state, vstate, o->end_lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_col_offset);
+ value = ast2obj_int(state, vstate, o->end_col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
-PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o)
+PyObject* ast2obj_expr_context(struct ast_state *state, struct validator
+ *vstate, expr_context_ty o)
{
switch(o) {
case Load:
@@ -4743,7 +4794,8 @@ PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o)
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o)
+PyObject* ast2obj_boolop(struct ast_state *state, struct validator *vstate,
+ boolop_ty o)
{
switch(o) {
case And:
@@ -4755,7 +4807,8 @@ PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o)
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_operator(struct ast_state *state, operator_ty o)
+PyObject* ast2obj_operator(struct ast_state *state, struct validator *vstate,
+ operator_ty o)
{
switch(o) {
case Add:
@@ -4800,7 +4853,8 @@ PyObject* ast2obj_operator(struct ast_state *state, operator_ty o)
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o)
+PyObject* ast2obj_unaryop(struct ast_state *state, struct validator *vstate,
+ unaryop_ty o)
{
switch(o) {
case Invert:
@@ -4818,7 +4872,8 @@ PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o)
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o)
+PyObject* ast2obj_cmpop(struct ast_state *state, struct validator *vstate,
+ cmpop_ty o)
{
switch(o) {
case Eq:
@@ -4855,7 +4910,8 @@ PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o)
Py_UNREACHABLE();
}
PyObject*
-ast2obj_comprehension(struct ast_state *state, void* _o)
+ast2obj_comprehension(struct ast_state *state, struct validator *vstate, void*
+ _o)
{
comprehension_ty o = (comprehension_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4863,7 +4919,7 @@ ast2obj_comprehension(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -4871,36 +4927,38 @@ ast2obj_comprehension(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->comprehension_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_expr(state, o->target);
+ value = ast2obj_expr(state, vstate, o->target);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->iter);
+ value = ast2obj_expr(state, vstate, o->iter);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->ifs, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ifs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->is_async);
+ value = ast2obj_int(state, vstate, o->is_async);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->is_async, value) == -1)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_excepthandler(struct ast_state *state, void* _o)
+ast2obj_excepthandler(struct ast_state *state, struct validator *vstate, void*
+ _o)
{
excepthandler_ty o = (excepthandler_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4908,7 +4966,7 @@ ast2obj_excepthandler(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -4918,17 +4976,17 @@ ast2obj_excepthandler(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->ExceptHandler_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.ExceptHandler.type);
+ value = ast2obj_expr(state, vstate, o->v.ExceptHandler.type);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(state, o->v.ExceptHandler.name);
+ value = ast2obj_identifier(state, vstate, o->v.ExceptHandler.name);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.ExceptHandler.body,
ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
@@ -4936,36 +4994,37 @@ ast2obj_excepthandler(struct ast_state *state, void* _o)
Py_DECREF(value);
break;
}
- value = ast2obj_int(state, o->lineno);
+ value = ast2obj_int(state, vstate, o->lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->col_offset);
+ value = ast2obj_int(state, vstate, o->col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_lineno);
+ value = ast2obj_int(state, vstate, o->end_lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_col_offset);
+ value = ast2obj_int(state, vstate, o->end_col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_arguments(struct ast_state *state, void* _o)
+ast2obj_arguments(struct ast_state *state, struct validator *vstate, void* _o)
{
arguments_ty o = (arguments_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4973,7 +5032,7 @@ ast2obj_arguments(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -4981,51 +5040,53 @@ ast2obj_arguments(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->arguments_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->posonlyargs, ast2obj_arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->args, ast2obj_arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arg(state, o->vararg);
+ value = ast2obj_arg(state, vstate, o->vararg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->vararg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->kw_defaults,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arg(state, o->kwarg);
+ value = ast2obj_arg(state, vstate, o->kwarg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kwarg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->defaults, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->defaults, value) == -1)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_arg(struct ast_state *state, void* _o)
+ast2obj_arg(struct ast_state *state, struct validator *vstate, void* _o)
{
arg_ty o = (arg_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5033,7 +5094,7 @@ ast2obj_arg(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -5041,51 +5102,52 @@ ast2obj_arg(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->arg_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_identifier(state, o->arg);
+ value = ast2obj_identifier(state, vstate, o->arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->arg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->annotation);
+ value = ast2obj_expr(state, vstate, o->annotation);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->annotation, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->type_comment);
+ value = ast2obj_string(state, vstate, o->type_comment);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->lineno);
+ value = ast2obj_int(state, vstate, o->lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->col_offset);
+ value = ast2obj_int(state, vstate, o->col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_lineno);
+ value = ast2obj_int(state, vstate, o->end_lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_col_offset);
+ value = ast2obj_int(state, vstate, o->end_col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_keyword(struct ast_state *state, void* _o)
+ast2obj_keyword(struct ast_state *state, struct validator *vstate, void* _o)
{
keyword_ty o = (keyword_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5093,7 +5155,7 @@ ast2obj_keyword(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -5101,46 +5163,47 @@ ast2obj_keyword(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->keyword_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_identifier(state, o->arg);
+ value = ast2obj_identifier(state, vstate, o->arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->arg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->value);
+ value = ast2obj_expr(state, vstate, o->value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->lineno);
+ value = ast2obj_int(state, vstate, o->lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->col_offset);
+ value = ast2obj_int(state, vstate, o->col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_lineno);
+ value = ast2obj_int(state, vstate, o->end_lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_col_offset);
+ value = ast2obj_int(state, vstate, o->end_col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_alias(struct ast_state *state, void* _o)
+ast2obj_alias(struct ast_state *state, struct validator *vstate, void* _o)
{
alias_ty o = (alias_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5148,7 +5211,7 @@ ast2obj_alias(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -5156,46 +5219,47 @@ ast2obj_alias(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->alias_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_identifier(state, o->name);
+ value = ast2obj_identifier(state, vstate, o->name);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(state, o->asname);
+ value = ast2obj_identifier(state, vstate, o->asname);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->asname, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->lineno);
+ value = ast2obj_int(state, vstate, o->lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->col_offset);
+ value = ast2obj_int(state, vstate, o->col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_lineno);
+ value = ast2obj_int(state, vstate, o->end_lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_col_offset);
+ value = ast2obj_int(state, vstate, o->end_col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_withitem(struct ast_state *state, void* _o)
+ast2obj_withitem(struct ast_state *state, struct validator *vstate, void* _o)
{
withitem_ty o = (withitem_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5203,7 +5267,7 @@ ast2obj_withitem(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -5211,26 +5275,27 @@ ast2obj_withitem(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->withitem_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_expr(state, o->context_expr);
+ value = ast2obj_expr(state, vstate, o->context_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->context_expr, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->optional_vars);
+ value = ast2obj_expr(state, vstate, o->optional_vars);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->optional_vars, value) == -1)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_match_case(struct ast_state *state, void* _o)
+ast2obj_match_case(struct ast_state *state, struct validator *vstate, void* _o)
{
match_case_ty o = (match_case_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5238,7 +5303,7 @@ ast2obj_match_case(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -5246,31 +5311,32 @@ ast2obj_match_case(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->match_case_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_pattern(state, o->pattern);
+ value = ast2obj_pattern(state, vstate, o->pattern);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->pattern, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(state, o->guard);
+ value = ast2obj_expr(state, vstate, o->guard);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->guard, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->body, ast2obj_stmt);
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->body, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_pattern(struct ast_state *state, void* _o)
+ast2obj_pattern(struct ast_state *state, struct validator *vstate, void* _o)
{
pattern_ty o = (pattern_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5278,7 +5344,7 @@ ast2obj_pattern(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -5288,7 +5354,7 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchValue_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.MatchValue.value);
+ value = ast2obj_expr(state, vstate, o->v.MatchValue.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -5298,7 +5364,7 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchSingleton_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_constant(state, o->v.MatchSingleton.value);
+ value = ast2obj_constant(state, vstate, o->v.MatchSingleton.value);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
@@ -5308,7 +5374,8 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchSequence_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.MatchSequence.patterns,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.MatchSequence.patterns,
ast2obj_pattern);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->patterns, value) == -1)
@@ -5319,19 +5386,20 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchMapping_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.keys,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.MatchMapping.keys,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->keys, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.patterns,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.MatchMapping.patterns,
ast2obj_pattern);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->patterns, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(state, o->v.MatchMapping.rest);
+ value = ast2obj_identifier(state, vstate, o->v.MatchMapping.rest);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->rest, value) == -1)
goto failed;
@@ -5341,24 +5409,27 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchClass_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(state, o->v.MatchClass.cls);
+ value = ast2obj_expr(state, vstate, o->v.MatchClass.cls);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->cls, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.patterns,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.MatchClass.patterns,
ast2obj_pattern);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->patterns, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_attrs,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.MatchClass.kwd_attrs,
ast2obj_identifier);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kwd_attrs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_patterns,
+ value = ast2obj_list(state, vstate,
+ (asdl_seq*)o->v.MatchClass.kwd_patterns,
ast2obj_pattern);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kwd_patterns, value) == -1)
@@ -5369,7 +5440,7 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchStar_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(state, o->v.MatchStar.name);
+ value = ast2obj_identifier(state, vstate, o->v.MatchStar.name);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
@@ -5379,12 +5450,12 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchAs_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_pattern(state, o->v.MatchAs.pattern);
+ value = ast2obj_pattern(state, vstate, o->v.MatchAs.pattern);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->pattern, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(state, o->v.MatchAs.name);
+ value = ast2obj_identifier(state, vstate, o->v.MatchAs.name);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
@@ -5394,7 +5465,7 @@ ast2obj_pattern(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->MatchOr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns,
+ value = ast2obj_list(state, vstate, (asdl_seq*)o->v.MatchOr.patterns,
ast2obj_pattern);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->patterns, value) == -1)
@@ -5402,36 +5473,37 @@ ast2obj_pattern(struct ast_state *state, void* _o)
Py_DECREF(value);
break;
}
- value = ast2obj_int(state, o->lineno);
+ value = ast2obj_int(state, vstate, o->lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->col_offset);
+ value = ast2obj_int(state, vstate, o->col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_lineno);
+ value = ast2obj_int(state, vstate, o->end_lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(state, o->end_col_offset);
+ value = ast2obj_int(state, vstate, o->end_col_offset);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
PyObject*
-ast2obj_type_ignore(struct ast_state *state, void* _o)
+ast2obj_type_ignore(struct ast_state *state, struct validator *vstate, void* _o)
{
type_ignore_ty o = (type_ignore_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5439,7 +5511,7 @@ ast2obj_type_ignore(struct ast_state *state, void* _o)
if (!o) {
Py_RETURN_NONE;
}
- if (++state->recursion_depth > state->recursion_limit) {
+ if (++vstate->recursion_depth > vstate->recursion_limit) {
PyErr_SetString(PyExc_RecursionError,
"maximum recursion depth exceeded during ast construction");
return 0;
@@ -5449,21 +5521,22 @@ ast2obj_type_ignore(struct ast_state *state, void* _o)
tp = (PyTypeObject *)state->TypeIgnore_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_int(state, o->v.TypeIgnore.lineno);
+ value = ast2obj_int(state, vstate, o->v.TypeIgnore.lineno);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->lineno, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(state, o->v.TypeIgnore.tag);
+ value = ast2obj_string(state, vstate, o->v.TypeIgnore.tag);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->tag, value) == -1)
goto failed;
Py_DECREF(value);
break;
}
- state->recursion_depth--;
+ vstate->recursion_depth--;
return result;
failed:
+ vstate->recursion_depth--;
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
@@ -12328,23 +12401,24 @@ PyObject* PyAST_mod2obj(mod_ty t)
int COMPILER_STACK_FRAME_SCALE = 3;
PyThreadState *tstate = _PyThreadState_GET();
if (!tstate) {
- return 0;
+ return NULL;
}
- state->recursion_limit = (recursion_limit < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
+ struct validator vstate;
+ vstate.recursion_limit = (recursion_limit < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
recursion_limit * COMPILER_STACK_FRAME_SCALE : recursion_limit;
int recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
starting_recursion_depth = (recursion_depth < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
recursion_depth * COMPILER_STACK_FRAME_SCALE : recursion_depth;
- state->recursion_depth = starting_recursion_depth;
+ vstate.recursion_depth = starting_recursion_depth;
- PyObject *result = ast2obj_mod(state, t);
+ PyObject *result = ast2obj_mod(state, &vstate, t);
/* Check that the recursion depth counting balanced correctly */
- if (result && state->recursion_depth != starting_recursion_depth) {
+ if (result && vstate.recursion_depth != starting_recursion_depth) {
PyErr_Format(PyExc_SystemError,
"AST constructor recursion depth mismatch (before=%d, after=%d)",
- starting_recursion_depth, state->recursion_depth);
- return 0;
+ starting_recursion_depth, vstate.recursion_depth);
+ return NULL;
}
return result;
}
diff --git a/contrib/tools/python3/src/Python/ceval.c b/contrib/tools/python3/src/Python/ceval.c
index bb6bb35030..1ce6bbc10f 100644
--- a/contrib/tools/python3/src/Python/ceval.c
+++ b/contrib/tools/python3/src/Python/ceval.c
@@ -7153,11 +7153,8 @@ PyObject *
_PyEval_GetBuiltin(PyObject *name)
{
PyThreadState *tstate = _PyThreadState_GET();
- PyObject *attr = PyDict_GetItemWithError(PyEval_GetBuiltins(), name);
- if (attr) {
- Py_INCREF(attr);
- }
- else if (!_PyErr_Occurred(tstate)) {
+ PyObject *attr = PyObject_GetItem(PyEval_GetBuiltins(), name);
+ if (attr == NULL && _PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
_PyErr_SetObject(tstate, PyExc_AttributeError, name);
}
return attr;
@@ -7407,9 +7404,9 @@ import_name(PyThreadState *tstate, _PyInterpreterFrame *frame,
PyObject *import_func, *res;
PyObject* stack[5];
- import_func = _PyDict_GetItemWithError(frame->f_builtins, &_Py_ID(__import__));
+ import_func = PyObject_GetItem(frame->f_builtins, &_Py_ID(__import__));
if (import_func == NULL) {
- if (!_PyErr_Occurred(tstate)) {
+ if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
_PyErr_SetString(tstate, PyExc_ImportError, "__import__ not found");
}
return NULL;
@@ -7417,6 +7414,7 @@ import_name(PyThreadState *tstate, _PyInterpreterFrame *frame,
PyObject *locals = frame->f_locals;
/* Fast path for not overloaded __import__. */
if (import_func == tstate->interp->import_func) {
+ Py_DECREF(import_func);
int ilevel = _PyLong_AsInt(level);
if (ilevel == -1 && _PyErr_Occurred(tstate)) {
return NULL;
@@ -7430,8 +7428,6 @@ import_name(PyThreadState *tstate, _PyInterpreterFrame *frame,
return res;
}
- Py_INCREF(import_func);
-
stack[0] = name;
stack[1] = frame->f_globals;
stack[2] = locals == NULL ? Py_None : locals;
diff --git a/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c b/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c
index d704c00486..32b81fcb81 100644
--- a/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c
+++ b/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c
@@ -125826,7 +125826,7 @@ site_toplevel_consts_3 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 91,
+ .co_firstlineno = 92,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -125969,7 +125969,7 @@ site_toplevel_consts_4 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 96,
+ .co_firstlineno = 97,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -126214,7 +126214,7 @@ site_toplevel_consts_5 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 6,
- .co_firstlineno = 105,
+ .co_firstlineno = 106,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -126453,7 +126453,7 @@ site_toplevel_consts_6 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 128,
+ .co_firstlineno = 129,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -126666,7 +126666,7 @@ site_toplevel_consts_7 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 147,
+ .co_firstlineno = 148,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -126708,9 +126708,75 @@ site_toplevel_consts_8_consts_0 = {
static
struct {
PyASCIIObject _ascii;
+ uint8_t _data[9];
+ }
+const_str_st_flags = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 8,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "st_flags",
+};
+static
+ struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[19];
+ }
+const_str_st_file_attributes = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 18,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "st_file_attributes",
+};
+static
+ struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[28];
+ }
+site_toplevel_consts_8_consts_7 = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 27,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "Skipping hidden .pth file: ",
+};
+static
+ struct {
+ PyASCIIObject _ascii;
uint8_t _data[23];
}
-site_toplevel_consts_8_consts_4 = {
+site_toplevel_consts_8_consts_8 = {
._ascii = {
.ob_base = {
.ob_refcnt = 999999999,
@@ -126732,7 +126798,7 @@ static
PyASCIIObject _ascii;
uint8_t _data[8];
}
-site_toplevel_consts_8_consts_9_1 = {
+site_toplevel_consts_8_consts_13_1 = {
._ascii = {
.ob_base = {
.ob_refcnt = 999999999,
@@ -126757,7 +126823,7 @@ static
PyObject *ob_item[2];
}_object;
}
-site_toplevel_consts_8_consts_9 = {
+site_toplevel_consts_8_consts_13 = {
._object = {
.ob_base = {
.ob_base = {
@@ -126768,7 +126834,7 @@ site_toplevel_consts_8_consts_9 = {
},
.ob_item = {
& importlib__bootstrap_toplevel_consts_18_consts_1_1._ascii.ob_base,
- & site_toplevel_consts_8_consts_9_1._ascii.ob_base,
+ & site_toplevel_consts_8_consts_13_1._ascii.ob_base,
},
},
};
@@ -126777,7 +126843,7 @@ static
PyASCIIObject _ascii;
uint8_t _data[35];
}
-site_toplevel_consts_8_consts_10 = {
+site_toplevel_consts_8_consts_14 = {
._ascii = {
.ob_base = {
.ob_refcnt = 999999999,
@@ -126799,7 +126865,7 @@ static
PyASCIIObject _ascii;
uint8_t _data[3];
}
-site_toplevel_consts_8_consts_14 = {
+site_toplevel_consts_8_consts_17 = {
._ascii = {
.ob_base = {
.ob_refcnt = 999999999,
@@ -126821,7 +126887,7 @@ static
PyASCIIObject _ascii;
uint8_t _data[27];
}
-site_toplevel_consts_8_consts_15 = {
+site_toplevel_consts_8_consts_18 = {
._ascii = {
.ob_base = {
.ob_refcnt = 999999999,
@@ -126843,7 +126909,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[16];
+ PyObject *ob_item[19];
}_object;
}
site_toplevel_consts_8_consts = {
@@ -126853,31 +126919,78 @@ site_toplevel_consts_8_consts = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 16,
+ .ob_size = 19,
},
.ob_item = {
& site_toplevel_consts_8_consts_0._ascii.ob_base,
Py_None,
Py_True,
Py_False,
- & site_toplevel_consts_8_consts_4._ascii.ob_base,
+ & const_str_st_flags._ascii.ob_base,
+ (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS + 0],
+ & const_str_st_file_attributes._ascii.ob_base,
+ & site_toplevel_consts_8_consts_7._ascii.ob_base,
+ & site_toplevel_consts_8_consts_8._ascii.ob_base,
&_Py_ID(locale),
& codecs_toplevel_consts_37_localsplusnames._object.ob_base.ob_base,
& importlib__bootstrap_toplevel_consts_18_consts_1_0._ascii.ob_base,
&_Py_STR(empty),
- & site_toplevel_consts_8_consts_9._object.ob_base.ob_base,
- & site_toplevel_consts_8_consts_10._ascii.ob_base,
+ & site_toplevel_consts_8_consts_13._object.ob_base.ob_base,
+ & site_toplevel_consts_8_consts_14._ascii.ob_base,
(PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS + 1],
& importlib__bootstrap_toplevel_consts_18_consts_3._object.ob_base.ob_base,
- (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS + 0],
- & site_toplevel_consts_8_consts_14._ascii.ob_base,
- & site_toplevel_consts_8_consts_15._ascii.ob_base,
+ & site_toplevel_consts_8_consts_17._ascii.ob_base,
+ & site_toplevel_consts_8_consts_18._ascii.ob_base,
},
},
};
static
struct {
PyASCIIObject _ascii;
+ uint8_t _data[10];
+ }
+const_str_UF_HIDDEN = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 9,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "UF_HIDDEN",
+};
+static
+ struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[22];
+ }
+const_str_FILE_ATTRIBUTE_HIDDEN = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 21,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "FILE_ATTRIBUTE_HIDDEN",
+};
+static
+ struct {
+ PyASCIIObject _ascii;
uint8_t _data[6];
}
const_str_strip = {
@@ -126968,7 +127081,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[27];
+ PyObject *ob_item[32];
}_object;
}
site_toplevel_consts_8_names = {
@@ -126978,18 +127091,23 @@ site_toplevel_consts_8_names = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 27,
+ .ob_size = 32,
},
.ob_item = {
& const_str__init_pathinfo._ascii.ob_base,
& const_str_os._ascii.ob_base,
&_Py_ID(path),
&_Py_ID(join),
+ & const_str_lstat._ascii.ob_base,
+ & const_str_OSError._ascii.ob_base,
+ &_Py_ID(getattr),
+ & const_str_stat._ascii.ob_base,
+ & const_str_UF_HIDDEN._ascii.ob_base,
+ & const_str_FILE_ATTRIBUTE_HIDDEN._ascii.ob_base,
& const_str__trace._ascii.ob_base,
& const_str_io._ascii.ob_base,
&_Py_ID(TextIOWrapper),
& const_str_open_code._ascii.ob_base,
- & const_str_OSError._ascii.ob_base,
& const_str_enumerate._ascii.ob_base,
& const_str_startswith._ascii.ob_base,
& const_str_strip._ascii.ob_base,
@@ -127037,7 +127155,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[685];
+ char ob_sval[825];
}
site_toplevel_consts_8_linetable = {
.ob_base = {
@@ -127045,16 +127163,16 @@ site_toplevel_consts_8_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 684,
+ .ob_size = 824,
},
.ob_shash = -1,
- .ob_sval = "\x80\x00\xf0\x0a\x00\x08\x13\xd0\x07\x1a\xdd\x16\x24\xd1\x16\x26\xd4\x16\x26\x88\x0b\xd8\x10\x14\x88\x05\x88\x05\xe0\x10\x15\x88\x05\xdd\x0f\x11\x8c\x77\x8f\x7c\x8a\x7c\x98\x47\xa0\x54\xd1\x0f\x2a\xd4\x0f\x2a\x80\x48\xdd\x04\x0a\xd0\x0b\x30\xa0\x48\xd0\x0b\x30\xd0\x0b\x30\xd1\x04\x31\xd4\x04\x31\xd0\x04\x31\xf0\x02\x05\x05\x0f\xf5\x06\x00\x0d\x0f\xd4\x0c\x1c\x9d\x52\x9c\x5c\xa8\x28\xd1\x1d\x33\xd4\x1d\x33\xb8\x68\xd0\x0c\x47\xd1\x0c\x47\xd4\x0c\x47\x88\x01\x88\x01\xf8\xdd\x0b\x12\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xd8\x08\x0e\x88\x06\x88\x06\xf0\x03\x01\x05\x0f\xf8\xf8\xf8\xe0\x09\x0a\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xdd\x17\x20\xa0\x11\x91\x7c\x94\x7c\xf0\x00\x16\x09\x16\xf1\x00\x16\x09\x16\x89\x47\x88\x41\x88\x74\xd8\x0f\x13\x8f\x7f\x8a\x7f\x98\x73\xd1\x0f\x23\xd4\x0f\x23\xf0\x00\x01\x0d\x19\xd8\x10\x18\xd8\x0f\x13\x8f\x7a\x8a\x7a\x89\x7c\x8c\x7c\x98\x72\xd2\x0f\x21\xd0\x0f\x21\xd8\x10\x18\xf0\x02\x11\x0d\x16\xd8\x13\x17\x97\x3f\x92\x3f\xd0\x23\x3a\xd1\x13\x3b\xd4\x13\x3b\xf0\x00\x02\x11\x1d\xdd\x14\x18\x98\x14\x91\x4a\x94\x4a\x90\x4a\xd8\x14\x1c\xd8\x17\x1b\x97\x7b\x92\x7b\x91\x7d\x94\x7d\x90\x04\xdd\x1f\x27\xa8\x07\xb0\x14\xd1\x1f\x36\xd4\x1f\x36\x91\x0c\x90\x03\x90\x57\xd8\x17\x1e\xa0\x2b\xd0\x17\x2d\xd0\x17\x2d\xb5\x22\xb4\x27\xb7\x2e\xb2\x2e\xc0\x13\xd1\x32\x45\xd4\x32\x45\xd0\x17\x2d\xdd\x14\x17\x94\x48\x97\x4f\x92\x4f\xa0\x43\xd1\x14\x28\xd4\x14\x28\xd0\x14\x28\xd8\x14\x1f\x97\x4f\x92\x4f\xa0\x47\xd1\x14\x2c\xd4\x14\x2c\xd0\x14\x2c\xf8\xf8\xdd\x13\x1c\xf0\x00\x08\x0d\x16\xf0\x00\x08\x0d\x16\xf0\x00\x08\x0d\x16\xdd\x10\x15\xd0\x16\x3b\xd7\x16\x42\xd2\x16\x42\xc0\x31\xc0\x51\xc1\x33\xc8\x08\xd1\x16\x51\xd4\x16\x51\xdd\x1b\x1e\x9c\x3a\xf0\x03\x01\x11\x27\xf1\x00\x01\x11\x27\xf4\x00\x01\x11\x27\xf0\x00\x01\x11\x27\xe0\x10\x20\xd0\x10\x20\xd0\x10\x20\xd0\x10\x20\xd8\x1e\x38\x98\x69\xd4\x1e\x38\xbd\x23\xbc\x2c\xb9\x2e\xbc\x2e\xd0\x1e\x49\xf0\x00\x02\x11\x3a\xf0\x00\x02\x11\x3a\x90\x46\xd8\x20\x26\xd7\x20\x31\xd2\x20\x31\xd1\x20\x33\xd4\x20\x33\xf0\x00\x01\x15\x3a\xf0\x00\x01\x15\x3a\x98\x04\xdd\x18\x1d\x98\x64\xa0\x34\x99\x69\xad\x63\xac\x6a\xd0\x18\x39\xd1\x18\x39\xd4\x18\x39\xd0\x18\x39\xd0\x18\x39\xf0\x03\x01\x15\x3a\xe5\x10\x15\xd0\x16\x33\xbd\x23\xbc\x2a\xd0\x10\x45\xd1\x10\x45\xd4\x10\x45\xd0\x10\x45\xd8\x10\x15\x90\x05\x90\x05\xf0\x11\x08\x0d\x16\xf8\xf8\xf8\xf0\x1f\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf1\x00\x17\x05\x16\xf4\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf8\xf8\xf8\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x30\x00\x08\x0d\xf0\x00\x01\x05\x1b\xd8\x16\x1a\x88\x0b\xd8\x0b\x16\xd0\x04\x16",
+ .ob_sval = "\x80\x00\xf0\x0a\x00\x08\x13\xd0\x07\x1a\xdd\x16\x24\xd1\x16\x26\xd4\x16\x26\x88\x0b\xd8\x10\x14\x88\x05\x88\x05\xe0\x10\x15\x88\x05\xdd\x0f\x11\x8c\x77\x8f\x7c\x8a\x7c\x98\x47\xa0\x54\xd1\x0f\x2a\xd4\x0f\x2a\x80\x48\xf0\x02\x03\x05\x0f\xdd\x0d\x0f\x8c\x58\x90\x68\xd1\x0d\x1f\xd4\x0d\x1f\x88\x02\x88\x02\xf8\xdd\x0b\x12\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xd8\x08\x0e\x88\x06\x88\x06\xf0\x03\x01\x05\x0f\xf8\xf8\xf8\xe5\x09\x10\x90\x12\x90\x5a\xa0\x11\xd1\x09\x23\xd4\x09\x23\xa5\x64\xa4\x6e\xd1\x09\x34\xf0\x00\x03\x05\x0f\xdd\x09\x10\x90\x12\xd0\x15\x29\xa8\x31\xd1\x09\x2d\xd4\x09\x2d\xb5\x04\xd4\x30\x4a\xd1\x09\x4a\xf0\x03\x03\x05\x0f\xe5\x08\x0e\xd0\x0f\x39\xa8\x58\xd0\x0f\x39\xd0\x0f\x39\xd1\x08\x3a\xd4\x08\x3a\xd0\x08\x3a\xd8\x08\x0e\x88\x06\xdd\x04\x0a\xd0\x0b\x30\xa0\x48\xd0\x0b\x30\xd0\x0b\x30\xd1\x04\x31\xd4\x04\x31\xd0\x04\x31\xf0\x02\x05\x05\x0f\xf5\x06\x00\x0d\x0f\xd4\x0c\x1c\x9d\x52\x9c\x5c\xa8\x28\xd1\x1d\x33\xd4\x1d\x33\xb8\x68\xd0\x0c\x47\xd1\x0c\x47\xd4\x0c\x47\x88\x01\x88\x01\xf8\xdd\x0b\x12\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xd8\x08\x0e\x88\x06\x88\x06\xf0\x03\x01\x05\x0f\xf8\xf8\xf8\xe0\x09\x0a\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xdd\x17\x20\xa0\x11\x91\x7c\x94\x7c\xf0\x00\x16\x09\x16\xf1\x00\x16\x09\x16\x89\x47\x88\x41\x88\x74\xd8\x0f\x13\x8f\x7f\x8a\x7f\x98\x73\xd1\x0f\x23\xd4\x0f\x23\xf0\x00\x01\x0d\x19\xd8\x10\x18\xd8\x0f\x13\x8f\x7a\x8a\x7a\x89\x7c\x8c\x7c\x98\x72\xd2\x0f\x21\xd0\x0f\x21\xd8\x10\x18\xf0\x02\x11\x0d\x16\xd8\x13\x17\x97\x3f\x92\x3f\xd0\x23\x3a\xd1\x13\x3b\xd4\x13\x3b\xf0\x00\x02\x11\x1d\xdd\x14\x18\x98\x14\x91\x4a\x94\x4a\x90\x4a\xd8\x14\x1c\xd8\x17\x1b\x97\x7b\x92\x7b\x91\x7d\x94\x7d\x90\x04\xdd\x1f\x27\xa8\x07\xb0\x14\xd1\x1f\x36\xd4\x1f\x36\x91\x0c\x90\x03\x90\x57\xd8\x17\x1e\xa0\x2b\xd0\x17\x2d\xd0\x17\x2d\xb5\x22\xb4\x27\xb7\x2e\xb2\x2e\xc0\x13\xd1\x32\x45\xd4\x32\x45\xd0\x17\x2d\xdd\x14\x17\x94\x48\x97\x4f\x92\x4f\xa0\x43\xd1\x14\x28\xd4\x14\x28\xd0\x14\x28\xd8\x14\x1f\x97\x4f\x92\x4f\xa0\x47\xd1\x14\x2c\xd4\x14\x2c\xd0\x14\x2c\xf8\xf8\xdd\x13\x1c\xf0\x00\x08\x0d\x16\xf0\x00\x08\x0d\x16\xf0\x00\x08\x0d\x16\xdd\x10\x15\xd0\x16\x3b\xd7\x16\x42\xd2\x16\x42\xc0\x31\xc0\x51\xc1\x33\xc8\x08\xd1\x16\x51\xd4\x16\x51\xdd\x1b\x1e\x9c\x3a\xf0\x03\x01\x11\x27\xf1\x00\x01\x11\x27\xf4\x00\x01\x11\x27\xf0\x00\x01\x11\x27\xe0\x10\x20\xd0\x10\x20\xd0\x10\x20\xd0\x10\x20\xd8\x1e\x38\x98\x69\xd4\x1e\x38\xbd\x23\xbc\x2c\xb9\x2e\xbc\x2e\xd0\x1e\x49\xf0\x00\x02\x11\x3a\xf0\x00\x02\x11\x3a\x90\x46\xd8\x20\x26\xd7\x20\x31\xd2\x20\x31\xd1\x20\x33\xd4\x20\x33\xf0\x00\x01\x15\x3a\xf0\x00\x01\x15\x3a\x98\x04\xdd\x18\x1d\x98\x64\xa0\x34\x99\x69\xad\x63\xac\x6a\xd0\x18\x39\xd1\x18\x39\xd4\x18\x39\xd0\x18\x39\xd0\x18\x39\xf0\x03\x01\x15\x3a\xe5\x10\x15\xd0\x16\x33\xbd\x23\xbc\x2a\xd0\x10\x45\xd1\x10\x45\xd4\x10\x45\xd0\x10\x45\xd8\x10\x15\x90\x05\x90\x05\xf0\x11\x08\x0d\x16\xf8\xf8\xf8\xf0\x1f\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf1\x00\x17\x05\x16\xf4\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf8\xf8\xf8\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x00\x17\x05\x16\xf0\x30\x00\x08\x0d\xf0\x00\x01\x05\x1b\xd8\x16\x1a\x88\x0b\xd8\x0b\x16\xd0\x04\x16",
};
static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[88];
+ char ob_sval[105];
}
site_toplevel_consts_8_exceptiontable = {
.ob_base = {
@@ -127062,10 +127180,10 @@ site_toplevel_consts_8_exceptiontable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 87,
+ .ob_size = 104,
},
.ob_shash = -1,
- .ob_sval = "\xc1\x09\x28\x41\x32\x00\xc1\x32\x0a\x42\x00\x03\xc1\x3f\x01\x42\x00\x03\xc2\x05\x41\x05\x48\x30\x03\xc3\x0b\x24\x45\x2f\x04\xc3\x2f\x01\x48\x30\x03\xc3\x30\x41\x3e\x45\x2f\x04\xc5\x2e\x01\x48\x30\x03\xc5\x2f\x42\x2e\x48\x21\x07\xc8\x1d\x03\x48\x30\x03\xc8\x20\x01\x48\x21\x07\xc8\x21\x03\x48\x30\x03\xc8\x30\x04\x48\x34\x07\xc8\x37\x01\x48\x34\x07",
+ .ob_sval = "\xb7\x14\x41\x0c\x00\xc1\x0c\x0a\x41\x1a\x03\xc1\x19\x01\x41\x1a\x03\xc3\x00\x28\x43\x29\x00\xc3\x29\x0a\x43\x37\x03\xc3\x36\x01\x43\x37\x03\xc3\x3c\x41\x05\x4a\x27\x03\xc5\x02\x24\x47\x26\x04\xc5\x26\x01\x4a\x27\x03\xc5\x27\x41\x3e\x47\x26\x04\xc7\x25\x01\x4a\x27\x03\xc7\x26\x42\x2e\x4a\x18\x07\xca\x14\x03\x4a\x27\x03\xca\x17\x01\x4a\x18\x07\xca\x18\x03\x4a\x27\x03\xca\x27\x04\x4a\x2b\x07\xca\x2e\x01\x4a\x2b\x07",
};
static
struct {
@@ -127116,7 +127234,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[12];
+ PyObject *ob_item[13];
}_object;
}
site_toplevel_consts_8_localsplusnames = {
@@ -127126,7 +127244,7 @@ site_toplevel_consts_8_localsplusnames = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 12,
+ .ob_size = 13,
},
.ob_item = {
& const_str_sitedir._ascii.ob_base,
@@ -127134,6 +127252,7 @@ site_toplevel_consts_8_localsplusnames = {
& const_str_known_paths._ascii.ob_base,
&_Py_ID(reset),
& const_str_fullname._ascii.ob_base,
+ & const_str_st._ascii.ob_base,
& const_str_f._ascii.ob_base,
& const_str_n._ascii.ob_base,
&_Py_ID(line),
@@ -127145,14 +127264,14 @@ site_toplevel_consts_8_localsplusnames = {
},
};
static
- struct _PyCode_DEF(1154)
+ struct _PyCode_DEF(1392)
site_toplevel_consts_8 = {
.ob_base = {
.ob_base = {
.ob_refcnt = 999999999,
.ob_type = &PyCode_Type,
},
- .ob_size = 577,
+ .ob_size = 696,
},
.co_consts = & site_toplevel_consts_8_consts._object.ob_base.ob_base,
.co_names = & site_toplevel_consts_8_names._object.ob_base.ob_base,
@@ -127164,21 +127283,21 @@ site_toplevel_consts_8 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 9,
- .co_firstlineno = 160,
- .co_nlocalsplus = 12,
- .co_nlocals = 12,
+ .co_firstlineno = 161,
+ .co_nlocalsplus = 13,
+ .co_nlocals = 13,
.co_nplaincellvars = 0,
.co_ncellvars = 0,
.co_nfreevars = 0,
.co_localsplusnames = & site_toplevel_consts_8_localsplusnames._object.ob_base.ob_base,
- .co_localspluskinds = & importlib__bootstrap_external_toplevel_consts_36_localspluskinds.ob_base.ob_base,
+ .co_localspluskinds = & posixpath_toplevel_consts_32_localspluskinds.ob_base.ob_base,
.co_filename = & site_toplevel_consts_3_filename._ascii.ob_base,
.co_name = & const_str_addpackage._ascii.ob_base,
.co_qualname = & const_str_addpackage._ascii.ob_base,
.co_linetable = & site_toplevel_consts_8_linetable.ob_base.ob_base,
._co_code = NULL,
._co_linearray = NULL,
- .co_code_adaptive = "\x97\x00\x7c\x02\x80\x11\x74\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x02\x64\x02\x7d\x03\x6e\x02\x64\x03\x7d\x03\x74\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x00\x7c\x01\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x04\x74\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x04\x7c\x04\x9b\x02\x9d\x02\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x09\x00\x74\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x06\x00\x00\x00\x00\x00\x00\x00\x00\x74\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x07\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x04\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x64\x05\xac\x06\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x05\x6e\x11\x23\x00\x74\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x72\x04\x01\x00\x59\x00\x64\x01\x53\x00\x77\x00\x78\x03\x59\x00\x77\x01\x7c\x05\x35\x00\x01\x00\x74\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x05\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x90\x01\x5d\x8d\x5c\x02\x00\x00\x7d\x06\x7d\x07\x7c\x07\xa0\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x07\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x72\x01\x8c\x1c\x7c\x07\xa0\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x08\x6b\x02\x00\x00\x00\x00\x72\x01\x8c\x35\x09\x00\x7c\x07\xa0\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x09\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x72\x10\x74\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x07\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8c\x5b\x7c\x07\xa0\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x07\x74\x1d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x00\x7c\x07\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x5c\x02\x00\x00\x7d\x08\x7d\x09\x7c\x09\x7c\x02\x76\x01\x72\x53\x74\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x08\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x72\x34\x74\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x08\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x7c\x02\xa0\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x09\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8c\xda\x23\x00\x74\x26\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x72\xa8\x01\x00\x74\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x0a\xa0\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x06\x64\x0b\x7a\x00\x00\x00\x7c\x04\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x74\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x16\x00\x00\x00\x00\x00\x00\x00\x00\xac\x0c\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x64\x0d\x64\x01\x6c\x17\x7d\x0a\x02\x00\x7c\x0a\x6a\x18\x00\x00\x00\x00\x00\x00\x00\x00\x74\x21\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x19\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8e\x00\x44\x00\x5d\x37\x7d\x0b\x7c\x0b\xa0\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x5d\x20\x7d\x07\x74\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x0e\x7c\x07\x7a\x00\x00\x00\x74\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x16\x00\x00\x00\x00\x00\x00\x00\x00\xac\x0c\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8c\x21\x8c\x38\x74\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x0f\x74\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x16\x00\x00\x00\x00\x00\x00\x00\x00\xac\x0c\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x59\x00\x01\x00\x6e\x04\x77\x00\x78\x03\x59\x00\x77\x01\x64\x01\x64\x01\x64\x01\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x6e\x0b\x23\x00\x31\x00\x73\x04\x77\x02\x78\x03\x59\x00\x77\x01\x01\x00\x59\x00\x01\x00\x01\x00\x7c\x03\x72\x02\x64\x01\x7d\x02\x7c\x02\x53\x00",
+ .co_code_adaptive = "\x97\x00\x7c\x02\x80\x11\x74\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x02\x64\x02\x7d\x03\x6e\x02\x64\x03\x7d\x03\x74\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x00\x7c\x01\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x04\x09\x00\x74\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x04\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x04\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x05\x6e\x11\x23\x00\x74\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x72\x04\x01\x00\x59\x00\x64\x01\x53\x00\x77\x00\x78\x03\x59\x00\x77\x01\x74\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x05\x64\x04\x64\x05\xa6\x03\x00\x00\xab\x03\x00\x00\x00\x00\x00\x00\x00\x00\x74\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x08\x00\x00\x00\x00\x00\x00\x00\x00\x7a\x01\x00\x00\x73\x1e\x74\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x05\x64\x06\x64\x05\xa6\x03\x00\x00\xab\x03\x00\x00\x00\x00\x00\x00\x00\x00\x74\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x7a\x01\x00\x00\x72\x14\x74\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x07\x7c\x04\x9b\x02\x9d\x02\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x64\x01\x53\x00\x74\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x08\x7c\x04\x9b\x02\x9d\x02\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x09\x00\x74\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x74\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x04\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x64\x09\xac\x0a\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x06\x6e\x11\x23\x00\x74\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x72\x04\x01\x00\x59\x00\x64\x01\x53\x00\x77\x00\x78\x03\x59\x00\x77\x01\x7c\x06\x35\x00\x01\x00\x74\x1d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x06\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x90\x01\x5d\x8d\x5c\x02\x00\x00\x7d\x07\x7d\x08\x7c\x08\xa0\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x0b\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x72\x01\x8c\x1c\x7c\x08\xa0\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x0c\x6b\x02\x00\x00\x00\x00\x72\x01\x8c\x35\x09\x00\x7c\x08\xa0\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x0d\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x72\x10\x74\x23\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x08\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8c\x5b\x7c\x08\xa0\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x08\x74\x27\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x00\x7c\x08\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x5c\x02\x00\x00\x7d\x09\x7d\x0a\x7c\x0a\x7c\x02\x76\x01\x72\x53\x74\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x09\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x72\x34\x74\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x09\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x7c\x02\xa0\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x0a\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8c\xda\x23\x00\x74\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x72\xa8\x01\x00\x74\x33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x0e\xa0\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c\x07\x64\x0f\x7a\x00\x00\x00\x7c\x04\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x74\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x1b\x00\x00\x00\x00\x00\x00\x00\x00\xac\x10\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x64\x05\x64\x01\x6c\x1c\x7d\x0b\x02\x00\x7c\x0b\x6a\x1d\x00\x00\x00\x00\x00\x00\x00\x00\x74\x2b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x1e\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8e\x00\x44\x00\x5d\x37\x7d\x0c\x7c\x0c\xa0\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x5d\x20\x7d\x08\x74\x33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x11\x7c\x08\x7a\x00\x00\x00\x74\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x1b\x00\x00\x00\x00\x00\x00\x00\x00\xac\x10\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8c\x21\x8c\x38\x74\x33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x12\x74\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x1b\x00\x00\x00\x00\x00\x00\x00\x00\xac\x10\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x59\x00\x01\x00\x6e\x04\x77\x00\x78\x03\x59\x00\x77\x01\x64\x01\x64\x01\x64\x01\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x6e\x0b\x23\x00\x31\x00\x73\x04\x77\x02\x78\x03\x59\x00\x77\x01\x01\x00\x59\x00\x01\x00\x01\x00\x7c\x03\x72\x02\x64\x01\x7d\x02\x7c\x02\x53\x00",
._co_firsttraceable = 0,
};
static
@@ -127252,7 +127371,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[1];
+ PyObject *ob_item[2];
}_object;
}
site_toplevel_consts_9_consts_5_consts = {
@@ -127262,10 +127381,11 @@ site_toplevel_consts_9_consts_5_consts = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 1,
+ .ob_size = 2,
},
.ob_item = {
& site_toplevel_consts_9_consts_5_consts_0._ascii.ob_base,
+ &_Py_STR(dot),
},
},
};
@@ -127274,7 +127394,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[1];
+ PyObject *ob_item[2];
}_object;
}
site_toplevel_consts_9_consts_5_names = {
@@ -127284,10 +127404,11 @@ site_toplevel_consts_9_consts_5_names = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 1,
+ .ob_size = 2,
},
.ob_item = {
& const_str_endswith._ascii.ob_base,
+ & const_str_startswith._ascii.ob_base,
},
},
};
@@ -127317,7 +127438,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[42];
+ char ob_sval[85];
}
site_toplevel_consts_9_consts_5_linetable = {
.ob_base = {
@@ -127325,10 +127446,10 @@ site_toplevel_consts_9_consts_5_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 41,
+ .ob_size = 84,
},
.ob_shash = -1,
- .ob_sval = "\x80\x00\xd0\x0c\x3d\xd0\x0c\x3d\xd0\x0c\x3d\x90\x64\xa0\x74\xa7\x7d\xa2\x7d\xb0\x56\xd1\x27\x3c\xd4\x27\x3c\xd0\x0c\x3d\x88\x54\xd0\x0c\x3d\xd0\x0c\x3d\xd0\x0c\x3d",
+ .ob_sval = "\x80\x00\xf0\x00\x01\x0d\x44\x01\xf0\x00\x01\x0d\x44\x01\xf0\x00\x01\x0d\x44\x01\x90\x64\xd8\x10\x14\x97\x0d\x92\x0d\x98\x66\xd1\x10\x25\xd4\x10\x25\xf0\x03\x01\x0d\x44\x01\xd8\x2e\x32\xaf\x6f\xaa\x6f\xb8\x63\xd1\x2e\x42\xd4\x2e\x42\xf0\x03\x01\x0d\x44\x01\x88\x54\xf0\x00\x01\x0d\x44\x01\xf0\x00\x01\x0d\x44\x01\xf0\x00\x01\x0d\x44\x01",
};
static
struct {
@@ -127354,14 +127475,14 @@ site_toplevel_consts_9_consts_5_localsplusnames = {
},
};
static
- struct _PyCode_DEF(60)
+ struct _PyCode_DEF(102)
site_toplevel_consts_9_consts_5 = {
.ob_base = {
.ob_base = {
.ob_refcnt = 999999999,
.ob_type = &PyCode_Type,
},
- .ob_size = 30,
+ .ob_size = 51,
},
.co_consts = & site_toplevel_consts_9_consts_5_consts._object.ob_base.ob_base,
.co_names = & site_toplevel_consts_9_consts_5_names._object.ob_base.ob_base,
@@ -127373,7 +127494,7 @@ site_toplevel_consts_9_consts_5 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 224,
+ .co_firstlineno = 233,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -127387,7 +127508,7 @@ site_toplevel_consts_9_consts_5 = {
.co_linetable = & site_toplevel_consts_9_consts_5_linetable.ob_base.ob_base,
._co_code = NULL,
._co_linearray = NULL,
- .co_code_adaptive = "\x97\x00\x67\x00\x7c\x00\x5d\x19\x7d\x01\x7c\x01\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\xaf\x17\x7c\x01\x91\x02\x8c\x1a\x53\x00",
+ .co_code_adaptive = "\x97\x00\x67\x00\x7c\x00\x5d\x2e\x7d\x01\x7c\x01\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\xaf\x17\x7c\x01\xa0\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x01\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\xb0\x2c\x7c\x01\x91\x02\x8c\x2f\x53\x00",
._co_firsttraceable = 0,
};
static
@@ -127476,7 +127597,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[260];
+ char ob_sval[275];
}
site_toplevel_consts_9_linetable = {
.ob_base = {
@@ -127484,10 +127605,10 @@ site_toplevel_consts_9_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 259,
+ .ob_size = 274,
},
.ob_shash = -1,
- .ob_sval = "\x80\x00\xf5\x06\x00\x05\x0b\xd0\x0b\x2b\xa0\x07\xd0\x0b\x2b\xd0\x0b\x2b\xd1\x04\x2c\xd4\x04\x2c\xd0\x04\x2c\xd8\x07\x12\xd0\x07\x1a\xdd\x16\x24\xd1\x16\x26\xd4\x16\x26\x88\x0b\xd8\x10\x14\x88\x05\x88\x05\xe0\x10\x15\x88\x05\xdd\x1b\x23\xa0\x47\xd1\x1b\x2c\xd4\x1b\x2c\xd1\x04\x18\x80\x47\x88\x5b\xd8\x0b\x16\x98\x2b\xd0\x0b\x25\xd0\x0b\x25\xdd\x08\x0b\x8c\x08\x8f\x0f\x8a\x0f\x98\x07\xd1\x08\x20\xd4\x08\x20\xd0\x08\x20\xd8\x08\x13\x8f\x0f\x8a\x0f\x98\x0b\xd1\x08\x24\xd4\x08\x24\xd0\x08\x24\xf0\x02\x03\x05\x0f\xdd\x10\x12\x94\x0a\x98\x37\xd1\x10\x23\xd4\x10\x23\x88\x05\x88\x05\xf8\xdd\x0b\x12\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xd8\x08\x0e\x88\x06\x88\x06\xf0\x03\x01\x05\x0f\xf8\xf8\xf8\xe0\x0c\x3d\xd0\x0c\x3d\x98\x65\xd0\x0c\x3d\xd1\x0c\x3d\xd4\x0c\x3d\x80\x45\xdd\x10\x16\x90\x75\x91\x0d\x94\x0d\xf0\x00\x01\x05\x2f\xf0\x00\x01\x05\x2f\x88\x04\xdd\x08\x12\x90\x37\x98\x44\xa0\x2b\xd1\x08\x2e\xd4\x08\x2e\xd0\x08\x2e\xd0\x08\x2e\xd8\x07\x0c\xf0\x00\x01\x05\x1b\xd8\x16\x1a\x88\x0b\xd8\x0b\x16\xd0\x04\x16",
+ .ob_sval = "\x80\x00\xf5\x06\x00\x05\x0b\xd0\x0b\x2b\xa0\x07\xd0\x0b\x2b\xd0\x0b\x2b\xd1\x04\x2c\xd4\x04\x2c\xd0\x04\x2c\xd8\x07\x12\xd0\x07\x1a\xdd\x16\x24\xd1\x16\x26\xd4\x16\x26\x88\x0b\xd8\x10\x14\x88\x05\x88\x05\xe0\x10\x15\x88\x05\xdd\x1b\x23\xa0\x47\xd1\x1b\x2c\xd4\x1b\x2c\xd1\x04\x18\x80\x47\x88\x5b\xd8\x0b\x16\x98\x2b\xd0\x0b\x25\xd0\x0b\x25\xdd\x08\x0b\x8c\x08\x8f\x0f\x8a\x0f\x98\x07\xd1\x08\x20\xd4\x08\x20\xd0\x08\x20\xd8\x08\x13\x8f\x0f\x8a\x0f\x98\x0b\xd1\x08\x24\xd4\x08\x24\xd0\x08\x24\xf0\x02\x03\x05\x0f\xdd\x10\x12\x94\x0a\x98\x37\xd1\x10\x23\xd4\x10\x23\x88\x05\x88\x05\xf8\xdd\x0b\x12\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xf0\x00\x01\x05\x0f\xd8\x08\x0e\x88\x06\x88\x06\xf0\x03\x01\x05\x0f\xf8\xf8\xf8\xf0\x04\x01\x0d\x44\x01\xf0\x00\x01\x0d\x44\x01\x98\x65\xf0\x00\x01\x0d\x44\x01\xf1\x00\x01\x0d\x44\x01\xf4\x00\x01\x0d\x44\x01\x80\x45\xe5\x10\x16\x90\x75\x91\x0d\x94\x0d\xf0\x00\x01\x05\x2f\xf0\x00\x01\x05\x2f\x88\x04\xdd\x08\x12\x90\x37\x98\x44\xa0\x2b\xd1\x08\x2e\xd4\x08\x2e\xd0\x08\x2e\xd0\x08\x2e\xd8\x07\x0c\xf0\x00\x01\x05\x1b\xd8\x16\x1a\x88\x0b\xd8\x0b\x16\xd0\x04\x16",
};
static
struct {
@@ -127575,7 +127696,7 @@ site_toplevel_consts_9 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 6,
- .co_firstlineno = 207,
+ .co_firstlineno = 216,
.co_nlocalsplus = 6,
.co_nlocals = 6,
.co_nplaincellvars = 0,
@@ -127820,7 +127941,7 @@ site_toplevel_consts_10 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 232,
+ .co_firstlineno = 242,
.co_nlocalsplus = 0,
.co_nlocals = 0,
.co_nplaincellvars = 0,
@@ -128056,7 +128177,7 @@ site_toplevel_consts_11_consts_3 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 273,
+ .co_firstlineno = 283,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -128351,7 +128472,7 @@ site_toplevel_consts_11 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 9,
- .co_firstlineno = 264,
+ .co_firstlineno = 274,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -128689,7 +128810,7 @@ site_toplevel_consts_12 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 6,
- .co_firstlineno = 288,
+ .co_firstlineno = 298,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -128854,7 +128975,7 @@ site_toplevel_consts_13 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 301,
+ .co_firstlineno = 311,
.co_nlocalsplus = 0,
.co_nlocals = 0,
.co_nplaincellvars = 0,
@@ -129067,7 +129188,7 @@ site_toplevel_consts_14 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 314,
+ .co_firstlineno = 324,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -129283,7 +129404,7 @@ site_toplevel_consts_15 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 331,
+ .co_firstlineno = 341,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -129690,7 +129811,7 @@ site_toplevel_consts_16 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 10,
- .co_firstlineno = 346,
+ .co_firstlineno = 356,
.co_nlocalsplus = 7,
.co_nlocals = 7,
.co_nplaincellvars = 0,
@@ -129884,7 +130005,7 @@ site_toplevel_consts_17 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 379,
+ .co_firstlineno = 389,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -130170,7 +130291,7 @@ site_toplevel_consts_18 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 388,
+ .co_firstlineno = 398,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -130586,7 +130707,7 @@ site_toplevel_consts_19 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 6,
- .co_firstlineno = 404,
+ .co_firstlineno = 414,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -130687,7 +130808,7 @@ site_toplevel_consts_20 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 430,
+ .co_firstlineno = 440,
.co_nlocalsplus = 0,
.co_nlocals = 0,
.co_nplaincellvars = 0,
@@ -131019,7 +131140,7 @@ site_toplevel_consts_21_consts_1_consts_9 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 480,
+ .co_firstlineno = 490,
.co_nlocalsplus = 2,
.co_nlocals = 0,
.co_nplaincellvars = 0,
@@ -131399,7 +131520,7 @@ site_toplevel_consts_21_consts_1 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 442,
+ .co_firstlineno = 452,
.co_nlocalsplus = 6,
.co_nlocals = 4,
.co_nplaincellvars = 2,
@@ -131566,7 +131687,7 @@ site_toplevel_consts_21 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 433,
+ .co_firstlineno = 443,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -131755,7 +131876,7 @@ site_toplevel_consts_22_consts_4 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 504,
+ .co_firstlineno = 514,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -132268,7 +132389,7 @@ site_toplevel_consts_22 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 6,
- .co_firstlineno = 492,
+ .co_firstlineno = 502,
.co_nlocalsplus = 14,
.co_nlocals = 14,
.co_nplaincellvars = 0,
@@ -132513,7 +132634,7 @@ site_toplevel_consts_23 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 8,
- .co_firstlineno = 544,
+ .co_firstlineno = 554,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -132724,7 +132845,7 @@ site_toplevel_consts_24 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 8,
- .co_firstlineno = 564,
+ .co_firstlineno = 574,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -132950,7 +133071,7 @@ site_toplevel_consts_25 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 584,
+ .co_firstlineno = 594,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -133184,7 +133305,7 @@ site_toplevel_consts_26_consts_7 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 641,
+ .co_firstlineno = 651,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -133565,7 +133686,7 @@ site_toplevel_consts_26 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 8,
- .co_firstlineno = 618,
+ .co_firstlineno = 628,
.co_nlocalsplus = 8,
.co_nlocals = 8,
.co_nplaincellvars = 0,
@@ -133659,7 +133780,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[39];
+ PyObject *ob_item[40];
}_object;
}
site_toplevel_names = {
@@ -133669,7 +133790,7 @@ site_toplevel_names = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 39,
+ .ob_size = 40,
},
.ob_item = {
&_Py_ID(__doc__),
@@ -133678,6 +133799,7 @@ site_toplevel_names = {
&_Py_ID(builtins),
& const_str__sitebuiltins._ascii.ob_base,
& const_str_io._ascii.ob_base,
+ & const_str_stat._ascii.ob_base,
& const_str_prefix._ascii.ob_base,
& const_str_exec_prefix._ascii.ob_base,
& const_str_PREFIXES._ascii.ob_base,
@@ -133718,7 +133840,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[551];
+ char ob_sval[560];
}
site_toplevel_linetable = {
.ob_base = {
@@ -133726,20 +133848,20 @@ site_toplevel_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 550,
+ .ob_size = 559,
},
.ob_shash = -1,
- .ob_sval = "\xf0\x03\x01\x01\x01\xf0\x02\x45\x01\x01\x04\xf0\x00\x45\x01\x01\x04\xf0\x4e\x02\x00\x01\x0b\x80\x0a\x80\x0a\x80\x0a\xd8\x00\x09\x80\x09\x80\x09\x80\x09\xd8\x00\x0f\x80\x0f\x80\x0f\x80\x0f\xd8\x00\x14\xd0\x00\x14\xd0\x00\x14\xd0\x00\x14\xd8\x00\x09\x80\x09\x80\x09\x80\x09\xf0\x06\x00\x0d\x10\x8c\x4a\x98\x03\x9c\x0f\xd0\x0b\x28\x80\x08\xf0\x06\x00\x14\x18\xd0\x00\x10\xf0\x0a\x00\x0d\x11\x80\x09\xd8\x0c\x10\x80\x09\xf0\x06\x02\x01\x28\xf0\x00\x02\x01\x28\xf0\x00\x02\x01\x28\xf0\x0a\x06\x01\x26\xf0\x00\x06\x01\x26\xf0\x00\x06\x01\x26\xf0\x12\x14\x01\x11\xf0\x00\x14\x01\x11\xf0\x00\x14\x01\x11\xf0\x2e\x10\x01\x17\xf0\x00\x10\x01\x17\xf0\x00\x10\x01\x17\xf0\x26\x0a\x01\x0d\xf0\x00\x0a\x01\x0d\xf0\x00\x0a\x01\x0d\xf0\x1a\x2c\x01\x17\xf0\x00\x2c\x01\x17\xf0\x00\x2c\x01\x17\xf0\x5e\x01\x16\x01\x17\xf0\x00\x16\x01\x17\xf0\x00\x16\x01\x17\xf0\x00\x16\x01\x17\xf0\x32\x16\x01\x10\xf0\x00\x16\x01\x10\xf0\x00\x16\x01\x10\xf0\x40\x01\x14\x01\x23\xf0\x00\x14\x01\x23\xf0\x00\x14\x01\x23\xf0\x30\x0a\x01\x4b\x01\xf0\x00\x0a\x01\x4b\x01\xf0\x00\x0a\x01\x4b\x01\xf0\x1a\x0a\x01\x15\xf0\x00\x0a\x01\x15\xf0\x00\x0a\x01\x15\xf0\x1a\x0f\x01\x15\xf0\x00\x0f\x01\x15\xf0\x00\x0f\x01\x15\xf0\x22\x0d\x01\x17\xf0\x00\x0d\x01\x17\xf0\x00\x0d\x01\x17\xf0\x1e\x1f\x01\x18\xf0\x00\x1f\x01\x18\xf0\x00\x1f\x01\x18\xf0\x00\x1f\x01\x18\xf0\x42\x01\x07\x01\x17\xf0\x00\x07\x01\x17\xf0\x00\x07\x01\x17\xf0\x00\x07\x01\x17\xf0\x12\x0d\x01\x37\xf0\x00\x0d\x01\x37\xf0\x00\x0d\x01\x37\xf0\x20\x17\x01\x15\xf0\x00\x17\x01\x15\xf0\x00\x17\x01\x15\xf0\x34\x01\x01\x2c\xf0\x00\x01\x01\x2c\xf0\x00\x01\x01\x2c\xf0\x06\x39\x01\x30\xf0\x00\x39\x01\x30\xf0\x00\x39\x01\x30\xf0\x76\x01\x31\x01\x17\xf0\x00\x31\x01\x17\xf0\x00\x31\x01\x17\xf0\x68\x01\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x28\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x28\x1b\x01\x1c\xf0\x00\x1b\x01\x1c\xf0\x00\x1b\x01\x1c\xf0\x3e\x00\x08\x0b\x84\x79\xd4\x07\x18\xf0\x00\x01\x01\x0b\xd8\x04\x08\x80\x44\x81\x46\x84\x46\x80\x46\xf0\x04\x34\x01\x15\xf0\x00\x34\x01\x15\xf0\x00\x34\x01\x15\xf0\x6c\x01\x00\x04\x0c\x88\x7a\xd2\x03\x19\xd0\x03\x19\xd8\x04\x0b\x80\x47\x81\x49\x84\x49\x80\x49\x80\x49\x80\x49\xf0\x03\x00\x04\x1a\xd0\x03\x19",
+ .ob_sval = "\xf0\x03\x01\x01\x01\xf0\x02\x45\x01\x01\x04\xf0\x00\x45\x01\x01\x04\xf0\x4e\x02\x00\x01\x0b\x80\x0a\x80\x0a\x80\x0a\xd8\x00\x09\x80\x09\x80\x09\x80\x09\xd8\x00\x0f\x80\x0f\x80\x0f\x80\x0f\xd8\x00\x14\xd0\x00\x14\xd0\x00\x14\xd0\x00\x14\xd8\x00\x09\x80\x09\x80\x09\x80\x09\xd8\x00\x0b\x80\x0b\x80\x0b\x80\x0b\xf0\x06\x00\x0d\x10\x8c\x4a\x98\x03\x9c\x0f\xd0\x0b\x28\x80\x08\xf0\x06\x00\x14\x18\xd0\x00\x10\xf0\x0a\x00\x0d\x11\x80\x09\xd8\x0c\x10\x80\x09\xf0\x06\x02\x01\x28\xf0\x00\x02\x01\x28\xf0\x00\x02\x01\x28\xf0\x0a\x06\x01\x26\xf0\x00\x06\x01\x26\xf0\x00\x06\x01\x26\xf0\x12\x14\x01\x11\xf0\x00\x14\x01\x11\xf0\x00\x14\x01\x11\xf0\x2e\x10\x01\x17\xf0\x00\x10\x01\x17\xf0\x00\x10\x01\x17\xf0\x26\x0a\x01\x0d\xf0\x00\x0a\x01\x0d\xf0\x00\x0a\x01\x0d\xf0\x1a\x34\x01\x17\xf0\x00\x34\x01\x17\xf0\x00\x34\x01\x17\xf0\x6e\x01\x17\x01\x17\xf0\x00\x17\x01\x17\xf0\x00\x17\x01\x17\xf0\x00\x17\x01\x17\xf0\x34\x16\x01\x10\xf0\x00\x16\x01\x10\xf0\x00\x16\x01\x10\xf0\x40\x01\x14\x01\x23\xf0\x00\x14\x01\x23\xf0\x00\x14\x01\x23\xf0\x30\x0a\x01\x4b\x01\xf0\x00\x0a\x01\x4b\x01\xf0\x00\x0a\x01\x4b\x01\xf0\x1a\x0a\x01\x15\xf0\x00\x0a\x01\x15\xf0\x00\x0a\x01\x15\xf0\x1a\x0f\x01\x15\xf0\x00\x0f\x01\x15\xf0\x00\x0f\x01\x15\xf0\x22\x0d\x01\x17\xf0\x00\x0d\x01\x17\xf0\x00\x0d\x01\x17\xf0\x1e\x1f\x01\x18\xf0\x00\x1f\x01\x18\xf0\x00\x1f\x01\x18\xf0\x00\x1f\x01\x18\xf0\x42\x01\x07\x01\x17\xf0\x00\x07\x01\x17\xf0\x00\x07\x01\x17\xf0\x00\x07\x01\x17\xf0\x12\x0d\x01\x37\xf0\x00\x0d\x01\x37\xf0\x00\x0d\x01\x37\xf0\x20\x17\x01\x15\xf0\x00\x17\x01\x15\xf0\x00\x17\x01\x15\xf0\x34\x01\x01\x2c\xf0\x00\x01\x01\x2c\xf0\x00\x01\x01\x2c\xf0\x06\x39\x01\x30\xf0\x00\x39\x01\x30\xf0\x00\x39\x01\x30\xf0\x76\x01\x31\x01\x17\xf0\x00\x31\x01\x17\xf0\x00\x31\x01\x17\xf0\x68\x01\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x28\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x00\x11\x01\x2f\xf0\x28\x1b\x01\x1c\xf0\x00\x1b\x01\x1c\xf0\x00\x1b\x01\x1c\xf0\x3e\x00\x08\x0b\x84\x79\xd4\x07\x18\xf0\x00\x01\x01\x0b\xd8\x04\x08\x80\x44\x81\x46\x84\x46\x80\x46\xf0\x04\x34\x01\x15\xf0\x00\x34\x01\x15\xf0\x00\x34\x01\x15\xf0\x6c\x01\x00\x04\x0c\x88\x7a\xd2\x03\x19\xd0\x03\x19\xd8\x04\x0b\x80\x47\x81\x49\x84\x49\x80\x49\x80\x49\x80\x49\xf0\x03\x00\x04\x1a\xd0\x03\x19",
};
static
- struct _PyCode_DEF(320)
+ struct _PyCode_DEF(328)
site_toplevel = {
.ob_base = {
.ob_base = {
.ob_refcnt = 999999999,
.ob_type = &PyCode_Type,
},
- .ob_size = 160,
+ .ob_size = 164,
},
.co_consts = & site_toplevel_consts._object.ob_base.ob_base,
.co_names = & site_toplevel_names._object.ob_base.ob_base,
@@ -133765,7 +133887,7 @@ site_toplevel = {
.co_linetable = & site_toplevel_linetable.ob_base.ob_base,
._co_code = NULL,
._co_linearray = NULL,
- .co_code_adaptive = "\x97\x00\x64\x00\x5a\x00\x64\x01\x64\x02\x6c\x01\x5a\x01\x64\x01\x64\x02\x6c\x02\x5a\x02\x64\x01\x64\x02\x6c\x03\x5a\x03\x64\x01\x64\x02\x6c\x04\x5a\x04\x64\x01\x64\x02\x6c\x05\x5a\x05\x65\x01\x6a\x06\x00\x00\x00\x00\x00\x00\x00\x00\x65\x01\x6a\x07\x00\x00\x00\x00\x00\x00\x00\x00\x67\x02\x61\x08\x64\x02\x61\x09\x64\x02\x61\x0a\x64\x02\x61\x0b\x64\x03\x84\x00\x5a\x0c\x64\x04\x84\x00\x5a\x0d\x64\x05\x84\x00\x5a\x0e\x64\x06\x84\x00\x5a\x0f\x64\x07\x84\x00\x5a\x10\x64\x08\x84\x00\x5a\x11\x64\x1c\x64\x09\x84\x01\x5a\x12\x64\x0a\x84\x00\x5a\x13\x64\x0b\x84\x00\x5a\x14\x64\x0c\x84\x00\x5a\x15\x64\x0d\x84\x00\x5a\x16\x64\x0e\x84\x00\x5a\x17\x64\x0f\x84\x00\x5a\x18\x64\x1c\x64\x10\x84\x01\x5a\x19\x64\x1c\x64\x11\x84\x01\x5a\x1a\x64\x12\x84\x00\x5a\x1b\x64\x13\x84\x00\x5a\x1c\x64\x14\x84\x00\x5a\x1d\x64\x15\x84\x00\x5a\x1e\x64\x16\x84\x00\x5a\x1f\x64\x17\x84\x00\x5a\x20\x64\x18\x84\x00\x5a\x21\x64\x19\x84\x00\x5a\x22\x65\x01\x6a\x23\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x24\x00\x00\x00\x00\x00\x00\x00\x00\x73\x0a\x02\x00\x65\x22\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x64\x1a\x84\x00\x5a\x25\x65\x26\x64\x1b\x6b\x02\x00\x00\x00\x00\x72\x0c\x02\x00\x65\x25\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x64\x02\x53\x00\x64\x02\x53\x00",
+ .co_code_adaptive = "\x97\x00\x64\x00\x5a\x00\x64\x01\x64\x02\x6c\x01\x5a\x01\x64\x01\x64\x02\x6c\x02\x5a\x02\x64\x01\x64\x02\x6c\x03\x5a\x03\x64\x01\x64\x02\x6c\x04\x5a\x04\x64\x01\x64\x02\x6c\x05\x5a\x05\x64\x01\x64\x02\x6c\x06\x5a\x06\x65\x01\x6a\x07\x00\x00\x00\x00\x00\x00\x00\x00\x65\x01\x6a\x08\x00\x00\x00\x00\x00\x00\x00\x00\x67\x02\x61\x09\x64\x02\x61\x0a\x64\x02\x61\x0b\x64\x02\x61\x0c\x64\x03\x84\x00\x5a\x0d\x64\x04\x84\x00\x5a\x0e\x64\x05\x84\x00\x5a\x0f\x64\x06\x84\x00\x5a\x10\x64\x07\x84\x00\x5a\x11\x64\x08\x84\x00\x5a\x12\x64\x1c\x64\x09\x84\x01\x5a\x13\x64\x0a\x84\x00\x5a\x14\x64\x0b\x84\x00\x5a\x15\x64\x0c\x84\x00\x5a\x16\x64\x0d\x84\x00\x5a\x17\x64\x0e\x84\x00\x5a\x18\x64\x0f\x84\x00\x5a\x19\x64\x1c\x64\x10\x84\x01\x5a\x1a\x64\x1c\x64\x11\x84\x01\x5a\x1b\x64\x12\x84\x00\x5a\x1c\x64\x13\x84\x00\x5a\x1d\x64\x14\x84\x00\x5a\x1e\x64\x15\x84\x00\x5a\x1f\x64\x16\x84\x00\x5a\x20\x64\x17\x84\x00\x5a\x21\x64\x18\x84\x00\x5a\x22\x64\x19\x84\x00\x5a\x23\x65\x01\x6a\x24\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x25\x00\x00\x00\x00\x00\x00\x00\x00\x73\x0a\x02\x00\x65\x23\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x64\x1a\x84\x00\x5a\x26\x65\x27\x64\x1b\x6b\x02\x00\x00\x00\x00\x72\x0c\x02\x00\x65\x26\xa6\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x64\x02\x53\x00\x64\x02\x53\x00",
._co_firsttraceable = 0,
};
static void site_do_patchups(void) {
@@ -137060,28 +137182,6 @@ const_str_UF_COMPRESSED = {
static
struct {
PyASCIIObject _ascii;
- uint8_t _data[10];
- }
-const_str_UF_HIDDEN = {
- ._ascii = {
- .ob_base = {
- .ob_refcnt = 999999999,
- .ob_type = &PyUnicode_Type,
- },
- .length = 9,
- .hash = -1,
- .state = {
- .kind = 1,
- .compact = 1,
- .ascii = 1,
- .ready = 1,
- },
- },
- ._data = "UF_HIDDEN",
-};
-static
- struct {
- PyASCIIObject _ascii;
uint8_t _data[12];
}
const_str_SF_ARCHIVED = {
@@ -137302,28 +137402,6 @@ const_str_FILE_ATTRIBUTE_ENCRYPTED = {
static
struct {
PyASCIIObject _ascii;
- uint8_t _data[22];
- }
-const_str_FILE_ATTRIBUTE_HIDDEN = {
- ._ascii = {
- .ob_base = {
- .ob_refcnt = 999999999,
- .ob_type = &PyUnicode_Type,
- },
- .length = 21,
- .hash = -1,
- .state = {
- .kind = 1,
- .compact = 1,
- .ascii = 1,
- .ready = 1,
- },
- },
- ._data = "FILE_ATTRIBUTE_HIDDEN",
-};
-static
- struct {
- PyASCIIObject _ascii;
uint8_t _data[32];
}
const_str_FILE_ATTRIBUTE_INTEGRITY_STREAM = {
@@ -151105,11 +151183,16 @@ _Py_Deepfreeze_Fini(void) {
_PyStaticUnicode_Dealloc((PyObject *)&const_str_itemcase);
_PyStaticCode_Dealloc((PyCodeObject *)&site_toplevel_consts_7);
_PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_0);
- _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_4);
- _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_9_1);
- _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_10);
+ _PyStaticUnicode_Dealloc((PyObject *)&const_str_st_flags);
+ _PyStaticUnicode_Dealloc((PyObject *)&const_str_st_file_attributes);
+ _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_7);
+ _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_8);
+ _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_13_1);
_PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_14);
- _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_15);
+ _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_17);
+ _PyStaticUnicode_Dealloc((PyObject *)&site_toplevel_consts_8_consts_18);
+ _PyStaticUnicode_Dealloc((PyObject *)&const_str_UF_HIDDEN);
+ _PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_HIDDEN);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_strip);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_traceback);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_format_exception);
@@ -151382,7 +151465,6 @@ _Py_Deepfreeze_Fini(void) {
_PyStaticUnicode_Dealloc((PyObject *)&const_str_UF_OPAQUE);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_UF_NOUNLINK);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_UF_COMPRESSED);
- _PyStaticUnicode_Dealloc((PyObject *)&const_str_UF_HIDDEN);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_SF_ARCHIVED);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_SF_IMMUTABLE);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_SF_APPEND);
@@ -151393,7 +151475,6 @@ _Py_Deepfreeze_Fini(void) {
_PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_DEVICE);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_DIRECTORY);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_ENCRYPTED);
- _PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_HIDDEN);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_INTEGRITY_STREAM);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_NORMAL);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
diff --git a/contrib/tools/python3/src/Python/import.c b/contrib/tools/python3/src/Python/import.c
index f1c9b478b2..2151bc09f1 100644
--- a/contrib/tools/python3/src/Python/import.c
+++ b/contrib/tools/python3/src/Python/import.c
@@ -2196,7 +2196,7 @@ _imp_get_frozen_object_impl(PyObject *module, PyObject *name,
struct frozen_info info = {0};
Py_buffer buf = {0};
if (PyObject_CheckBuffer(dataobj)) {
- if (PyObject_GetBuffer(dataobj, &buf, PyBUF_READ) != 0) {
+ if (PyObject_GetBuffer(dataobj, &buf, PyBUF_SIMPLE) != 0) {
return NULL;
}
info.data = (const char *)buf.buf;
diff --git a/contrib/tools/python3/src/Python/pythonrun.c b/contrib/tools/python3/src/Python/pythonrun.c
index 91c2ad3a13..fca8b7ab66 100644
--- a/contrib/tools/python3/src/Python/pythonrun.c
+++ b/contrib/tools/python3/src/Python/pythonrun.c
@@ -1200,6 +1200,37 @@ error:
}
static int
+get_exception_notes(struct exception_print_context *ctx, PyObject *value, PyObject **notes) {
+ PyObject *note = NULL;
+
+ if (_PyObject_LookupAttr(value, &_Py_ID(__notes__), notes) < 0) {
+ PyObject *type, *errvalue, *tback;
+ PyErr_Fetch(&type, &errvalue, &tback);
+ PyErr_NormalizeException(&type, &errvalue, &tback);
+ note = PyUnicode_FromFormat("Ignored error getting __notes__: %R", errvalue);
+ Py_XDECREF(type);
+ Py_XDECREF(errvalue);
+ Py_XDECREF(tback);
+ if (!note) {
+ goto error;
+ }
+ *notes = PyList_New(1);
+ if (!*notes) {
+ goto error;
+ }
+ if (PyList_SetItem(*notes, 0, note) < 0) {
+ Py_DECREF(*notes);
+ goto error;
+ }
+ }
+
+ return 0;
+error:
+ Py_XDECREF(note);
+ return -1;
+}
+
+static int
print_exception(struct exception_print_context *ctx, PyObject *value)
{
PyObject *notes = NULL;
@@ -1218,7 +1249,7 @@ print_exception(struct exception_print_context *ctx, PyObject *value)
/* grab the type and notes now because value can change below */
PyObject *type = (PyObject *) Py_TYPE(value);
- if (_PyObject_LookupAttr(value, &_Py_ID(__notes__), &notes) < 0) {
+ if (get_exception_notes(ctx, value, &notes) < 0) {
goto error;
}
diff --git a/contrib/tools/python3/src/Python/specialize.c b/contrib/tools/python3/src/Python/specialize.c
index 4a5213c31c..3441e844e1 100644
--- a/contrib/tools/python3/src/Python/specialize.c
+++ b/contrib/tools/python3/src/Python/specialize.c
@@ -481,6 +481,7 @@ miss_counter_start(void) {
#define SPEC_FAIL_UNPACK_SEQUENCE_ITERATOR 8
#define SPEC_FAIL_UNPACK_SEQUENCE_SEQUENCE 9
+static uint32_t type_get_version(PyTypeObject *t, int opcode);
static int
specialize_module_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
@@ -673,6 +674,9 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
}
PyObject *descr;
DescriptorClassification kind = analyze_descriptor(type, name, &descr, 0);
+ if (type_get_version(type, LOAD_ATTR) == 0) {
+ goto fail;
+ }
switch(kind) {
case OVERRIDING:
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_OVERRIDING_DESCRIPTOR);
@@ -766,6 +770,9 @@ _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
}
PyObject *descr;
DescriptorClassification kind = analyze_descriptor(type, name, &descr, 1);
+ if (type_get_version(type, STORE_ATTR) == 0) {
+ goto fail;
+ }
switch(kind) {
case OVERRIDING:
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_ATTR_OVERRIDING_DESCRIPTOR);
@@ -889,6 +896,9 @@ specialize_class_load_method(PyObject *owner, _Py_CODEUNIT *instr,
PyObject *descr = NULL;
DescriptorClassification kind = 0;
kind = analyze_descriptor((PyTypeObject *)owner, name, &descr, 0);
+ if (type_get_version((PyTypeObject *)owner, LOAD_METHOD) == 0) {
+ return -1;
+ }
switch (kind) {
case METHOD:
case NON_DESCRIPTOR:
@@ -950,6 +960,9 @@ _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
PyObject *descr = NULL;
DescriptorClassification kind = 0;
kind = analyze_descriptor(owner_cls, name, &descr, 0);
+ if (type_get_version(owner_cls, LOAD_METHOD) == 0) {
+ goto fail;
+ }
assert(descr != NULL || kind == ABSENT || kind == GETSET_OVERRIDDEN);
if (kind != METHOD) {
SPECIALIZATION_FAIL(LOAD_METHOD, load_method_fail_kind(kind));
@@ -1183,6 +1196,18 @@ function_kind(PyCodeObject *code) {
return SIMPLE_FUNCTION;
}
+/* Returning 0 indicates a failure. */
+static uint32_t
+type_get_version(PyTypeObject *t, int opcode)
+{
+ uint32_t version = t->tp_version_tag;
+ if (version == 0) {
+ SPECIALIZATION_FAIL(opcode, SPEC_FAIL_OUT_OF_VERSIONS);
+ return 0;
+ }
+ return version;
+}
+
int
_Py_Specialize_BinarySubscr(
PyObject *container, PyObject *sub, _Py_CODEUNIT *instr)
@@ -1231,6 +1256,9 @@ _Py_Specialize_BinarySubscr(
SPECIALIZATION_FAIL(BINARY_SUBSCR, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
goto fail;
}
+ if (type_get_version(cls, BINARY_SUBSCR) == 0) {
+ goto fail;
+ }
assert(cls->tp_version_tag != 0);
write_u32(cache->type_version, cls->tp_version_tag);
int version = _PyFunction_GetVersionForCurrentState(func);
diff --git a/contrib/tools/python3/src/Python/structmember.c b/contrib/tools/python3/src/Python/structmember.c
index c7e318811d..c790656978 100644
--- a/contrib/tools/python3/src/Python/structmember.c
+++ b/contrib/tools/python3/src/Python/structmember.c
@@ -187,45 +187,74 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
WARN("Truncation of value to int");
break;
}
- case T_UINT:{
- unsigned long ulong_val = PyLong_AsUnsignedLong(v);
- if ((ulong_val == (unsigned long)-1) && PyErr_Occurred()) {
- /* XXX: For compatibility, accept negative int values
- as well. */
- PyErr_Clear();
- ulong_val = PyLong_AsLong(v);
- if ((ulong_val == (unsigned long)-1) &&
- PyErr_Occurred())
+ case T_UINT: {
+ /* XXX: For compatibility, accept negative int values
+ as well. */
+ int overflow;
+ long long_val = PyLong_AsLongAndOverflow(v, &overflow);
+ if (long_val == -1 && PyErr_Occurred()) {
+ return -1;
+ }
+ if (overflow < 0) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Python int too large to convert to C long");
+ return -1;
+ }
+ else if (!overflow) {
+ *(unsigned int *)addr = (unsigned int)(unsigned long)long_val;
+ if (long_val < 0) {
+ WARN("Writing negative value into unsigned field");
+ }
+ else if ((unsigned long)long_val > UINT_MAX) {
+ WARN("Truncation of value to unsigned short");
+ }
+ }
+ else {
+ unsigned long ulong_val = PyLong_AsUnsignedLong(v);
+ if (ulong_val == (unsigned long)-1 && PyErr_Occurred()) {
return -1;
- *(unsigned int *)addr = (unsigned int)ulong_val;
- WARN("Writing negative value into unsigned field");
- } else
- *(unsigned int *)addr = (unsigned int)ulong_val;
- if (ulong_val > UINT_MAX)
- WARN("Truncation of value to unsigned int");
- break;
+ }
+ *(unsigned int*)addr = (unsigned int)ulong_val;
+ if (ulong_val > UINT_MAX) {
+ WARN("Truncation of value to unsigned int");
+ }
}
+ break;
+ }
case T_LONG:{
*(long*)addr = PyLong_AsLong(v);
if ((*(long*)addr == -1) && PyErr_Occurred())
return -1;
break;
}
- case T_ULONG:{
- *(unsigned long*)addr = PyLong_AsUnsignedLong(v);
- if ((*(unsigned long*)addr == (unsigned long)-1)
- && PyErr_Occurred()) {
- /* XXX: For compatibility, accept negative int values
- as well. */
- PyErr_Clear();
- *(unsigned long*)addr = PyLong_AsLong(v);
- if ((*(unsigned long*)addr == (unsigned long)-1)
- && PyErr_Occurred())
+ case T_ULONG: {
+ /* XXX: For compatibility, accept negative int values
+ as well. */
+ int overflow;
+ long long_val = PyLong_AsLongAndOverflow(v, &overflow);
+ if (long_val == -1 && PyErr_Occurred()) {
+ return -1;
+ }
+ if (overflow < 0) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Python int too large to convert to C long");
+ return -1;
+ }
+ else if (!overflow) {
+ *(unsigned long *)addr = (unsigned long)long_val;
+ if (long_val < 0) {
+ WARN("Writing negative value into unsigned field");
+ }
+ }
+ else {
+ unsigned long ulong_val = PyLong_AsUnsignedLong(v);
+ if (ulong_val == (unsigned long)-1 && PyErr_Occurred()) {
return -1;
- WARN("Writing negative value into unsigned field");
+ }
+ *(unsigned long*)addr = ulong_val;
}
break;
- }
+ }
case T_PYSSIZET:{
*(Py_ssize_t*)addr = PyLong_AsSsize_t(v);
if ((*(Py_ssize_t*)addr == (Py_ssize_t)-1)
diff --git a/contrib/tools/python3/src/Python/symtable.c b/contrib/tools/python3/src/Python/symtable.c
index 37e5c69740..3519f62098 100644
--- a/contrib/tools/python3/src/Python/symtable.c
+++ b/contrib/tools/python3/src/Python/symtable.c
@@ -728,6 +728,12 @@ update_symbols(PyObject *symbols, PyObject *scopes,
}
Py_DECREF(name);
}
+
+ /* Check if loop ended because of exception in PyIter_Next */
+ if (PyErr_Occurred()) {
+ goto error;
+ }
+
Py_DECREF(itr);
Py_DECREF(v_free);
return 1;
diff --git a/contrib/tools/python3/src/Python/sysmodule.c b/contrib/tools/python3/src/Python/sysmodule.c
index 25fcd4aecf..fd8819bc46 100644
--- a/contrib/tools/python3/src/Python/sysmodule.c
+++ b/contrib/tools/python3/src/Python/sysmodule.c
@@ -1282,7 +1282,7 @@ sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw)
}
PyDoc_STRVAR(set_asyncgen_hooks_doc,
-"set_asyncgen_hooks(* [, firstiter] [, finalizer])\n\
+"set_asyncgen_hooks([firstiter] [, finalizer])\n\
\n\
Set a finalizer for async generators objects."
);
diff --git a/contrib/tools/python3/src/README.rst b/contrib/tools/python3/src/README.rst
index 5910128874..511041a4b5 100644
--- a/contrib/tools/python3/src/README.rst
+++ b/contrib/tools/python3/src/README.rst
@@ -1,4 +1,4 @@
-This is Python version 3.11.7
+This is Python version 3.11.8
=============================
.. image:: https://github.com/python/cpython/workflows/Tests/badge.svg
diff --git a/contrib/tools/python3/src/ya.make b/contrib/tools/python3/src/ya.make
index f38d3924ea..154d64cda6 100644
--- a/contrib/tools/python3/src/ya.make
+++ b/contrib/tools/python3/src/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(3.11.7)
+VERSION(3.11.8)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.7.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.8.tar.gz)
LICENSE(Python-2.0)