aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2023-10-03 23:32:21 +0300
committershadchin <shadchin@yandex-team.com>2023-10-03 23:48:51 +0300
commit01ffd024041ac933854c367fb8d1b5682d19883f (patch)
treeb70aa497ba132a133ccece49f7763427dcd0743f
parenta33fdb9a34581fd124e92535153b1f1fdeca6aaf (diff)
downloadydb-01ffd024041ac933854c367fb8d1b5682d19883f.tar.gz
Update Python 3 to 3.11.6
-rw-r--r--contrib/tools/python3/src/Include/internal/pycore_pystate.h6
-rw-r--r--contrib/tools/python3/src/Include/patchlevel.h4
-rw-r--r--contrib/tools/python3/src/Include/pyport.h5
-rw-r--r--contrib/tools/python3/src/Lib/ast.py18
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/streams.py5
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/subprocess.py12
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/tasks.py24
-rw-r--r--contrib/tools/python3/src/Lib/calendar.py2
-rw-r--r--contrib/tools/python3/src/Lib/codecs.py12
-rw-r--r--contrib/tools/python3/src/Lib/concurrent/futures/process.py23
-rw-r--r--contrib/tools/python3/src/Lib/datetime.py12
-rw-r--r--contrib/tools/python3/src/Lib/enum.py7
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/connection.py17
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py11
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/resource_tracker.py34
-rw-r--r--contrib/tools/python3/src/Lib/multiprocessing/synchronize.py8
-rwxr-xr-xcontrib/tools/python3/src/Lib/pdb.py7
-rw-r--r--contrib/tools/python3/src/Lib/pydoc_data/topics.py2037
-rw-r--r--contrib/tools/python3/src/Lib/selectors.py7
-rw-r--r--contrib/tools/python3/src/Lib/shutil.py2
-rw-r--r--contrib/tools/python3/src/Lib/sqlite3/dump.py20
-rw-r--r--contrib/tools/python3/src/Lib/threading.py7
-rwxr-xr-xcontrib/tools/python3/src/Lib/timeit.py18
-rw-r--r--contrib/tools/python3/src/Lib/traceback.py16
-rw-r--r--contrib/tools/python3/src/Lib/unittest/loader.py22
-rw-r--r--contrib/tools/python3/src/Lib/ya.make4
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/textio.c.h8
-rw-r--r--contrib/tools/python3/src/Modules/_io/fileio.c12
-rw-r--r--contrib/tools/python3/src/Modules/_io/iobase.c21
-rw-r--r--contrib/tools/python3/src/Modules/_io/textio.c7
-rw-r--r--contrib/tools/python3/src/Modules/_io/winconsoleio.c2
-rw-r--r--contrib/tools/python3/src/Modules/_localemodule.c2
-rw-r--r--contrib/tools/python3/src/Modules/_multiprocessing/semaphore.c9
-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/sre.h1
-rw-r--r--contrib/tools/python3/src/Modules/_sre/sre_lib.h6
-rw-r--r--contrib/tools/python3/src/Modules/_ssl.c8
-rw-r--r--contrib/tools/python3/src/Modules/_threadmodule.c71
-rw-r--r--contrib/tools/python3/src/Modules/_xxtestfuzz/fuzzer.c36
-rw-r--r--contrib/tools/python3/src/Modules/faulthandler.c6
-rw-r--r--contrib/tools/python3/src/Modules/fcntlmodule.c5
-rw-r--r--contrib/tools/python3/src/Modules/getpath.c3
-rw-r--r--contrib/tools/python3/src/Modules/mmapmodule.c2
-rw-r--r--contrib/tools/python3/src/Modules/overlapped.c3
-rw-r--r--contrib/tools/python3/src/Modules/posixmodule.c243
-rw-r--r--contrib/tools/python3/src/Modules/selectmodule.c4
-rw-r--r--contrib/tools/python3/src/Modules/socketmodule.c12
-rw-r--r--contrib/tools/python3/src/Modules/ya.make4
-rw-r--r--contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h6
-rw-r--r--contrib/tools/python3/src/Objects/unicodeobject.c6
-rw-r--r--contrib/tools/python3/src/Parser/tokenizer.c2
-rw-r--r--contrib/tools/python3/src/Python/ast.c5
-rw-r--r--contrib/tools/python3/src/Python/ceval.c26
-rw-r--r--contrib/tools/python3/src/Python/ceval_gil.h33
-rw-r--r--contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c613
-rw-r--r--contrib/tools/python3/src/Python/fileutils.c4
-rw-r--r--contrib/tools/python3/src/Python/pystate.c44
-rw-r--r--contrib/tools/python3/src/Python/pythonrun.c24
-rw-r--r--contrib/tools/python3/src/Python/symtable.c57
-rw-r--r--contrib/tools/python3/src/Python/sysmodule.c11
-rw-r--r--contrib/tools/python3/src/Python/traceback.c65
-rw-r--r--contrib/tools/python3/src/README.rst2
-rw-r--r--contrib/tools/python3/src/ya.make4
-rw-r--r--contrib/tools/python3/ya.make4
65 files changed, 2275 insertions, 1461 deletions
diff --git a/contrib/tools/python3/src/Include/internal/pycore_pystate.h b/contrib/tools/python3/src/Include/internal/pycore_pystate.h
index cb8f115768..7c5aba12d5 100644
--- a/contrib/tools/python3/src/Include/internal/pycore_pystate.h
+++ b/contrib/tools/python3/src/Include/internal/pycore_pystate.h
@@ -61,6 +61,12 @@ _Py_ThreadCanHandlePendingCalls(void)
}
+#ifndef NDEBUG
+extern int _PyThreadState_CheckConsistency(PyThreadState *tstate);
+#endif
+
+int _PyThreadState_MustExit(PyThreadState *tstate);
+
/* Variable and macro for in-line access to current thread
and interpreter state */
diff --git a/contrib/tools/python3/src/Include/patchlevel.h b/contrib/tools/python3/src/Include/patchlevel.h
index 7023a3f6c3..70d71c1137 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 5
+#define PY_MICRO_VERSION 6
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL 0
/* Version as a string */
-#define PY_VERSION "3.11.5"
+#define PY_VERSION "3.11.6"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/contrib/tools/python3/src/Include/pyport.h b/contrib/tools/python3/src/Include/pyport.h
index 93250f4eb1..b3b8b6f09a 100644
--- a/contrib/tools/python3/src/Include/pyport.h
+++ b/contrib/tools/python3/src/Include/pyport.h
@@ -439,11 +439,6 @@ Please be conservative with adding new ones, document them and enclose them
in platform-specific #ifdefs.
**************************************************************************/
-#ifdef SOLARIS
-/* Unchecked */
-extern int gethostname(char *, int);
-#endif
-
#ifdef HAVE__GETPTY
#include <sys/types.h> /* we need to import mode_t */
extern char * _getpty(int *, int, mode_t, int);
diff --git a/contrib/tools/python3/src/Lib/ast.py b/contrib/tools/python3/src/Lib/ast.py
index 623b9a1b80..d84d75e1f3 100644
--- a/contrib/tools/python3/src/Lib/ast.py
+++ b/contrib/tools/python3/src/Lib/ast.py
@@ -1175,13 +1175,29 @@ class _Unparser(NodeVisitor):
new_fstring_parts = []
quote_types = list(_ALL_QUOTES)
+ fallback_to_repr = False
for value, is_constant in fstring_parts:
- value, quote_types = self._str_literal_helper(
+ value, new_quote_types = self._str_literal_helper(
value,
quote_types=quote_types,
escape_special_whitespace=is_constant,
)
new_fstring_parts.append(value)
+ if set(new_quote_types).isdisjoint(quote_types):
+ fallback_to_repr = True
+ break
+ quote_types = new_quote_types
+
+ if fallback_to_repr:
+ # If we weren't able to find a quote type that works for all parts
+ # of the JoinedStr, fallback to using repr and triple single quotes.
+ quote_types = ["'''"]
+ new_fstring_parts.clear()
+ for value, is_constant in fstring_parts:
+ value = repr('"' + value) # force repr to use single quotes
+ expected_prefix = "'\""
+ assert value.startswith(expected_prefix), repr(value)
+ new_fstring_parts.append(value[len(expected_prefix):-1])
value = "".join(new_fstring_parts)
quote_type = quote_types[0]
diff --git a/contrib/tools/python3/src/Lib/asyncio/streams.py b/contrib/tools/python3/src/Lib/asyncio/streams.py
index 3d577f1270..19d9154b66 100644
--- a/contrib/tools/python3/src/Lib/asyncio/streams.py
+++ b/contrib/tools/python3/src/Lib/asyncio/streams.py
@@ -67,9 +67,8 @@ async def start_server(client_connected_cb, host=None, port=None, *,
positional host and port, with various optional keyword arguments
following. The return value is the same as loop.create_server().
- Additional optional keyword arguments are loop (to set the event loop
- instance to use) and limit (to set the buffer limit passed to the
- StreamReader).
+ Additional optional keyword argument is limit (to set the buffer
+ limit passed to the StreamReader).
The return value is the same as loop.create_server(), i.e. a
Server object which can be used to stop the service.
diff --git a/contrib/tools/python3/src/Lib/asyncio/subprocess.py b/contrib/tools/python3/src/Lib/asyncio/subprocess.py
index c380bbb0ee..da4f00a4a0 100644
--- a/contrib/tools/python3/src/Lib/asyncio/subprocess.py
+++ b/contrib/tools/python3/src/Lib/asyncio/subprocess.py
@@ -147,14 +147,16 @@ class Process:
async def _feed_stdin(self, input):
debug = self._loop.get_debug()
- self.stdin.write(input)
- if debug:
- logger.debug(
- '%r communicate: feed stdin (%s bytes)', self, len(input))
try:
+ self.stdin.write(input)
+ if debug:
+ logger.debug(
+ '%r communicate: feed stdin (%s bytes)', self, len(input))
+
await self.stdin.drain()
except (BrokenPipeError, ConnectionResetError) as exc:
- # communicate() ignores BrokenPipeError and ConnectionResetError
+ # communicate() ignores BrokenPipeError and ConnectionResetError.
+ # write() and drain() can raise these exceptions.
if debug:
logger.debug('%r communicate: stdin got %r', self, exc)
diff --git a/contrib/tools/python3/src/Lib/asyncio/tasks.py b/contrib/tools/python3/src/Lib/asyncio/tasks.py
index 3e07ce5294..6ca545e30a 100644
--- a/contrib/tools/python3/src/Lib/asyncio/tasks.py
+++ b/contrib/tools/python3/src/Lib/asyncio/tasks.py
@@ -81,15 +81,25 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
"""A coroutine wrapped in a Future."""
# An important invariant maintained while a Task not done:
+ # _fut_waiter is either None or a Future. The Future
+ # can be either done() or not done().
+ # The task can be in any of 3 states:
#
- # - Either _fut_waiter is None, and _step() is scheduled;
- # - or _fut_waiter is some Future, and _step() is *not* scheduled.
+ # - 1: _fut_waiter is not None and not _fut_waiter.done():
+ # __step() is *not* scheduled and the Task is waiting for _fut_waiter.
+ # - 2: (_fut_waiter is None or _fut_waiter.done()) and __step() is scheduled:
+ # the Task is waiting for __step() to be executed.
+ # - 3: _fut_waiter is None and __step() is *not* scheduled:
+ # the Task is currently executing (in __step()).
#
- # The only transition from the latter to the former is through
- # _wakeup(). When _fut_waiter is not None, one of its callbacks
- # must be _wakeup().
-
- # If False, don't log a message if the task is destroyed whereas its
+ # * In state 1, one of the callbacks of __fut_waiter must be __wakeup().
+ # * The transition from 1 to 2 happens when _fut_waiter becomes done(),
+ # as it schedules __wakeup() to be called (which calls __step() so
+ # we way that __step() is scheduled).
+ # * It transitions from 2 to 3 when __step() is executed, and it clears
+ # _fut_waiter to None.
+
+ # If False, don't log a message if the task is destroyed while its
# status is still pending
_log_destroy_pending = True
diff --git a/contrib/tools/python3/src/Lib/calendar.py b/contrib/tools/python3/src/Lib/calendar.py
index 657396439c..7cdf9311b5 100644
--- a/contrib/tools/python3/src/Lib/calendar.py
+++ b/contrib/tools/python3/src/Lib/calendar.py
@@ -693,7 +693,7 @@ def main(args):
parser.add_argument(
"-L", "--locale",
default=None,
- help="locale to be used from month and weekday names"
+ help="locale to use for month and weekday names"
)
parser.add_argument(
"-e", "--encoding",
diff --git a/contrib/tools/python3/src/Lib/codecs.py b/contrib/tools/python3/src/Lib/codecs.py
index 3b173b6121..c6165fcb14 100644
--- a/contrib/tools/python3/src/Lib/codecs.py
+++ b/contrib/tools/python3/src/Lib/codecs.py
@@ -414,6 +414,9 @@ class StreamWriter(Codec):
def __exit__(self, type, value, tb):
self.stream.close()
+ def __reduce_ex__(self, proto):
+ raise TypeError("can't serialize %s" % self.__class__.__name__)
+
###
class StreamReader(Codec):
@@ -663,6 +666,9 @@ class StreamReader(Codec):
def __exit__(self, type, value, tb):
self.stream.close()
+ def __reduce_ex__(self, proto):
+ raise TypeError("can't serialize %s" % self.__class__.__name__)
+
###
class StreamReaderWriter:
@@ -750,6 +756,9 @@ class StreamReaderWriter:
def __exit__(self, type, value, tb):
self.stream.close()
+ def __reduce_ex__(self, proto):
+ raise TypeError("can't serialize %s" % self.__class__.__name__)
+
###
class StreamRecoder:
@@ -866,6 +875,9 @@ class StreamRecoder:
def __exit__(self, type, value, tb):
self.stream.close()
+ def __reduce_ex__(self, proto):
+ raise TypeError("can't serialize %s" % self.__class__.__name__)
+
### Shortcuts
def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
diff --git a/contrib/tools/python3/src/Lib/concurrent/futures/process.py b/contrib/tools/python3/src/Lib/concurrent/futures/process.py
index 321608ab17..952fa90345 100644
--- a/contrib/tools/python3/src/Lib/concurrent/futures/process.py
+++ b/contrib/tools/python3/src/Lib/concurrent/futures/process.py
@@ -69,6 +69,11 @@ class _ThreadWakeup:
self._reader, self._writer = mp.Pipe(duplex=False)
def close(self):
+ # Please note that we do not take the shutdown lock when
+ # calling clear() (to avoid deadlocking) so this method can
+ # only be called safely from the same thread as all calls to
+ # clear() even if you hold the shutdown lock. Otherwise we
+ # might try to read from the closed pipe.
if not self._closed:
self._closed = True
self._writer.close()
@@ -424,8 +429,12 @@ class _ExecutorManagerThread(threading.Thread):
elif wakeup_reader in ready:
is_broken = False
- with self.shutdown_lock:
- self.thread_wakeup.clear()
+ # No need to hold the _shutdown_lock here because:
+ # 1. we're the only thread to use the wakeup reader
+ # 2. we're also the only thread to call thread_wakeup.close()
+ # 3. we want to avoid a possible deadlock when both reader and writer
+ # would block (gh-105829)
+ self.thread_wakeup.clear()
return result_item, is_broken, cause
@@ -501,6 +510,11 @@ class _ExecutorManagerThread(threading.Thread):
# https://github.com/python/cpython/issues/94777
self.call_queue._reader.close()
+ # gh-107219: Close the connection writer which can unblock
+ # Queue._feed() if it was stuck in send_bytes().
+ if sys.platform == 'win32':
+ self.call_queue._writer.close()
+
# clean up resources
self.join_executor_internals()
@@ -704,7 +718,10 @@ class ProcessPoolExecutor(_base.Executor):
# as it could result in a deadlock if a worker process dies with the
# _result_queue write lock still acquired.
#
- # _shutdown_lock must be locked to access _ThreadWakeup.
+ # _shutdown_lock must be locked to access _ThreadWakeup.close() and
+ # .wakeup(). Care must also be taken to not call clear or close from
+ # more than one thread since _ThreadWakeup.clear() is not protected by
+ # the _shutdown_lock
self._executor_manager_thread_wakeup = _ThreadWakeup()
# Create communication channels for the executor
diff --git a/contrib/tools/python3/src/Lib/datetime.py b/contrib/tools/python3/src/Lib/datetime.py
index c3c2568f98..474b4e9ae5 100644
--- a/contrib/tools/python3/src/Lib/datetime.py
+++ b/contrib/tools/python3/src/Lib/datetime.py
@@ -1002,13 +1002,9 @@ class date:
def __repr__(self):
"""Convert to formal string, for repr().
- >>> dt = datetime(2010, 1, 1)
- >>> repr(dt)
- 'datetime.datetime(2010, 1, 1, 0, 0)'
-
- >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)
- >>> repr(dt)
- 'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'
+ >>> d = date(2010, 1, 1)
+ >>> repr(d)
+ 'datetime.date(2010, 1, 1)'
"""
return "%s.%s(%d, %d, %d)" % (self.__class__.__module__,
self.__class__.__qualname__,
@@ -1223,7 +1219,7 @@ date.resolution = timedelta(days=1)
class tzinfo:
"""Abstract base class for time zone info classes.
- Subclasses must override the name(), utcoffset() and dst() methods.
+ Subclasses must override the tzname(), utcoffset() and dst() methods.
"""
__slots__ = ()
diff --git a/contrib/tools/python3/src/Lib/enum.py b/contrib/tools/python3/src/Lib/enum.py
index 1f447c878c..155cb13022 100644
--- a/contrib/tools/python3/src/Lib/enum.py
+++ b/contrib/tools/python3/src/Lib/enum.py
@@ -863,6 +863,8 @@ class EnumType(type):
value = first_enum._generate_next_value_(name, start, count, last_values[:])
last_values.append(value)
names.append((name, value))
+ if names is None:
+ names = ()
# Here, names is either an iterable of (name, value) or a mapping.
for item in names:
@@ -1107,6 +1109,11 @@ class Enum(metaclass=EnumType):
for member in cls._member_map_.values():
if member._value_ == value:
return member
+ # still not found -- verify that members exist, in-case somebody got here mistakenly
+ # (such as via super when trying to override __new__)
+ if not cls._member_map_:
+ raise TypeError("%r has no members defined" % cls)
+ #
# still not found -- try _missing_ hook
try:
exc = None
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/connection.py b/contrib/tools/python3/src/Lib/multiprocessing/connection.py
index b08144f7a1..8b81f9954e 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/connection.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/connection.py
@@ -9,6 +9,7 @@
__all__ = [ 'Client', 'Listener', 'Pipe', 'wait' ]
+import errno
import io
import os
import sys
@@ -271,12 +272,22 @@ if _winapi:
with FILE_FLAG_OVERLAPPED.
"""
_got_empty_message = False
+ _send_ov = None
def _close(self, _CloseHandle=_winapi.CloseHandle):
+ ov = self._send_ov
+ if ov is not None:
+ # Interrupt WaitForMultipleObjects() in _send_bytes()
+ ov.cancel()
_CloseHandle(self._handle)
def _send_bytes(self, buf):
+ if self._send_ov is not None:
+ # A connection should only be used by a single thread
+ raise ValueError("concurrent send_bytes() calls "
+ "are not supported")
ov, err = _winapi.WriteFile(self._handle, buf, overlapped=True)
+ self._send_ov = ov
try:
if err == _winapi.ERROR_IO_PENDING:
waitres = _winapi.WaitForMultipleObjects(
@@ -286,7 +297,13 @@ if _winapi:
ov.cancel()
raise
finally:
+ self._send_ov = None
nwritten, err = ov.GetOverlappedResult(True)
+ if err == _winapi.ERROR_OPERATION_ABORTED:
+ # close() was called by another thread while
+ # WaitForMultipleObjects() was waiting for the overlapped
+ # operation.
+ raise OSError(errno.EPIPE, "handle is closed")
assert err == 0
assert nwritten == len(buf)
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 5f25eaf68e..f968968189 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/popen_spawn_win32.py
@@ -14,6 +14,7 @@ __all__ = ['Popen']
#
#
+# Exit code used by Popen.terminate()
TERMINATE = 0x10000
WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False))
WINSERVICE = sys.executable.lower().endswith("pythonservice.exe")
@@ -123,9 +124,15 @@ class Popen(object):
if self.returncode is None:
try:
_winapi.TerminateProcess(int(self._handle), TERMINATE)
- except OSError:
- if self.wait(timeout=1.0) is None:
+ 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
kill = terminate
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/resource_tracker.py b/contrib/tools/python3/src/Lib/multiprocessing/resource_tracker.py
index ea36950729..79e96ecf32 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/resource_tracker.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/resource_tracker.py
@@ -51,15 +51,31 @@ if os.name == 'posix':
})
+class ReentrantCallError(RuntimeError):
+ pass
+
+
class ResourceTracker(object):
def __init__(self):
- self._lock = threading.Lock()
+ self._lock = threading.RLock()
self._fd = None
self._pid = None
+ def _reentrant_call_error(self):
+ # gh-109629: this happens if an explicit call to the ResourceTracker
+ # gets interrupted by a garbage collection, invoking a finalizer (*)
+ # that itself calls back into ResourceTracker.
+ # (*) for example the SemLock finalizer
+ raise ReentrantCallError(
+ "Reentrant call into the multiprocessing resource tracker")
+
def _stop(self):
with self._lock:
+ # This should not happen (_stop() isn't called by a finalizer)
+ # but we check for it anyway.
+ if self._lock._recursion_count() > 1:
+ return self._reentrant_call_error()
if self._fd is None:
# not running
return
@@ -81,6 +97,9 @@ class ResourceTracker(object):
This can be run from any process. Usually a child process will use
the resource created by its parent.'''
with self._lock:
+ if self._lock._recursion_count() > 1:
+ # The code below is certainly not reentrant-safe, so bail out
+ return self._reentrant_call_error()
if self._fd is not None:
# resource tracker was launched before, is it still running?
if self._check_alive():
@@ -159,7 +178,17 @@ class ResourceTracker(object):
self._send('UNREGISTER', name, rtype)
def _send(self, cmd, name, rtype):
- self.ensure_running()
+ try:
+ self.ensure_running()
+ except ReentrantCallError:
+ # The code below might or might not work, depending on whether
+ # the resource tracker was already running and still alive.
+ # Better warn the user.
+ # (XXX is warnings.warn itself reentrant-safe? :-)
+ warnings.warn(
+ f"ResourceTracker called reentrantly for resource cleanup, "
+ f"which is unsupported. "
+ f"The {rtype} object {name!r} might leak.")
msg = '{0}:{1}:{2}\n'.format(cmd, name, rtype).encode('ascii')
if len(msg) > 512:
# posix guarantees that writes to a pipe of less than PIPE_BUF
@@ -176,6 +205,7 @@ register = _resource_tracker.register
unregister = _resource_tracker.unregister
getfd = _resource_tracker.getfd
+
def main(fd):
'''Run resource tracker.'''
# protect the process from ^C and "killall python" etc
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py b/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py
index 2328d33212..3ccbfe311c 100644
--- a/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py
+++ b/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py
@@ -50,8 +50,8 @@ class SemLock(object):
def __init__(self, kind, value, maxvalue, *, ctx):
if ctx is None:
ctx = context._default_context.get_context()
- self.is_fork_ctx = ctx.get_start_method() == 'fork'
- unlink_now = sys.platform == 'win32' or self.is_fork_ctx
+ self._is_fork_ctx = ctx.get_start_method() == 'fork'
+ unlink_now = sys.platform == 'win32' or self._is_fork_ctx
for i in range(100):
try:
sl = self._semlock = _multiprocessing.SemLock(
@@ -103,7 +103,7 @@ class SemLock(object):
if sys.platform == 'win32':
h = context.get_spawning_popen().duplicate_for_child(sl.handle)
else:
- if self.is_fork_ctx:
+ if self._is_fork_ctx:
raise RuntimeError('A SemLock created in a fork context is being '
'shared with a process in a spawn context. This is '
'not supported. Please use the same context to create '
@@ -115,6 +115,8 @@ class SemLock(object):
self._semlock = _multiprocessing.SemLock._rebuild(*state)
util.debug('recreated blocker with handle %r' % state[0])
self._make_methods()
+ # Ensure that deserialized SemLock can be serialized again (gh-108520).
+ self._is_fork_ctx = False
@staticmethod
def _make_name():
diff --git a/contrib/tools/python3/src/Lib/pdb.py b/contrib/tools/python3/src/Lib/pdb.py
index d3824e19fa..fe9eab9b5e 100755
--- a/contrib/tools/python3/src/Lib/pdb.py
+++ b/contrib/tools/python3/src/Lib/pdb.py
@@ -1505,8 +1505,11 @@ class Pdb(bdb.Bdb, cmd.Cmd):
for alias in keys:
self.message("%s = %s" % (alias, self.aliases[alias]))
return
- if args[0] in self.aliases and len(args) == 1:
- self.message("%s = %s" % (args[0], self.aliases[args[0]]))
+ if len(args) == 1:
+ if args[0] in self.aliases:
+ self.message("%s = %s" % (args[0], self.aliases[args[0]]))
+ else:
+ self.error(f"Unknown alias '{args[0]}'")
else:
self.aliases[args[0]] = ' '.join(args[1:])
diff --git a/contrib/tools/python3/src/Lib/pydoc_data/topics.py b/contrib/tools/python3/src/Lib/pydoc_data/topics.py
index 1b1251b690..06422d21c6 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 Thu Aug 24 13:07:17 2023
+# Autogenerated by Sphinx on Mon Oct 2 14:27:48 2023
# as part of the release process.
topics = {'assert': 'The "assert" statement\n'
'**********************\n'
@@ -1076,9 +1076,7 @@ topics = {'assert': 'The "assert" statement\n'
'for each\n'
' instance.\n'
'\n'
- '\n'
- 'Notes on using *__slots__*\n'
- '--------------------------\n'
+ 'Notes on using *__slots__*:\n'
'\n'
'* When inheriting from a class without *__slots__*, the '
'"__dict__" and\n'
@@ -10003,9 +10001,7 @@ topics = {'assert': 'The "assert" statement\n'
'each\n'
' instance.\n'
'\n'
- '\n'
- 'Notes on using *__slots__*\n'
- '~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
+ 'Notes on using *__slots__*:\n'
'\n'
'* When inheriting from a class without *__slots__*, the '
'"__dict__" and\n'
@@ -12374,71 +12370,71 @@ topics = {'assert': 'The "assert" statement\n'
'those\n'
'used by Standard C. The recognized escape sequences are:\n'
'\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| Escape Sequence | Meaning | Notes '
- '|\n'
- '|===================|===================================|=========|\n'
- '| "\\"<newline> | Backslash and newline ignored | '
- '(1) |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\\\" | Backslash ("\\") '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\\'" | Single quote ("\'") '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| Escape Sequence | Meaning | '
+ 'Notes |\n'
+ '|===========================|===================================|=========|\n'
+ '| "\\"<newline> | Backslash and newline ignored '
+ '| (1) |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\\\" | Backslash '
+ '("\\") | |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\\'" | Single quote '
+ '("\'") | |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\"" | Double quote (""") '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\"" | Double quote (""") '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\a" | ASCII Bell (BEL) '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\a" | ASCII Bell (BEL) '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\b" | ASCII Backspace (BS) '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\b" | ASCII Backspace (BS) '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\f" | ASCII Formfeed (FF) '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\f" | ASCII Formfeed (FF) '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\n" | ASCII Linefeed (LF) '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\n" | ASCII Linefeed (LF) '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\r" | ASCII Carriage Return (CR) '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\r" | ASCII Carriage Return (CR) '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\t" | ASCII Horizontal Tab (TAB) '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\t" | ASCII Horizontal Tab (TAB) '
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\v" | ASCII Vertical Tab (VT) '
'| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\v" | ASCII Vertical Tab (VT) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\ooo" | Character with octal value *ooo* | '
- '(2,4) |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\xhh" | Character with hex value *hh* | '
- '(3,4) |\n'
- '+-------------------+-----------------------------------+---------+\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\*ooo*" | Character with octal value *ooo* '
+ '| (2,4) |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\x*hh*" | Character with hex value *hh* '
+ '| (3,4) |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
'\n'
'Escape sequences only recognized in string literals are:\n'
'\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| Escape Sequence | Meaning | Notes '
- '|\n'
- '|===================|===================================|=========|\n'
- '| "\\N{name}" | Character named *name* in the | '
- '(5) |\n'
- '| | Unicode database | '
- '|\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\uxxxx" | Character with 16-bit hex value | '
- '(6) |\n'
- '| | *xxxx* | '
- '|\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\Uxxxxxxxx" | Character with 32-bit hex value | '
- '(7) |\n'
- '| | *xxxxxxxx* | '
- '|\n'
- '+-------------------+-----------------------------------+---------+\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| Escape Sequence | Meaning | '
+ 'Notes |\n'
+ '|===========================|===================================|=========|\n'
+ '| "\\N{*name*}" | Character named *name* in the '
+ '| (5) |\n'
+ '| | Unicode database '
+ '| |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\u*xxxx*" | Character with 16-bit hex value '
+ '| (6) |\n'
+ '| | *xxxx* '
+ '| |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
+ '| "\\U*xxxxxxxx*" | Character with 32-bit hex value '
+ '| (7) |\n'
+ '| | *xxxxxxxx* '
+ '| |\n'
+ '+---------------------------+-----------------------------------+---------+\n'
'\n'
'Notes:\n'
'\n'
@@ -12896,1145 +12892,1172 @@ topics = {'assert': 'The "assert" statement\n'
'definition\n'
'may change in the future.\n'
'\n'
+ '\n'
'None\n'
- ' This type has a single value. There is a single object with '
- 'this\n'
- ' value. This object is accessed through the built-in name "None". '
- 'It\n'
- ' is used to signify the absence of a value in many situations, '
- 'e.g.,\n'
- ' it is returned from functions that don’t explicitly return\n'
- ' anything. Its truth value is false.\n'
+ '====\n'
+ '\n'
+ 'This type has a single value. There is a single object with this\n'
+ 'value. This object is accessed through the built-in name "None". It '
+ 'is\n'
+ 'used to signify the absence of a value in many situations, e.g., it '
+ 'is\n'
+ 'returned from functions that don’t explicitly return anything. Its\n'
+ 'truth value is false.\n'
+ '\n'
'\n'
'NotImplemented\n'
- ' This type has a single value. There is a single object with '
- 'this\n'
- ' value. This object is accessed through the built-in name\n'
- ' "NotImplemented". Numeric methods and rich comparison methods\n'
- ' should return this value if they do not implement the operation '
- 'for\n'
- ' the operands provided. (The interpreter will then try the\n'
- ' reflected operation, or some other fallback, depending on the\n'
- ' operator.) It should not be evaluated in a boolean context.\n'
+ '==============\n'
+ '\n'
+ 'This type has a single value. There is a single object with this\n'
+ 'value. This object is accessed through the built-in name\n'
+ '"NotImplemented". Numeric methods and rich comparison methods '
+ 'should\n'
+ 'return this value if they do not implement the operation for the\n'
+ 'operands provided. (The interpreter will then try the reflected\n'
+ 'operation, or some other fallback, depending on the operator.) It\n'
+ 'should not be evaluated in a boolean context.\n'
'\n'
- ' See Implementing the arithmetic operations for more details.\n'
+ 'See Implementing the arithmetic operations for more details.\n'
+ '\n'
+ 'Changed in version 3.9: Evaluating "NotImplemented" in a boolean\n'
+ 'context is deprecated. While it currently evaluates as true, it '
+ 'will\n'
+ 'emit a "DeprecationWarning". It will raise a "TypeError" in a '
+ 'future\n'
+ 'version of Python.\n'
'\n'
- ' Changed in version 3.9: Evaluating "NotImplemented" in a '
- 'boolean\n'
- ' context is deprecated. While it currently evaluates as true, it\n'
- ' will emit a "DeprecationWarning". It will raise a "TypeError" in '
- 'a\n'
- ' future version of Python.\n'
'\n'
'Ellipsis\n'
- ' This type has a single value. There is a single object with '
- 'this\n'
- ' value. This object is accessed through the literal "..." or the\n'
- ' built-in name "Ellipsis". Its truth value is true.\n'
+ '========\n'
+ '\n'
+ 'This type has a single value. There is a single object with this\n'
+ 'value. This object is accessed through the literal "..." or the '
+ 'built-\n'
+ 'in name "Ellipsis". Its truth value is true.\n'
+ '\n'
'\n'
'"numbers.Number"\n'
- ' These are created by numeric literals and returned as results '
- 'by\n'
- ' arithmetic operators and arithmetic built-in functions. '
- 'Numeric\n'
- ' objects are immutable; once created their value never changes.\n'
- ' Python numbers are of course strongly related to mathematical\n'
- ' numbers, but subject to the limitations of numerical '
- 'representation\n'
- ' in computers.\n'
- '\n'
- ' The string representations of the numeric classes, computed by\n'
- ' "__repr__()" and "__str__()", have the following properties:\n'
- '\n'
- ' * They are valid numeric literals which, when passed to their '
+ '================\n'
+ '\n'
+ 'These are created by numeric literals and returned as results by\n'
+ 'arithmetic operators and arithmetic built-in functions. Numeric\n'
+ 'objects are immutable; once created their value never changes. '
+ 'Python\n'
+ 'numbers are of course strongly related to mathematical numbers, '
+ 'but\n'
+ 'subject to the limitations of numerical representation in '
+ 'computers.\n'
+ '\n'
+ 'The string representations of the numeric classes, computed by\n'
+ '"__repr__()" and "__str__()", have the following properties:\n'
+ '\n'
+ '* They are valid numeric literals which, when passed to their '
'class\n'
- ' constructor, produce an object having the value of the '
- 'original\n'
- ' numeric.\n'
+ ' constructor, produce an object having the value of the original\n'
+ ' numeric.\n'
'\n'
- ' * The representation is in base 10, when possible.\n'
+ '* The representation is in base 10, when possible.\n'
'\n'
- ' * Leading zeros, possibly excepting a single zero before a '
- 'decimal\n'
- ' point, are not shown.\n'
+ '* Leading zeros, possibly excepting a single zero before a decimal\n'
+ ' point, are not shown.\n'
'\n'
- ' * Trailing zeros, possibly excepting a single zero after a '
- 'decimal\n'
- ' point, are not shown.\n'
+ '* Trailing zeros, possibly excepting a single zero after a decimal\n'
+ ' point, are not shown.\n'
'\n'
- ' * A sign is shown only when the number is negative.\n'
+ '* A sign is shown only when the number is negative.\n'
'\n'
- ' Python distinguishes between integers, floating point numbers, '
- 'and\n'
- ' complex numbers:\n'
+ 'Python distinguishes between integers, floating point numbers, and\n'
+ 'complex numbers:\n'
'\n'
- ' "numbers.Integral"\n'
- ' These represent elements from the mathematical set of '
- 'integers\n'
- ' (positive and negative).\n'
'\n'
- ' There are two types of integers:\n'
+ '"numbers.Integral"\n'
+ '------------------\n'
'\n'
- ' Integers ("int")\n'
- ' These represent numbers in an unlimited range, subject to\n'
- ' available (virtual) memory only. For the purpose of '
- 'shift\n'
- ' and mask operations, a binary representation is assumed, '
- 'and\n'
- ' negative numbers are represented in a variant of 2’s\n'
- ' complement which gives the illusion of an infinite string '
- 'of\n'
- ' sign bits extending to the left.\n'
+ 'These represent elements from the mathematical set of integers\n'
+ '(positive and negative).\n'
'\n'
- ' Booleans ("bool")\n'
- ' These represent the truth values False and True. The two\n'
- ' objects representing the values "False" and "True" are '
- 'the\n'
- ' only Boolean objects. The Boolean type is a subtype of '
+ 'Note:\n'
+ '\n'
+ ' The rules for integer representation are intended to give the '
+ 'most\n'
+ ' meaningful interpretation of shift and mask operations involving\n'
+ ' negative integers.\n'
+ '\n'
+ 'There are two types of integers:\n'
+ '\n'
+ 'Integers ("int")\n'
+ ' These represent numbers in an unlimited range, subject to '
+ 'available\n'
+ ' (virtual) memory only. For the purpose of shift and mask\n'
+ ' operations, a binary representation is assumed, and negative\n'
+ ' numbers are represented in a variant of 2’s complement which '
+ 'gives\n'
+ ' the illusion of an infinite string of sign bits extending to '
'the\n'
- ' integer type, and Boolean values behave like the values 0 '
- 'and\n'
- ' 1, respectively, in almost all contexts, the exception '
- 'being\n'
- ' that when converted to a string, the strings ""False"" or\n'
- ' ""True"" are returned, respectively.\n'
+ ' left.\n'
+ '\n'
+ 'Booleans ("bool")\n'
+ ' These represent the truth values False and True. The two '
+ 'objects\n'
+ ' representing the values "False" and "True" are the only Boolean\n'
+ ' objects. The Boolean type is a subtype of the integer type, and\n'
+ ' Boolean values behave like the values 0 and 1, respectively, in\n'
+ ' almost all contexts, the exception being that when converted to '
+ 'a\n'
+ ' string, the strings ""False"" or ""True"" are returned,\n'
+ ' respectively.\n'
+ '\n'
+ '\n'
+ '"numbers.Real" ("float")\n'
+ '------------------------\n'
'\n'
- ' The rules for integer representation are intended to give '
+ 'These represent machine-level double precision floating point '
+ 'numbers.\n'
+ 'You are at the mercy of the underlying machine architecture (and C '
+ 'or\n'
+ 'Java implementation) for the accepted range and handling of '
+ 'overflow.\n'
+ 'Python does not support single-precision floating point numbers; '
'the\n'
- ' most meaningful interpretation of shift and mask operations\n'
- ' involving negative integers.\n'
- '\n'
- ' "numbers.Real" ("float")\n'
- ' These represent machine-level double precision floating '
- 'point\n'
- ' numbers. You are at the mercy of the underlying machine\n'
- ' architecture (and C or Java implementation) for the accepted\n'
- ' range and handling of overflow. Python does not support '
- 'single-\n'
- ' precision floating point numbers; the savings in processor '
- 'and\n'
- ' memory usage that are usually the reason for using these are\n'
- ' dwarfed by the overhead of using objects in Python, so there '
- 'is\n'
- ' no reason to complicate the language with two kinds of '
- 'floating\n'
- ' point numbers.\n'
- '\n'
- ' "numbers.Complex" ("complex")\n'
- ' These represent complex numbers as a pair of machine-level\n'
- ' double precision floating point numbers. The same caveats '
- 'apply\n'
- ' as for floating point numbers. The real and imaginary parts '
- 'of a\n'
- ' complex number "z" can be retrieved through the read-only\n'
- ' attributes "z.real" and "z.imag".\n'
+ 'savings in processor and memory usage that are usually the reason '
+ 'for\n'
+ 'using these are dwarfed by the overhead of using objects in Python, '
+ 'so\n'
+ 'there is no reason to complicate the language with two kinds of\n'
+ 'floating point numbers.\n'
+ '\n'
+ '\n'
+ '"numbers.Complex" ("complex")\n'
+ '-----------------------------\n'
+ '\n'
+ 'These represent complex numbers as a pair of machine-level double\n'
+ 'precision floating point numbers. The same caveats apply as for\n'
+ 'floating point numbers. The real and imaginary parts of a complex\n'
+ 'number "z" can be retrieved through the read-only attributes '
+ '"z.real"\n'
+ 'and "z.imag".\n'
+ '\n'
'\n'
'Sequences\n'
- ' These represent finite ordered sets indexed by non-negative\n'
- ' numbers. The built-in function "len()" returns the number of '
- 'items\n'
- ' of a sequence. When the length of a sequence is *n*, the index '
+ '=========\n'
+ '\n'
+ 'These represent finite ordered sets indexed by non-negative '
+ 'numbers.\n'
+ 'The built-in function "len()" returns the number of items of a\n'
+ 'sequence. When the length of a sequence is *n*, the index set '
+ 'contains\n'
+ 'the numbers 0, 1, …, *n*-1. Item *i* of sequence *a* is selected '
+ 'by\n'
+ '"a[i]".\n'
+ '\n'
+ 'Sequences also support slicing: "a[i:j]" selects all items with '
+ 'index\n'
+ '*k* such that *i* "<=" *k* "<" *j*. When used as an expression, a\n'
+ 'slice is a sequence of the same type. This implies that the index '
'set\n'
- ' contains the numbers 0, 1, …, *n*-1. Item *i* of sequence *a* '
- 'is\n'
- ' selected by "a[i]".\n'
+ 'is renumbered so that it starts at 0.\n'
'\n'
- ' Sequences also support slicing: "a[i:j]" selects all items with\n'
- ' index *k* such that *i* "<=" *k* "<" *j*. When used as an\n'
- ' expression, a slice is a sequence of the same type. This '
- 'implies\n'
- ' that the index set is renumbered so that it starts at 0.\n'
+ 'Some sequences also support “extended slicing” with a third “step”\n'
+ 'parameter: "a[i:j:k]" selects all items of *a* with index *x* where '
+ '"x\n'
+ '= i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n'
'\n'
- ' Some sequences also support “extended slicing” with a third '
- '“step”\n'
- ' parameter: "a[i:j:k]" selects all items of *a* with index *x* '
- 'where\n'
- ' "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n'
+ 'Sequences are distinguished according to their mutability:\n'
'\n'
- ' Sequences are distinguished according to their mutability:\n'
'\n'
- ' Immutable sequences\n'
- ' An object of an immutable sequence type cannot change once it '
- 'is\n'
- ' created. (If the object contains references to other '
- 'objects,\n'
- ' these other objects may be mutable and may be changed; '
- 'however,\n'
- ' the collection of objects directly referenced by an '
- 'immutable\n'
- ' object cannot change.)\n'
+ 'Immutable sequences\n'
+ '-------------------\n'
'\n'
- ' The following types are immutable sequences:\n'
+ 'An object of an immutable sequence type cannot change once it is\n'
+ 'created. (If the object contains references to other objects, '
+ 'these\n'
+ 'other objects may be mutable and may be changed; however, the\n'
+ 'collection of objects directly referenced by an immutable object\n'
+ 'cannot change.)\n'
'\n'
- ' Strings\n'
- ' A string is a sequence of values that represent Unicode '
- 'code\n'
- ' points. All the code points in the range "U+0000 - '
- 'U+10FFFF"\n'
- ' can be represented in a string. Python doesn’t have a '
- 'char\n'
- ' type; instead, every code point in the string is '
- 'represented\n'
- ' as a string object with length "1". The built-in '
- 'function\n'
- ' "ord()" converts a code point from its string form to an\n'
- ' integer in the range "0 - 10FFFF"; "chr()" converts an\n'
- ' integer in the range "0 - 10FFFF" to the corresponding '
- 'length\n'
- ' "1" string object. "str.encode()" can be used to convert '
- 'a\n'
- ' "str" to "bytes" using the given text encoding, and\n'
- ' "bytes.decode()" can be used to achieve the opposite.\n'
+ 'The following types are immutable sequences:\n'
'\n'
- ' Tuples\n'
- ' The items of a tuple are arbitrary Python objects. Tuples '
- 'of\n'
- ' two or more items are formed by comma-separated lists of\n'
- ' expressions. A tuple of one item (a ‘singleton’) can be\n'
- ' formed by affixing a comma to an expression (an expression '
- 'by\n'
- ' itself does not create a tuple, since parentheses must be\n'
- ' usable for grouping of expressions). An empty tuple can '
+ 'Strings\n'
+ ' A string is a sequence of values that represent Unicode code\n'
+ ' points. All the code points in the range "U+0000 - U+10FFFF" can '
'be\n'
- ' formed by an empty pair of parentheses.\n'
- '\n'
- ' Bytes\n'
- ' A bytes object is an immutable array. The items are '
- '8-bit\n'
- ' bytes, represented by integers in the range 0 <= x < 256.\n'
- ' Bytes literals (like "b\'abc\'") and the built-in '
- '"bytes()"\n'
- ' constructor can be used to create bytes objects. Also, '
- 'bytes\n'
- ' objects can be decoded to strings via the "decode()" '
- 'method.\n'
+ ' represented in a string. Python doesn’t have a char type; '
+ 'instead,\n'
+ ' every code point in the string is represented as a string '
+ 'object\n'
+ ' with length "1". The built-in function "ord()" converts a code\n'
+ ' point from its string form to an integer in the range "0 - '
+ '10FFFF";\n'
+ ' "chr()" converts an integer in the range "0 - 10FFFF" to the\n'
+ ' corresponding length "1" string object. "str.encode()" can be '
+ 'used\n'
+ ' to convert a "str" to "bytes" using the given text encoding, '
+ 'and\n'
+ ' "bytes.decode()" can be used to achieve the opposite.\n'
'\n'
- ' Mutable sequences\n'
- ' Mutable sequences can be changed after they are created. '
- 'The\n'
- ' subscription and slicing notations can be used as the target '
+ 'Tuples\n'
+ ' The items of a tuple are arbitrary Python objects. Tuples of two '
+ 'or\n'
+ ' more items are formed by comma-separated lists of expressions. '
+ 'A\n'
+ ' tuple of one item (a ‘singleton’) can be formed by affixing a '
+ 'comma\n'
+ ' to an expression (an expression by itself does not create a '
+ 'tuple,\n'
+ ' since parentheses must be usable for grouping of expressions). '
+ 'An\n'
+ ' empty tuple can be formed by an empty pair of parentheses.\n'
+ '\n'
+ 'Bytes\n'
+ ' A bytes object is an immutable array. The items are 8-bit '
+ 'bytes,\n'
+ ' represented by integers in the range 0 <= x < 256. Bytes '
+ 'literals\n'
+ ' (like "b\'abc\'") and the built-in "bytes()" constructor can be '
+ 'used\n'
+ ' to create bytes objects. Also, bytes objects can be decoded to\n'
+ ' strings via the "decode()" method.\n'
+ '\n'
+ '\n'
+ 'Mutable sequences\n'
+ '-----------------\n'
+ '\n'
+ 'Mutable sequences can be changed after they are created. The\n'
+ 'subscription and slicing notations can be used as the target of\n'
+ 'assignment and "del" (delete) statements.\n'
+ '\n'
+ 'Note:\n'
+ '\n'
+ ' The "collections" and "array" module provide additional examples '
'of\n'
- ' assignment and "del" (delete) statements.\n'
+ ' mutable sequence types.\n'
'\n'
- ' There are currently two intrinsic mutable sequence types:\n'
+ 'There are currently two intrinsic mutable sequence types:\n'
'\n'
- ' Lists\n'
- ' The items of a list are arbitrary Python objects. Lists '
- 'are\n'
- ' formed by placing a comma-separated list of expressions '
- 'in\n'
- ' square brackets. (Note that there are no special cases '
- 'needed\n'
- ' to form lists of length 0 or 1.)\n'
+ 'Lists\n'
+ ' The items of a list are arbitrary Python objects. Lists are '
+ 'formed\n'
+ ' by placing a comma-separated list of expressions in square\n'
+ ' brackets. (Note that there are no special cases needed to form\n'
+ ' lists of length 0 or 1.)\n'
'\n'
- ' Byte Arrays\n'
- ' A bytearray object is a mutable array. They are created '
- 'by\n'
- ' the built-in "bytearray()" constructor. Aside from being\n'
- ' mutable (and hence unhashable), byte arrays otherwise '
- 'provide\n'
- ' the same interface and functionality as immutable "bytes"\n'
- ' objects.\n'
+ 'Byte Arrays\n'
+ ' A bytearray object is a mutable array. They are created by the\n'
+ ' built-in "bytearray()" constructor. Aside from being mutable '
+ '(and\n'
+ ' hence unhashable), byte arrays otherwise provide the same '
+ 'interface\n'
+ ' and functionality as immutable "bytes" objects.\n'
'\n'
- ' The extension module "array" provides an additional example '
- 'of a\n'
- ' mutable sequence type, as does the "collections" module.\n'
'\n'
'Set types\n'
- ' These represent unordered, finite sets of unique, immutable\n'
- ' objects. As such, they cannot be indexed by any subscript. '
- 'However,\n'
- ' they can be iterated over, and the built-in function "len()"\n'
- ' returns the number of items in a set. Common uses for sets are '
- 'fast\n'
- ' membership testing, removing duplicates from a sequence, and\n'
- ' computing mathematical operations such as intersection, union,\n'
- ' difference, and symmetric difference.\n'
- '\n'
- ' For set elements, the same immutability rules apply as for\n'
- ' dictionary keys. Note that numeric types obey the normal rules '
- 'for\n'
- ' numeric comparison: if two numbers compare equal (e.g., "1" and\n'
- ' "1.0"), only one of them can be contained in a set.\n'
+ '=========\n'
+ '\n'
+ 'These represent unordered, finite sets of unique, immutable '
+ 'objects.\n'
+ 'As such, they cannot be indexed by any subscript. However, they can '
+ 'be\n'
+ 'iterated over, and the built-in function "len()" returns the number '
+ 'of\n'
+ 'items in a set. Common uses for sets are fast membership testing,\n'
+ 'removing duplicates from a sequence, and computing mathematical\n'
+ 'operations such as intersection, union, difference, and symmetric\n'
+ 'difference.\n'
+ '\n'
+ 'For set elements, the same immutability rules apply as for '
+ 'dictionary\n'
+ 'keys. Note that numeric types obey the normal rules for numeric\n'
+ 'comparison: if two numbers compare equal (e.g., "1" and "1.0"), '
+ 'only\n'
+ 'one of them can be contained in a set.\n'
+ '\n'
+ 'There are currently two intrinsic set types:\n'
'\n'
- ' There are currently two intrinsic set types:\n'
+ 'Sets\n'
+ ' These represent a mutable set. They are created by the built-in\n'
+ ' "set()" constructor and can be modified afterwards by several\n'
+ ' methods, such as "add()".\n'
'\n'
- ' Sets\n'
- ' These represent a mutable set. They are created by the '
+ 'Frozen sets\n'
+ ' These represent an immutable set. They are created by the '
'built-in\n'
- ' "set()" constructor and can be modified afterwards by '
- 'several\n'
- ' methods, such as "add()".\n'
- '\n'
- ' Frozen sets\n'
- ' These represent an immutable set. They are created by the\n'
- ' built-in "frozenset()" constructor. As a frozenset is '
- 'immutable\n'
- ' and *hashable*, it can be used again as an element of '
- 'another\n'
- ' set, or as a dictionary key.\n'
+ ' "frozenset()" constructor. As a frozenset is immutable and\n'
+ ' *hashable*, it can be used again as an element of another set, '
+ 'or\n'
+ ' as a dictionary key.\n'
+ '\n'
'\n'
'Mappings\n'
- ' These represent finite sets of objects indexed by arbitrary '
- 'index\n'
- ' sets. The subscript notation "a[k]" selects the item indexed by '
+ '========\n'
+ '\n'
+ 'These represent finite sets of objects indexed by arbitrary index\n'
+ 'sets. The subscript notation "a[k]" selects the item indexed by '
'"k"\n'
- ' from the mapping "a"; this can be used in expressions and as '
- 'the\n'
- ' target of assignments or "del" statements. The built-in '
- 'function\n'
- ' "len()" returns the number of items in a mapping.\n'
+ 'from the mapping "a"; this can be used in expressions and as the\n'
+ 'target of assignments or "del" statements. The built-in function\n'
+ '"len()" returns the number of items in a mapping.\n'
'\n'
- ' There is currently a single intrinsic mapping type:\n'
+ 'There is currently a single intrinsic mapping type:\n'
'\n'
- ' Dictionaries\n'
- ' These represent finite sets of objects indexed by nearly\n'
- ' arbitrary values. The only types of values not acceptable '
- 'as\n'
- ' keys are values containing lists or dictionaries or other\n'
- ' mutable types that are compared by value rather than by '
- 'object\n'
- ' identity, the reason being that the efficient implementation '
- 'of\n'
- ' dictionaries requires a key’s hash value to remain constant.\n'
- ' Numeric types used for keys obey the normal rules for '
- 'numeric\n'
- ' comparison: if two numbers compare equal (e.g., "1" and '
- '"1.0")\n'
- ' then they can be used interchangeably to index the same\n'
- ' dictionary entry.\n'
- '\n'
- ' Dictionaries preserve insertion order, meaning that keys will '
- 'be\n'
- ' produced in the same order they were added sequentially over '
- 'the\n'
- ' dictionary. Replacing an existing key does not change the '
- 'order,\n'
- ' however removing a key and re-inserting it will add it to '
+ '\n'
+ 'Dictionaries\n'
+ '------------\n'
+ '\n'
+ 'These represent finite sets of objects indexed by nearly arbitrary\n'
+ 'values. The only types of values not acceptable as keys are '
+ 'values\n'
+ 'containing lists or dictionaries or other mutable types that are\n'
+ 'compared by value rather than by object identity, the reason being\n'
+ 'that the efficient implementation of dictionaries requires a key’s\n'
+ 'hash value to remain constant. Numeric types used for keys obey '
'the\n'
- ' end instead of keeping its old place.\n'
+ 'normal rules for numeric comparison: if two numbers compare equal\n'
+ '(e.g., "1" and "1.0") then they can be used interchangeably to '
+ 'index\n'
+ 'the same dictionary entry.\n'
'\n'
- ' Dictionaries are mutable; they can be created by the "{...}"\n'
- ' notation (see section Dictionary displays).\n'
+ 'Dictionaries preserve insertion order, meaning that keys will be\n'
+ 'produced in the same order they were added sequentially over the\n'
+ 'dictionary. Replacing an existing key does not change the order,\n'
+ 'however removing a key and re-inserting it will add it to the end\n'
+ 'instead of keeping its old place.\n'
'\n'
- ' The extension modules "dbm.ndbm" and "dbm.gnu" provide\n'
- ' additional examples of mapping types, as does the '
- '"collections"\n'
- ' module.\n'
+ 'Dictionaries are mutable; they can be created by the "{...}" '
+ 'notation\n'
+ '(see section Dictionary displays).\n'
+ '\n'
+ 'The extension modules "dbm.ndbm" and "dbm.gnu" provide additional\n'
+ 'examples of mapping types, as does the "collections" module.\n'
+ '\n'
+ 'Changed in version 3.7: Dictionaries did not preserve insertion '
+ 'order\n'
+ 'in versions of Python before 3.6. In CPython 3.6, insertion order '
+ 'was\n'
+ 'preserved, but it was considered an implementation detail at that '
+ 'time\n'
+ 'rather than a language guarantee.\n'
'\n'
- ' Changed in version 3.7: Dictionaries did not preserve '
- 'insertion\n'
- ' order in versions of Python before 3.6. In CPython 3.6,\n'
- ' insertion order was preserved, but it was considered an\n'
- ' implementation detail at that time rather than a language\n'
- ' guarantee.\n'
'\n'
'Callable types\n'
- ' These are the types to which the function call operation (see\n'
- ' section Calls) can be applied:\n'
+ '==============\n'
'\n'
- ' User-defined functions\n'
- ' A user-defined function object is created by a function\n'
- ' definition (see section Function definitions). It should be\n'
- ' called with an argument list containing the same number of '
- 'items\n'
- ' as the function’s formal parameter list.\n'
+ 'These are the types to which the function call operation (see '
+ 'section\n'
+ 'Calls) can be applied:\n'
'\n'
- ' Special attributes:\n'
'\n'
- ' '
+ 'User-defined functions\n'
+ '----------------------\n'
+ '\n'
+ 'A user-defined function object is created by a function definition\n'
+ '(see section Function definitions). It should be called with an\n'
+ 'argument list containing the same number of items as the '
+ 'function’s\n'
+ 'formal parameter list.\n'
+ '\n'
+ 'Special attributes:\n'
+ '\n'
'+---------------------------+---------------------------------+-------------+\n'
- ' | Attribute | Meaning '
+ '| Attribute | Meaning '
'| |\n'
- ' '
'|===========================|=================================|=============|\n'
- ' | "__doc__" | The function’s documentation '
- '| Writable |\n'
- ' | | string, or "None" if '
+ '| "__doc__" | The function’s documentation | '
+ 'Writable |\n'
+ '| | string, or "None" if '
'| |\n'
- ' | | unavailable; not inherited by '
+ '| | unavailable; not inherited by '
'| |\n'
- ' | | subclasses. '
+ '| | subclasses. '
'| |\n'
- ' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__name__" | The function’s name. '
- '| Writable |\n'
- ' '
+ '| "__name__" | The function’s name. | '
+ 'Writable |\n'
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__qualname__" | The function’s *qualified '
- '| Writable |\n'
- ' | | name*. New in version 3.3. '
+ '| "__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 '
+ '| "__module__" | The name of the module the | '
+ 'Writable |\n'
+ '| | function was defined in, or '
'| |\n'
- ' | | "None" if unavailable. '
+ '| | "None" if unavailable. '
'| |\n'
- ' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__defaults__" | A tuple containing default '
- '| Writable |\n'
- ' | | argument values for those '
+ '| "__defaults__" | A tuple containing default | '
+ 'Writable |\n'
+ '| | argument values for those '
'| |\n'
- ' | | arguments that have defaults, '
+ '| | arguments that have defaults, '
'| |\n'
- ' | | or "None" if no arguments have '
+ '| | or "None" if no arguments have '
'| |\n'
- ' | | a default value. '
+ '| | a default value. '
'| |\n'
- ' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__code__" | The code object representing '
- '| Writable |\n'
- ' | | the compiled function body. '
+ '| "__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 '
+ '| "__globals__" | A reference to the dictionary | '
+ 'Read-only |\n'
+ '| | that holds the function’s '
'| |\n'
- ' | | global variables — the global '
+ '| | global variables — the global '
'| |\n'
- ' | | namespace of the module in '
+ '| | namespace of the module in '
'| |\n'
- ' | | which the function was defined. '
+ '| | which the function was defined. '
'| |\n'
- ' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__dict__" | The namespace supporting '
- '| Writable |\n'
- ' | | arbitrary function attributes. '
+ '| "__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 '
+ '| "__closure__" | "None" or a tuple of cells that | '
+ 'Read-only |\n'
+ '| | contain bindings for the '
'| |\n'
- ' | | function’s free variables. See '
+ '| | function’s free variables. See '
'| |\n'
- ' | | below for information on the '
+ '| | below for information on the '
'| |\n'
- ' | | "cell_contents" attribute. '
+ '| | "cell_contents" attribute. '
'| |\n'
- ' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__annotations__" | A dict containing annotations '
- '| Writable |\n'
- ' | | of parameters. The keys of the '
+ '| "__annotations__" | A dict containing annotations | '
+ 'Writable |\n'
+ '| | of parameters. The keys of the '
+ '| |\n'
+ '| | dict are the parameter names, '
'| |\n'
- ' | | dict are the parameter names, '
+ '| | and "\'return\'" for the return '
'| |\n'
- ' | | and "\'return\'" for the '
- 'return | |\n'
- ' | | annotation, if provided. For '
+ '| | annotation, if provided. For '
'| |\n'
- ' | | more information on working '
+ '| | more information on working '
'| |\n'
- ' | | with this attribute, see '
+ '| | with this attribute, see '
'| |\n'
- ' | | Annotations Best Practices. '
+ '| | Annotations Best Practices. '
'| |\n'
- ' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__kwdefaults__" | A dict containing defaults for '
- '| Writable |\n'
- ' | | keyword-only parameters. '
+ '| "__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'
+ 'Most of the attributes labelled “Writable” check the type of the\n'
+ 'assigned value.\n'
'\n'
- ' Function objects also support getting and setting arbitrary\n'
- ' attributes, which can be used, for example, to attach '
- 'metadata\n'
- ' to functions. Regular attribute dot-notation is used to get '
- 'and\n'
- ' set such attributes. *Note that the current implementation '
- 'only\n'
- ' supports function attributes on user-defined functions. '
- 'Function\n'
- ' attributes on built-in functions may be supported in the\n'
- ' future.*\n'
- '\n'
- ' A cell object has the attribute "cell_contents". This can be\n'
- ' used to get the value of the cell, as well as set the value.\n'
- '\n'
- ' Additional information about a function’s definition can be\n'
- ' retrieved from its code object; see the description of '
- 'internal\n'
- ' types below. The "cell" type can be accessed in the "types"\n'
- ' module.\n'
- '\n'
- ' Instance methods\n'
- ' An instance method object combines a class, a class instance '
- 'and\n'
- ' any callable object (normally a user-defined function).\n'
- '\n'
- ' Special read-only attributes: "__self__" is the class '
- 'instance\n'
- ' object, "__func__" is the function object; "__doc__" is the\n'
- ' method’s documentation (same as "__func__.__doc__"); '
- '"__name__"\n'
- ' is the method name (same as "__func__.__name__"); '
- '"__module__"\n'
- ' is the name of the module the method was defined in, or '
- '"None"\n'
- ' if unavailable.\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'
'\n'
- ' Methods also support accessing (but not setting) the '
- 'arbitrary\n'
- ' function attributes on the underlying function object.\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'
'\n'
- ' User-defined method objects may be created when getting an\n'
- ' attribute of a class (perhaps via an instance of that class), '
- 'if\n'
- ' that attribute is a user-defined function object or a class\n'
- ' method object.\n'
- '\n'
- ' When an instance method object is created by retrieving a '
- 'user-\n'
- ' defined function object from a class via one of its '
- 'instances,\n'
- ' its "__self__" attribute is the instance, and the method '
- 'object\n'
- ' is said to be bound. The new method’s "__func__" attribute '
- 'is\n'
- ' the original function object.\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'
'\n'
- ' When an instance method object is created by retrieving a '
- 'class\n'
- ' method object from a class or instance, its "__self__" '
- 'attribute\n'
- ' 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\n'
- ' function ("__func__") is called, inserting the class '
- 'instance\n'
- ' ("__self__") in front of the argument list. For instance, '
- 'when\n'
- ' "C" is a class which contains a definition for a function '
- '"f()",\n'
- ' and "x" is an instance of "C", calling "x.f(1)" is equivalent '
- 'to\n'
- ' calling "C.f(x, 1)".\n'
+ 'Instance methods\n'
+ '----------------\n'
+ '\n'
+ 'An instance method object combines a class, a class instance and '
+ 'any\n'
+ 'callable object (normally a user-defined function).\n'
'\n'
- ' When an instance method object is derived from a class '
+ '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'
- ' object, the “class instance” stored in "__self__" will '
- 'actually\n'
- ' be the class itself, so that calling either "x.f(1)" or '
- '"C.f(1)"\n'
- ' is equivalent to calling "f(C,1)" where "f" is the '
- 'underlying\n'
- ' function.\n'
- '\n'
- ' Note that the transformation from function object to '
- 'instance\n'
- ' method object happens each time the attribute is retrieved '
- 'from\n'
- ' the instance. In some cases, a fruitful optimization is to\n'
- ' assign the attribute to a local variable and call that local\n'
- ' variable. Also notice that this transformation only happens '
- 'for\n'
- ' user-defined functions; other callable objects (and all non-\n'
- ' callable objects) are retrieved without transformation. It '
- 'is\n'
- ' also important to note that user-defined functions which are\n'
- ' attributes of a class instance are not converted to bound\n'
- ' methods; this *only* happens when the function is an '
+ 'name (same as "__func__.__name__"); "__module__" is the name of '
+ 'the\n'
+ 'module the method was defined in, or "None" if unavailable.\n'
+ '\n'
+ 'Methods also support accessing (but not setting) the arbitrary\n'
+ 'function attributes on the underlying function object.\n'
+ '\n'
+ 'User-defined method objects may be created when getting an '
+ 'attribute\n'
+ 'of a class (perhaps via an instance of that class), if that '
'attribute\n'
- ' of the class.\n'
+ 'is a user-defined function object or a class method object.\n'
'\n'
- ' Generator functions\n'
- ' A function or method which uses the "yield" statement (see\n'
- ' section The yield statement) is called a *generator '
- 'function*.\n'
- ' Such a function, when called, always returns an *iterator*\n'
- ' object which can be used to execute the body of the '
- 'function:\n'
- ' calling the iterator’s "iterator.__next__()" method will '
- 'cause\n'
- ' the function to execute until it provides a value using the\n'
- ' "yield" statement. When the function executes a "return"\n'
- ' statement or falls off the end, a "StopIteration" exception '
- 'is\n'
- ' raised and the iterator will have reached the end of the set '
+ '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'
+ '\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'
+ '\n'
+ 'When an instance method object is called, the underlying function\n'
+ '("__func__") is called, inserting the class instance ("__self__") '
+ 'in\n'
+ 'front of the argument list. For instance, when "C" is a class '
+ 'which\n'
+ 'contains a definition for a function "f()", and "x" is an instance '
'of\n'
- ' values to be returned.\n'
- '\n'
- ' Coroutine functions\n'
- ' A function or method which is defined using "async def" is\n'
- ' called a *coroutine function*. Such a function, when '
- 'called,\n'
- ' returns a *coroutine* object. It may contain "await"\n'
- ' expressions, as well as "async with" and "async for" '
- 'statements.\n'
- ' See also the Coroutine Objects section.\n'
- '\n'
- ' Asynchronous generator functions\n'
- ' A function or method which is defined using "async def" and\n'
- ' which uses the "yield" statement is called a *asynchronous\n'
- ' generator function*. Such a function, when called, returns '
- 'an\n'
- ' *asynchronous iterator* object which can be used in an '
- '"async\n'
- ' for" statement to execute the body of the function.\n'
+ '"C", calling "x.f(1)" is equivalent to calling "C.f(x, 1)".\n'
'\n'
- ' Calling the asynchronous iterator’s "aiterator.__anext__" '
+ 'When an instance method object is derived from a class method '
+ 'object,\n'
+ 'the “class instance” stored in "__self__" will actually be the '
+ 'class\n'
+ 'itself, so that calling either "x.f(1)" or "C.f(1)" is equivalent '
+ 'to\n'
+ 'calling "f(C,1)" where "f" is the underlying function.\n'
+ '\n'
+ 'Note that the transformation from function object to instance '
'method\n'
- ' will return an *awaitable* which when awaited will execute '
+ 'object happens each time the attribute is retrieved from the '
+ 'instance.\n'
+ 'In some cases, a fruitful optimization is to assign the attribute '
+ 'to a\n'
+ 'local variable and call that local variable. Also notice that this\n'
+ 'transformation only happens for user-defined functions; other '
+ 'callable\n'
+ 'objects (and all non-callable objects) are retrieved without\n'
+ 'transformation. It is also important to note that user-defined\n'
+ 'functions which are attributes of a class instance are not '
+ 'converted\n'
+ 'to bound methods; this *only* happens when the function is an\n'
+ 'attribute of the class.\n'
+ '\n'
+ '\n'
+ 'Generator functions\n'
+ '-------------------\n'
+ '\n'
+ 'A function or method which uses the "yield" statement (see section '
+ 'The\n'
+ 'yield statement) is called a *generator function*. Such a '
+ 'function,\n'
+ 'when called, always returns an *iterator* object which can be used '
+ 'to\n'
+ 'execute the body of the function: calling the iterator’s\n'
+ '"iterator.__next__()" method will cause the function to execute '
'until\n'
- ' it provides a value using the "yield" expression. When the\n'
- ' function executes an empty "return" statement or falls off '
+ 'it provides a value using the "yield" statement. When the '
+ 'function\n'
+ 'executes a "return" statement or falls off the end, a '
+ '"StopIteration"\n'
+ 'exception is raised and the iterator will have reached the end of '
'the\n'
- ' end, a "StopAsyncIteration" exception is raised and the\n'
- ' asynchronous iterator will have reached the end of the set '
- 'of\n'
- ' values to be yielded.\n'
+ 'set of values to be returned.\n'
'\n'
- ' Built-in functions\n'
- ' A built-in function object is a wrapper around a C function.\n'
- ' Examples of built-in functions are "len()" and "math.sin()"\n'
- ' ("math" is a standard built-in module). The number and type '
- 'of\n'
- ' the arguments are determined by the C function. Special '
- 'read-\n'
- ' only attributes: "__doc__" is the function’s documentation\n'
- ' string, or "None" if unavailable; "__name__" is the '
- 'function’s\n'
- ' name; "__self__" is set to "None" (but see the next item);\n'
- ' "__module__" is the name of the module the function was '
- 'defined\n'
- ' in or "None" if unavailable.\n'
'\n'
- ' Built-in methods\n'
- ' This is really a different disguise of a built-in function, '
- 'this\n'
- ' time containing an object passed to the C function as an\n'
- ' implicit extra argument. An example of a built-in method is\n'
- ' "alist.append()", assuming *alist* is a list object. In this\n'
- ' case, the special read-only attribute "__self__" is set to '
+ 'Coroutine functions\n'
+ '-------------------\n'
+ '\n'
+ 'A function or method which is defined using "async def" is called '
+ 'a\n'
+ '*coroutine function*. Such a function, when called, returns a\n'
+ '*coroutine* object. It may contain "await" expressions, as well '
+ 'as\n'
+ '"async with" and "async for" statements. See also the Coroutine\n'
+ 'Objects section.\n'
+ '\n'
+ '\n'
+ 'Asynchronous generator functions\n'
+ '--------------------------------\n'
+ '\n'
+ 'A function or method which is defined using "async def" and which '
+ 'uses\n'
+ 'the "yield" statement is called a *asynchronous generator '
+ 'function*.\n'
+ 'Such a function, when called, returns an *asynchronous iterator*\n'
+ 'object which can be used in an "async for" statement to execute '
'the\n'
- ' object denoted by *alist*.\n'
+ 'body of the function.\n'
+ '\n'
+ 'Calling the asynchronous iterator’s "aiterator.__anext__" method '
+ 'will\n'
+ 'return an *awaitable* which when awaited will execute until it\n'
+ 'provides a value using the "yield" expression. When the function\n'
+ 'executes an empty "return" statement or falls off the end, a\n'
+ '"StopAsyncIteration" exception is raised and the asynchronous '
+ 'iterator\n'
+ 'will have reached the end of the set of values to be yielded.\n'
+ '\n'
+ '\n'
+ 'Built-in functions\n'
+ '------------------\n'
+ '\n'
+ 'A built-in function object is a wrapper around a C function. '
+ 'Examples\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'
+ '\n'
+ '\n'
+ 'Built-in methods\n'
+ '----------------\n'
+ '\n'
+ 'This is really a different disguise of a built-in function, this '
+ 'time\n'
+ 'containing an object passed to the C function as an implicit extra\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'
+ '\n'
+ '\n'
+ 'Classes\n'
+ '-------\n'
+ '\n'
+ 'Classes are callable. These objects normally act as factories for '
+ 'new\n'
+ 'instances of themselves, but variations are possible for class '
+ 'types\n'
+ 'that override "__new__()". The arguments of the call are passed '
+ 'to\n'
+ '"__new__()" and, in the typical case, to "__init__()" to '
+ 'initialize\n'
+ 'the new instance.\n'
'\n'
- ' Classes\n'
- ' Classes are callable. These objects normally act as '
- 'factories\n'
- ' for new instances of themselves, but variations are possible '
- 'for\n'
- ' class types that override "__new__()". The arguments of the\n'
- ' call are passed to "__new__()" and, in the typical case, to\n'
- ' "__init__()" to initialize the new instance.\n'
'\n'
- ' Class Instances\n'
- ' Instances of arbitrary classes can be made callable by '
- 'defining\n'
- ' a "__call__()" method in their class.\n'
+ 'Class Instances\n'
+ '---------------\n'
+ '\n'
+ 'Instances of arbitrary classes can be made callable by defining a\n'
+ '"__call__()" method in their class.\n'
+ '\n'
'\n'
'Modules\n'
- ' Modules are a basic organizational unit of Python code, and are\n'
- ' created by the import system as invoked either by the "import"\n'
- ' statement, or by calling functions such as\n'
- ' "importlib.import_module()" and built-in "__import__()". A '
- 'module\n'
- ' object has a namespace implemented by a dictionary object (this '
- 'is\n'
- ' the dictionary referenced by the "__globals__" attribute of\n'
- ' functions defined in the module). Attribute references are\n'
- ' translated to lookups in this dictionary, e.g., "m.x" is '
- 'equivalent\n'
- ' to "m.__dict__["x"]". A module object does not contain the code\n'
- ' object used to initialize the module (since it isn’t needed '
- 'once\n'
- ' the initialization is done).\n'
+ '=======\n'
+ '\n'
+ 'Modules are a basic organizational unit of Python code, and are\n'
+ 'created by the import system as invoked either by the "import"\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'
+ '\n'
+ 'Attribute assignment updates the module’s namespace dictionary, '
+ 'e.g.,\n'
+ '"m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n'
'\n'
- ' Attribute assignment updates the module’s namespace dictionary,\n'
- ' e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n'
+ 'Predefined (writable) attributes:\n'
'\n'
- ' Predefined (writable) attributes:\n'
+ ' "__name__"\n'
+ ' The module’s name.\n'
'\n'
- ' "__name__"\n'
- ' The module’s name.\n'
+ ' "__doc__"\n'
+ ' The module’s documentation string, or "None" if unavailable.\n'
'\n'
- ' "__doc__"\n'
- ' The module’s documentation string, or "None" if '
- 'unavailable.\n'
+ ' "__file__"\n'
+ ' The pathname of the file from which the module was loaded, if '
+ 'it\n'
+ ' was loaded from a file. The "__file__" attribute may be '
+ 'missing\n'
+ ' for certain types of modules, such as C modules that are\n'
+ ' statically linked into the interpreter. For extension '
+ 'modules\n'
+ ' loaded dynamically from a shared library, it’s the pathname '
+ 'of\n'
+ ' the shared library file.\n'
'\n'
- ' "__file__"\n'
- ' The pathname of the file from which the module was loaded, '
- 'if\n'
- ' it was loaded from a file. The "__file__" attribute may '
- 'be\n'
- ' missing for certain types of modules, such as C modules '
- 'that\n'
- ' are statically linked into the interpreter. For '
- 'extension\n'
- ' modules loaded dynamically from a shared library, it’s '
- 'the\n'
- ' pathname of the shared library file.\n'
- '\n'
- ' "__annotations__"\n'
- ' A dictionary containing *variable annotations* collected\n'
- ' during module body execution. For best practices on '
- 'working\n'
- ' with "__annotations__", please see Annotations Best\n'
- ' Practices.\n'
- '\n'
- ' Special read-only attribute: "__dict__" is the module’s '
- 'namespace\n'
- ' as a dictionary object.\n'
- '\n'
- ' **CPython implementation detail:** Because of the way CPython\n'
- ' clears module dictionaries, the module dictionary will be '
- 'cleared\n'
- ' when the module falls out of scope even if the dictionary still '
- 'has\n'
- ' live references. To avoid this, copy the dictionary or keep '
+ ' "__annotations__"\n'
+ ' A dictionary containing *variable annotations* collected '
+ 'during\n'
+ ' module body execution. For best practices on working with\n'
+ ' "__annotations__", please see Annotations Best Practices.\n'
+ '\n'
+ 'Special read-only attribute: "__dict__" is the module’s namespace '
+ 'as a\n'
+ 'dictionary object.\n'
+ '\n'
+ '**CPython implementation detail:** Because of the way CPython '
+ 'clears\n'
+ 'module dictionaries, the module dictionary will be cleared when '
'the\n'
- ' module around while using its dictionary directly.\n'
+ 'module falls out of scope even if the dictionary still has live\n'
+ 'references. To avoid this, copy the dictionary or keep the module\n'
+ 'around while using its dictionary directly.\n'
+ '\n'
'\n'
'Custom classes\n'
- ' Custom class types are typically created by class definitions '
- '(see\n'
- ' section Class definitions). A class has a namespace implemented '
- 'by\n'
- ' a dictionary object. Class attribute references are translated '
- 'to\n'
- ' lookups in this dictionary, e.g., "C.x" is translated to\n'
- ' "C.__dict__["x"]" (although there are a number of hooks which '
+ '==============\n'
+ '\n'
+ 'Custom class types are typically created by class definitions (see\n'
+ 'section Class definitions). A class has a namespace implemented by '
+ 'a\n'
+ 'dictionary object. Class attribute references are translated to\n'
+ 'lookups in this dictionary, e.g., "C.x" is translated to\n'
+ '"C.__dict__["x"]" (although there are a number of hooks which '
'allow\n'
- ' for other means of locating attributes). When the attribute name '
+ 'for other means of locating attributes). When the attribute name '
'is\n'
- ' not found there, the attribute search continues in the base\n'
- ' classes. This search of the base classes uses the C3 method\n'
- ' resolution order which behaves correctly even in the presence '
- 'of\n'
- ' ‘diamond’ inheritance structures where there are multiple\n'
- ' inheritance paths leading back to a common ancestor. Additional\n'
- ' details on the C3 MRO used by Python can be found in the\n'
- ' documentation accompanying the 2.3 release at\n'
- ' https://www.python.org/download/releases/2.3/mro/.\n'
- '\n'
- ' When a class attribute reference (for class "C", say) would '
- 'yield a\n'
- ' class method object, it is transformed into an instance method\n'
- ' object whose "__self__" attribute is "C". When it would yield '
+ 'not found there, the attribute search continues in the base '
+ 'classes.\n'
+ 'This search of the base classes uses the C3 method resolution '
+ 'order\n'
+ 'which behaves correctly even in the presence of ‘diamond’ '
+ 'inheritance\n'
+ 'structures where there are multiple inheritance paths leading back '
+ 'to\n'
+ 'a common ancestor. Additional details on the C3 MRO used by Python '
+ 'can\n'
+ 'be found in the documentation accompanying the 2.3 release at\n'
+ 'https://www.python.org/download/releases/2.3/mro/.\n'
+ '\n'
+ 'When a class attribute reference (for class "C", say) would yield '
'a\n'
- ' static method 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\n'
- ' from those actually contained in its "__dict__".\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'
'\n'
- ' Class attribute assignments update the class’s dictionary, '
- 'never\n'
- ' the dictionary of a base class.\n'
+ 'Class attribute assignments update the class’s dictionary, never '
+ 'the\n'
+ 'dictionary of a base class.\n'
+ '\n'
+ 'A class object can be called (see above) to yield a class instance\n'
+ '(see below).\n'
'\n'
- ' A class object can be called (see above) to yield a class '
- 'instance\n'
- ' (see below).\n'
+ 'Special attributes:\n'
'\n'
- ' Special attributes:\n'
+ ' "__name__"\n'
+ ' The class name.\n'
'\n'
- ' "__name__"\n'
- ' The class name.\n'
+ ' "__module__"\n'
+ ' The name of the module in which the class was defined.\n'
'\n'
- ' "__module__"\n'
- ' The name of the module in which the class was defined.\n'
+ ' "__dict__"\n'
+ ' The dictionary containing the class’s namespace.\n'
'\n'
- ' "__dict__"\n'
- ' The dictionary containing the class’s namespace.\n'
+ ' "__bases__"\n'
+ ' A tuple containing the base classes, in the order of their\n'
+ ' occurrence in the base class list.\n'
'\n'
- ' "__bases__"\n'
- ' A tuple containing the base classes, in the order of '
- 'their\n'
- ' occurrence in the base class list.\n'
+ ' "__doc__"\n'
+ ' The class’s documentation string, or "None" if undefined.\n'
'\n'
- ' "__doc__"\n'
- ' The class’s documentation string, or "None" if undefined.\n'
+ ' "__annotations__"\n'
+ ' A dictionary containing *variable annotations* collected '
+ 'during\n'
+ ' class body execution. For best practices on working with\n'
+ ' "__annotations__", please see Annotations Best Practices.\n'
'\n'
- ' "__annotations__"\n'
- ' A dictionary containing *variable annotations* collected\n'
- ' during class body execution. For best practices on '
- 'working\n'
- ' with "__annotations__", please see Annotations Best\n'
- ' Practices.\n'
'\n'
'Class instances\n'
- ' A class instance is created by calling a class object (see '
- 'above).\n'
- ' A class instance has a namespace implemented as a dictionary '
- 'which\n'
- ' is the first place in which attribute references are searched.\n'
- ' When an attribute is not found there, and the instance’s class '
- 'has\n'
- ' an attribute by that name, the search continues with the class\n'
- ' attributes. If a class attribute is found that is a '
- 'user-defined\n'
- ' function object, it is transformed into an instance method '
- 'object\n'
- ' whose "__self__" attribute is the instance. Static method and\n'
- ' class method objects are also transformed; see above under\n'
- ' “Classes”. See section Implementing Descriptors for another way '
- 'in\n'
- ' which attributes of a class retrieved via its instances may '
- 'differ\n'
- ' from the objects actually stored in the class’s "__dict__". If '
- 'no\n'
- ' class attribute is found, and the object’s class has a\n'
- ' "__getattr__()" method, that is called to satisfy the lookup.\n'
+ '===============\n'
'\n'
- ' Attribute assignments and deletions update the instance’s\n'
- ' dictionary, never a class’s dictionary. If the class has a\n'
- ' "__setattr__()" or "__delattr__()" method, this is called '
- 'instead\n'
- ' of updating the instance dictionary directly.\n'
+ 'A class instance is created by calling a class object (see above). '
+ 'A\n'
+ 'class instance has a namespace implemented as a dictionary which '
+ 'is\n'
+ 'the first place in which attribute references are searched. When '
+ 'an\n'
+ 'attribute is not found there, and the instance’s class has an\n'
+ 'attribute by that name, the search continues with the class\n'
+ 'attributes. If a class attribute is found that is a user-defined\n'
+ 'function object, it is transformed into an instance method object\n'
+ 'whose "__self__" attribute is the instance. Static method and '
+ 'class\n'
+ 'method objects are also transformed; see above under “Classes”. '
+ 'See\n'
+ 'section Implementing Descriptors for another way in which '
+ 'attributes\n'
+ 'of a class retrieved via its instances may differ from the objects\n'
+ 'actually stored in the class’s "__dict__". If no class attribute '
+ 'is\n'
+ 'found, and the object’s class has a "__getattr__()" method, that '
+ 'is\n'
+ 'called to satisfy the lookup.\n'
'\n'
- ' Class instances can pretend to be numbers, sequences, or '
- 'mappings\n'
- ' if they have methods with certain special names. See section\n'
- ' Special method names.\n'
+ 'Attribute assignments and deletions update the instance’s '
+ 'dictionary,\n'
+ 'never a class’s dictionary. If the class has a "__setattr__()" or\n'
+ '"__delattr__()" method, this is called instead of updating the\n'
+ 'instance dictionary directly.\n'
+ '\n'
+ 'Class instances can pretend to be numbers, sequences, or mappings '
+ 'if\n'
+ 'they have methods with certain special names. See section Special\n'
+ 'method names.\n'
+ '\n'
+ 'Special attributes: "__dict__" is the attribute dictionary;\n'
+ '"__class__" is the instance’s class.\n'
'\n'
- ' Special attributes: "__dict__" is the attribute dictionary;\n'
- ' "__class__" is the instance’s class.\n'
'\n'
'I/O objects (also known as file objects)\n'
- ' A *file object* represents an open file. Various shortcuts are\n'
- ' available to create file objects: the "open()" built-in '
- 'function,\n'
- ' and also "os.popen()", "os.fdopen()", and the "makefile()" '
- 'method\n'
- ' of socket objects (and perhaps by other functions or methods\n'
- ' provided by extension modules).\n'
+ '========================================\n'
+ '\n'
+ 'A *file object* represents an open file. Various shortcuts are\n'
+ 'available to create file objects: the "open()" built-in function, '
+ 'and\n'
+ 'also "os.popen()", "os.fdopen()", and the "makefile()" method of\n'
+ 'socket objects (and perhaps by other functions or methods provided '
+ 'by\n'
+ 'extension modules).\n'
+ '\n'
+ 'The objects "sys.stdin", "sys.stdout" and "sys.stderr" are '
+ 'initialized\n'
+ 'to file objects corresponding to the interpreter’s standard input,\n'
+ 'output and error streams; they are all open in text mode and '
+ 'therefore\n'
+ 'follow the interface defined by the "io.TextIOBase" abstract '
+ 'class.\n'
'\n'
- ' The objects "sys.stdin", "sys.stdout" and "sys.stderr" are\n'
- ' initialized to file objects corresponding to the interpreter’s\n'
- ' standard input, output and error streams; they are all open in '
- 'text\n'
- ' mode and therefore follow the interface defined by the\n'
- ' "io.TextIOBase" abstract class.\n'
'\n'
'Internal types\n'
- ' A few types used internally by the interpreter are exposed to '
- 'the\n'
- ' user. Their definitions may change with future versions of the\n'
- ' interpreter, but they are mentioned here for completeness.\n'
- '\n'
- ' Code objects\n'
- ' Code objects represent *byte-compiled* executable Python '
- 'code,\n'
- ' or *bytecode*. The difference between a code object and a\n'
- ' function object is that the function object contains an '
- 'explicit\n'
- ' reference to the function’s globals (the module in which it '
- 'was\n'
- ' defined), while a code object contains no context; also the\n'
- ' default argument values are stored in the function object, '
- 'not\n'
- ' in the code object (because they represent values calculated '
- 'at\n'
- ' run-time). Unlike function objects, code objects are '
- 'immutable\n'
- ' and contain no references (directly or indirectly) to '
- 'mutable\n'
- ' objects.\n'
- '\n'
- ' Special read-only attributes: "co_name" gives the function '
- 'name;\n'
- ' "co_qualname" gives the fully qualified function name;\n'
- ' "co_argcount" is the total number of positional arguments\n'
- ' (including positional-only arguments and arguments with '
- 'default\n'
- ' values); "co_posonlyargcount" is the number of '
- 'positional-only\n'
- ' arguments (including arguments with default values);\n'
- ' "co_kwonlyargcount" is the number of keyword-only arguments\n'
- ' (including arguments with default values); "co_nlocals" is '
- 'the\n'
- ' number of local variables used by the function (including\n'
- ' arguments); "co_varnames" is a tuple containing the names of '
- 'the\n'
- ' local variables (starting with the argument names);\n'
- ' "co_cellvars" is a tuple containing the names of local '
- 'variables\n'
- ' that are referenced by nested functions; "co_freevars" is a\n'
- ' tuple containing the names of free variables; "co_code" is a\n'
- ' string representing the sequence of bytecode instructions;\n'
- ' "co_consts" is a tuple containing the literals used by the\n'
- ' 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\n'
- ' function; "co_lnotab" is a string encoding the mapping from\n'
- ' bytecode offsets to line numbers (for details see the source\n'
- ' code of the interpreter); "co_stacksize" is the required '
- 'stack\n'
- ' size; "co_flags" is an integer encoding a number of flags '
- 'for\n'
- ' the interpreter.\n'
+ '==============\n'
+ '\n'
+ 'A few types used internally by the interpreter are exposed to the\n'
+ 'user. Their definitions may change with future versions of the\n'
+ 'interpreter, but they are mentioned here for completeness.\n'
'\n'
- ' The following flag bits are defined for "co_flags": bit '
- '"0x04"\n'
- ' is set if the function uses the "*arguments" syntax to accept '
- 'an\n'
- ' arbitrary number of positional arguments; bit "0x08" is set '
- 'if\n'
- ' the function uses the "**keywords" syntax to accept '
- 'arbitrary\n'
- ' keyword arguments; bit "0x20" is set if the function is a\n'
- ' generator.\n'
'\n'
- ' Future feature declarations ("from __future__ import '
- 'division")\n'
- ' also use bits in "co_flags" to indicate whether a code '
+ 'Code objects\n'
+ '------------\n'
+ '\n'
+ 'Code objects represent *byte-compiled* executable Python code, or\n'
+ '*bytecode*. The difference between a code object and a function '
'object\n'
- ' was compiled with a particular feature enabled: bit "0x2000" '
+ 'is that the function object contains an explicit reference to the\n'
+ 'function’s globals (the module in which it was defined), while a '
+ 'code\n'
+ 'object contains no context; also the default argument values are\n'
+ 'stored in the function object, not in the code object (because '
+ 'they\n'
+ 'represent values calculated at run-time). Unlike function '
+ 'objects,\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'
- ' set if the function was compiled with future division '
- 'enabled;\n'
- ' bits "0x10" and "0x1000" were used in earlier versions of\n'
- ' Python.\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'
- ' Other bits in "co_flags" are reserved for internal use.\n'
+ 'The following flag bits are defined for "co_flags": bit "0x04" is '
+ 'set\n'
+ 'if the function uses the "*arguments" syntax to accept an '
+ 'arbitrary\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'
+ '\n'
+ 'Future feature declarations ("from __future__ import division") '
+ 'also\n'
+ 'use bits in "co_flags" to indicate whether a code object was '
+ 'compiled\n'
+ 'with a particular feature enabled: bit "0x2000" is set if the '
+ 'function\n'
+ 'was compiled with future division enabled; bits "0x10" and '
+ '"0x1000"\n'
+ 'were used in earlier versions of Python.\n'
'\n'
- ' If a code object represents a function, the first item in\n'
- ' "co_consts" is the documentation string of the function, or\n'
- ' "None" if undefined.\n'
+ 'Other bits in "co_flags" are reserved for internal use.\n'
'\n'
- ' codeobject.co_positions()\n'
+ 'If a code object represents a function, the first item in '
+ '"co_consts"\n'
+ 'is the documentation string of the function, or "None" if '
+ 'undefined.\n'
'\n'
- ' Returns an iterable over the source code positions of '
- 'each\n'
- ' bytecode instruction in the code object.\n'
+ 'codeobject.co_positions()\n'
'\n'
- ' The iterator returns tuples containing the "(start_line,\n'
- ' end_line, start_column, end_column)". The *i-th* tuple\n'
- ' corresponds to the position of the source code that '
- 'compiled\n'
- ' to the *i-th* instruction. Column information is '
- '0-indexed\n'
- ' utf-8 byte offsets on the given source line.\n'
+ ' Returns an iterable over the source code positions of each '
+ 'bytecode\n'
+ ' instruction in the code object.\n'
'\n'
- ' This positional information can be missing. A '
- 'non-exhaustive\n'
- ' lists of cases where this may happen:\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'
+ ' instruction. Column information is 0-indexed utf-8 byte offsets '
+ 'on\n'
+ ' the given source line.\n'
'\n'
- ' * Running the interpreter with "-X" "no_debug_ranges".\n'
+ ' This positional information can be missing. A non-exhaustive '
+ 'lists\n'
+ ' of cases where this may happen:\n'
'\n'
- ' * Loading a pyc file compiled while using "-X"\n'
- ' "no_debug_ranges".\n'
+ ' * Running the interpreter with "-X" "no_debug_ranges".\n'
'\n'
- ' * Position tuples corresponding to artificial '
- 'instructions.\n'
+ ' * Loading a pyc file compiled while using "-X" '
+ '"no_debug_ranges".\n'
'\n'
- ' * Line and column numbers that can’t be represented due '
- 'to\n'
- ' implementation specific limitations.\n'
+ ' * Position tuples corresponding to artificial instructions.\n'
'\n'
- ' When this occurs, some or all of the tuple elements can '
- 'be\n'
- ' "None".\n'
+ ' * Line and column numbers that can’t be represented due to\n'
+ ' implementation specific limitations.\n'
'\n'
- ' New in version 3.11.\n'
+ ' When this occurs, some or all of the tuple elements can be '
+ '"None".\n'
'\n'
- ' Note:\n'
+ ' New in version 3.11.\n'
'\n'
- ' This feature requires storing column positions in code\n'
- ' objects which may result in a small increase of disk '
- 'usage\n'
- ' of compiled Python files or interpreter memory usage. '
- 'To\n'
- ' avoid storing the extra information and/or deactivate\n'
- ' printing the extra traceback information, the "-X"\n'
- ' "no_debug_ranges" command line flag or the\n'
- ' "PYTHONNODEBUGRANGES" environment variable can be used.\n'
+ ' Note:\n'
'\n'
- ' Frame objects\n'
- ' Frame objects represent execution frames. They may occur in\n'
- ' traceback objects (see below), and are also passed to '
- 'registered\n'
- ' trace functions.\n'
+ ' This feature requires storing column positions in code '
+ 'objects\n'
+ ' which may result in a small increase of disk usage of '
+ 'compiled\n'
+ ' Python files or interpreter memory usage. To avoid storing '
+ 'the\n'
+ ' extra information and/or deactivate printing the extra '
+ 'traceback\n'
+ ' information, the "-X" "no_debug_ranges" command line flag or '
+ 'the\n'
+ ' "PYTHONNODEBUGRANGES" environment variable can be used.\n'
+ '\n'
+ '\n'
+ 'Frame objects\n'
+ '-------------\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'
+ '\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'
+ '\n'
+ 'Accessing "f_code" raises an auditing event "object.__getattr__" '
+ 'with\n'
+ 'arguments "obj" and ""f_code"".\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\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'
- ' Special read-only attributes: "f_back" is to the previous '
- 'stack\n'
- ' frame (towards the caller), or "None" if this is the bottom\n'
- ' stack frame; "f_code" is the code object being executed in '
+ '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'
- ' frame; "f_locals" is the dictionary used to look up local\n'
- ' variables; "f_globals" is used for global variables;\n'
- ' "f_builtins" is used for built-in (intrinsic) names; '
- '"f_lasti"\n'
- ' gives the precise instruction (this is an index into the\n'
- ' bytecode string of the code object).\n'
- '\n'
- ' Accessing "f_code" raises an auditing event '
- '"object.__getattr__"\n'
- ' with arguments "obj" and ""f_code"".\n'
- '\n'
- ' Special writable attributes: "f_trace", if not "None", is a\n'
- ' function called for various events during code execution '
- '(this\n'
- ' is used by the debugger). Normally an event is triggered for\n'
- ' each new source line - this can be disabled by setting\n'
- ' "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\n'
- ' trace function escape to the function being traced.\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'
'\n'
- ' "f_lineno" is the current line number of the frame — writing '
- 'to\n'
- ' this from within a trace function jumps to the given line '
- '(only\n'
- ' for the bottom-most frame). A debugger can implement a Jump\n'
- ' command (aka Set Next Statement) by writing to f_lineno.\n'
+ 'Frame objects support one method:\n'
'\n'
- ' Frame objects support one method:\n'
+ 'frame.clear()\n'
'\n'
- ' frame.clear()\n'
+ ' This method clears all references to local variables held by '
+ 'the\n'
+ ' frame. Also, if the frame belonged to a generator, the '
+ 'generator\n'
+ ' is finalized. This helps break reference cycles involving '
+ 'frame\n'
+ ' objects (for example when catching an exception and storing its\n'
+ ' traceback for later use).\n'
'\n'
- ' This method clears all references to local variables held '
- 'by\n'
- ' the frame. Also, if the frame belonged to a generator, '
+ ' "RuntimeError" is raised if the frame is currently executing.\n'
+ '\n'
+ ' New in version 3.4.\n'
+ '\n'
+ '\n'
+ 'Traceback objects\n'
+ '-----------------\n'
+ '\n'
+ 'Traceback objects represent a 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'
+ 'For implicitly created tracebacks, when the search for an '
+ 'exception\n'
+ 'handler unwinds the execution stack, at each unwound level a '
+ 'traceback\n'
+ 'object is inserted in front of the current traceback. When an\n'
+ 'exception handler is entered, the stack trace is made available to '
'the\n'
- ' generator is finalized. This helps break reference '
- 'cycles\n'
- ' involving frame objects (for example when catching an\n'
- ' exception and storing its traceback for later use).\n'
+ 'program. (See section The try statement.) It is accessible as the\n'
+ 'third item of the tuple returned by "sys.exc_info()", and as the\n'
+ '"__traceback__" attribute of the caught exception.\n'
'\n'
- ' "RuntimeError" is raised if the frame is currently '
- 'executing.\n'
+ 'When the program contains no suitable handler, the stack trace is\n'
+ 'written (nicely formatted) to the standard error stream; if the\n'
+ 'interpreter is interactive, it is also made available to the user '
+ 'as\n'
+ '"sys.last_traceback".\n'
'\n'
- ' New in version 3.4.\n'
+ 'For explicitly created tracebacks, it is up to the creator of the\n'
+ 'traceback to determine how the "tb_next" attributes should be '
+ 'linked\n'
+ 'to form a full stack trace.\n'
'\n'
- ' Traceback objects\n'
- ' Traceback objects represent a stack trace of an exception. '
- 'A\n'
- ' traceback object is implicitly created when an exception '
- 'occurs,\n'
- ' and may also be explicitly created by calling\n'
- ' "types.TracebackType".\n'
- '\n'
- ' For implicitly created tracebacks, when the search for an\n'
- ' exception handler unwinds the execution stack, at each '
- 'unwound\n'
- ' level a traceback object is inserted in front of the current\n'
- ' traceback. When an exception handler is entered, the stack\n'
- ' trace is made available to the program. (See section The try\n'
- ' statement.) It is accessible as the third item of the tuple\n'
- ' returned by "sys.exc_info()", and as the "__traceback__"\n'
- ' attribute of the caught exception.\n'
- '\n'
- ' When the program contains no suitable handler, the stack '
- 'trace\n'
- ' is written (nicely formatted) to the standard error stream; '
- 'if\n'
- ' the interpreter is interactive, it is also made available to '
+ '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 '
'the\n'
- ' user as "sys.last_traceback".\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'
- ' For explicitly created tracebacks, it is up to the creator '
- 'of\n'
- ' the traceback to determine how the "tb_next" attributes '
- 'should\n'
- ' be linked to form a full stack trace.\n'
- '\n'
- ' Special read-only attributes: "tb_frame" points to the '
- 'execution\n'
- ' frame of the current level; "tb_lineno" gives the line '
- 'number\n'
- ' where the exception occurred; "tb_lasti" indicates the '
- 'precise\n'
- ' instruction. The line number and last instruction in the\n'
- ' traceback may differ from the line number of its frame object '
+ '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'
- ' the exception occurred in a "try" statement with no matching\n'
- ' except clause or with a finally clause.\n'
+ 'there is no next level.\n'
'\n'
- ' Accessing "tb_frame" raises an auditing event\n'
- ' "object.__getattr__" with arguments "obj" and ""tb_frame"".\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'
'\n'
- ' Special writable attribute: "tb_next" is the next level in '
- 'the\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\n'
- ' existing instances can be updated.\n'
+ 'Slice objects\n'
+ '-------------\n'
'\n'
- ' Slice objects\n'
- ' Slice objects are used to represent slices for '
- '"__getitem__()"\n'
- ' methods. They are also created by the built-in "slice()"\n'
- ' function.\n'
+ 'Slice objects are used to represent slices for "__getitem__()"\n'
+ 'methods. They are also created by the built-in "slice()" '
+ 'function.\n'
'\n'
- ' Special read-only attributes: "start" is the lower bound; '
- '"stop"\n'
- ' is the upper bound; "step" is the step value; each is "None" '
- 'if\n'
- ' omitted. These attributes can have any type.\n'
+ 'Special read-only attributes: "start" is the lower bound; "stop" '
+ 'is\n'
+ 'the upper bound; "step" is the step value; each is "None" if '
+ 'omitted.\n'
+ 'These attributes can have any type.\n'
'\n'
- ' Slice objects support one method:\n'
+ 'Slice objects support one method:\n'
'\n'
- ' slice.indices(self, length)\n'
+ 'slice.indices(self, length)\n'
'\n'
- ' This method takes a single integer argument *length* and\n'
- ' computes information about the slice that the slice '
- 'object\n'
- ' would describe if applied to a sequence of *length* '
- 'items.\n'
- ' It returns a tuple of three integers; respectively these '
- 'are\n'
- ' the *start* and *stop* indices and the *step* or stride\n'
- ' length of the slice. Missing or out-of-bounds indices are\n'
- ' handled in a manner consistent with regular slices.\n'
- '\n'
- ' Static method objects\n'
- ' Static method objects provide a way of defeating the\n'
- ' transformation of function objects to method objects '
- 'described\n'
- ' above. A static method object is a wrapper around any other\n'
- ' object, usually a user-defined method object. When a static\n'
- ' method object is retrieved from a class or a class instance, '
- 'the\n'
- ' object actually returned is the wrapped object, which is not\n'
- ' subject to any further transformation. Static method objects '
- 'are\n'
- ' also callable. Static method objects are created by the '
- 'built-in\n'
- ' "staticmethod()" constructor.\n'
+ ' This method takes a single integer argument *length* and '
+ 'computes\n'
+ ' information about the slice that the slice object would describe '
+ 'if\n'
+ ' applied to a sequence of *length* items. It returns a tuple of\n'
+ ' three integers; respectively these are the *start* and *stop*\n'
+ ' indices and the *step* or stride length of the slice. Missing '
+ 'or\n'
+ ' out-of-bounds indices are handled in a manner consistent with\n'
+ ' regular slices.\n'
'\n'
- ' Class method objects\n'
- ' A class method object, like a static method object, is a '
- 'wrapper\n'
- ' around another object that alters the way in which that '
- 'object\n'
- ' is retrieved from classes and class instances. The behaviour '
+ '\n'
+ 'Static method objects\n'
+ '---------------------\n'
+ '\n'
+ 'Static method objects provide a way of defeating the transformation '
'of\n'
- ' class method objects upon such retrieval is described above,\n'
- ' under “User-defined methods”. Class method objects are '
- 'created\n'
- ' by the built-in "classmethod()" constructor.\n',
+ 'function objects to method objects described above. A static '
+ 'method\n'
+ 'object is a wrapper around any other object, usually a '
+ 'user-defined\n'
+ 'method object. When a static method object is retrieved from a '
+ 'class\n'
+ 'or a class instance, the object actually returned is the wrapped\n'
+ 'object, which is not subject to any further transformation. Static\n'
+ 'method objects are also callable. Static method objects are created '
+ 'by\n'
+ 'the built-in "staticmethod()" constructor.\n'
+ '\n'
+ '\n'
+ 'Class method objects\n'
+ '--------------------\n'
+ '\n'
+ 'A class method object, like a static method object, is a wrapper\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'
+ '"classmethod()" constructor.\n',
'typesfunctions': 'Functions\n'
'*********\n'
'\n'
diff --git a/contrib/tools/python3/src/Lib/selectors.py b/contrib/tools/python3/src/Lib/selectors.py
index af6a4f94b5..c3b065b522 100644
--- a/contrib/tools/python3/src/Lib/selectors.py
+++ b/contrib/tools/python3/src/Lib/selectors.py
@@ -509,6 +509,7 @@ if hasattr(select, 'kqueue'):
def __init__(self):
super().__init__()
self._selector = select.kqueue()
+ self._max_events = 0
def fileno(self):
return self._selector.fileno()
@@ -520,10 +521,12 @@ if hasattr(select, 'kqueue'):
kev = select.kevent(key.fd, select.KQ_FILTER_READ,
select.KQ_EV_ADD)
self._selector.control([kev], 0, 0)
+ self._max_events += 1
if events & EVENT_WRITE:
kev = select.kevent(key.fd, select.KQ_FILTER_WRITE,
select.KQ_EV_ADD)
self._selector.control([kev], 0, 0)
+ self._max_events += 1
except:
super().unregister(fileobj)
raise
@@ -534,6 +537,7 @@ if hasattr(select, 'kqueue'):
if key.events & EVENT_READ:
kev = select.kevent(key.fd, select.KQ_FILTER_READ,
select.KQ_EV_DELETE)
+ self._max_events -= 1
try:
self._selector.control([kev], 0, 0)
except OSError:
@@ -543,6 +547,7 @@ if hasattr(select, 'kqueue'):
if key.events & EVENT_WRITE:
kev = select.kevent(key.fd, select.KQ_FILTER_WRITE,
select.KQ_EV_DELETE)
+ self._max_events -= 1
try:
self._selector.control([kev], 0, 0)
except OSError:
@@ -555,7 +560,7 @@ if hasattr(select, 'kqueue'):
# If max_ev is 0, kqueue will ignore the timeout. For consistent
# behavior with the other selector classes, we prevent that here
# (using max). See https://bugs.python.org/issue29255
- max_ev = max(len(self._fd_to_key), 1)
+ max_ev = self._max_events or 1
ready = []
try:
kev_list = self._selector.control(None, max_ev, timeout)
diff --git a/contrib/tools/python3/src/Lib/shutil.py b/contrib/tools/python3/src/Lib/shutil.py
index 1c3a75da55..d108986d13 100644
--- a/contrib/tools/python3/src/Lib/shutil.py
+++ b/contrib/tools/python3/src/Lib/shutil.py
@@ -454,7 +454,7 @@ def _copytree(entries, src, dst, symlinks, ignore, copy_function,
if ignore is not None:
ignored_names = ignore(os.fspath(src), [x.name for x in entries])
else:
- ignored_names = set()
+ ignored_names = ()
os.makedirs(dst, exist_ok=dirs_exist_ok)
errors = []
diff --git a/contrib/tools/python3/src/Lib/sqlite3/dump.py b/contrib/tools/python3/src/Lib/sqlite3/dump.py
index 07b9da10b9..1cf8759f89 100644
--- a/contrib/tools/python3/src/Lib/sqlite3/dump.py
+++ b/contrib/tools/python3/src/Lib/sqlite3/dump.py
@@ -16,6 +16,7 @@ def _iterdump(connection):
directly but instead called from the Connection method, iterdump().
"""
+ writeable_schema = False
cu = connection.cursor()
yield('BEGIN TRANSACTION;')
@@ -42,13 +43,15 @@ def _iterdump(connection):
yield('ANALYZE "sqlite_master";')
elif table_name.startswith('sqlite_'):
continue
- # NOTE: Virtual table support not implemented
- #elif sql.startswith('CREATE VIRTUAL TABLE'):
- # qtable = table_name.replace("'", "''")
- # yield("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"\
- # "VALUES('table','{0}','{0}',0,'{1}');".format(
- # qtable,
- # sql.replace("''")))
+ elif sql.startswith('CREATE VIRTUAL TABLE'):
+ if not writeable_schema:
+ writeable_schema = True
+ yield('PRAGMA writable_schema=ON;')
+ yield("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
+ "VALUES('table','{0}','{0}',0,'{1}');".format(
+ table_name.replace("'", "''"),
+ sql.replace("'", "''"),
+ ))
else:
yield('{0};'.format(sql))
@@ -74,6 +77,9 @@ def _iterdump(connection):
for name, type, sql in schema_res.fetchall():
yield('{0};'.format(sql))
+ if writeable_schema:
+ yield('PRAGMA writable_schema=OFF;')
+
# gh-79009: Yield statements concerning the sqlite_sequence table at the
# end of the transaction.
for row in sqlite_sequence:
diff --git a/contrib/tools/python3/src/Lib/threading.py b/contrib/tools/python3/src/Lib/threading.py
index 4f72938551..70601fc0d5 100644
--- a/contrib/tools/python3/src/Lib/threading.py
+++ b/contrib/tools/python3/src/Lib/threading.py
@@ -218,6 +218,13 @@ class _RLock:
def _is_owned(self):
return self._owner == get_ident()
+ # Internal method used for reentrancy checks
+
+ def _recursion_count(self):
+ if self._owner != get_ident():
+ return 0
+ return self._count
+
_PyRLock = _RLock
diff --git a/contrib/tools/python3/src/Lib/timeit.py b/contrib/tools/python3/src/Lib/timeit.py
index 9dfd454936..3250563f42 100755
--- a/contrib/tools/python3/src/Lib/timeit.py
+++ b/contrib/tools/python3/src/Lib/timeit.py
@@ -50,9 +50,9 @@ Functions:
"""
import gc
+import itertools
import sys
import time
-import itertools
__all__ = ["Timer", "timeit", "repeat", "default_timer"]
@@ -77,9 +77,11 @@ def inner(_it, _timer{init}):
return _t1 - _t0
"""
+
def reindent(src, indent):
"""Helper to reindent a multi-line statement."""
- return src.replace("\n", "\n" + " "*indent)
+ return src.replace("\n", "\n" + " " * indent)
+
class Timer:
"""Class for timing execution speed of small code snippets.
@@ -166,7 +168,7 @@ class Timer:
To be precise, this executes the setup statement once, and
then returns the time it takes to execute the main statement
- a number of times, as a float measured in seconds. The
+ a number of times, as float seconds if using the default timer. The
argument is the number of times through the loop, defaulting
to one million. The main statement, the setup statement and
the timer function to be used are passed to the constructor.
@@ -228,16 +230,19 @@ class Timer:
return (number, time_taken)
i *= 10
+
def timeit(stmt="pass", setup="pass", timer=default_timer,
number=default_number, globals=None):
"""Convenience function to create Timer object and call timeit method."""
return Timer(stmt, setup, timer, globals).timeit(number)
+
def repeat(stmt="pass", setup="pass", timer=default_timer,
repeat=default_repeat, number=default_number, globals=None):
"""Convenience function to create Timer object and call repeat method."""
return Timer(stmt, setup, timer, globals).repeat(repeat, number)
+
def main(args=None, *, _wrap_timer=None):
"""Main program, used when run as a script.
@@ -270,7 +275,7 @@ def main(args=None, *, _wrap_timer=None):
timer = default_timer
stmt = "\n".join(args) or "pass"
- number = 0 # auto-determine
+ number = 0 # auto-determine
setup = []
repeat = default_repeat
verbose = 0
@@ -287,7 +292,7 @@ def main(args=None, *, _wrap_timer=None):
time_unit = a
else:
print("Unrecognized unit. Please select nsec, usec, msec, or sec.",
- file=sys.stderr)
+ file=sys.stderr)
return 2
if o in ("-r", "--repeat"):
repeat = int(a)
@@ -321,7 +326,7 @@ def main(args=None, *, _wrap_timer=None):
msg = "{num} loop{s} -> {secs:.{prec}g} secs"
plural = (number != 1)
print(msg.format(num=number, s='s' if plural else '',
- secs=time_taken, prec=precision))
+ secs=time_taken, prec=precision))
try:
number, _ = t.autorange(callback)
except:
@@ -372,5 +377,6 @@ def main(args=None, *, _wrap_timer=None):
UserWarning, '', 0)
return None
+
if __name__ == "__main__":
sys.exit(main())
diff --git a/contrib/tools/python3/src/Lib/traceback.py b/contrib/tools/python3/src/Lib/traceback.py
index 09950a8b55..d3edd3a63e 100644
--- a/contrib/tools/python3/src/Lib/traceback.py
+++ b/contrib/tools/python3/src/Lib/traceback.py
@@ -603,11 +603,21 @@ def _extract_caret_anchors_from_line_segment(segment):
and not operator_str[operator_offset + 1].isspace()
):
right_anchor += 1
+
+ while left_anchor < len(segment) and ((ch := segment[left_anchor]).isspace() or ch in ")#"):
+ left_anchor += 1
+ right_anchor += 1
return _Anchors(normalize(left_anchor), normalize(right_anchor))
case ast.Subscript():
- subscript_start = normalize(expr.value.end_col_offset)
- subscript_end = normalize(expr.slice.end_col_offset + 1)
- return _Anchors(subscript_start, subscript_end)
+ left_anchor = normalize(expr.value.end_col_offset)
+ right_anchor = normalize(expr.slice.end_col_offset + 1)
+ while left_anchor < len(segment) and ((ch := segment[left_anchor]).isspace() or ch != "["):
+ left_anchor += 1
+ while right_anchor < len(segment) and ((ch := segment[right_anchor]).isspace() or ch != "]"):
+ right_anchor += 1
+ if right_anchor < len(segment):
+ right_anchor += 1
+ return _Anchors(left_anchor, right_anchor)
return None
diff --git a/contrib/tools/python3/src/Lib/unittest/loader.py b/contrib/tools/python3/src/Lib/unittest/loader.py
index 7e6ce2f224..f4e3d6e8f2 100644
--- a/contrib/tools/python3/src/Lib/unittest/loader.py
+++ b/contrib/tools/python3/src/Lib/unittest/loader.py
@@ -87,9 +87,13 @@ class TestLoader(object):
raise TypeError("Test cases should not be derived from "
"TestSuite. Maybe you meant to derive from "
"TestCase?")
- testCaseNames = self.getTestCaseNames(testCaseClass)
- if not testCaseNames and hasattr(testCaseClass, 'runTest'):
- testCaseNames = ['runTest']
+ if testCaseClass in (case.TestCase, case.FunctionTestCase):
+ # We don't load any tests from base types that should not be loaded.
+ testCaseNames = []
+ else:
+ testCaseNames = self.getTestCaseNames(testCaseClass)
+ if not testCaseNames and hasattr(testCaseClass, 'runTest'):
+ testCaseNames = ['runTest']
loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames))
return loaded_suite
@@ -120,7 +124,11 @@ class TestLoader(object):
tests = []
for name in dir(module):
obj = getattr(module, name)
- if isinstance(obj, type) and issubclass(obj, case.TestCase):
+ if (
+ isinstance(obj, type)
+ and issubclass(obj, case.TestCase)
+ and obj not in (case.TestCase, case.FunctionTestCase)
+ ):
tests.append(self.loadTestsFromTestCase(obj))
load_tests = getattr(module, 'load_tests', None)
@@ -189,7 +197,11 @@ class TestLoader(object):
if isinstance(obj, types.ModuleType):
return self.loadTestsFromModule(obj)
- elif isinstance(obj, type) and issubclass(obj, case.TestCase):
+ elif (
+ isinstance(obj, type)
+ and issubclass(obj, case.TestCase)
+ and obj not in (case.TestCase, case.FunctionTestCase)
+ ):
return self.loadTestsFromTestCase(obj)
elif (isinstance(obj, types.FunctionType) and
isinstance(parent, type) and
diff --git a/contrib/tools/python3/src/Lib/ya.make b/contrib/tools/python3/src/Lib/ya.make
index bcfc17f816..9495fe44b9 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.5)
+VERSION(3.11.6)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.5.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.6.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h b/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h
index 91755dc3ed..c220b44988 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h
@@ -526,7 +526,11 @@ exit:
PyDoc_STRVAR(_io_TextIOWrapper_tell__doc__,
"tell($self, /)\n"
"--\n"
-"\n");
+"\n"
+"Return the stream position as an opaque number.\n"
+"\n"
+"The return value of tell() can be given as input to seek(), to restore a\n"
+"previous stream position.");
#define _IO_TEXTIOWRAPPER_TELL_METHODDEF \
{"tell", (PyCFunction)_io_TextIOWrapper_tell, METH_NOARGS, _io_TextIOWrapper_tell__doc__},
@@ -689,4 +693,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
-/*[clinic end generated code: output=f9bda53adf576a8e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=4865229ff65da09a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/fileio.c b/contrib/tools/python3/src/Modules/_io/fileio.c
index 4496609afc..fee97f266f 100644
--- a/contrib/tools/python3/src/Modules/_io/fileio.c
+++ b/contrib/tools/python3/src/Modules/_io/fileio.c
@@ -389,6 +389,11 @@ _Py_COMP_DIAG_POP
if (async_err)
goto error;
+
+ if (self->fd < 0) {
+ PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, nameobj);
+ goto error;
+ }
}
else {
PyObject *fdobj;
@@ -420,12 +425,7 @@ _Py_COMP_DIAG_POP
goto error;
}
}
-
fd_is_own = 1;
- if (self->fd < 0) {
- PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, nameobj);
- goto error;
- }
#ifndef MS_WINDOWS
if (_Py_set_inheritable(self->fd, 0, atomic_flag_works) < 0)
@@ -1044,8 +1044,8 @@ _io_FileIO_truncate_impl(fileio *self, PyObject *posobj)
Py_END_ALLOW_THREADS
if (ret != 0) {
- Py_DECREF(posobj);
PyErr_SetFromErrno(PyExc_OSError);
+ Py_DECREF(posobj);
return NULL;
}
diff --git a/contrib/tools/python3/src/Modules/_io/iobase.c b/contrib/tools/python3/src/Modules/_io/iobase.c
index 6ae43a8b3b..8424fabca9 100644
--- a/contrib/tools/python3/src/Modules/_io/iobase.c
+++ b/contrib/tools/python3/src/Modules/_io/iobase.c
@@ -82,15 +82,22 @@ iobase_unsupported(const char *message)
/* Positioning */
PyDoc_STRVAR(iobase_seek_doc,
- "Change stream position.\n"
+ "seek($self, offset, whence=os.SEEK_SET, /)\n"
+ "--\n"
"\n"
- "Change the stream position to the given byte offset. The offset is\n"
- "interpreted relative to the position indicated by whence. Values\n"
- "for whence are:\n"
+ "Change the stream position to the given byte offset.\n"
"\n"
- "* 0 -- start of stream (the default); offset should be zero or positive\n"
- "* 1 -- current stream position; offset may be negative\n"
- "* 2 -- end of stream; offset is usually negative\n"
+ " offset\n"
+ " The stream position, relative to \'whence\'.\n"
+ " whence\n"
+ " The relative position to seek from.\n"
+ "\n"
+ "The offset is interpreted relative to the position indicated by whence.\n"
+ "Values for whence are:\n"
+ "\n"
+ "* os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive\n"
+ "* os.SEEK_CUR or 1 -- current stream position; offset may be negative\n"
+ "* os.SEEK_END or 2 -- end of stream; offset is usually negative\n"
"\n"
"Return the new absolute position.");
diff --git a/contrib/tools/python3/src/Modules/_io/textio.c b/contrib/tools/python3/src/Modules/_io/textio.c
index 403687dac0..7d5afb4c44 100644
--- a/contrib/tools/python3/src/Modules/_io/textio.c
+++ b/contrib/tools/python3/src/Modules/_io/textio.c
@@ -2627,11 +2627,16 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
/*[clinic input]
_io.TextIOWrapper.tell
+
+Return the stream position as an opaque number.
+
+The return value of tell() can be given as input to seek(), to restore a
+previous stream position.
[clinic start generated code]*/
static PyObject *
_io_TextIOWrapper_tell_impl(textio *self)
-/*[clinic end generated code: output=4f168c08bf34ad5f input=9a2caf88c24f9ddf]*/
+/*[clinic end generated code: output=4f168c08bf34ad5f input=0852d627d76fb520]*/
{
PyObject *res;
PyObject *posobj = NULL;
diff --git a/contrib/tools/python3/src/Modules/_io/winconsoleio.c b/contrib/tools/python3/src/Modules/_io/winconsoleio.c
index c8f3481e66..89431b1e4c 100644
--- a/contrib/tools/python3/src/Modules/_io/winconsoleio.c
+++ b/contrib/tools/python3/src/Modules/_io/winconsoleio.c
@@ -368,8 +368,8 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
else
self->fd = _Py_open_osfhandle_noraise(handle, _O_RDONLY | _O_BINARY);
if (self->fd < 0) {
- CloseHandle(handle);
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, nameobj);
+ CloseHandle(handle);
goto error;
}
}
diff --git a/contrib/tools/python3/src/Modules/_localemodule.c b/contrib/tools/python3/src/Modules/_localemodule.c
index 23c38e14d9..ac9709cabc 100644
--- a/contrib/tools/python3/src/Modules/_localemodule.c
+++ b/contrib/tools/python3/src/Modules/_localemodule.c
@@ -735,8 +735,8 @@ _locale_bindtextdomain_impl(PyObject *module, const char *domain,
}
current_dirname = bindtextdomain(domain, dirname);
if (current_dirname == NULL) {
- Py_XDECREF(dirname_bytes);
PyErr_SetFromErrno(PyExc_OSError);
+ Py_XDECREF(dirname_bytes);
return NULL;
}
result = PyUnicode_DecodeLocale(current_dirname, NULL);
diff --git a/contrib/tools/python3/src/Modules/_multiprocessing/semaphore.c b/contrib/tools/python3/src/Modules/_multiprocessing/semaphore.c
index f5fd3257f0..49174d39f1 100644
--- a/contrib/tools/python3/src/Modules/_multiprocessing/semaphore.c
+++ b/contrib/tools/python3/src/Modules/_multiprocessing/semaphore.c
@@ -516,12 +516,12 @@ _multiprocessing_SemLock_impl(PyTypeObject *type, int kind, int value,
return result;
failure:
- if (handle != SEM_FAILED)
- SEM_CLOSE(handle);
- PyMem_Free(name_copy);
if (!PyErr_Occurred()) {
_PyMp_SetError(NULL, MP_STANDARD_ERROR);
}
+ if (handle != SEM_FAILED)
+ SEM_CLOSE(handle);
+ PyMem_Free(name_copy);
return NULL;
}
@@ -556,8 +556,9 @@ _multiprocessing_SemLock__rebuild_impl(PyTypeObject *type, SEM_HANDLE handle,
if (name != NULL) {
handle = sem_open(name, 0);
if (handle == SEM_FAILED) {
+ PyErr_SetFromErrno(PyExc_OSError);
PyMem_Free(name_copy);
- return PyErr_SetFromErrno(PyExc_OSError);
+ return NULL;
}
}
#endif
diff --git a/contrib/tools/python3/src/Modules/_posixsubprocess.c b/contrib/tools/python3/src/Modules/_posixsubprocess.c
index ad9daaede4..072519c91a 100644
--- a/contrib/tools/python3/src/Modules/_posixsubprocess.c
+++ b/contrib/tools/python3/src/Modules/_posixsubprocess.c
@@ -537,7 +537,7 @@ reset_signal_handlers(const sigset_t *child_sigmask)
* required by POSIX but not supported natively on Linux. Another reason to
* avoid this family of functions is that sharing an address space between
* processes running with different privileges is inherently insecure.
- * See bpo-35823 for further discussion and references.
+ * See https://bugs.python.org/issue35823 for discussion and references.
*
* In some C libraries, setrlimit() has the same thread list/signalling
* behavior since resource limits were per-thread attributes before
@@ -774,6 +774,7 @@ do_fork_exec(char *const exec_array[],
pid_t pid;
#ifdef VFORK_USABLE
+ PyThreadState *vfork_tstate_save;
if (child_sigmask) {
/* These are checked by our caller; verify them in debug builds. */
assert(!call_setuid);
@@ -781,8 +782,23 @@ do_fork_exec(char *const exec_array[],
assert(!call_setgroups);
assert(preexec_fn == Py_None);
+ /* Drop the GIL so that other threads can continue execution while this
+ * thread in the parent remains blocked per vfork-semantics on the
+ * child's exec syscall outcome. Exec does filesystem access which
+ * can take an arbitrarily long time. This addresses GH-104372.
+ *
+ * The vfork'ed child still runs in our address space. Per POSIX it
+ * must be limited to nothing but exec, but the Linux implementation
+ * is a little more usable. See the child_exec() comment - The child
+ * MUST NOT re-acquire the GIL.
+ */
+ vfork_tstate_save = PyEval_SaveThread();
pid = vfork();
- if (pid == -1) {
+ if (pid != 0) {
+ // Not in the child process, reacquire the GIL.
+ PyEval_RestoreThread(vfork_tstate_save);
+ }
+ if (pid == (pid_t)-1) {
/* If vfork() fails, fall back to using fork(). When it isn't
* allowed in a process by the kernel, vfork can return -1
* with errno EINVAL. https://bugs.python.org/issue47151. */
@@ -795,6 +811,7 @@ do_fork_exec(char *const exec_array[],
}
if (pid != 0) {
+ // Parent process.
return pid;
}
diff --git a/contrib/tools/python3/src/Modules/_sqlite/ya.make b/contrib/tools/python3/src/Modules/_sqlite/ya.make
index 1d16438d62..c32056e4a7 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.5)
+VERSION(3.11.6)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.5.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.6.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/src/Modules/_sre/sre.h b/contrib/tools/python3/src/Modules/_sre/sre.h
index 52ae3e11b5..8d09b110ed 100644
--- a/contrib/tools/python3/src/Modules/_sre/sre.h
+++ b/contrib/tools/python3/src/Modules/_sre/sre.h
@@ -83,6 +83,7 @@ typedef struct {
size_t data_stack_base;
/* current repeat context */
SRE_REPEAT *repeat;
+ unsigned int sigcount;
} SRE_STATE;
typedef struct {
diff --git a/contrib/tools/python3/src/Modules/_sre/sre_lib.h b/contrib/tools/python3/src/Modules/_sre/sre_lib.h
index e83149825e..f8d556b2db 100644
--- a/contrib/tools/python3/src/Modules/_sre/sre_lib.h
+++ b/contrib/tools/python3/src/Modules/_sre/sre_lib.h
@@ -563,7 +563,7 @@ SRE(match)(SRE_STATE* state, const SRE_CODE* pattern, int toplevel)
Py_ssize_t alloc_pos, ctx_pos = -1;
Py_ssize_t ret = 0;
int jump;
- unsigned int sigcount=0;
+ unsigned int sigcount = state->sigcount;
SRE(match_context)* ctx;
SRE(match_context)* nextctx;
@@ -1565,8 +1565,10 @@ exit:
ctx_pos = ctx->last_ctx_pos;
jump = ctx->jump;
DATA_POP_DISCARD(ctx);
- if (ctx_pos == -1)
+ if (ctx_pos == -1) {
+ state->sigcount = sigcount;
return ret;
+ }
DATA_LOOKUP_AT(SRE(match_context), ctx, ctx_pos);
switch (jump) {
diff --git a/contrib/tools/python3/src/Modules/_ssl.c b/contrib/tools/python3/src/Modules/_ssl.c
index f5fb5bd0e2..8f3766cc48 100644
--- a/contrib/tools/python3/src/Modules/_ssl.c
+++ b/contrib/tools/python3/src/Modules/_ssl.c
@@ -3902,8 +3902,8 @@ _ssl__SSLContext_load_cert_chain_impl(PySSLContext *self, PyObject *certfile,
/* the password callback has already set the error information */
}
else if (errno != 0) {
- ERR_clear_error();
PyErr_SetFromErrno(PyExc_OSError);
+ ERR_clear_error();
}
else {
_setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
@@ -3923,8 +3923,8 @@ _ssl__SSLContext_load_cert_chain_impl(PySSLContext *self, PyObject *certfile,
/* the password callback has already set the error information */
}
else if (errno != 0) {
- ERR_clear_error();
PyErr_SetFromErrno(PyExc_OSError);
+ ERR_clear_error();
}
else {
_setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
@@ -4151,8 +4151,8 @@ _ssl__SSLContext_load_verify_locations_impl(PySSLContext *self,
PySSL_END_ALLOW_THREADS
if (r != 1) {
if (errno != 0) {
- ERR_clear_error();
PyErr_SetFromErrno(PyExc_OSError);
+ ERR_clear_error();
}
else {
_setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
@@ -4199,8 +4199,8 @@ _ssl__SSLContext_load_dh_params(PySSLContext *self, PyObject *filepath)
PySSL_END_ALLOW_THREADS
if (dh == NULL) {
if (errno != 0) {
- ERR_clear_error();
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, filepath);
+ ERR_clear_error();
}
else {
_setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
diff --git a/contrib/tools/python3/src/Modules/_threadmodule.c b/contrib/tools/python3/src/Modules/_threadmodule.c
index 199e3b89d9..625e4e6e77 100644
--- a/contrib/tools/python3/src/Modules/_threadmodule.c
+++ b/contrib/tools/python3/src/Modules/_threadmodule.c
@@ -485,6 +485,18 @@ PyDoc_STRVAR(rlock_release_save_doc,
\n\
For internal use by `threading.Condition`.");
+static PyObject *
+rlock_recursion_count(rlockobject *self, PyObject *Py_UNUSED(ignored))
+{
+ unsigned long tid = PyThread_get_thread_ident();
+ return PyLong_FromUnsignedLong(
+ self->rlock_owner == tid ? self->rlock_count : 0UL);
+}
+
+PyDoc_STRVAR(rlock_recursion_count_doc,
+"_recursion_count() -> int\n\
+\n\
+For internal use by reentrancy checks.");
static PyObject *
rlock_is_owned(rlockobject *self, PyObject *Py_UNUSED(ignored))
@@ -560,6 +572,8 @@ static PyMethodDef rlock_methods[] = {
METH_VARARGS, rlock_acquire_restore_doc},
{"_release_save", (PyCFunction)rlock_release_save,
METH_NOARGS, rlock_release_save_doc},
+ {"_recursion_count", (PyCFunction)rlock_recursion_count,
+ METH_NOARGS, rlock_recursion_count_doc},
{"__enter__", _PyCFunction_CAST(rlock_acquire),
METH_VARARGS | METH_KEYWORDS, rlock_acquire_doc},
{"__exit__", (PyCFunction)rlock_release,
@@ -1053,22 +1067,22 @@ _localdummy_destroyed(PyObject *localweakref, PyObject *dummyweakref)
/* Module functions */
struct bootstate {
- PyInterpreterState *interp;
+ PyThreadState *tstate;
PyObject *func;
PyObject *args;
PyObject *kwargs;
- PyThreadState *tstate;
- _PyRuntimeState *runtime;
};
static void
-thread_bootstate_free(struct bootstate *boot)
+thread_bootstate_free(struct bootstate *boot, int decref)
{
- Py_DECREF(boot->func);
- Py_DECREF(boot->args);
- Py_XDECREF(boot->kwargs);
- PyMem_Free(boot);
+ if (decref) {
+ Py_DECREF(boot->func);
+ Py_DECREF(boot->args);
+ Py_XDECREF(boot->kwargs);
+ }
+ PyMem_RawFree(boot);
}
@@ -1076,9 +1090,27 @@ static void
thread_run(void *boot_raw)
{
struct bootstate *boot = (struct bootstate *) boot_raw;
- PyThreadState *tstate;
+ PyThreadState *tstate = boot->tstate;
+
+ // gh-108987: If _thread.start_new_thread() is called before or while
+ // Python is being finalized, thread_run() can called *after*.
+ // _PyRuntimeState_SetFinalizing() is called. At this point, all Python
+ // threads must exit, except of the thread calling Py_Finalize() whch holds
+ // the GIL and must not exit.
+ //
+ // At this stage, tstate can be a dangling pointer (point to freed memory),
+ // it's ok to call _PyThreadState_MustExit() with a dangling pointer.
+ if (_PyThreadState_MustExit(tstate)) {
+ // Don't call PyThreadState_Clear() nor _PyThreadState_DeleteCurrent().
+ // These functions are called on tstate indirectly by Py_Finalize()
+ // which calls _PyInterpreterState_Clear().
+ //
+ // Py_DECREF() cannot be called because the GIL is not held: leak
+ // references on purpose. Python is being finalized anyway.
+ thread_bootstate_free(boot, 0);
+ goto exit;
+ }
- tstate = boot->tstate;
tstate->thread_id = PyThread_get_thread_ident();
#ifdef PY_HAVE_THREAD_NATIVE_ID
tstate->native_thread_id = PyThread_get_thread_native_id();
@@ -1102,20 +1134,22 @@ thread_run(void *boot_raw)
Py_DECREF(res);
}
- thread_bootstate_free(boot);
+ thread_bootstate_free(boot, 1);
+
tstate->interp->threads.count--;
PyThreadState_Clear(tstate);
_PyThreadState_DeleteCurrent(tstate);
+exit:
// bpo-44434: Don't call explicitly PyThread_exit_thread(). On Linux with
// the glibc, pthread_exit() can abort the whole process if dlopen() fails
// to open the libgcc_s.so library (ex: EMFILE error).
+ return;
}
static PyObject *
thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
{
- _PyRuntimeState *runtime = &_PyRuntime;
PyObject *func, *args, *kwargs = NULL;
if (!PyArg_UnpackTuple(fargs, "start_new_thread", 2, 3,
@@ -1144,17 +1178,18 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
return NULL;
}
- struct bootstate *boot = PyMem_NEW(struct bootstate, 1);
+ // gh-109795: Use PyMem_RawMalloc() instead of PyMem_Malloc(),
+ // because it should be possible to call thread_bootstate_free()
+ // without holding the GIL.
+ struct bootstate *boot = PyMem_RawMalloc(sizeof(struct bootstate));
if (boot == NULL) {
return PyErr_NoMemory();
}
- boot->interp = _PyInterpreterState_GET();
- boot->tstate = _PyThreadState_Prealloc(boot->interp);
+ boot->tstate = _PyThreadState_Prealloc(interp);
if (boot->tstate == NULL) {
- PyMem_Free(boot);
+ PyMem_RawFree(boot);
return PyErr_NoMemory();
}
- boot->runtime = runtime;
boot->func = Py_NewRef(func);
boot->args = Py_NewRef(args);
boot->kwargs = Py_XNewRef(kwargs);
@@ -1163,7 +1198,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
if (ident == PYTHREAD_INVALID_THREAD_ID) {
PyErr_SetString(ThreadError, "can't start new thread");
PyThreadState_Clear(boot->tstate);
- thread_bootstate_free(boot);
+ thread_bootstate_free(boot, 1);
return NULL;
}
return PyLong_FromUnsignedLong(ident);
diff --git a/contrib/tools/python3/src/Modules/_xxtestfuzz/fuzzer.c b/contrib/tools/python3/src/Modules/_xxtestfuzz/fuzzer.c
index 366e81a545..0c9f842725 100644
--- a/contrib/tools/python3/src/Modules/_xxtestfuzz/fuzzer.c
+++ b/contrib/tools/python3/src/Modules/_xxtestfuzz/fuzzer.c
@@ -188,37 +188,33 @@ static int fuzz_json_loads(const char* data, size_t size) {
#define MAX_RE_TEST_SIZE 0x10000
-PyObject* sre_compile_method = NULL;
-PyObject* sre_error_exception = NULL;
-int SRE_FLAG_DEBUG = 0;
+PyObject* re_compile_method = NULL;
+PyObject* re_error_exception = NULL;
+int RE_FLAG_DEBUG = 0;
/* Called by LLVMFuzzerTestOneInput for initialization */
static int init_sre_compile(void) {
/* Import sre_compile.compile and sre.error */
- PyObject* sre_compile_module = PyImport_ImportModule("sre_compile");
- if (sre_compile_module == NULL) {
+ PyObject* re_module = PyImport_ImportModule("re");
+ if (re_module == NULL) {
return 0;
}
- sre_compile_method = PyObject_GetAttrString(sre_compile_module, "compile");
- if (sre_compile_method == NULL) {
+ re_compile_method = PyObject_GetAttrString(re_module, "compile");
+ if (re_compile_method == NULL) {
return 0;
}
- PyObject* sre_constants = PyImport_ImportModule("sre_constants");
- if (sre_constants == NULL) {
- return 0;
- }
- sre_error_exception = PyObject_GetAttrString(sre_constants, "error");
- if (sre_error_exception == NULL) {
+ re_error_exception = PyObject_GetAttrString(re_module, "error");
+ if (re_error_exception == NULL) {
return 0;
}
- PyObject* debug_flag = PyObject_GetAttrString(sre_constants, "SRE_FLAG_DEBUG");
+ PyObject* debug_flag = PyObject_GetAttrString(re_module, "DEBUG");
if (debug_flag == NULL) {
return 0;
}
- SRE_FLAG_DEBUG = PyLong_AsLong(debug_flag);
+ RE_FLAG_DEBUG = PyLong_AsLong(debug_flag);
return 1;
}
-/* Fuzz _sre.compile(x) */
+/* Fuzz re.compile(x) */
static int fuzz_sre_compile(const char* data, size_t size) {
/* Ignore really long regex patterns that will timeout the fuzzer */
if (size > MAX_RE_TEST_SIZE) {
@@ -231,7 +227,7 @@ static int fuzz_sre_compile(const char* data, size_t size) {
uint16_t flags = ((uint16_t*) data)[0];
/* We remove the SRE_FLAG_DEBUG if present. This is because it
prints to stdout which greatly decreases fuzzing speed */
- flags &= ~SRE_FLAG_DEBUG;
+ flags &= ~RE_FLAG_DEBUG;
/* Pull the pattern from the remaining bytes */
PyObject* pattern_bytes = PyBytes_FromStringAndSize(data + 2, size - 2);
@@ -244,9 +240,9 @@ static int fuzz_sre_compile(const char* data, size_t size) {
return 0;
}
- /* compiled = _sre.compile(data[2:], data[0:2] */
+ /* compiled = re.compile(data[2:], data[0:2] */
PyObject* compiled = PyObject_CallFunctionObjArgs(
- sre_compile_method, pattern_bytes, flags_obj, NULL);
+ re_compile_method, pattern_bytes, flags_obj, NULL);
/* Ignore ValueError as the fuzzer will more than likely
generate some invalid combination of flags */
if (compiled == NULL && PyErr_ExceptionMatches(PyExc_ValueError)) {
@@ -262,7 +258,7 @@ static int fuzz_sre_compile(const char* data, size_t size) {
PyErr_Clear();
}
/* Ignore re.error */
- if (compiled == NULL && PyErr_ExceptionMatches(sre_error_exception)) {
+ if (compiled == NULL && PyErr_ExceptionMatches(re_error_exception)) {
PyErr_Clear();
}
diff --git a/contrib/tools/python3/src/Modules/faulthandler.c b/contrib/tools/python3/src/Modules/faulthandler.c
index 04995d2e74..520b7b603e 100644
--- a/contrib/tools/python3/src/Modules/faulthandler.c
+++ b/contrib/tools/python3/src/Modules/faulthandler.c
@@ -231,7 +231,6 @@ faulthandler_dump_traceback(int fd, int all_threads,
PyInterpreterState *interp)
{
static volatile int reentrant = 0;
- PyThreadState *tstate;
if (reentrant)
return;
@@ -246,7 +245,7 @@ faulthandler_dump_traceback(int fd, int all_threads,
fault if the thread released the GIL, and so this function cannot be
used. Read the thread specific storage (TSS) instead: call
PyGILState_GetThisThreadState(). */
- tstate = PyGILState_GetThisThreadState();
+ PyThreadState *tstate = PyGILState_GetThisThreadState();
if (all_threads) {
(void)_Py_DumpTracebackThreads(fd, NULL, tstate);
@@ -469,11 +468,10 @@ faulthandler_allocate_stack(void)
int err = sigaltstack(&stack, &old_stack);
if (err) {
+ PyErr_SetFromErrno(PyExc_OSError);
/* Release the stack to retry sigaltstack() next time */
PyMem_Free(stack.ss_sp);
stack.ss_sp = NULL;
-
- PyErr_SetFromErrno(PyExc_OSError);
return -1;
}
return 0;
diff --git a/contrib/tools/python3/src/Modules/fcntlmodule.c b/contrib/tools/python3/src/Modules/fcntlmodule.c
index ea9b2bc14a..e4bdd3a493 100644
--- a/contrib/tools/python3/src/Modules/fcntlmodule.c
+++ b/contrib/tools/python3/src/Modules/fcntlmodule.c
@@ -208,11 +208,12 @@ fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
if (mutate_arg && (len <= IOCTL_BUFSZ)) {
memcpy(str, buf, len);
}
- PyBuffer_Release(&pstr); /* No further access to str below this point */
if (ret < 0) {
PyErr_SetFromErrno(PyExc_OSError);
+ PyBuffer_Release(&pstr);
return NULL;
}
+ PyBuffer_Release(&pstr);
if (mutate_arg) {
return PyLong_FromLong(ret);
}
@@ -237,8 +238,8 @@ fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
ret = ioctl(fd, code, buf);
Py_END_ALLOW_THREADS
if (ret < 0) {
- PyBuffer_Release(&pstr);
PyErr_SetFromErrno(PyExc_OSError);
+ PyBuffer_Release(&pstr);
return NULL;
}
PyBuffer_Release(&pstr);
diff --git a/contrib/tools/python3/src/Modules/getpath.c b/contrib/tools/python3/src/Modules/getpath.c
index 22b105eadc..46cad45695 100644
--- a/contrib/tools/python3/src/Modules/getpath.c
+++ b/contrib/tools/python3/src/Modules/getpath.c
@@ -348,11 +348,12 @@ getpath_readlines(PyObject *Py_UNUSED(self), PyObject *args)
return NULL;
}
FILE *fp = _Py_wfopen(path, L"rb");
- PyMem_Free((void *)path);
if (!fp) {
PyErr_SetFromErrno(PyExc_OSError);
+ PyMem_Free((void *)path);
return NULL;
}
+ PyMem_Free((void *)path);
r = PyList_New(0);
if (!r) {
diff --git a/contrib/tools/python3/src/Modules/mmapmodule.c b/contrib/tools/python3/src/Modules/mmapmodule.c
index 8ff63f5118..a8d48ec6f3 100644
--- a/contrib/tools/python3/src/Modules/mmapmodule.c
+++ b/contrib/tools/python3/src/Modules/mmapmodule.c
@@ -1366,6 +1366,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
prot, flags,
fd, offset);
+ int saved_errno = errno;
if (devzero != -1) {
close(devzero);
}
@@ -1373,6 +1374,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
if (m_obj->data == (char *)-1) {
m_obj->data = NULL;
Py_DECREF(m_obj);
+ errno = saved_errno;
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
diff --git a/contrib/tools/python3/src/Modules/overlapped.c b/contrib/tools/python3/src/Modules/overlapped.c
index 9334dcaa2e..d1f2f11d48 100644
--- a/contrib/tools/python3/src/Modules/overlapped.c
+++ b/contrib/tools/python3/src/Modules/overlapped.c
@@ -365,8 +365,9 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
&NewWaitObject, Object, PostToQueueCallback, pdata, Milliseconds,
WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE))
{
+ SetFromWindowsErr(0);
PyMem_RawFree(pdata);
- return SetFromWindowsErr(0);
+ return NULL;
}
return Py_BuildValue(F_HANDLE, NewWaitObject);
diff --git a/contrib/tools/python3/src/Modules/posixmodule.c b/contrib/tools/python3/src/Modules/posixmodule.c
index 6afc8088c2..a45e8887da 100644
--- a/contrib/tools/python3/src/Modules/posixmodule.c
+++ b/contrib/tools/python3/src/Modules/posixmodule.c
@@ -2365,21 +2365,26 @@ _posix_free(void *module)
_posix_clear((PyObject *)module);
}
-static void
+static int
fill_time(PyObject *module, PyObject *v, int index, time_t sec, unsigned long nsec)
{
- PyObject *s = _PyLong_FromTime_t(sec);
- PyObject *ns_fractional = PyLong_FromUnsignedLong(nsec);
+ assert(!PyErr_Occurred());
+
+ int res = -1;
PyObject *s_in_ns = NULL;
PyObject *ns_total = NULL;
PyObject *float_s = NULL;
- if (!(s && ns_fractional))
+ PyObject *s = _PyLong_FromTime_t(sec);
+ PyObject *ns_fractional = PyLong_FromUnsignedLong(nsec);
+ if (!(s && ns_fractional)) {
goto exit;
+ }
s_in_ns = PyNumber_Multiply(s, get_posix_state(module)->billion);
- if (!s_in_ns)
+ if (!s_in_ns) {
goto exit;
+ }
ns_total = PyNumber_Add(s_in_ns, ns_fractional);
if (!ns_total)
@@ -2396,12 +2401,17 @@ fill_time(PyObject *module, PyObject *v, int index, time_t sec, unsigned long ns
s = NULL;
float_s = NULL;
ns_total = NULL;
+
+ assert(!PyErr_Occurred());
+ res = 0;
+
exit:
Py_XDECREF(s);
Py_XDECREF(ns_fractional);
Py_XDECREF(s_in_ns);
Py_XDECREF(ns_total);
Py_XDECREF(float_s);
+ return res;
}
/* pack a system stat C structure into the Python stat tuple
@@ -2409,33 +2419,46 @@ exit:
static PyObject*
_pystat_fromstructstat(PyObject *module, STRUCT_STAT *st)
{
- unsigned long ansec, mnsec, cnsec;
+ assert(!PyErr_Occurred());
+
PyObject *StatResultType = get_posix_state(module)->StatResultType;
PyObject *v = PyStructSequence_New((PyTypeObject *)StatResultType);
- if (v == NULL)
+ if (v == NULL) {
return NULL;
+ }
+
+#define SET_ITEM(pos, expr) \
+ do { \
+ PyObject *obj = (expr); \
+ if (obj == NULL) { \
+ goto error; \
+ } \
+ PyStructSequence_SET_ITEM(v, (pos), obj); \
+ } while (0)
- PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode));
+ SET_ITEM(0, PyLong_FromLong((long)st->st_mode));
static_assert(sizeof(unsigned long long) >= sizeof(st->st_ino),
"stat.st_ino is larger than unsigned long long");
- PyStructSequence_SET_ITEM(v, 1, PyLong_FromUnsignedLongLong(st->st_ino));
+ SET_ITEM(1, PyLong_FromUnsignedLongLong(st->st_ino));
#ifdef MS_WINDOWS
- PyStructSequence_SET_ITEM(v, 2, PyLong_FromUnsignedLong(st->st_dev));
+ SET_ITEM(2, PyLong_FromUnsignedLong(st->st_dev));
#else
- PyStructSequence_SET_ITEM(v, 2, _PyLong_FromDev(st->st_dev));
+ SET_ITEM(2, _PyLong_FromDev(st->st_dev));
#endif
- PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink));
+ SET_ITEM(3, PyLong_FromLong((long)st->st_nlink));
#if defined(MS_WINDOWS)
- PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong(0));
- PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong(0));
+ SET_ITEM(4, PyLong_FromLong(0));
+ SET_ITEM(5, PyLong_FromLong(0));
#else
- PyStructSequence_SET_ITEM(v, 4, _PyLong_FromUid(st->st_uid));
- PyStructSequence_SET_ITEM(v, 5, _PyLong_FromGid(st->st_gid));
+ SET_ITEM(4, _PyLong_FromUid(st->st_uid));
+ SET_ITEM(5, _PyLong_FromGid(st->st_gid));
#endif
static_assert(sizeof(long long) >= sizeof(st->st_size),
"stat.st_size is larger than long long");
- PyStructSequence_SET_ITEM(v, 6, PyLong_FromLongLong(st->st_size));
+ SET_ITEM(6, PyLong_FromLongLong(st->st_size));
+ // Set st_atime, st_mtime and st_ctime
+ unsigned long ansec, mnsec, cnsec;
#if defined(HAVE_STAT_TV_NSEC)
ansec = st->st_atim.tv_nsec;
mnsec = st->st_mtim.tv_nsec;
@@ -2451,64 +2474,62 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st)
#else
ansec = mnsec = cnsec = 0;
#endif
- fill_time(module, v, 7, st->st_atime, ansec);
- fill_time(module, v, 8, st->st_mtime, mnsec);
- fill_time(module, v, 9, st->st_ctime, cnsec);
+ if (fill_time(module, v, 7, st->st_atime, ansec) < 0) {
+ goto error;
+ }
+ if (fill_time(module, v, 8, st->st_mtime, mnsec) < 0) {
+ goto error;
+ }
+ if (fill_time(module, v, 9, st->st_ctime, cnsec) < 0) {
+ goto error;
+ }
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX,
- PyLong_FromLong((long)st->st_blksize));
+ SET_ITEM(ST_BLKSIZE_IDX, PyLong_FromLong((long)st->st_blksize));
#endif
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
- PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX,
- PyLong_FromLong((long)st->st_blocks));
+ SET_ITEM(ST_BLOCKS_IDX, PyLong_FromLong((long)st->st_blocks));
#endif
#ifdef HAVE_STRUCT_STAT_ST_RDEV
- PyStructSequence_SET_ITEM(v, ST_RDEV_IDX,
- PyLong_FromLong((long)st->st_rdev));
+ SET_ITEM(ST_RDEV_IDX, PyLong_FromLong((long)st->st_rdev));
#endif
#ifdef HAVE_STRUCT_STAT_ST_GEN
- PyStructSequence_SET_ITEM(v, ST_GEN_IDX,
- PyLong_FromLong((long)st->st_gen));
+ SET_ITEM(ST_GEN_IDX, PyLong_FromLong((long)st->st_gen));
#endif
#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
{
- PyObject *val;
- unsigned long bsec,bnsec;
+ unsigned long bsec, bnsec;
bsec = (long)st->st_birthtime;
#ifdef HAVE_STAT_TV_NSEC2
bnsec = st->st_birthtimespec.tv_nsec;
#else
bnsec = 0;
#endif
- val = PyFloat_FromDouble(bsec + 1e-9*bnsec);
- PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX,
- val);
+ SET_ITEM(ST_BIRTHTIME_IDX, PyFloat_FromDouble(bsec + bnsec * 1e-9));
}
#endif
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
- PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX,
- PyLong_FromLong((long)st->st_flags));
+ SET_ITEM(ST_FLAGS_IDX, PyLong_FromLong((long)st->st_flags));
#endif
#ifdef HAVE_STRUCT_STAT_ST_FILE_ATTRIBUTES
- PyStructSequence_SET_ITEM(v, ST_FILE_ATTRIBUTES_IDX,
- PyLong_FromUnsignedLong(st->st_file_attributes));
+ SET_ITEM(ST_FILE_ATTRIBUTES_IDX,
+ PyLong_FromUnsignedLong(st->st_file_attributes));
#endif
#ifdef HAVE_STRUCT_STAT_ST_FSTYPE
- PyStructSequence_SET_ITEM(v, ST_FSTYPE_IDX,
- PyUnicode_FromString(st->st_fstype));
+ SET_ITEM(ST_FSTYPE_IDX, PyUnicode_FromString(st->st_fstype));
#endif
#ifdef HAVE_STRUCT_STAT_ST_REPARSE_TAG
- PyStructSequence_SET_ITEM(v, ST_REPARSE_TAG_IDX,
- PyLong_FromUnsignedLong(st->st_reparse_tag));
+ SET_ITEM(ST_REPARSE_TAG_IDX, PyLong_FromUnsignedLong(st->st_reparse_tag));
#endif
- if (PyErr_Occurred()) {
- Py_DECREF(v);
- return NULL;
- }
-
+ assert(!PyErr_Occurred());
return v;
+
+error:
+ Py_DECREF(v);
+ return NULL;
+
+#undef SET_ITEM
}
/* POSIX methods */
@@ -3812,9 +3833,10 @@ posix_getcwd(int use_bytes)
return NULL;
}
if (!len) {
+ PyErr_SetFromWindowsErr(0);
if (wbuf2 != wbuf)
PyMem_RawFree(wbuf2);
- return PyErr_SetFromWindowsErr(0);
+ return NULL;
}
PyObject *resobj = PyUnicode_FromWideChar(wbuf2, len);
@@ -3862,8 +3884,9 @@ posix_getcwd(int use_bytes)
return PyErr_NoMemory();
}
if (cwd == NULL) {
+ posix_error();
PyMem_RawFree(buf);
- return posix_error();
+ return NULL;
}
PyObject *obj;
@@ -4075,8 +4098,8 @@ _listdir_windows_no_opendir(path_t *path, PyObject *list)
int error = GetLastError();
if (error == ERROR_FILE_NOT_FOUND)
goto exit;
- Py_DECREF(list);
- list = path_error(path);
+ path_error(path);
+ Py_CLEAR(list);
goto exit;
}
do {
@@ -4089,14 +4112,12 @@ _listdir_windows_no_opendir(path_t *path, PyObject *list)
Py_SETREF(v, PyUnicode_EncodeFSDefault(v));
}
if (v == NULL) {
- Py_DECREF(list);
- list = NULL;
+ Py_CLEAR(list);
break;
}
if (PyList_Append(list, v) != 0) {
Py_DECREF(v);
- Py_DECREF(list);
- list = NULL;
+ Py_CLEAR(list);
break;
}
Py_DECREF(v);
@@ -4107,8 +4128,8 @@ _listdir_windows_no_opendir(path_t *path, PyObject *list)
/* FindNextFile sets error to ERROR_NO_MORE_FILES if
it got to the end of the directory. */
if (!result && GetLastError() != ERROR_NO_MORE_FILES) {
- Py_DECREF(list);
- list = path_error(path);
+ path_error(path);
+ Py_CLEAR(list);
goto exit;
}
} while (result == TRUE);
@@ -4117,8 +4138,8 @@ exit:
if (hFindFile != INVALID_HANDLE_VALUE) {
if (FindClose(hFindFile) == FALSE) {
if (list != NULL) {
- Py_DECREF(list);
- list = path_error(path);
+ path_error(path);
+ Py_CLEAR(list);
}
}
}
@@ -4180,7 +4201,8 @@ _posix_listdir(path_t *path, PyObject *list)
}
if (dirp == NULL) {
- list = path_error(path);
+ path_error(path);
+ list = NULL;
#ifdef HAVE_FDOPENDIR
if (fd != -1) {
Py_BEGIN_ALLOW_THREADS
@@ -4202,8 +4224,8 @@ _posix_listdir(path_t *path, PyObject *list)
if (errno == 0) {
break;
} else {
- Py_DECREF(list);
- list = path_error(path);
+ path_error(path);
+ Py_CLEAR(list);
goto exit;
}
}
@@ -5881,8 +5903,9 @@ os_execv_impl(PyObject *module, path_t *path, PyObject *argv)
/* If we get here it's definitely an error */
+ posix_error();
free_string_array(argvlist, argc);
- return posix_error();
+ return NULL;
}
@@ -6179,11 +6202,12 @@ parse_file_actions(PyObject *file_actions,
}
errno = posix_spawn_file_actions_addopen(file_actionsp,
fd, PyBytes_AS_STRING(path), oflag, (mode_t)mode);
- Py_DECREF(path);
if (errno) {
posix_error();
+ Py_DECREF(path);
goto fail;
}
+ Py_DECREF(path);
break;
}
case POSIX_SPAWN_CLOSE: {
@@ -6580,12 +6604,15 @@ os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv)
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
+ int saved_errno = errno;
free_string_array(argvlist, argc);
- if (spawnval == -1)
- return posix_error();
- else
- return Py_BuildValue(_Py_PARSE_INTPTR, spawnval);
+ if (spawnval == -1) {
+ errno = saved_errno;
+ posix_error();
+ return NULL;
+ }
+ return Py_BuildValue(_Py_PARSE_INTPTR, spawnval);
}
/*[clinic input]
@@ -6799,6 +6826,7 @@ os_fork1_impl(PyObject *module)
}
PyOS_BeforeFork();
pid = fork1();
+ int saved_errno = errno;
if (pid == 0) {
/* child: this clobbers and resets the import lock. */
PyOS_AfterFork_Child();
@@ -6806,8 +6834,10 @@ os_fork1_impl(PyObject *module)
/* parent: release the import lock. */
PyOS_AfterFork_Parent();
}
- if (pid == -1)
+ if (pid == -1) {
+ errno = saved_errno;
return posix_error();
+ }
return PyLong_FromPid(pid);
}
#endif /* HAVE_FORK1 */
@@ -6838,6 +6868,7 @@ os_fork_impl(PyObject *module)
}
PyOS_BeforeFork();
pid = fork();
+ int saved_errno = errno;
if (pid == 0) {
/* child: this clobbers and resets the import lock. */
PyOS_AfterFork_Child();
@@ -6845,8 +6876,10 @@ os_fork_impl(PyObject *module)
/* parent: release the import lock. */
PyOS_AfterFork_Parent();
}
- if (pid == -1)
+ if (pid == -1) {
+ errno = saved_errno;
return posix_error();
+ }
return PyLong_FromPid(pid);
}
#endif /* HAVE_FORK */
@@ -7387,13 +7420,17 @@ os_openpty_impl(PyObject *module)
/* change permission of slave */
if (grantpt(master_fd) < 0) {
+ int saved_errno = errno;
PyOS_setsig(SIGCHLD, sig_saved);
+ errno = saved_errno;
goto posix_error;
}
/* unlock slave */
if (unlockpt(master_fd) < 0) {
+ int saved_errno = errno;
PyOS_setsig(SIGCHLD, sig_saved);
+ errno = saved_errno;
goto posix_error;
}
@@ -7746,8 +7783,9 @@ os_getgroups_impl(PyObject *module)
n = getgroups(n, grouplist);
if (n == -1) {
+ posix_error();
PyMem_Free(grouplist);
- return posix_error();
+ return NULL;
}
PyObject *result = PyList_New(n);
@@ -8319,8 +8357,9 @@ os_setgroups(PyObject *module, PyObject *groups)
}
if (setgroups(len, grouplist) < 0) {
+ posix_error();
PyMem_Free(grouplist);
- return posix_error();
+ return NULL;
}
PyMem_Free(grouplist);
Py_RETURN_NONE;
@@ -9716,10 +9755,13 @@ os_readv_impl(PyObject *module, int fd, PyObject *buffers)
Py_END_ALLOW_THREADS
} while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
+ int saved_errno = errno;
iov_cleanup(iov, buf, cnt);
if (n < 0) {
- if (!async_err)
+ if (!async_err) {
+ errno = saved_errno;
posix_error();
+ }
return -1;
}
@@ -9768,8 +9810,11 @@ os_pread_impl(PyObject *module, int fd, Py_ssize_t length, Py_off_t offset)
} while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
if (n < 0) {
+ if (!async_err) {
+ posix_error();
+ }
Py_DECREF(buffer);
- return (!async_err) ? posix_error() : NULL;
+ return NULL;
}
if (n != length)
_PyBytes_Resize(&buffer, n);
@@ -9866,9 +9911,11 @@ os_preadv_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
#endif
+ int saved_errno = errno;
iov_cleanup(iov, buf, cnt);
if (n < 0) {
if (!async_err) {
+ errno = saved_errno;
posix_error();
}
return -1;
@@ -10037,24 +10084,26 @@ os_sendfile_impl(PyObject *module, int out_fd, int in_fd, PyObject *offobj,
} while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
_Py_END_SUPPRESS_IPH
+ int saved_errno = errno;
if (sf.headers != NULL)
iov_cleanup(sf.headers, hbuf, sf.hdr_cnt);
if (sf.trailers != NULL)
iov_cleanup(sf.trailers, tbuf, sf.trl_cnt);
if (ret < 0) {
- if ((errno == EAGAIN) || (errno == EBUSY)) {
+ if ((saved_errno == EAGAIN) || (saved_errno == EBUSY)) {
if (sbytes != 0) {
// some data has been sent
goto done;
}
- else {
- // no data has been sent; upper application is supposed
- // to retry on EAGAIN or EBUSY
- return posix_error();
- }
+ // no data has been sent; upper application is supposed
+ // to retry on EAGAIN or EBUSY
}
- return (!async_err) ? posix_error() : NULL;
+ if (!async_err) {
+ errno = saved_errno;
+ posix_error();
+ }
+ return NULL;
}
goto done;
@@ -10371,10 +10420,10 @@ os_writev_impl(PyObject *module, int fd, PyObject *buffers)
Py_END_ALLOW_THREADS
} while (result < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
- iov_cleanup(iov, buf, cnt);
if (result < 0 && !async_err)
posix_error();
+ iov_cleanup(iov, buf, cnt);
return result;
}
#endif /* HAVE_WRITEV */
@@ -10509,13 +10558,13 @@ os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
#endif
- iov_cleanup(iov, buf, cnt);
if (result < 0) {
if (!async_err) {
posix_error();
}
- return -1;
+ result = -1;
}
+ iov_cleanup(iov, buf, cnt);
return result;
}
@@ -11077,12 +11126,13 @@ win32_putenv(PyObject *name, PyObject *value)
Prefer _wputenv() to be compatible with C libraries using CRT
variables and CRT functions using these variables (ex: getenv()). */
int err = _wputenv(env);
- PyMem_Free(env);
if (err) {
posix_error();
+ PyMem_Free(env);
return NULL;
}
+ PyMem_Free(env);
Py_RETURN_NONE;
}
@@ -12924,10 +12974,12 @@ os_getxattr_impl(PyObject *module, path_t *path, path_t *attribute,
Py_END_ALLOW_THREADS;
if (result < 0) {
- Py_DECREF(buffer);
- if (errno == ERANGE)
+ if (errno == ERANGE) {
+ Py_DECREF(buffer);
continue;
+ }
path_error(path);
+ Py_DECREF(buffer);
return NULL;
}
@@ -13693,14 +13745,18 @@ _Py_COMP_DIAG_POP
}
Py_END_ALLOW_THREADS
}
+ int saved_errno = errno;
#if defined(MS_WINDOWS) && !USE_UNICODE_WCHAR_CACHE
PyMem_Free(path);
#else /* USE_UNICODE_WCHAR_CACHE */
Py_DECREF(ub);
#endif /* USE_UNICODE_WCHAR_CACHE */
- if (result != 0)
- return path_object_error(self->path);
+ if (result != 0) {
+ errno = saved_errno;
+ path_object_error(self->path);
+ return NULL;
+ }
return _pystat_fromstructstat(module, &st);
}
@@ -13896,17 +13952,22 @@ _Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const wchar_t *path = PyUnicode_AsUnicode(unicode);
result = LSTAT(path, &stat);
+ int saved_errno = errno;
Py_DECREF(unicode);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
wchar_t *path = PyUnicode_AsWideCharString(unicode, NULL);
Py_DECREF(unicode);
result = LSTAT(path, &stat);
+
+ int saved_errno = errno;
PyMem_Free(path);
#endif /* USE_UNICODE_WCHAR_CACHE */
- if (result != 0)
+ if (result != 0) {
+ errno = saved_errno;
return path_object_error(self->path);
+ }
self->win32_file_index = stat.st_ino;
self->got_file_index = 1;
@@ -14473,12 +14534,12 @@ os_scandir_impl(PyObject *module, path_t *path)
iterator->handle = FindFirstFileW(path_strW, &iterator->file_data);
Py_END_ALLOW_THREADS
- PyMem_Free(path_strW);
-
if (iterator->handle == INVALID_HANDLE_VALUE) {
path_error(&iterator->path);
+ PyMem_Free(path_strW);
goto error;
}
+ PyMem_Free(path_strW);
#else /* POSIX */
errno = 0;
#ifdef HAVE_FDOPENDIR
diff --git a/contrib/tools/python3/src/Modules/selectmodule.c b/contrib/tools/python3/src/Modules/selectmodule.c
index 4eea928a26..8210269867 100644
--- a/contrib/tools/python3/src/Modules/selectmodule.c
+++ b/contrib/tools/python3/src/Modules/selectmodule.c
@@ -1290,8 +1290,8 @@ newPyEpoll_Object(PyTypeObject *type, int sizehint, SOCKET fd)
self->epfd = fd;
}
if (self->epfd < 0) {
- Py_DECREF(self);
PyErr_SetFromErrno(PyExc_OSError);
+ Py_DECREF(self);
return NULL;
}
@@ -1973,8 +1973,8 @@ newKqueue_Object(PyTypeObject *type, SOCKET fd)
self->kqfd = fd;
}
if (self->kqfd < 0) {
- Py_DECREF(self);
PyErr_SetFromErrno(PyExc_OSError);
+ Py_DECREF(self);
return NULL;
}
diff --git a/contrib/tools/python3/src/Modules/socketmodule.c b/contrib/tools/python3/src/Modules/socketmodule.c
index 4424ea367b..da18bf9666 100644
--- a/contrib/tools/python3/src/Modules/socketmodule.c
+++ b/contrib/tools/python3/src/Modules/socketmodule.c
@@ -5358,8 +5358,8 @@ sock_initobj_impl(PySocketSockObject *self, int family, int type, int proto,
if (!support_wsa_no_inherit) {
if (!SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0)) {
- closesocket(fd);
PyErr_SetFromWindowsErr(0);
+ closesocket(fd);
return -1;
}
}
@@ -5502,8 +5502,9 @@ socket_gethostname(PyObject *self, PyObject *unused)
name,
&size))
{
+ PyErr_SetFromWindowsErr(0);
PyMem_Free(name);
- return PyErr_SetFromWindowsErr(0);
+ return NULL;
}
result = PyUnicode_FromWideChar(name, size);
@@ -6090,8 +6091,8 @@ socket_dup(PyObject *self, PyObject *fdobj)
return set_error();
if (!SetHandleInformation((HANDLE)newfd, HANDLE_FLAG_INHERIT, 0)) {
- closesocket(newfd);
PyErr_SetFromWindowsErr(0);
+ closesocket(newfd);
return NULL;
}
#else
@@ -6535,11 +6536,12 @@ socket_inet_ntop(PyObject *self, PyObject *args)
/* inet_ntop guarantee NUL-termination of resulting string. */
retval = inet_ntop(af, packed_ip.buf, ip, sizeof(ip));
- PyBuffer_Release(&packed_ip);
if (!retval) {
PyErr_SetFromErrno(PyExc_OSError);
+ PyBuffer_Release(&packed_ip);
return NULL;
} else {
+ PyBuffer_Release(&packed_ip);
return PyUnicode_FromString(retval);
}
}
@@ -6869,8 +6871,8 @@ socket_if_nameindex(PyObject *self, PyObject *arg)
ni = if_nameindex();
if (ni == NULL) {
- Py_DECREF(list);
PyErr_SetFromErrno(PyExc_OSError);
+ Py_DECREF(list);
return NULL;
}
diff --git a/contrib/tools/python3/src/Modules/ya.make b/contrib/tools/python3/src/Modules/ya.make
index 833218bf9e..0301557e23 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.5)
+VERSION(3.11.6)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.5.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.6.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h b/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h
index 07877693c2..7a42cd8ffc 100644
--- a/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h
+++ b/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h
@@ -882,7 +882,7 @@ PyDoc_STRVAR(unicode_split__doc__,
" The separator used to split the string.\n"
"\n"
" When set to None (the default value), will split on any whitespace\n"
-" character (including \\\\n \\\\r \\\\t \\\\f and spaces) and will discard\n"
+" 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"
@@ -983,7 +983,7 @@ PyDoc_STRVAR(unicode_rsplit__doc__,
" The separator used to split the string.\n"
"\n"
" When set to None (the default value), will split on any whitespace\n"
-" character (including \\\\n \\\\r \\\\t \\\\f and spaces) and will discard\n"
+" 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"
@@ -1353,4 +1353,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=b5dd7cefead9a8e7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=11519887c1619a4e input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Objects/unicodeobject.c b/contrib/tools/python3/src/Objects/unicodeobject.c
index ffa8b982bd..c27fc009c5 100644
--- a/contrib/tools/python3/src/Objects/unicodeobject.c
+++ b/contrib/tools/python3/src/Objects/unicodeobject.c
@@ -7556,7 +7556,7 @@ decode_code_page_errors(UINT code_page,
if (err != ERROR_NO_UNICODE_TRANSLATION
&& err != ERROR_INSUFFICIENT_BUFFER)
{
- PyErr_SetFromWindowsErr(0);
+ PyErr_SetFromWindowsErr(err);
goto error;
}
insize++;
@@ -13167,7 +13167,7 @@ str.split as unicode_split
The separator used to split the string.
When set to None (the default value), will split on any whitespace
- character (including \\n \\r \\t \\f and spaces) and will discard
+ 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).
@@ -13183,7 +13183,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=906d953b44efc43b]*/
+/*[clinic end generated code: output=3a65b1db356948dc input=07b9040d98c5fe8d]*/
{
if (sep == Py_None)
return split(self, NULL, maxsplit);
diff --git a/contrib/tools/python3/src/Parser/tokenizer.c b/contrib/tools/python3/src/Parser/tokenizer.c
index b552b41718..7fc8a58562 100644
--- a/contrib/tools/python3/src/Parser/tokenizer.c
+++ b/contrib/tools/python3/src/Parser/tokenizer.c
@@ -1303,7 +1303,7 @@ verify_end_of_number(struct tok_state *tok, int c, const char *kind)
tok_nextc(tok);
}
else /* In future releases, only error will remain. */
- if (is_potential_identifier_char(c)) {
+ if (c < 128 && is_potential_identifier_char(c)) {
tok_backup(tok, c);
syntaxerror(tok, "invalid %s literal", kind);
return 0;
diff --git a/contrib/tools/python3/src/Python/ast.c b/contrib/tools/python3/src/Python/ast.c
index 95179cb702..8bc3c96237 100644
--- a/contrib/tools/python3/src/Python/ast.c
+++ b/contrib/tools/python3/src/Python/ast.c
@@ -379,6 +379,11 @@ validate_expr(struct validator *state, expr_ty exp, expr_context_ty ctx)
ret = validate_exprs(state, exp->v.Tuple.elts, ctx, 0);
break;
case NamedExpr_kind:
+ if (exp->v.NamedExpr.target->kind != Name_kind) {
+ PyErr_SetString(PyExc_TypeError,
+ "NamedExpr target must be a Name");
+ return 0;
+ }
ret = validate_expr(state, exp->v.NamedExpr.value, Load);
break;
/* This last case doesn't have any checking. */
diff --git a/contrib/tools/python3/src/Python/ceval.c b/contrib/tools/python3/src/Python/ceval.c
index 47df353197..df11de084d 100644
--- a/contrib/tools/python3/src/Python/ceval.c
+++ b/contrib/tools/python3/src/Python/ceval.c
@@ -216,20 +216,6 @@ _PyEvalFrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame *frame);
"cannot access free variable '%s' where it is not associated with a" \
" value in enclosing scope"
-#ifndef NDEBUG
-/* Ensure that tstate is valid: sanity check for PyEval_AcquireThread() and
- PyEval_RestoreThread(). Detect if tstate memory was freed. It can happen
- when a thread continues to run after Python finalization, especially
- daemon threads. */
-static int
-is_tstate_valid(PyThreadState *tstate)
-{
- assert(!_PyMem_IsPtrFreed(tstate));
- assert(!_PyMem_IsPtrFreed(tstate->interp));
- return 1;
-}
-#endif
-
/* This can set eval_breaker to 0 even though gil_drop_request became
1. We believe this is all right because the eval loop will release
@@ -464,7 +450,7 @@ PyEval_AcquireThread(PyThreadState *tstate)
void
PyEval_ReleaseThread(PyThreadState *tstate)
{
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
_PyRuntimeState *runtime = tstate->interp->runtime;
PyThreadState *new_tstate = _PyThreadState_Swap(&runtime->gilstate, NULL);
@@ -671,7 +657,7 @@ Py_AddPendingCall(int (*func)(void *), void *arg)
static int
handle_signals(PyThreadState *tstate)
{
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
if (!_Py_ThreadCanHandleSignals(tstate->interp)) {
return 0;
}
@@ -739,7 +725,7 @@ void
_Py_FinishPendingCalls(PyThreadState *tstate)
{
assert(PyGILState_Check());
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
struct _pending_calls *pending = &tstate->interp->ceval.pending;
@@ -764,7 +750,7 @@ Py_MakePendingCalls(void)
assert(PyGILState_Check());
PyThreadState *tstate = _PyThreadState_GET();
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
/* Python signal handler doesn't really queue a callback: it only signals
that a signal was received, see _PyEval_SignalReceived(). */
@@ -6947,7 +6933,7 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
int
_PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
{
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
/* The caller must hold the GIL */
assert(PyGILState_Check());
@@ -6999,7 +6985,7 @@ PyEval_SetProfile(Py_tracefunc func, PyObject *arg)
int
_PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
{
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
/* The caller must hold the GIL */
assert(PyGILState_Check());
diff --git a/contrib/tools/python3/src/Python/ceval_gil.h b/contrib/tools/python3/src/Python/ceval_gil.h
index 476ed7f1a2..94e2df03e0 100644
--- a/contrib/tools/python3/src/Python/ceval_gil.h
+++ b/contrib/tools/python3/src/Python/ceval_gil.h
@@ -171,7 +171,7 @@ drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2,
/* Not switched yet => wait */
if (((PyThreadState*)_Py_atomic_load_relaxed(&gil->last_holder)) == tstate)
{
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
RESET_GIL_DROP_REQUEST(tstate->interp);
/* NOTE: if COND_WAIT does not atomically start waiting when
releasing the mutex, another thread can run through, take
@@ -185,25 +185,6 @@ drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2,
}
-/* Check if a Python thread must exit immediately, rather than taking the GIL
- if Py_Finalize() has been called.
-
- When this function is called by a daemon thread after Py_Finalize() has been
- called, the GIL does no longer exist.
-
- tstate must be non-NULL. */
-static inline int
-tstate_must_exit(PyThreadState *tstate)
-{
- /* bpo-39877: Access _PyRuntime directly rather than using
- tstate->interp->runtime to support calls from Python daemon threads.
- After Py_Finalize() has been called, tstate can be a dangling pointer:
- point to PyThreadState freed memory. */
- PyThreadState *finalizing = _PyRuntimeState_GetFinalizing(&_PyRuntime);
- return (finalizing != NULL && finalizing != tstate);
-}
-
-
/* Take the GIL.
The function saves errno at entry and restores its value at exit.
@@ -216,7 +197,7 @@ take_gil(PyThreadState *tstate)
assert(tstate != NULL);
- if (tstate_must_exit(tstate)) {
+ if (_PyThreadState_MustExit(tstate)) {
/* bpo-39877: If Py_Finalize() has been called and tstate is not the
thread which called Py_Finalize(), exit immediately the thread.
@@ -226,7 +207,7 @@ take_gil(PyThreadState *tstate)
PyThread_exit_thread();
}
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
PyInterpreterState *interp = tstate->interp;
struct _ceval_runtime_state *ceval = &interp->runtime->ceval;
struct _ceval_state *ceval2 = &interp->ceval;
@@ -255,7 +236,7 @@ take_gil(PyThreadState *tstate)
_Py_atomic_load_relaxed(&gil->locked) &&
gil->switch_number == saved_switchnum)
{
- if (tstate_must_exit(tstate)) {
+ if (_PyThreadState_MustExit(tstate)) {
MUTEX_UNLOCK(gil->mutex);
// gh-96387: If the loop requested a drop request in a previous
// iteration, reset the request. Otherwise, drop_gil() can
@@ -268,7 +249,7 @@ take_gil(PyThreadState *tstate)
}
PyThread_exit_thread();
}
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
SET_GIL_DROP_REQUEST(interp);
drop_requested = 1;
@@ -295,7 +276,7 @@ _ready:
MUTEX_UNLOCK(gil->switch_mutex);
#endif
- if (tstate_must_exit(tstate)) {
+ if (_PyThreadState_MustExit(tstate)) {
/* bpo-36475: If Py_Finalize() has been called and tstate is not
the thread which called Py_Finalize(), exit immediately the
thread.
@@ -307,7 +288,7 @@ _ready:
drop_gil(ceval, ceval2, tstate);
PyThread_exit_thread();
}
- assert(is_tstate_valid(tstate));
+ assert(_PyThreadState_CheckConsistency(tstate));
if (_Py_atomic_load_relaxed(&ceval2->gil_drop_request)) {
RESET_GIL_DROP_REQUEST(interp);
diff --git a/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c b/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c
index 4c527746a2..10274f6b5b 100644
--- a/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c
+++ b/contrib/tools/python3/src/Python/deepfreeze/deepfreeze.c
@@ -63328,13 +63328,203 @@ codecs_toplevel_consts_24_consts_10 = {
};
static
struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[19];
+ }
+codecs_toplevel_consts_24_consts_11_consts_1 = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 18,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "can't serialize %s",
+};
+static
+ struct {
+ PyGC_Head _gc_head;
+ struct {
+ PyObject_VAR_HEAD
+ PyObject *ob_item[2];
+ }_object;
+ }
+codecs_toplevel_consts_24_consts_11_consts = {
+ ._object = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyTuple_Type,
+ },
+ .ob_size = 2,
+ },
+ .ob_item = {
+ Py_None,
+ & codecs_toplevel_consts_24_consts_11_consts_1._ascii.ob_base,
+ },
+ },
+};
+static
+ struct {
+ PyGC_Head _gc_head;
+ struct {
+ PyObject_VAR_HEAD
+ PyObject *ob_item[3];
+ }_object;
+ }
+codecs_toplevel_consts_24_consts_11_names = {
+ ._object = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyTuple_Type,
+ },
+ .ob_size = 3,
+ },
+ .ob_item = {
+ & const_str_TypeError._ascii.ob_base,
+ &_Py_ID(__class__),
+ &_Py_ID(__name__),
+ },
+ },
+};
+static
+ struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[27];
+ }
+codecs_toplevel_consts_24_consts_11_qualname = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 26,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "StreamWriter.__reduce_ex__",
+};
+static
+ struct {
+ PyObject_VAR_HEAD
+ Py_hash_t ob_shash;
+ char ob_sval[28];
+ }
+codecs_toplevel_consts_24_consts_11_linetable = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyBytes_Type,
+ },
+ .ob_size = 27,
+ },
+ .ob_shash = -1,
+ .ob_sval = "\x80\x00\xdd\x0e\x17\xd0\x18\x2c\xa8\x74\xac\x7e\xd4\x2f\x46\xd1\x18\x46\xd1\x0e\x47\xd4\x0e\x47\xd0\x08\x47",
+};
+static
+ struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[6];
+ }
+const_str_proto = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 5,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "proto",
+};
+static
+ struct {
+ PyGC_Head _gc_head;
+ struct {
+ PyObject_VAR_HEAD
+ PyObject *ob_item[2];
+ }_object;
+ }
+codecs_toplevel_consts_24_consts_11_localsplusnames = {
+ ._object = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyTuple_Type,
+ },
+ .ob_size = 2,
+ },
+ .ob_item = {
+ & const_str_self._ascii.ob_base,
+ & const_str_proto._ascii.ob_base,
+ },
+ },
+};
+static
+ struct _PyCode_DEF(58)
+codecs_toplevel_consts_24_consts_11 = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyCode_Type,
+ },
+ .ob_size = 29,
+ },
+ .co_consts = & codecs_toplevel_consts_24_consts_11_consts._object.ob_base.ob_base,
+ .co_names = & codecs_toplevel_consts_24_consts_11_names._object.ob_base.ob_base,
+ .co_exceptiontable = (PyObject *)&_Py_SINGLETON(bytes_empty),
+ .co_flags = 3,
+ .co_warmup = QUICKENING_INITIAL_WARMUP_VALUE,
+ ._co_linearray_entry_size = 0,
+ .co_argcount = 2,
+ .co_posonlyargcount = 0,
+ .co_kwonlyargcount = 0,
+ .co_stacksize = 4,
+ .co_firstlineno = 417,
+ .co_nlocalsplus = 2,
+ .co_nlocals = 2,
+ .co_nplaincellvars = 0,
+ .co_ncellvars = 0,
+ .co_nfreevars = 0,
+ .co_localsplusnames = & codecs_toplevel_consts_24_consts_11_localsplusnames._object.ob_base.ob_base,
+ .co_localspluskinds = & importlib__bootstrap_toplevel_consts_7_consts_2_localspluskinds.ob_base.ob_base,
+ .co_filename = & codecs_toplevel_consts_12_consts_5_filename._ascii.ob_base,
+ .co_name = &_Py_ID(__reduce_ex__),
+ .co_qualname = & codecs_toplevel_consts_24_consts_11_qualname._ascii.ob_base,
+ .co_linetable = & codecs_toplevel_consts_24_consts_11_linetable.ob_base.ob_base,
+ ._co_code = NULL,
+ ._co_linearray = NULL,
+ .co_code_adaptive = "\x97\x00\x74\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x01\x7c\x00\x6a\x01\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7a\x06\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x82\x01",
+ ._co_firsttraceable = 0,
+};
+static
+ struct {
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
PyObject *ob_item[1];
}_object;
}
-codecs_toplevel_consts_24_consts_13 = {
+codecs_toplevel_consts_24_consts_14 = {
._object = {
.ob_base = {
.ob_base = {
@@ -63353,7 +63543,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[14];
+ PyObject *ob_item[15];
}_object;
}
codecs_toplevel_consts_24_consts = {
@@ -63363,7 +63553,7 @@ codecs_toplevel_consts_24_consts = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 14,
+ .ob_size = 15,
},
.ob_item = {
& const_str_StreamWriter._ascii.ob_base,
@@ -63377,9 +63567,10 @@ codecs_toplevel_consts_24_consts = {
& codecs_toplevel_consts_24_consts_8.ob_base.ob_base,
& codecs_toplevel_consts_24_consts_9.ob_base.ob_base,
& codecs_toplevel_consts_24_consts_10.ob_base.ob_base,
+ & codecs_toplevel_consts_24_consts_11.ob_base.ob_base,
Py_None,
& codecs_toplevel_consts_14_consts_6._object.ob_base.ob_base,
- & codecs_toplevel_consts_24_consts_13._object.ob_base.ob_base,
+ & codecs_toplevel_consts_24_consts_14._object.ob_base.ob_base,
},
},
};
@@ -63388,7 +63579,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[12];
+ PyObject *ob_item[13];
}_object;
}
codecs_toplevel_consts_24_names = {
@@ -63398,7 +63589,7 @@ codecs_toplevel_consts_24_names = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 12,
+ .ob_size = 13,
},
.ob_item = {
&_Py_ID(__name__),
@@ -63413,6 +63604,7 @@ codecs_toplevel_consts_24_names = {
&_Py_ID(__getattr__),
&_Py_ID(__enter__),
&_Py_ID(__exit__),
+ &_Py_ID(__reduce_ex__),
},
},
};
@@ -63420,7 +63612,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[161];
+ char ob_sval[181];
}
codecs_toplevel_consts_24_linetable = {
.ob_base = {
@@ -63428,20 +63620,20 @@ codecs_toplevel_consts_24_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 160,
+ .ob_size = 180,
},
.ob_shash = -1,
- .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xf0\x04\x17\x05\x1d\xf0\x00\x17\x05\x1d\xf0\x00\x17\x05\x1d\xf0\x00\x17\x05\x1d\xf0\x32\x05\x05\x20\xf0\x00\x05\x05\x20\xf0\x00\x05\x05\x20\xf0\x0e\x05\x05\x22\xf0\x00\x05\x05\x22\xf0\x00\x05\x05\x22\xf0\x0e\x0a\x05\x0d\xf0\x00\x0a\x05\x0d\xf0\x00\x0a\x05\x0d\xf0\x18\x03\x05\x19\xf0\x00\x03\x05\x19\xf0\x00\x03\x05\x19\xf0\x00\x03\x05\x19\xf0\x0c\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c",
+ .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xf0\x04\x17\x05\x1d\xf0\x00\x17\x05\x1d\xf0\x00\x17\x05\x1d\xf0\x00\x17\x05\x1d\xf0\x32\x05\x05\x20\xf0\x00\x05\x05\x20\xf0\x00\x05\x05\x20\xf0\x0e\x05\x05\x22\xf0\x00\x05\x05\x22\xf0\x00\x05\x05\x22\xf0\x0e\x0a\x05\x0d\xf0\x00\x0a\x05\x0d\xf0\x00\x0a\x05\x0d\xf0\x18\x03\x05\x19\xf0\x00\x03\x05\x19\xf0\x00\x03\x05\x19\xf0\x00\x03\x05\x19\xf0\x0c\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x06\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01",
};
static
- struct _PyCode_DEF(70)
+ struct _PyCode_DEF(76)
codecs_toplevel_consts_24 = {
.ob_base = {
.ob_base = {
.ob_refcnt = 999999999,
.ob_type = &PyCode_Type,
},
- .ob_size = 35,
+ .ob_size = 38,
},
.co_consts = & codecs_toplevel_consts_24_consts._object.ob_base.ob_base,
.co_names = & codecs_toplevel_consts_24_names._object.ob_base.ob_base,
@@ -63467,7 +63659,7 @@ codecs_toplevel_consts_24 = {
.co_linetable = & codecs_toplevel_consts_24_linetable.ob_base.ob_base,
._co_code = NULL,
._co_linearray = NULL,
- .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x64\x0c\x64\x02\x84\x01\x5a\x03\x64\x03\x84\x00\x5a\x04\x64\x04\x84\x00\x5a\x05\x64\x05\x84\x00\x5a\x06\x64\x0d\x64\x07\x84\x01\x5a\x07\x65\x08\x66\x01\x64\x08\x84\x01\x5a\x09\x64\x09\x84\x00\x5a\x0a\x64\x0a\x84\x00\x5a\x0b\x64\x0b\x53\x00",
+ .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x64\x0d\x64\x02\x84\x01\x5a\x03\x64\x03\x84\x00\x5a\x04\x64\x04\x84\x00\x5a\x05\x64\x05\x84\x00\x5a\x06\x64\x0e\x64\x07\x84\x01\x5a\x07\x65\x08\x66\x01\x64\x08\x84\x01\x5a\x09\x64\x09\x84\x00\x5a\x0a\x64\x0a\x84\x00\x5a\x0b\x64\x0b\x84\x00\x5a\x0c\x64\x0c\x53\x00",
._co_firsttraceable = 0,
};
static
@@ -63713,7 +63905,7 @@ codecs_toplevel_consts_26_consts_2 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 423,
+ .co_firstlineno = 426,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -63789,7 +63981,7 @@ codecs_toplevel_consts_26_consts_3 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 1,
- .co_firstlineno = 448,
+ .co_firstlineno = 451,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -64217,7 +64409,7 @@ codecs_toplevel_consts_26_consts_6 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 6,
- .co_firstlineno = 451,
+ .co_firstlineno = 454,
.co_nlocalsplus = 11,
.co_nlocals = 11,
.co_nplaincellvars = 0,
@@ -64583,7 +64775,7 @@ codecs_toplevel_consts_26_consts_9 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 531,
+ .co_firstlineno = 534,
.co_nlocalsplus = 9,
.co_nlocals = 9,
.co_nplaincellvars = 0,
@@ -64795,7 +64987,7 @@ codecs_toplevel_consts_26_consts_10 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 606,
+ .co_firstlineno = 609,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -64942,7 +65134,7 @@ codecs_toplevel_consts_26_consts_11 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 621,
+ .co_firstlineno = 624,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -65063,7 +65255,7 @@ codecs_toplevel_consts_26_consts_13 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 634,
+ .co_firstlineno = 637,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -65251,7 +65443,7 @@ codecs_toplevel_consts_26_consts_14 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 642,
+ .co_firstlineno = 645,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -65310,7 +65502,7 @@ codecs_toplevel_consts_26_consts_15 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 1,
- .co_firstlineno = 650,
+ .co_firstlineno = 653,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -65369,7 +65561,7 @@ codecs_toplevel_consts_26_consts_16 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 653,
+ .co_firstlineno = 656,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -65428,7 +65620,7 @@ codecs_toplevel_consts_26_consts_17 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 1,
- .co_firstlineno = 660,
+ .co_firstlineno = 663,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -65487,7 +65679,7 @@ codecs_toplevel_consts_26_consts_18 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 663,
+ .co_firstlineno = 666,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -65506,13 +65698,72 @@ codecs_toplevel_consts_26_consts_18 = {
};
static
struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[27];
+ }
+codecs_toplevel_consts_26_consts_19_qualname = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 26,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "StreamReader.__reduce_ex__",
+};
+static
+ struct _PyCode_DEF(58)
+codecs_toplevel_consts_26_consts_19 = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyCode_Type,
+ },
+ .ob_size = 29,
+ },
+ .co_consts = & codecs_toplevel_consts_24_consts_11_consts._object.ob_base.ob_base,
+ .co_names = & codecs_toplevel_consts_24_consts_11_names._object.ob_base.ob_base,
+ .co_exceptiontable = (PyObject *)&_Py_SINGLETON(bytes_empty),
+ .co_flags = 3,
+ .co_warmup = QUICKENING_INITIAL_WARMUP_VALUE,
+ ._co_linearray_entry_size = 0,
+ .co_argcount = 2,
+ .co_posonlyargcount = 0,
+ .co_kwonlyargcount = 0,
+ .co_stacksize = 4,
+ .co_firstlineno = 669,
+ .co_nlocalsplus = 2,
+ .co_nlocals = 2,
+ .co_nplaincellvars = 0,
+ .co_ncellvars = 0,
+ .co_nfreevars = 0,
+ .co_localsplusnames = & codecs_toplevel_consts_24_consts_11_localsplusnames._object.ob_base.ob_base,
+ .co_localspluskinds = & importlib__bootstrap_toplevel_consts_7_consts_2_localspluskinds.ob_base.ob_base,
+ .co_filename = & codecs_toplevel_consts_12_consts_5_filename._ascii.ob_base,
+ .co_name = &_Py_ID(__reduce_ex__),
+ .co_qualname = & codecs_toplevel_consts_26_consts_19_qualname._ascii.ob_base,
+ .co_linetable = & codecs_toplevel_consts_24_consts_11_linetable.ob_base.ob_base,
+ ._co_code = NULL,
+ ._co_linearray = NULL,
+ .co_code_adaptive = "\x97\x00\x74\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x01\x7c\x00\x6a\x01\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7a\x06\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x82\x01",
+ ._co_firsttraceable = 0,
+};
+static
+ struct {
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
PyObject *ob_item[3];
}_object;
}
-codecs_toplevel_consts_26_consts_20 = {
+codecs_toplevel_consts_26_consts_21 = {
._object = {
.ob_base = {
.ob_base = {
@@ -65533,7 +65784,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[23];
+ PyObject *ob_item[24];
}_object;
}
codecs_toplevel_consts_26_consts = {
@@ -65543,7 +65794,7 @@ codecs_toplevel_consts_26_consts = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 23,
+ .ob_size = 24,
},
.ob_item = {
& const_str_StreamReader._ascii.ob_base,
@@ -65565,10 +65816,11 @@ codecs_toplevel_consts_26_consts = {
& codecs_toplevel_consts_26_consts_16.ob_base.ob_base,
& codecs_toplevel_consts_26_consts_17.ob_base.ob_base,
& codecs_toplevel_consts_26_consts_18.ob_base.ob_base,
+ & codecs_toplevel_consts_26_consts_19.ob_base.ob_base,
& codecs_toplevel_consts_14_consts_6._object.ob_base.ob_base,
- & codecs_toplevel_consts_26_consts_20._object.ob_base.ob_base,
+ & codecs_toplevel_consts_26_consts_21._object.ob_base.ob_base,
& importlib__bootstrap_external_toplevel_consts_69_consts_3_consts._object.ob_base.ob_base,
- & codecs_toplevel_consts_24_consts_13._object.ob_base.ob_base,
+ & codecs_toplevel_consts_24_consts_14._object.ob_base.ob_base,
},
},
};
@@ -65577,7 +65829,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[18];
+ PyObject *ob_item[19];
}_object;
}
codecs_toplevel_consts_26_names = {
@@ -65587,7 +65839,7 @@ codecs_toplevel_consts_26_names = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 18,
+ .ob_size = 19,
},
.ob_item = {
&_Py_ID(__name__),
@@ -65608,6 +65860,7 @@ codecs_toplevel_consts_26_names = {
&_Py_ID(__getattr__),
&_Py_ID(__enter__),
&_Py_ID(__exit__),
+ &_Py_ID(__reduce_ex__),
},
},
};
@@ -65615,7 +65868,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[256];
+ char ob_sval[276];
}
codecs_toplevel_consts_26_linetable = {
.ob_base = {
@@ -65623,20 +65876,20 @@ codecs_toplevel_consts_26_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 255,
+ .ob_size = 275,
},
.ob_shash = -1,
- .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xe0\x15\x18\x80\x4e\xf0\x04\x17\x05\x1f\xf0\x00\x17\x05\x1f\xf0\x00\x17\x05\x1f\xf0\x00\x17\x05\x1f\xf0\x32\x01\x05\x22\xf0\x00\x01\x05\x22\xf0\x00\x01\x05\x22\xf0\x00\x01\x05\x22\xf0\x06\x4e\x01\x05\x16\xf0\x00\x4e\x01\x05\x16\xf0\x00\x4e\x01\x05\x16\xf0\x00\x4e\x01\x05\x16\xf0\x60\x02\x49\x01\x05\x14\xf0\x00\x49\x01\x05\x14\xf0\x00\x49\x01\x05\x14\xf0\x00\x49\x01\x05\x14\xf0\x56\x02\x0d\x05\x29\xf0\x00\x0d\x05\x29\xf0\x00\x0d\x05\x29\xf0\x00\x0d\x05\x29\xf0\x1e\x0b\x05\x1f\xf0\x00\x0b\x05\x1f\xf0\x00\x0b\x05\x1f\xf0\x1a\x06\x05\x15\xf0\x00\x06\x05\x15\xf0\x00\x06\x05\x15\xf0\x00\x06\x05\x15\xf0\x10\x06\x05\x1c\xf0\x00\x06\x05\x1c\xf0\x00\x06\x05\x1c\xf0\x10\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x08\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c",
+ .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xe0\x15\x18\x80\x4e\xf0\x04\x17\x05\x1f\xf0\x00\x17\x05\x1f\xf0\x00\x17\x05\x1f\xf0\x00\x17\x05\x1f\xf0\x32\x01\x05\x22\xf0\x00\x01\x05\x22\xf0\x00\x01\x05\x22\xf0\x00\x01\x05\x22\xf0\x06\x4e\x01\x05\x16\xf0\x00\x4e\x01\x05\x16\xf0\x00\x4e\x01\x05\x16\xf0\x00\x4e\x01\x05\x16\xf0\x60\x02\x49\x01\x05\x14\xf0\x00\x49\x01\x05\x14\xf0\x00\x49\x01\x05\x14\xf0\x00\x49\x01\x05\x14\xf0\x56\x02\x0d\x05\x29\xf0\x00\x0d\x05\x29\xf0\x00\x0d\x05\x29\xf0\x00\x0d\x05\x29\xf0\x1e\x0b\x05\x1f\xf0\x00\x0b\x05\x1f\xf0\x00\x0b\x05\x1f\xf0\x1a\x06\x05\x15\xf0\x00\x06\x05\x15\xf0\x00\x06\x05\x15\xf0\x00\x06\x05\x15\xf0\x10\x06\x05\x1c\xf0\x00\x06\x05\x1c\xf0\x00\x06\x05\x1c\xf0\x10\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x08\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x06\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01",
};
static
- struct _PyCode_DEF(106)
+ struct _PyCode_DEF(112)
codecs_toplevel_consts_26 = {
.ob_base = {
.ob_base = {
.ob_refcnt = 999999999,
.ob_type = &PyCode_Type,
},
- .ob_size = 53,
+ .ob_size = 56,
},
.co_consts = & codecs_toplevel_consts_26_consts._object.ob_base.ob_base,
.co_names = & codecs_toplevel_consts_26_names._object.ob_base.ob_base,
@@ -65648,7 +65901,7 @@ codecs_toplevel_consts_26 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 419,
+ .co_firstlineno = 422,
.co_nlocalsplus = 0,
.co_nlocals = 0,
.co_nplaincellvars = 0,
@@ -65662,7 +65915,7 @@ codecs_toplevel_consts_26 = {
.co_linetable = & codecs_toplevel_consts_26_linetable.ob_base.ob_base,
._co_code = NULL,
._co_linearray = NULL,
- .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x65\x03\x5a\x04\x64\x13\x64\x02\x84\x01\x5a\x05\x64\x13\x64\x03\x84\x01\x5a\x06\x64\x14\x64\x06\x84\x01\x5a\x07\x64\x15\x64\x09\x84\x01\x5a\x08\x64\x15\x64\x0a\x84\x01\x5a\x09\x64\x0b\x84\x00\x5a\x0a\x64\x16\x64\x0d\x84\x01\x5a\x0b\x64\x0e\x84\x00\x5a\x0c\x64\x0f\x84\x00\x5a\x0d\x65\x0e\x66\x01\x64\x10\x84\x01\x5a\x0f\x64\x11\x84\x00\x5a\x10\x64\x12\x84\x00\x5a\x11\x64\x07\x53\x00",
+ .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x65\x03\x5a\x04\x64\x14\x64\x02\x84\x01\x5a\x05\x64\x14\x64\x03\x84\x01\x5a\x06\x64\x15\x64\x06\x84\x01\x5a\x07\x64\x16\x64\x09\x84\x01\x5a\x08\x64\x16\x64\x0a\x84\x01\x5a\x09\x64\x0b\x84\x00\x5a\x0a\x64\x17\x64\x0d\x84\x01\x5a\x0b\x64\x0e\x84\x00\x5a\x0c\x64\x0f\x84\x00\x5a\x0d\x65\x0e\x66\x01\x64\x10\x84\x01\x5a\x0f\x64\x11\x84\x00\x5a\x10\x64\x12\x84\x00\x5a\x11\x64\x13\x84\x00\x5a\x12\x64\x07\x53\x00",
._co_firsttraceable = 0,
};
static
@@ -65952,7 +66205,7 @@ codecs_toplevel_consts_28_consts_4 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 681,
+ .co_firstlineno = 687,
.co_nlocalsplus = 5,
.co_nlocals = 5,
.co_nplaincellvars = 0,
@@ -66074,7 +66327,7 @@ codecs_toplevel_consts_28_consts_6 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 699,
+ .co_firstlineno = 705,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -66173,7 +66426,7 @@ codecs_toplevel_consts_28_consts_8 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 703,
+ .co_firstlineno = 709,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -66295,7 +66548,7 @@ codecs_toplevel_consts_28_consts_9 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 707,
+ .co_firstlineno = 713,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -66394,7 +66647,7 @@ codecs_toplevel_consts_28_consts_10 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 711,
+ .co_firstlineno = 717,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -66453,7 +66706,7 @@ codecs_toplevel_consts_28_consts_11 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 1,
- .co_firstlineno = 716,
+ .co_firstlineno = 722,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -66575,7 +66828,7 @@ codecs_toplevel_consts_28_consts_12 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 719,
+ .co_firstlineno = 725,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -66674,7 +66927,7 @@ codecs_toplevel_consts_28_consts_13 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 723,
+ .co_firstlineno = 729,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -66774,7 +67027,7 @@ codecs_toplevel_consts_28_consts_14 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 727,
+ .co_firstlineno = 733,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -66876,7 +67129,7 @@ codecs_toplevel_consts_28_consts_16 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 732,
+ .co_firstlineno = 738,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -66935,7 +67188,7 @@ codecs_toplevel_consts_28_consts_17 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 738,
+ .co_firstlineno = 744,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -66994,7 +67247,7 @@ codecs_toplevel_consts_28_consts_18 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 1,
- .co_firstlineno = 747,
+ .co_firstlineno = 753,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -67053,7 +67306,7 @@ codecs_toplevel_consts_28_consts_19 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 750,
+ .co_firstlineno = 756,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -67072,13 +67325,72 @@ codecs_toplevel_consts_28_consts_19 = {
};
static
struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[33];
+ }
+codecs_toplevel_consts_28_consts_20_qualname = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 32,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "StreamReaderWriter.__reduce_ex__",
+};
+static
+ struct _PyCode_DEF(58)
+codecs_toplevel_consts_28_consts_20 = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyCode_Type,
+ },
+ .ob_size = 29,
+ },
+ .co_consts = & codecs_toplevel_consts_24_consts_11_consts._object.ob_base.ob_base,
+ .co_names = & codecs_toplevel_consts_24_consts_11_names._object.ob_base.ob_base,
+ .co_exceptiontable = (PyObject *)&_Py_SINGLETON(bytes_empty),
+ .co_flags = 3,
+ .co_warmup = QUICKENING_INITIAL_WARMUP_VALUE,
+ ._co_linearray_entry_size = 0,
+ .co_argcount = 2,
+ .co_posonlyargcount = 0,
+ .co_kwonlyargcount = 0,
+ .co_stacksize = 4,
+ .co_firstlineno = 759,
+ .co_nlocalsplus = 2,
+ .co_nlocals = 2,
+ .co_nplaincellvars = 0,
+ .co_ncellvars = 0,
+ .co_nfreevars = 0,
+ .co_localsplusnames = & codecs_toplevel_consts_24_consts_11_localsplusnames._object.ob_base.ob_base,
+ .co_localspluskinds = & importlib__bootstrap_toplevel_consts_7_consts_2_localspluskinds.ob_base.ob_base,
+ .co_filename = & codecs_toplevel_consts_12_consts_5_filename._ascii.ob_base,
+ .co_name = &_Py_ID(__reduce_ex__),
+ .co_qualname = & codecs_toplevel_consts_28_consts_20_qualname._ascii.ob_base,
+ .co_linetable = & codecs_toplevel_consts_24_consts_11_linetable.ob_base.ob_base,
+ ._co_code = NULL,
+ ._co_linearray = NULL,
+ .co_code_adaptive = "\x97\x00\x74\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x01\x7c\x00\x6a\x01\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7a\x06\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x82\x01",
+ ._co_firsttraceable = 0,
+};
+static
+ struct {
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
PyObject *ob_item[1];
}_object;
}
-codecs_toplevel_consts_28_consts_21 = {
+codecs_toplevel_consts_28_consts_22 = {
._object = {
.ob_base = {
.ob_base = {
@@ -67097,7 +67409,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[24];
+ PyObject *ob_item[25];
}_object;
}
codecs_toplevel_consts_28_consts = {
@@ -67107,7 +67419,7 @@ codecs_toplevel_consts_28_consts = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 24,
+ .ob_size = 25,
},
.ob_item = {
& const_str_StreamReaderWriter._ascii.ob_base,
@@ -67130,10 +67442,11 @@ codecs_toplevel_consts_28_consts = {
& codecs_toplevel_consts_28_consts_17.ob_base.ob_base,
& codecs_toplevel_consts_28_consts_18.ob_base.ob_base,
& codecs_toplevel_consts_28_consts_19.ob_base.ob_base,
+ & codecs_toplevel_consts_28_consts_20.ob_base.ob_base,
& codecs_toplevel_consts_14_consts_6._object.ob_base.ob_base,
- & codecs_toplevel_consts_28_consts_21._object.ob_base.ob_base,
+ & codecs_toplevel_consts_28_consts_22._object.ob_base.ob_base,
& importlib__bootstrap_toplevel_consts_1_consts._object.ob_base.ob_base,
- & codecs_toplevel_consts_24_consts_13._object.ob_base.ob_base,
+ & codecs_toplevel_consts_24_consts_14._object.ob_base.ob_base,
},
},
};
@@ -67142,7 +67455,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[19];
+ PyObject *ob_item[20];
}_object;
}
codecs_toplevel_consts_28_names = {
@@ -67152,7 +67465,7 @@ codecs_toplevel_consts_28_names = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 19,
+ .ob_size = 20,
},
.ob_item = {
&_Py_ID(__name__),
@@ -67174,6 +67487,7 @@ codecs_toplevel_consts_28_names = {
&_Py_ID(__getattr__),
&_Py_ID(__enter__),
&_Py_ID(__exit__),
+ &_Py_ID(__reduce_ex__),
},
},
};
@@ -67181,7 +67495,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[268];
+ char ob_sval[288];
}
codecs_toplevel_consts_28_linetable = {
.ob_base = {
@@ -67189,20 +67503,20 @@ codecs_toplevel_consts_28_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 267,
+ .ob_size = 287,
},
.ob_shash = -1,
- .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xf0\x04\x07\x05\x08\xf0\x00\x07\x05\x08\xf0\x12\x00\x10\x19\x80\x48\xf0\x04\x10\x05\x1d\xf0\x00\x10\x05\x1d\xf0\x00\x10\x05\x1d\xf0\x00\x10\x05\x1d\xf0\x24\x02\x05\x26\xf0\x00\x02\x05\x26\xf0\x00\x02\x05\x26\xf0\x00\x02\x05\x26\xf0\x08\x02\x05\x2a\xf0\x00\x02\x05\x2a\xf0\x00\x02\x05\x2a\xf0\x00\x02\x05\x2a\xf0\x08\x02\x05\x2f\xf0\x00\x02\x05\x2f\xf0\x00\x02\x05\x2f\xf0\x00\x02\x05\x2f\xf0\x08\x03\x05\x21\xf0\x00\x03\x05\x21\xf0\x00\x03\x05\x21\xf0\x0a\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x02\x05\x27\xf0\x00\x02\x05\x27\xf0\x00\x02\x05\x27\xf0\x08\x02\x05\x2c\xf0\x00\x02\x05\x2c\xf0\x00\x02\x05\x2c\xf0\x08\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x0a\x04\x05\x20\xf0\x00\x04\x05\x20\xf0\x00\x04\x05\x20\xf0\x00\x04\x05\x20\xf0\x0e\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x12\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c",
+ .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xf0\x04\x07\x05\x08\xf0\x00\x07\x05\x08\xf0\x12\x00\x10\x19\x80\x48\xf0\x04\x10\x05\x1d\xf0\x00\x10\x05\x1d\xf0\x00\x10\x05\x1d\xf0\x00\x10\x05\x1d\xf0\x24\x02\x05\x26\xf0\x00\x02\x05\x26\xf0\x00\x02\x05\x26\xf0\x00\x02\x05\x26\xf0\x08\x02\x05\x2a\xf0\x00\x02\x05\x2a\xf0\x00\x02\x05\x2a\xf0\x00\x02\x05\x2a\xf0\x08\x02\x05\x2f\xf0\x00\x02\x05\x2f\xf0\x00\x02\x05\x2f\xf0\x00\x02\x05\x2f\xf0\x08\x03\x05\x21\xf0\x00\x03\x05\x21\xf0\x00\x03\x05\x21\xf0\x0a\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x02\x05\x27\xf0\x00\x02\x05\x27\xf0\x00\x02\x05\x27\xf0\x08\x02\x05\x2c\xf0\x00\x02\x05\x2c\xf0\x00\x02\x05\x2c\xf0\x08\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x0a\x04\x05\x20\xf0\x00\x04\x05\x20\xf0\x00\x04\x05\x20\xf0\x00\x04\x05\x20\xf0\x0e\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x12\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x06\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01",
};
static
- struct _PyCode_DEF(114)
+ struct _PyCode_DEF(120)
codecs_toplevel_consts_28 = {
.ob_base = {
.ob_base = {
.ob_refcnt = 999999999,
.ob_type = &PyCode_Type,
},
- .ob_size = 57,
+ .ob_size = 60,
},
.co_consts = & codecs_toplevel_consts_28_consts._object.ob_base.ob_base,
.co_names = & codecs_toplevel_consts_28_names._object.ob_base.ob_base,
@@ -67214,7 +67528,7 @@ codecs_toplevel_consts_28 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 668,
+ .co_firstlineno = 674,
.co_nlocalsplus = 0,
.co_nlocals = 0,
.co_nplaincellvars = 0,
@@ -67228,7 +67542,7 @@ codecs_toplevel_consts_28 = {
.co_linetable = & codecs_toplevel_consts_28_linetable.ob_base.ob_base,
._co_code = NULL,
._co_linearray = NULL,
- .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x64\x01\x5a\x03\x64\x02\x5a\x04\x64\x14\x64\x04\x84\x01\x5a\x05\x64\x15\x64\x06\x84\x01\x5a\x06\x64\x16\x64\x08\x84\x01\x5a\x07\x64\x16\x64\x09\x84\x01\x5a\x08\x64\x0a\x84\x00\x5a\x09\x64\x0b\x84\x00\x5a\x0a\x64\x0c\x84\x00\x5a\x0b\x64\x0d\x84\x00\x5a\x0c\x64\x0e\x84\x00\x5a\x0d\x64\x17\x64\x10\x84\x01\x5a\x0e\x65\x0f\x66\x01\x64\x11\x84\x01\x5a\x10\x64\x12\x84\x00\x5a\x11\x64\x13\x84\x00\x5a\x12\x64\x07\x53\x00",
+ .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x64\x01\x5a\x03\x64\x02\x5a\x04\x64\x15\x64\x04\x84\x01\x5a\x05\x64\x16\x64\x06\x84\x01\x5a\x06\x64\x17\x64\x08\x84\x01\x5a\x07\x64\x17\x64\x09\x84\x01\x5a\x08\x64\x0a\x84\x00\x5a\x09\x64\x0b\x84\x00\x5a\x0a\x64\x0c\x84\x00\x5a\x0b\x64\x0d\x84\x00\x5a\x0c\x64\x0e\x84\x00\x5a\x0d\x64\x18\x64\x10\x84\x01\x5a\x0e\x65\x0f\x66\x01\x64\x11\x84\x01\x5a\x10\x64\x12\x84\x00\x5a\x11\x64\x13\x84\x00\x5a\x12\x64\x14\x84\x00\x5a\x13\x64\x07\x53\x00",
._co_firsttraceable = 0,
};
static
@@ -67412,7 +67726,7 @@ codecs_toplevel_consts_30_consts_4 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 775,
+ .co_firstlineno = 784,
.co_nlocalsplus = 7,
.co_nlocals = 7,
.co_nplaincellvars = 0,
@@ -67560,7 +67874,7 @@ codecs_toplevel_consts_30_consts_6 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 803,
+ .co_firstlineno = 812,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -67661,7 +67975,7 @@ codecs_toplevel_consts_30_consts_8 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 809,
+ .co_firstlineno = 818,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -67812,7 +68126,7 @@ codecs_toplevel_consts_30_consts_9 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 818,
+ .co_firstlineno = 827,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -67937,7 +68251,7 @@ codecs_toplevel_consts_30_consts_10 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 824,
+ .co_firstlineno = 833,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -67996,7 +68310,7 @@ codecs_toplevel_consts_30_consts_11 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 1,
- .co_firstlineno = 831,
+ .co_firstlineno = 840,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -68143,7 +68457,7 @@ codecs_toplevel_consts_30_consts_12 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 834,
+ .co_firstlineno = 843,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -68270,7 +68584,7 @@ codecs_toplevel_consts_30_consts_13 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 839,
+ .co_firstlineno = 848,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -68329,7 +68643,7 @@ codecs_toplevel_consts_30_consts_14 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 845,
+ .co_firstlineno = 854,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -68429,7 +68743,7 @@ codecs_toplevel_consts_30_consts_16 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 850,
+ .co_firstlineno = 859,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -68488,7 +68802,7 @@ codecs_toplevel_consts_30_consts_17 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 856,
+ .co_firstlineno = 865,
.co_nlocalsplus = 3,
.co_nlocals = 3,
.co_nplaincellvars = 0,
@@ -68547,7 +68861,7 @@ codecs_toplevel_consts_30_consts_18 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 1,
- .co_firstlineno = 863,
+ .co_firstlineno = 872,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -68606,7 +68920,7 @@ codecs_toplevel_consts_30_consts_19 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 866,
+ .co_firstlineno = 875,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -68625,10 +68939,69 @@ codecs_toplevel_consts_30_consts_19 = {
};
static
struct {
+ PyASCIIObject _ascii;
+ uint8_t _data[28];
+ }
+codecs_toplevel_consts_30_consts_20_qualname = {
+ ._ascii = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyUnicode_Type,
+ },
+ .length = 27,
+ .hash = -1,
+ .state = {
+ .kind = 1,
+ .compact = 1,
+ .ascii = 1,
+ .ready = 1,
+ },
+ },
+ ._data = "StreamRecoder.__reduce_ex__",
+};
+static
+ struct _PyCode_DEF(58)
+codecs_toplevel_consts_30_consts_20 = {
+ .ob_base = {
+ .ob_base = {
+ .ob_refcnt = 999999999,
+ .ob_type = &PyCode_Type,
+ },
+ .ob_size = 29,
+ },
+ .co_consts = & codecs_toplevel_consts_24_consts_11_consts._object.ob_base.ob_base,
+ .co_names = & codecs_toplevel_consts_24_consts_11_names._object.ob_base.ob_base,
+ .co_exceptiontable = (PyObject *)&_Py_SINGLETON(bytes_empty),
+ .co_flags = 3,
+ .co_warmup = QUICKENING_INITIAL_WARMUP_VALUE,
+ ._co_linearray_entry_size = 0,
+ .co_argcount = 2,
+ .co_posonlyargcount = 0,
+ .co_kwonlyargcount = 0,
+ .co_stacksize = 4,
+ .co_firstlineno = 878,
+ .co_nlocalsplus = 2,
+ .co_nlocals = 2,
+ .co_nplaincellvars = 0,
+ .co_ncellvars = 0,
+ .co_nfreevars = 0,
+ .co_localsplusnames = & codecs_toplevel_consts_24_consts_11_localsplusnames._object.ob_base.ob_base,
+ .co_localspluskinds = & importlib__bootstrap_toplevel_consts_7_consts_2_localspluskinds.ob_base.ob_base,
+ .co_filename = & codecs_toplevel_consts_12_consts_5_filename._ascii.ob_base,
+ .co_name = &_Py_ID(__reduce_ex__),
+ .co_qualname = & codecs_toplevel_consts_30_consts_20_qualname._ascii.ob_base,
+ .co_linetable = & codecs_toplevel_consts_24_consts_11_linetable.ob_base.ob_base,
+ ._co_code = NULL,
+ ._co_linearray = NULL,
+ .co_code_adaptive = "\x97\x00\x74\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x01\x7c\x00\x6a\x01\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x02\x00\x00\x00\x00\x00\x00\x00\x00\x7a\x06\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x82\x01",
+ ._co_firsttraceable = 0,
+};
+static
+ struct {
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[24];
+ PyObject *ob_item[25];
}_object;
}
codecs_toplevel_consts_30_consts = {
@@ -68638,7 +69011,7 @@ codecs_toplevel_consts_30_consts = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 24,
+ .ob_size = 25,
},
.ob_item = {
& const_str_StreamRecoder._ascii.ob_base,
@@ -68661,10 +69034,11 @@ codecs_toplevel_consts_30_consts = {
& codecs_toplevel_consts_30_consts_17.ob_base.ob_base,
& codecs_toplevel_consts_30_consts_18.ob_base.ob_base,
& codecs_toplevel_consts_30_consts_19.ob_base.ob_base,
+ & codecs_toplevel_consts_30_consts_20.ob_base.ob_base,
& codecs_toplevel_consts_14_consts_6._object.ob_base.ob_base,
- & codecs_toplevel_consts_28_consts_21._object.ob_base.ob_base,
+ & codecs_toplevel_consts_28_consts_22._object.ob_base.ob_base,
& importlib__bootstrap_toplevel_consts_1_consts._object.ob_base.ob_base,
- & codecs_toplevel_consts_24_consts_13._object.ob_base.ob_base,
+ & codecs_toplevel_consts_24_consts_14._object.ob_base.ob_base,
},
},
};
@@ -68717,7 +69091,7 @@ static
PyGC_Head _gc_head;
struct {
PyObject_VAR_HEAD
- PyObject *ob_item[20];
+ PyObject *ob_item[21];
}_object;
}
codecs_toplevel_consts_30_names = {
@@ -68727,7 +69101,7 @@ codecs_toplevel_consts_30_names = {
.ob_refcnt = 999999999,
.ob_type = &PyTuple_Type,
},
- .ob_size = 20,
+ .ob_size = 21,
},
.ob_item = {
&_Py_ID(__name__),
@@ -68750,6 +69124,7 @@ codecs_toplevel_consts_30_names = {
&_Py_ID(__getattr__),
&_Py_ID(__enter__),
&_Py_ID(__exit__),
+ &_Py_ID(__reduce_ex__),
},
},
};
@@ -68757,7 +69132,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[278];
+ char ob_sval[298];
}
codecs_toplevel_consts_30_linetable = {
.ob_base = {
@@ -68765,20 +69140,20 @@ codecs_toplevel_consts_30_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 277,
+ .ob_size = 297,
},
.ob_shash = -1,
- .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xf0\x04\x0d\x05\x08\xf0\x00\x0d\x05\x08\xf0\x1e\x00\x15\x1e\x80\x4d\xd8\x14\x1d\x80\x4d\xf0\x06\x00\x19\x21\xf0\x03\x1a\x05\x1d\xf0\x00\x1a\x05\x1d\xf0\x00\x1a\x05\x1d\xf0\x00\x1a\x05\x1d\xf0\x38\x04\x05\x14\xf0\x00\x04\x05\x14\xf0\x00\x04\x05\x14\xf0\x00\x04\x05\x14\xf0\x0c\x07\x05\x14\xf0\x00\x07\x05\x14\xf0\x00\x07\x05\x14\xf0\x00\x07\x05\x14\xf0\x12\x04\x05\x2e\xf0\x00\x04\x05\x2e\xf0\x00\x04\x05\x2e\xf0\x00\x04\x05\x2e\xf0\x0c\x05\x05\x14\xf0\x00\x05\x05\x14\xf0\x00\x05\x05\x14\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x03\x05\x27\xf0\x00\x03\x05\x27\xf0\x00\x03\x05\x27\xf0\x0a\x04\x05\x27\xf0\x00\x04\x05\x27\xf0\x00\x04\x05\x27\xf0\x0c\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x0a\x04\x05\x29\xf0\x00\x04\x05\x29\xf0\x00\x04\x05\x29\xf0\x00\x04\x05\x29\xf0\x0e\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c",
+ .ob_sval = "\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\xf0\x04\x0d\x05\x08\xf0\x00\x0d\x05\x08\xf0\x1e\x00\x15\x1e\x80\x4d\xd8\x14\x1d\x80\x4d\xf0\x06\x00\x19\x21\xf0\x03\x1a\x05\x1d\xf0\x00\x1a\x05\x1d\xf0\x00\x1a\x05\x1d\xf0\x00\x1a\x05\x1d\xf0\x38\x04\x05\x14\xf0\x00\x04\x05\x14\xf0\x00\x04\x05\x14\xf0\x00\x04\x05\x14\xf0\x0c\x07\x05\x14\xf0\x00\x07\x05\x14\xf0\x00\x07\x05\x14\xf0\x00\x07\x05\x14\xf0\x12\x04\x05\x2e\xf0\x00\x04\x05\x2e\xf0\x00\x04\x05\x2e\xf0\x00\x04\x05\x2e\xf0\x0c\x05\x05\x14\xf0\x00\x05\x05\x14\xf0\x00\x05\x05\x14\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x03\x05\x27\xf0\x00\x03\x05\x27\xf0\x00\x03\x05\x27\xf0\x0a\x04\x05\x27\xf0\x00\x04\x05\x27\xf0\x00\x04\x05\x27\xf0\x0c\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x00\x03\x05\x1c\xf0\x0a\x04\x05\x29\xf0\x00\x04\x05\x29\xf0\x00\x04\x05\x29\xf0\x00\x04\x05\x29\xf0\x0e\x00\x1d\x24\xf0\x03\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x00\x05\x05\x2a\xf0\x0e\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x00\x01\x05\x14\xf0\x06\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x00\x01\x05\x1c\xf0\x06\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01\xf0\x00\x01\x05\x48\x01",
};
static
- struct _PyCode_DEF(120)
+ struct _PyCode_DEF(126)
codecs_toplevel_consts_30 = {
.ob_base = {
.ob_base = {
.ob_refcnt = 999999999,
.ob_type = &PyCode_Type,
},
- .ob_size = 60,
+ .ob_size = 63,
},
.co_consts = & codecs_toplevel_consts_30_consts._object.ob_base.ob_base,
.co_names = & codecs_toplevel_consts_30_names._object.ob_base.ob_base,
@@ -68790,7 +69165,7 @@ codecs_toplevel_consts_30 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 755,
+ .co_firstlineno = 764,
.co_nlocalsplus = 0,
.co_nlocals = 0,
.co_nplaincellvars = 0,
@@ -68804,7 +69179,7 @@ codecs_toplevel_consts_30 = {
.co_linetable = & codecs_toplevel_consts_30_linetable.ob_base.ob_base,
._co_code = NULL,
._co_linearray = NULL,
- .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x64\x01\x5a\x03\x64\x02\x5a\x04\x64\x02\x5a\x05\x09\x00\x64\x14\x64\x04\x84\x01\x5a\x06\x64\x15\x64\x06\x84\x01\x5a\x07\x64\x16\x64\x08\x84\x01\x5a\x08\x64\x16\x64\x09\x84\x01\x5a\x09\x64\x0a\x84\x00\x5a\x0a\x64\x0b\x84\x00\x5a\x0b\x64\x0c\x84\x00\x5a\x0c\x64\x0d\x84\x00\x5a\x0d\x64\x0e\x84\x00\x5a\x0e\x64\x17\x64\x10\x84\x01\x5a\x0f\x65\x10\x66\x01\x64\x11\x84\x01\x5a\x11\x64\x12\x84\x00\x5a\x12\x64\x13\x84\x00\x5a\x13\x64\x07\x53\x00",
+ .co_code_adaptive = "\x97\x00\x65\x00\x5a\x01\x64\x00\x5a\x02\x64\x01\x5a\x03\x64\x02\x5a\x04\x64\x02\x5a\x05\x09\x00\x64\x15\x64\x04\x84\x01\x5a\x06\x64\x16\x64\x06\x84\x01\x5a\x07\x64\x17\x64\x08\x84\x01\x5a\x08\x64\x17\x64\x09\x84\x01\x5a\x09\x64\x0a\x84\x00\x5a\x0a\x64\x0b\x84\x00\x5a\x0b\x64\x0c\x84\x00\x5a\x0c\x64\x0d\x84\x00\x5a\x0d\x64\x0e\x84\x00\x5a\x0e\x64\x18\x64\x10\x84\x01\x5a\x0f\x65\x10\x66\x01\x64\x11\x84\x01\x5a\x11\x64\x12\x84\x00\x5a\x12\x64\x13\x84\x00\x5a\x13\x64\x14\x84\x00\x5a\x14\x64\x07\x53\x00",
._co_firsttraceable = 0,
};
static
@@ -69031,7 +69406,7 @@ codecs_toplevel_consts_35 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 6,
- .co_firstlineno = 871,
+ .co_firstlineno = 883,
.co_nlocalsplus = 8,
.co_nlocals = 8,
.co_nplaincellvars = 0,
@@ -69252,7 +69627,7 @@ codecs_toplevel_consts_36 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 8,
- .co_firstlineno = 920,
+ .co_firstlineno = 932,
.co_nlocalsplus = 7,
.co_nlocals = 7,
.co_nplaincellvars = 0,
@@ -69395,7 +69770,7 @@ codecs_toplevel_consts_37 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 958,
+ .co_firstlineno = 970,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -69499,7 +69874,7 @@ codecs_toplevel_consts_38 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 968,
+ .co_firstlineno = 980,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -69688,7 +70063,7 @@ codecs_toplevel_consts_39 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 978,
+ .co_firstlineno = 990,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -69838,7 +70213,7 @@ codecs_toplevel_consts_40 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 992,
+ .co_firstlineno = 1004,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -69959,7 +70334,7 @@ codecs_toplevel_consts_41 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 1006,
+ .co_firstlineno = 1018,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -70063,7 +70438,7 @@ codecs_toplevel_consts_42 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 3,
- .co_firstlineno = 1016,
+ .co_firstlineno = 1028,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -70259,7 +70634,7 @@ codecs_toplevel_consts_43 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 1026,
+ .co_firstlineno = 1038,
.co_nlocalsplus = 7,
.co_nlocals = 7,
.co_nplaincellvars = 0,
@@ -70411,7 +70786,7 @@ codecs_toplevel_consts_44 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 5,
- .co_firstlineno = 1044,
+ .co_firstlineno = 1056,
.co_nlocalsplus = 7,
.co_nlocals = 7,
.co_nplaincellvars = 0,
@@ -70532,7 +70907,7 @@ codecs_toplevel_consts_45_consts_1 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 1072,
+ .co_firstlineno = 1084,
.co_nlocalsplus = 2,
.co_nlocals = 2,
.co_nplaincellvars = 0,
@@ -70675,7 +71050,7 @@ codecs_toplevel_consts_45 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 2,
- .co_firstlineno = 1064,
+ .co_firstlineno = 1076,
.co_nlocalsplus = 1,
.co_nlocals = 1,
.co_nplaincellvars = 0,
@@ -70909,7 +71284,7 @@ codecs_toplevel_consts_46 = {
.co_posonlyargcount = 0,
.co_kwonlyargcount = 0,
.co_stacksize = 4,
- .co_firstlineno = 1074,
+ .co_firstlineno = 1086,
.co_nlocalsplus = 4,
.co_nlocals = 4,
.co_nplaincellvars = 0,
@@ -71358,7 +71733,7 @@ static
struct {
PyObject_VAR_HEAD
Py_hash_t ob_shash;
- char ob_sval[1189];
+ char ob_sval[1221];
}
codecs_toplevel_linetable = {
.ob_base = {
@@ -71366,10 +71741,10 @@ codecs_toplevel_linetable = {
.ob_refcnt = 999999999,
.ob_type = &PyBytes_Type,
},
- .ob_size = 1188,
+ .ob_size = 1220,
},
.ob_shash = -1,
- .ob_sval = "\xf0\x03\x01\x01\x01\xf0\x02\x07\x01\x04\xf0\x00\x07\x01\x04\xf0\x12\x00\x01\x10\x80\x0f\x80\x0f\x80\x0f\xd8\x00\x0a\x80\x0a\x80\x0a\x80\x0a\xf0\x08\x03\x01\x45\x01\xd8\x04\x19\xd0\x04\x19\xd0\x04\x19\xd0\x04\x19\xd0\x04\x19\xf8\xd8\x07\x12\xf0\x00\x01\x01\x45\x01\xf0\x00\x01\x01\x45\x01\xf0\x00\x01\x01\x45\x01\xd8\x0a\x15\x88\x2b\xd0\x16\x3d\xc0\x03\xd1\x16\x43\xd1\x0a\x44\xd4\x0a\x44\xd0\x04\x44\xf8\xf8\xf8\xf8\xf0\x03\x01\x01\x45\x01\xf8\xf8\xf8\xf0\x06\x0d\x0b\x2d\xf0\x00\x0d\x0b\x2d\xf0\x00\x0d\x0b\x2d\x80\x07\xf0\x30\x00\x0c\x1b\x80\x08\xf0\x06\x00\x19\x24\xd0\x00\x23\x80\x06\x88\x1c\xf0\x06\x00\x19\x24\xd0\x00\x23\x80\x06\x88\x1c\xf0\x06\x00\x10\x23\x80\x0c\xf0\x06\x00\x10\x23\x80\x0c\xe0\x03\x06\x84\x3d\x90\x48\xd2\x03\x1c\xd0\x03\x1c\xf0\x06\x00\x17\x23\xd0\x04\x22\x80\x43\x88\x29\xf0\x06\x00\x11\x1d\x80\x49\x80\x49\xf0\x0a\x00\x17\x23\xd0\x04\x22\x80\x43\x88\x29\xf0\x06\x00\x11\x1d\x80\x49\xf0\x06\x00\x0c\x18\x80\x08\xd8\x0b\x17\x80\x08\xd8\x0b\x17\x80\x08\xd8\x0b\x17\x80\x08\xf0\x0a\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\x90\x05\xf1\x00\x1d\x01\x26\xf4\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x3e\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf1\x00\x40\x01\x01\x22\xf4\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x44\x02\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\x98\x16\xf1\x00\x26\x01\x0c\xf4\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x50\x01\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xd0\x21\x33\xf1\x00\x20\x01\x22\xf4\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x44\x01\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\x98\x16\xf1\x00\x2f\x01\x0c\xf4\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x62\x01\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xd0\x21\x33\xf1\x00\x22\x01\x1f\xf4\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x56\x01\x45\x01\x01\x1c\xf0\x00\x45\x01\x01\x1c\xf0\x00\x45\x01\x01\x1c\xf0\x00\x45\x01\x01\x1c\xf0\x00\x45\x01\x01\x1c\x90\x35\xf1\x00\x45\x01\x01\x1c\xf4\x00\x45\x01\x01\x1c\xf0\x00\x45\x01\x01\x1c\xf0\x52\x02\x75\x03\x01\x1c\xf0\x00\x75\x03\x01\x1c\xf0\x00\x75\x03\x01\x1c\xf0\x00\x75\x03\x01\x1c\xf0\x00\x75\x03\x01\x1c\x90\x35\xf1\x00\x75\x03\x01\x1c\xf4\x00\x75\x03\x01\x1c\xf0\x00\x75\x03\x01\x1c\xf0\x72\x07\x53\x01\x01\x1c\xf0\x00\x53\x01\x01\x1c\xf0\x00\x53\x01\x01\x1c\xf0\x00\x53\x01\x01\x1c\xf0\x00\x53\x01\x01\x1c\xf1\x00\x53\x01\x01\x1c\xf4\x00\x53\x01\x01\x1c\xf0\x00\x53\x01\x01\x1c\xf0\x6e\x02\x70\x01\x01\x1c\xf0\x00\x70\x01\x01\x1c\xf0\x00\x70\x01\x01\x1c\xf0\x00\x70\x01\x01\x1c\xf0\x00\x70\x01\x01\x1c\xf1\x00\x70\x01\x01\x1c\xf4\x00\x70\x01\x01\x1c\xf0\x00\x70\x01\x01\x1c\xf0\x68\x03\x2f\x01\x0e\xf0\x00\x2f\x01\x0e\xf0\x00\x2f\x01\x0e\xf0\x00\x2f\x01\x0e\xf0\x62\x01\x22\x01\x0e\xf0\x00\x22\x01\x0e\xf0\x00\x22\x01\x0e\xf0\x00\x22\x01\x0e\xf0\x4c\x01\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x14\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x14\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x1c\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x1c\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x14\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x14\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x24\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x28\x08\x01\x1e\xf0\x00\x08\x01\x1e\xf0\x00\x08\x01\x1e\xf0\x14\x13\x01\x0d\xf0\x00\x13\x01\x0d\xf0\x00\x13\x01\x0d\xf0\x2e\x0e\x01\x1e\xd8\x14\x20\x90\x4c\xa0\x18\xd1\x14\x2a\xd4\x14\x2a\x80\x4d\xd8\x14\x20\x90\x4c\xa0\x18\xd1\x14\x2a\xd4\x14\x2a\x80\x4d\xd8\x15\x21\x90\x5c\xa0\x29\xd1\x15\x2c\xd4\x15\x2c\x80\x4e\xd8\x1f\x2b\x98\x7c\xd0\x2c\x3f\xd1\x1f\x40\xd4\x1f\x40\xd0\x04\x1c\xd8\x1e\x2a\x98\x6c\xd0\x2b\x3d\xd1\x1e\x3e\xd4\x1e\x3e\xd0\x04\x1b\xd8\x19\x25\x98\x1c\xa0\x6d\xd1\x19\x34\xd4\x19\x34\xd0\x04\x16\xd0\x04\x16\xf8\xd8\x07\x12\xf0\x00\x07\x01\x1e\xf0\x00\x07\x01\x1e\xf0\x00\x07\x01\x1e\xe0\x14\x18\x80\x4d\xd8\x14\x18\x80\x4d\xd8\x15\x19\x80\x4e\xd8\x1f\x23\xd0\x04\x1c\xd8\x1e\x22\xd0\x04\x1b\xd8\x19\x1d\xd0\x04\x16\xd0\x04\x16\xd0\x04\x16\xf0\x0f\x07\x01\x1e\xf8\xf8\xf8\xf0\x16\x00\x0a\x0b\x80\x06\xd8\x03\x09\xf0\x00\x01\x01\x15\xd8\x04\x14\xd0\x04\x14\xd0\x04\x14\xd0\x04\x14\xf0\x08\x00\x04\x0c\x88\x7a\xd2\x03\x19\xd0\x03\x19\xf0\x06\x00\x12\x1d\x90\x1b\x98\x53\x9c\x5a\xa8\x19\xb0\x47\xd1\x11\x3c\xd4\x11\x3c\x80\x43\x84\x4a\xf0\x06\x00\x11\x1c\x90\x0b\x98\x43\x9c\x49\xa0\x77\xb0\x09\xd1\x10\x3a\xd4\x10\x3a\x80\x43\x84\x49\x80\x49\x80\x49\xf0\x0d\x00\x04\x1a\xd0\x03\x19",
+ .ob_sval = "\xf0\x03\x01\x01\x01\xf0\x02\x07\x01\x04\xf0\x00\x07\x01\x04\xf0\x12\x00\x01\x10\x80\x0f\x80\x0f\x80\x0f\xd8\x00\x0a\x80\x0a\x80\x0a\x80\x0a\xf0\x08\x03\x01\x45\x01\xd8\x04\x19\xd0\x04\x19\xd0\x04\x19\xd0\x04\x19\xd0\x04\x19\xf8\xd8\x07\x12\xf0\x00\x01\x01\x45\x01\xf0\x00\x01\x01\x45\x01\xf0\x00\x01\x01\x45\x01\xd8\x0a\x15\x88\x2b\xd0\x16\x3d\xc0\x03\xd1\x16\x43\xd1\x0a\x44\xd4\x0a\x44\xd0\x04\x44\xf8\xf8\xf8\xf8\xf0\x03\x01\x01\x45\x01\xf8\xf8\xf8\xf0\x06\x0d\x0b\x2d\xf0\x00\x0d\x0b\x2d\xf0\x00\x0d\x0b\x2d\x80\x07\xf0\x30\x00\x0c\x1b\x80\x08\xf0\x06\x00\x19\x24\xd0\x00\x23\x80\x06\x88\x1c\xf0\x06\x00\x19\x24\xd0\x00\x23\x80\x06\x88\x1c\xf0\x06\x00\x10\x23\x80\x0c\xf0\x06\x00\x10\x23\x80\x0c\xe0\x03\x06\x84\x3d\x90\x48\xd2\x03\x1c\xd0\x03\x1c\xf0\x06\x00\x17\x23\xd0\x04\x22\x80\x43\x88\x29\xf0\x06\x00\x11\x1d\x80\x49\x80\x49\xf0\x0a\x00\x17\x23\xd0\x04\x22\x80\x43\x88\x29\xf0\x06\x00\x11\x1d\x80\x49\xf0\x06\x00\x0c\x18\x80\x08\xd8\x0b\x17\x80\x08\xd8\x0b\x17\x80\x08\xd8\x0b\x17\x80\x08\xf0\x0a\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\x90\x05\xf1\x00\x1d\x01\x26\xf4\x00\x1d\x01\x26\xf0\x00\x1d\x01\x26\xf0\x3e\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf1\x00\x40\x01\x01\x22\xf4\x00\x40\x01\x01\x22\xf0\x00\x40\x01\x01\x22\xf0\x44\x02\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\x98\x16\xf1\x00\x26\x01\x0c\xf4\x00\x26\x01\x0c\xf0\x00\x26\x01\x0c\xf0\x50\x01\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xd0\x21\x33\xf1\x00\x20\x01\x22\xf4\x00\x20\x01\x22\xf0\x00\x20\x01\x22\xf0\x44\x01\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\x98\x16\xf1\x00\x2f\x01\x0c\xf4\x00\x2f\x01\x0c\xf0\x00\x2f\x01\x0c\xf0\x62\x01\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xd0\x21\x33\xf1\x00\x22\x01\x1f\xf4\x00\x22\x01\x1f\xf0\x00\x22\x01\x1f\xf0\x56\x01\x48\x01\x01\x48\x01\xf0\x00\x48\x01\x01\x48\x01\xf0\x00\x48\x01\x01\x48\x01\xf0\x00\x48\x01\x01\x48\x01\xf0\x00\x48\x01\x01\x48\x01\x90\x35\xf1\x00\x48\x01\x01\x48\x01\xf4\x00\x48\x01\x01\x48\x01\xf0\x00\x48\x01\x01\x48\x01\xf0\x58\x02\x78\x03\x01\x48\x01\xf0\x00\x78\x03\x01\x48\x01\xf0\x00\x78\x03\x01\x48\x01\xf0\x00\x78\x03\x01\x48\x01\xf0\x00\x78\x03\x01\x48\x01\x90\x35\xf1\x00\x78\x03\x01\x48\x01\xf4\x00\x78\x03\x01\x48\x01\xf0\x00\x78\x03\x01\x48\x01\xf0\x78\x07\x56\x01\x01\x48\x01\xf0\x00\x56\x01\x01\x48\x01\xf0\x00\x56\x01\x01\x48\x01\xf0\x00\x56\x01\x01\x48\x01\xf0\x00\x56\x01\x01\x48\x01\xf1\x00\x56\x01\x01\x48\x01\xf4\x00\x56\x01\x01\x48\x01\xf0\x00\x56\x01\x01\x48\x01\xf0\x74\x02\x73\x01\x01\x48\x01\xf0\x00\x73\x01\x01\x48\x01\xf0\x00\x73\x01\x01\x48\x01\xf0\x00\x73\x01\x01\x48\x01\xf0\x00\x73\x01\x01\x48\x01\xf1\x00\x73\x01\x01\x48\x01\xf4\x00\x73\x01\x01\x48\x01\xf0\x00\x73\x01\x01\x48\x01\xf0\x6e\x03\x2f\x01\x0e\xf0\x00\x2f\x01\x0e\xf0\x00\x2f\x01\x0e\xf0\x00\x2f\x01\x0e\xf0\x62\x01\x22\x01\x0e\xf0\x00\x22\x01\x0e\xf0\x00\x22\x01\x0e\xf0\x00\x22\x01\x0e\xf0\x4c\x01\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x14\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x00\x08\x01\x23\xf0\x14\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x1c\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x00\x0c\x01\x13\xf0\x1c\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x14\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x00\x08\x01\x29\xf0\x14\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x24\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x00\x10\x01\x15\xf0\x28\x08\x01\x1e\xf0\x00\x08\x01\x1e\xf0\x00\x08\x01\x1e\xf0\x14\x13\x01\x0d\xf0\x00\x13\x01\x0d\xf0\x00\x13\x01\x0d\xf0\x2e\x0e\x01\x1e\xd8\x14\x20\x90\x4c\xa0\x18\xd1\x14\x2a\xd4\x14\x2a\x80\x4d\xd8\x14\x20\x90\x4c\xa0\x18\xd1\x14\x2a\xd4\x14\x2a\x80\x4d\xd8\x15\x21\x90\x5c\xa0\x29\xd1\x15\x2c\xd4\x15\x2c\x80\x4e\xd8\x1f\x2b\x98\x7c\xd0\x2c\x3f\xd1\x1f\x40\xd4\x1f\x40\xd0\x04\x1c\xd8\x1e\x2a\x98\x6c\xd0\x2b\x3d\xd1\x1e\x3e\xd4\x1e\x3e\xd0\x04\x1b\xd8\x19\x25\x98\x1c\xa0\x6d\xd1\x19\x34\xd4\x19\x34\xd0\x04\x16\xd0\x04\x16\xf8\xd8\x07\x12\xf0\x00\x07\x01\x1e\xf0\x00\x07\x01\x1e\xf0\x00\x07\x01\x1e\xe0\x14\x18\x80\x4d\xd8\x14\x18\x80\x4d\xd8\x15\x19\x80\x4e\xd8\x1f\x23\xd0\x04\x1c\xd8\x1e\x22\xd0\x04\x1b\xd8\x19\x1d\xd0\x04\x16\xd0\x04\x16\xd0\x04\x16\xf0\x0f\x07\x01\x1e\xf8\xf8\xf8\xf0\x16\x00\x0a\x0b\x80\x06\xd8\x03\x09\xf0\x00\x01\x01\x15\xd8\x04\x14\xd0\x04\x14\xd0\x04\x14\xd0\x04\x14\xf0\x08\x00\x04\x0c\x88\x7a\xd2\x03\x19\xd0\x03\x19\xf0\x06\x00\x12\x1d\x90\x1b\x98\x53\x9c\x5a\xa8\x19\xb0\x47\xd1\x11\x3c\xd4\x11\x3c\x80\x43\x84\x4a\xf0\x06\x00\x11\x1c\x90\x0b\x98\x43\x9c\x49\xa0\x77\xb0\x09\xd1\x10\x3a\xd4\x10\x3a\x80\x43\x84\x49\x80\x49\x80\x49\xf0\x0d\x00\x04\x1a\xd0\x03\x19",
};
static
struct {
@@ -92094,7 +92469,7 @@ _collections_abc_toplevel_consts_70_consts = {
& _collections_abc_toplevel_consts_70_consts_12.ob_base.ob_base,
& _collections_abc_toplevel_consts_70_consts_13.ob_base.ob_base,
Py_None,
- & codecs_toplevel_consts_28_consts_21._object.ob_base.ob_base,
+ & codecs_toplevel_consts_28_consts_22._object.ob_base.ob_base,
},
},
};
@@ -149349,6 +149724,10 @@ _Py_Deepfreeze_Fini(void) {
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_24_consts_10_qualname);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_tb);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_24_consts_10);
+ _PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_24_consts_11_consts_1);
+ _PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_24_consts_11_qualname);
+ _PyStaticUnicode_Dealloc((PyObject *)&const_str_proto);
+ _PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_24_consts_11);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_24);
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_26_consts_2_consts_0);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_bytebuffer);
@@ -149403,6 +149782,8 @@ _Py_Deepfreeze_Fini(void) {
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_26_consts_17);
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_26_consts_18_qualname);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_26_consts_18);
+ _PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_26_consts_19_qualname);
+ _PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_26_consts_19);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_26);
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_28_consts_1);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_unknown);
@@ -149437,6 +149818,8 @@ _Py_Deepfreeze_Fini(void) {
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_28_consts_18);
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_28_consts_19_qualname);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_28_consts_19);
+ _PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_28_consts_20_qualname);
+ _PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_28_consts_20);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_28);
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_30_consts_1);
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_30_consts_4_consts_0);
@@ -149468,6 +149851,8 @@ _Py_Deepfreeze_Fini(void) {
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_30_consts_18);
_PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_30_consts_19_qualname);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_30_consts_19);
+ _PyStaticUnicode_Dealloc((PyObject *)&codecs_toplevel_consts_30_consts_20_qualname);
+ _PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_30_consts_20);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_data_encoding);
_PyStaticUnicode_Dealloc((PyObject *)&const_str_file_encoding);
_PyStaticCode_Dealloc((PyCodeObject *)&codecs_toplevel_consts_30);
@@ -152148,6 +152533,9 @@ _Py_Deepfreeze_Init(void) {
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_24_consts_10) < 0) {
return -1;
}
+ if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_24_consts_11) < 0) {
+ return -1;
+ }
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_24) < 0) {
return -1;
}
@@ -152187,6 +152575,9 @@ _Py_Deepfreeze_Init(void) {
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_26_consts_18) < 0) {
return -1;
}
+ if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_26_consts_19) < 0) {
+ return -1;
+ }
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_26) < 0) {
return -1;
}
@@ -152229,6 +152620,9 @@ _Py_Deepfreeze_Init(void) {
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_28_consts_19) < 0) {
return -1;
}
+ if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_28_consts_20) < 0) {
+ return -1;
+ }
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_28) < 0) {
return -1;
}
@@ -152271,6 +152665,9 @@ _Py_Deepfreeze_Init(void) {
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_30_consts_19) < 0) {
return -1;
}
+ if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_30_consts_20) < 0) {
+ return -1;
+ }
if (_PyStaticCode_InternStrings((PyCodeObject *)&codecs_toplevel_consts_30) < 0) {
return -1;
}
diff --git a/contrib/tools/python3/src/Python/fileutils.c b/contrib/tools/python3/src/Python/fileutils.c
index e1af39ddf0..79ce20bd72 100644
--- a/contrib/tools/python3/src/Python/fileutils.c
+++ b/contrib/tools/python3/src/Python/fileutils.c
@@ -1687,6 +1687,7 @@ _Py_fopen_obj(PyObject *path, const char *mode)
Py_END_ALLOW_THREADS
} while (f == NULL
&& errno == EINTR && !(async_err = PyErr_CheckSignals()));
+ int saved_errno = errno;
#if !USE_UNICODE_WCHAR_CACHE
PyMem_Free(wpath);
#endif /* USE_UNICODE_WCHAR_CACHE */
@@ -1711,13 +1712,14 @@ _Py_fopen_obj(PyObject *path, const char *mode)
Py_END_ALLOW_THREADS
} while (f == NULL
&& errno == EINTR && !(async_err = PyErr_CheckSignals()));
-
+ int saved_errno = errno;
Py_DECREF(bytes);
#endif
if (async_err)
return NULL;
if (f == NULL) {
+ errno = saved_errno;
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, path);
return NULL;
}
diff --git a/contrib/tools/python3/src/Python/pystate.c b/contrib/tools/python3/src/Python/pystate.c
index dfca3f5fd7..db2ce878af 100644
--- a/contrib/tools/python3/src/Python/pystate.c
+++ b/contrib/tools/python3/src/Python/pystate.c
@@ -882,6 +882,10 @@ _PyThreadState_Init(PyThreadState *tstate)
void
_PyThreadState_SetCurrent(PyThreadState *tstate)
{
+ // gh-104690: If Python is being finalized and PyInterpreterState_Delete()
+ // was called, tstate becomes a dangling pointer.
+ assert(_PyThreadState_CheckConsistency(tstate));
+
_PyGILState_NoteThreadState(&tstate->interp->runtime->gilstate, tstate);
}
@@ -2237,6 +2241,46 @@ _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame * frame)
}
+#ifndef NDEBUG
+// Check that a Python thread state valid. In practice, this function is used
+// on a Python debug build to check if 'tstate' is a dangling pointer, if the
+// PyThreadState memory has been freed.
+//
+// Usage:
+//
+// assert(_PyThreadState_CheckConsistency(tstate));
+int
+_PyThreadState_CheckConsistency(PyThreadState *tstate)
+{
+ assert(!_PyMem_IsPtrFreed(tstate));
+ assert(!_PyMem_IsPtrFreed(tstate->interp));
+ return 1;
+}
+#endif
+
+
+// Check if a Python thread must exit immediately, rather than taking the GIL
+// if Py_Finalize() has been called.
+//
+// When this function is called by a daemon thread after Py_Finalize() has been
+// called, the GIL does no longer exist.
+//
+// tstate can be a dangling pointer (point to freed memory): only tstate value
+// is used, the pointer is not deferenced.
+//
+// tstate must be non-NULL.
+int
+_PyThreadState_MustExit(PyThreadState *tstate)
+{
+ /* bpo-39877: Access _PyRuntime directly rather than using
+ tstate->interp->runtime to support calls from Python daemon threads.
+ After Py_Finalize() has been called, tstate can be a dangling pointer:
+ point to PyThreadState freed memory. */
+ PyThreadState *finalizing = _PyRuntimeState_GetFinalizing(&_PyRuntime);
+ return (finalizing != NULL && finalizing != tstate);
+}
+
+
#ifdef __cplusplus
}
#endif
diff --git a/contrib/tools/python3/src/Python/pythonrun.c b/contrib/tools/python3/src/Python/pythonrun.c
index 03e366a8d0..91c2ad3a13 100644
--- a/contrib/tools/python3/src/Python/pythonrun.c
+++ b/contrib/tools/python3/src/Python/pythonrun.c
@@ -1130,21 +1130,16 @@ error:
}
static int
-print_exception_notes(struct exception_print_context *ctx, PyObject *value)
+print_exception_notes(struct exception_print_context *ctx, PyObject *notes)
{
PyObject *f = ctx->file;
- if (!PyExceptionInstance_Check(value)) {
+ if (notes == NULL) {
return 0;
}
- PyObject *notes;
- int res = _PyObject_LookupAttr(value, &_Py_ID(__notes__), &notes);
- if (res <= 0) {
- return res;
- }
if (!PySequence_Check(notes)) {
- res = 0;
+ int res = 0;
if (write_indented_margin(ctx, f) < 0) {
res = -1;
}
@@ -1157,7 +1152,6 @@ print_exception_notes(struct exception_print_context *ctx, PyObject *value)
res = PyFile_WriteObject(s, f, Py_PRINT_RAW);
Py_DECREF(s);
}
- Py_DECREF(notes);
return res;
}
Py_ssize_t num_notes = PySequence_Length(notes);
@@ -1199,17 +1193,16 @@ print_exception_notes(struct exception_print_context *ctx, PyObject *value)
}
}
- Py_DECREF(notes);
return 0;
error:
Py_XDECREF(lines);
- Py_DECREF(notes);
return -1;
}
static int
print_exception(struct exception_print_context *ctx, PyObject *value)
{
+ PyObject *notes = NULL;
PyObject *f = ctx->file;
if (!PyExceptionInstance_Check(value)) {
@@ -1223,8 +1216,11 @@ print_exception(struct exception_print_context *ctx, PyObject *value)
goto error;
}
- /* grab the type now because value can change below */
+ /* 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) {
+ goto error;
+ }
if (print_exception_file_and_line(ctx, &value) < 0) {
goto error;
@@ -1238,14 +1234,16 @@ print_exception(struct exception_print_context *ctx, PyObject *value)
if (PyFile_WriteString("\n", f) < 0) {
goto error;
}
- if (print_exception_notes(ctx, value) < 0) {
+ if (print_exception_notes(ctx, notes) < 0) {
goto error;
}
+ Py_XDECREF(notes);
Py_DECREF(value);
assert(!PyErr_Occurred());
return 0;
error:
+ Py_XDECREF(notes);
Py_DECREF(value);
return -1;
}
diff --git a/contrib/tools/python3/src/Python/symtable.c b/contrib/tools/python3/src/Python/symtable.c
index 0b259b08b6..37e5c69740 100644
--- a/contrib/tools/python3/src/Python/symtable.c
+++ b/contrib/tools/python3/src/Python/symtable.c
@@ -128,9 +128,8 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
static PyObject *
ste_repr(PySTEntryObject *ste)
{
- return PyUnicode_FromFormat("<symtable entry %U(%ld), line %d>",
- ste->ste_name,
- PyLong_AS_LONG(ste->ste_id), ste->ste_lineno);
+ return PyUnicode_FromFormat("<symtable entry %U(%R), line %d>",
+ ste->ste_name, ste->ste_id, ste->ste_lineno);
}
static void
@@ -502,6 +501,7 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
PyObject *bound, PyObject *local, PyObject *free,
PyObject *global)
{
+ int contains;
if (flags & DEF_GLOBAL) {
if (flags & DEF_NONLOCAL) {
PyErr_Format(PyExc_SyntaxError,
@@ -522,7 +522,11 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
"nonlocal declaration not allowed at module level");
return error_at_directive(ste, name);
}
- if (!PySet_Contains(bound, name)) {
+ contains = PySet_Contains(bound, name);
+ if (contains < 0) {
+ return 0;
+ }
+ if (!contains) {
PyErr_Format(PyExc_SyntaxError,
"no binding for nonlocal '%U' found",
name);
@@ -546,17 +550,29 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
Note that having a non-NULL bound implies that the block
is nested.
*/
- if (bound && PySet_Contains(bound, name)) {
- SET_SCOPE(scopes, name, FREE);
- ste->ste_free = 1;
- return PySet_Add(free, name) >= 0;
+ if (bound) {
+ contains = PySet_Contains(bound, name);
+ if (contains < 0) {
+ return 0;
+ }
+ if (contains) {
+ SET_SCOPE(scopes, name, FREE);
+ ste->ste_free = 1;
+ return PySet_Add(free, name) >= 0;
+ }
}
/* If a parent has a global statement, then call it global
explicit? It could also be global implicit.
*/
- if (global && PySet_Contains(global, name)) {
- SET_SCOPE(scopes, name, GLOBAL_IMPLICIT);
- return 1;
+ if (global) {
+ contains = PySet_Contains(global, name);
+ if (contains < 0) {
+ return 0;
+ }
+ if (contains) {
+ SET_SCOPE(scopes, name, GLOBAL_IMPLICIT);
+ return 1;
+ }
}
if (ste->ste_nested)
ste->ste_free = 1;
@@ -590,8 +606,13 @@ analyze_cells(PyObject *scopes, PyObject *free)
scope = PyLong_AS_LONG(v);
if (scope != LOCAL)
continue;
- if (!PySet_Contains(free, name))
+ int contains = PySet_Contains(free, name);
+ if (contains < 0) {
+ goto error;
+ }
+ if (!contains) {
continue;
+ }
/* Replace LOCAL with CELL for this name, and remove
from free. It is safe to replace the value of name
in the dict, because it will not cause a resize.
@@ -691,9 +712,15 @@ update_symbols(PyObject *symbols, PyObject *scopes,
goto error;
}
/* Handle global symbol */
- if (bound && !PySet_Contains(bound, name)) {
- Py_DECREF(name);
- continue; /* it's a global */
+ if (bound) {
+ int contains = PySet_Contains(bound, name);
+ if (contains < 0) {
+ goto error;
+ }
+ if (!contains) {
+ Py_DECREF(name);
+ continue; /* it's a global */
+ }
}
/* Propagate new free symbol up the lexical stack */
if (PyDict_SetItem(symbols, name, v_free) < 0) {
diff --git a/contrib/tools/python3/src/Python/sysmodule.c b/contrib/tools/python3/src/Python/sysmodule.c
index 5da1381bbc..25fcd4aecf 100644
--- a/contrib/tools/python3/src/Python/sysmodule.c
+++ b/contrib/tools/python3/src/Python/sysmodule.c
@@ -3113,7 +3113,9 @@ _PySys_UpdateConfig(PyThreadState *tstate)
if (config->pycache_prefix != NULL) {
SET_SYS_FROM_WSTR("pycache_prefix", config->pycache_prefix);
} else {
- PyDict_SetItemString(sysdict, "pycache_prefix", Py_None);
+ if (PyDict_SetItemString(sysdict, "pycache_prefix", Py_None) < 0) {
+ return -1;
+ }
}
COPY_LIST("argv", config->argv);
@@ -3127,7 +3129,9 @@ _PySys_UpdateConfig(PyThreadState *tstate)
SET_SYS_FROM_WSTR("_stdlib_dir", stdlibdir);
}
else {
- PyDict_SetItemString(sysdict, "_stdlib_dir", Py_None);
+ if (PyDict_SetItemString(sysdict, "_stdlib_dir", Py_None) < 0) {
+ return -1;
+ }
}
#undef SET_SYS_FROM_WSTR
@@ -3137,6 +3141,9 @@ _PySys_UpdateConfig(PyThreadState *tstate)
// sys.flags
PyObject *flags = _PySys_GetObject(interp, "flags"); // borrowed ref
if (flags == NULL) {
+ if (!_PyErr_Occurred(tstate)) {
+ _PyErr_SetString(tstate, PyExc_RuntimeError, "lost sys.flags");
+ }
return -1;
}
if (set_flags_from_config(interp, flags) < 0) {
diff --git a/contrib/tools/python3/src/Python/traceback.c b/contrib/tools/python3/src/Python/traceback.c
index 7f47349a27..c4f5ec877b 100644
--- a/contrib/tools/python3/src/Python/traceback.c
+++ b/contrib/tools/python3/src/Python/traceback.c
@@ -12,6 +12,7 @@
#include "pycore_parser.h" // _PyParser_ASTFromString
#include "pycore_pyarena.h" // _PyArena_Free()
#include "pycore_pyerrors.h" // _PyErr_Fetch()
+#include "pycore_pymem.h" // _PyMem_IsPtrFreed()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_traceback.h" // EXCEPTION_TB_HEADER
@@ -621,6 +622,11 @@ extract_anchors_from_expr(const char *segment_str, expr_ty expr, Py_ssize_t *lef
++*right_anchor;
}
+ // Keep going if the current char is not ')'
+ if (i+1 < right->col_offset && (segment_str[i] == ')')) {
+ continue;
+ }
+
// Set the error characters
*primary_error_char = "~";
*secondary_error_char = "^";
@@ -631,6 +637,18 @@ extract_anchors_from_expr(const char *segment_str, expr_ty expr, Py_ssize_t *lef
case Subscript_kind: {
*left_anchor = expr->v.Subscript.value->end_col_offset;
*right_anchor = expr->v.Subscript.slice->end_col_offset + 1;
+ Py_ssize_t str_len = strlen(segment_str);
+
+ // Move right_anchor and left_anchor forward to the first non-whitespace character that is not ']' and '['
+ while (*left_anchor < str_len && (IS_WHITESPACE(segment_str[*left_anchor]) || segment_str[*left_anchor] != '[')) {
+ ++*left_anchor;
+ }
+ while (*right_anchor < str_len && (IS_WHITESPACE(segment_str[*right_anchor]) || segment_str[*right_anchor] != ']')) {
+ ++*right_anchor;
+ }
+ if (*right_anchor < str_len){
+ *right_anchor += 1;
+ }
// Set the error characters
*primary_error_char = "~";
@@ -1217,23 +1235,45 @@ dump_frame(int fd, _PyInterpreterFrame *frame)
PUTS(fd, "\n");
}
+static int
+tstate_is_freed(PyThreadState *tstate)
+{
+ if (_PyMem_IsPtrFreed(tstate)) {
+ return 1;
+ }
+ if (_PyMem_IsPtrFreed(tstate->interp)) {
+ return 1;
+ }
+ return 0;
+}
+
+
+static int
+interp_is_freed(PyInterpreterState *interp)
+{
+ return _PyMem_IsPtrFreed(interp);
+}
+
+
static void
dump_traceback(int fd, PyThreadState *tstate, int write_header)
{
- _PyInterpreterFrame *frame;
- unsigned int depth;
-
if (write_header) {
PUTS(fd, "Stack (most recent call first):\n");
}
- frame = tstate->cframe->current_frame;
+ if (tstate_is_freed(tstate)) {
+ PUTS(fd, " <tstate is freed>\n");
+ return;
+ }
+
+ _PyInterpreterFrame *frame = tstate->cframe->current_frame;
if (frame == NULL) {
PUTS(fd, " <no Python frame>\n");
return;
}
- depth = 0;
+ unsigned int depth = 0;
while (1) {
if (MAX_FRAME_DEPTH <= depth) {
PUTS(fd, " ...\n");
@@ -1288,9 +1328,6 @@ const char*
_Py_DumpTracebackThreads(int fd, PyInterpreterState *interp,
PyThreadState *current_tstate)
{
- PyThreadState *tstate;
- unsigned int nthreads;
-
if (current_tstate == NULL) {
/* _Py_DumpTracebackThreads() is called from signal handlers by
faulthandler.
@@ -1306,6 +1343,10 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp,
current_tstate = PyGILState_GetThisThreadState();
}
+ if (current_tstate != NULL && tstate_is_freed(current_tstate)) {
+ return "tstate is freed";
+ }
+
if (interp == NULL) {
if (current_tstate == NULL) {
interp = _PyGILState_GetInterpreterStateUnsafe();
@@ -1320,14 +1361,18 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp,
}
assert(interp != NULL);
+ if (interp_is_freed(interp)) {
+ return "interp is freed";
+ }
+
/* Get the current interpreter from the current thread */
- tstate = PyInterpreterState_ThreadHead(interp);
+ PyThreadState *tstate = PyInterpreterState_ThreadHead(interp);
if (tstate == NULL)
return "unable to get the thread head state";
/* Dump the traceback of each thread */
tstate = PyInterpreterState_ThreadHead(interp);
- nthreads = 0;
+ unsigned int nthreads = 0;
_Py_BEGIN_SUPPRESS_IPH
do
{
diff --git a/contrib/tools/python3/src/README.rst b/contrib/tools/python3/src/README.rst
index c26c85db42..1b82fa67d3 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.5
+This is Python version 3.11.6
=============================
.. 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 637212e54e..1e940961c5 100644
--- a/contrib/tools/python3/src/ya.make
+++ b/contrib/tools/python3/src/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(3.11.5)
+VERSION(3.11.6)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.5.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.6.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/ya.make b/contrib/tools/python3/ya.make
index b768fdef5a..1841d07198 100644
--- a/contrib/tools/python3/ya.make
+++ b/contrib/tools/python3/ya.make
@@ -2,9 +2,9 @@
PROGRAM()
-VERSION(3.11.5)
+VERSION(3.11.6)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.5.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.11.6.tar.gz)
LICENSE(Python-2.0)