aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-03-25 10:46:04 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-03-25 10:46:04 +0300
commit4a07b03673d315e0d98c5e29cc9cbeeec1d5c94f (patch)
tree7cdc507d170dc6f879b1fde1093012f5be58fece /contrib
parent86f93d737e9db0e8bfdb6d6a291b6dbdab9d1bdb (diff)
downloadydb-4a07b03673d315e0d98c5e29cc9cbeeec1d5c94f.tar.gz
intermediate changes
ref:ac52b2b4969cd1562fcebef15e16af428f77648b
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libs/apache/orc/CMakeLists.txt1
-rw-r--r--contrib/tools/protoc/bin/CMakeLists.darwin.txt27
-rw-r--r--contrib/tools/protoc/bin/CMakeLists.linux.txt32
-rw-r--r--contrib/tools/protoc/bin/CMakeLists.txt13
-rw-r--r--contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.darwin.txt27
-rw-r--r--contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.linux.txt32
-rw-r--r--contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.txt13
-rw-r--r--contrib/tools/python3/src/Include/patchlevel.h4
-rw-r--r--contrib/tools/python3/src/Lib/argparse.py8
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/locks.py15
-rw-r--r--contrib/tools/python3/src/Lib/doctest.py3
-rwxr-xr-xcontrib/tools/python3/src/Lib/pydoc.py22
-rw-r--r--contrib/tools/python3/src/Lib/pydoc_data/topics.py78
-rw-r--r--contrib/tools/python3/src/Lib/sre_parse.py4
-rw-r--r--contrib/tools/python3/src/Lib/unittest/main.py2
-rw-r--r--contrib/tools/python3/src/Lib/zipfile.py4
-rw-r--r--contrib/tools/python3/src/Modules/_hashopenssl.c13
-rw-r--r--contrib/tools/python3/src/Modules/_sre.c44
-rw-r--r--contrib/tools/python3/src/Modules/binascii.c22
-rw-r--r--contrib/tools/python3/src/Modules/faulthandler.c6
-rw-r--r--contrib/tools/python3/src/Modules/sre.h1
-rw-r--r--contrib/tools/python3/src/README.rst2
22 files changed, 150 insertions, 223 deletions
diff --git a/contrib/libs/apache/orc/CMakeLists.txt b/contrib/libs/apache/orc/CMakeLists.txt
index 6630daa99f..75cc746a28 100644
--- a/contrib/libs/apache/orc/CMakeLists.txt
+++ b/contrib/libs/apache/orc/CMakeLists.txt
@@ -59,4 +59,5 @@ target_sources(libs-apache-orc PRIVATE
${CMAKE_SOURCE_DIR}/contrib/libs/apache/orc/c++/src/Writer.cc
${CMAKE_SOURCE_DIR}/contrib/libs/apache/orc/c++/src/io/InputStream.cc
${CMAKE_SOURCE_DIR}/contrib/libs/apache/orc/c++/src/io/OutputStream.cc
+ ${CMAKE_BINARY_DIR}/contrib/libs/apache/orc/proto/orc_proto.pb.cc
)
diff --git a/contrib/tools/protoc/bin/CMakeLists.darwin.txt b/contrib/tools/protoc/bin/CMakeLists.darwin.txt
deleted file mode 100644
index 00c5ae2afa..0000000000
--- a/contrib/tools/protoc/bin/CMakeLists.darwin.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-
-# This file was gererated by the build system used internally in the Yandex monorepo.
-# Only simple modifications are allowed (adding source-files to targets, adding simple properties
-# like target_include_directories). These modifications will be ported to original
-# ya.make files by maintainers. Any complex modifications which can't be ported back to the
-# original buildsystem will not be accepted.
-
-
-
-add_executable(protoc)
-target_link_libraries(protoc PUBLIC
- contrib-libs-cxxsupp
- yutil
- library-cpp-cpuid_check
- contrib-libs-protoc
-)
-target_sources(protoc PRIVATE
- ${CMAKE_SOURCE_DIR}/contrib/libs/protoc/src/google/protobuf/compiler/main.cc
-)
-target_link_flags(protoc
- PUBLIC
- -Wl,-no_deduplicate
- -Wl,-sdk_version,10.15
- -fPIC
- -fPIC
-)
-vcs_info(protoc)
diff --git a/contrib/tools/protoc/bin/CMakeLists.linux.txt b/contrib/tools/protoc/bin/CMakeLists.linux.txt
deleted file mode 100644
index d0e1886d1e..0000000000
--- a/contrib/tools/protoc/bin/CMakeLists.linux.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-
-# This file was gererated by the build system used internally in the Yandex monorepo.
-# Only simple modifications are allowed (adding source-files to targets, adding simple properties
-# like target_include_directories). These modifications will be ported to original
-# ya.make files by maintainers. Any complex modifications which can't be ported back to the
-# original buildsystem will not be accepted.
-
-
-
-add_executable(protoc)
-target_link_libraries(protoc PUBLIC
- contrib-libs-cxxsupp
- yutil
- library-cpp-lfalloc
- library-cpp-cpuid_check
- contrib-libs-protoc
-)
-target_sources(protoc PRIVATE
- ${CMAKE_SOURCE_DIR}/contrib/libs/protoc/src/google/protobuf/compiler/main.cc
-)
-target_link_flags(protoc
- PUBLIC
- -ldl
- -lrt
- -Wl,--no-as-needed
- -fPIC
- -fPIC
- -lpthread
- -lrt
- -ldl
-)
-vcs_info(protoc)
diff --git a/contrib/tools/protoc/bin/CMakeLists.txt b/contrib/tools/protoc/bin/CMakeLists.txt
deleted file mode 100644
index a681d385f3..0000000000
--- a/contrib/tools/protoc/bin/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-# This file was gererated by the build system used internally in the Yandex monorepo.
-# Only simple modifications are allowed (adding source-files to targets, adding simple properties
-# like target_include_directories). These modifications will be ported to original
-# ya.make files by maintainers. Any complex modifications which can't be ported back to the
-# original buildsystem will not be accepted.
-
-
-if (APPLE)
- include(CMakeLists.darwin.txt)
-elseif (UNIX)
- include(CMakeLists.linux.txt)
-endif()
diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.darwin.txt b/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.darwin.txt
deleted file mode 100644
index c86c30114f..0000000000
--- a/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.darwin.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-
-# This file was gererated by the build system used internally in the Yandex monorepo.
-# Only simple modifications are allowed (adding source-files to targets, adding simple properties
-# like target_include_directories). These modifications will be ported to original
-# ya.make files by maintainers. Any complex modifications which can't be ported back to the
-# original buildsystem will not be accepted.
-
-
-
-add_executable(cpp_styleguide)
-target_link_libraries(cpp_styleguide PUBLIC
- contrib-libs-cxxsupp
- yutil
- library-cpp-cpuid_check
- contrib-libs-protoc
-)
-target_sources(cpp_styleguide PRIVATE
- ${CMAKE_SOURCE_DIR}/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
-)
-target_link_flags(cpp_styleguide
- PUBLIC
- -Wl,-no_deduplicate
- -Wl,-sdk_version,10.15
- -fPIC
- -fPIC
-)
-vcs_info(cpp_styleguide)
diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.linux.txt b/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.linux.txt
deleted file mode 100644
index f7cbff28a2..0000000000
--- a/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.linux.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-
-# This file was gererated by the build system used internally in the Yandex monorepo.
-# Only simple modifications are allowed (adding source-files to targets, adding simple properties
-# like target_include_directories). These modifications will be ported to original
-# ya.make files by maintainers. Any complex modifications which can't be ported back to the
-# original buildsystem will not be accepted.
-
-
-
-add_executable(cpp_styleguide)
-target_link_libraries(cpp_styleguide PUBLIC
- contrib-libs-cxxsupp
- yutil
- library-cpp-lfalloc
- library-cpp-cpuid_check
- contrib-libs-protoc
-)
-target_sources(cpp_styleguide PRIVATE
- ${CMAKE_SOURCE_DIR}/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
-)
-target_link_flags(cpp_styleguide
- PUBLIC
- -ldl
- -lrt
- -Wl,--no-as-needed
- -fPIC
- -fPIC
- -lpthread
- -lrt
- -ldl
-)
-vcs_info(cpp_styleguide)
diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.txt b/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.txt
deleted file mode 100644
index a681d385f3..0000000000
--- a/contrib/tools/protoc/plugins/cpp_styleguide/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-# This file was gererated by the build system used internally in the Yandex monorepo.
-# Only simple modifications are allowed (adding source-files to targets, adding simple properties
-# like target_include_directories). These modifications will be ported to original
-# ya.make files by maintainers. Any complex modifications which can't be ported back to the
-# original buildsystem will not be accepted.
-
-
-if (APPLE)
- include(CMakeLists.darwin.txt)
-elseif (UNIX)
- include(CMakeLists.linux.txt)
-endif()
diff --git a/contrib/tools/python3/src/Include/patchlevel.h b/contrib/tools/python3/src/Include/patchlevel.h
index bf343ad960..a4418b0a6c 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 9
-#define PY_MICRO_VERSION 11
+#define PY_MICRO_VERSION 12
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL 0
/* Version as a string */
-#define PY_VERSION "3.9.11"
+#define PY_VERSION "3.9.12"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/contrib/tools/python3/src/Lib/argparse.py b/contrib/tools/python3/src/Lib/argparse.py
index fbdfd5172f..c46bb30271 100644
--- a/contrib/tools/python3/src/Lib/argparse.py
+++ b/contrib/tools/python3/src/Lib/argparse.py
@@ -726,7 +726,7 @@ def _get_action_name(argument):
if argument is None:
return None
elif argument.option_strings:
- return '/'.join(argument.option_strings)
+ return '/'.join(argument.option_strings)
elif argument.metavar not in (None, SUPPRESS):
return argument.metavar
elif argument.dest not in (None, SUPPRESS):
@@ -1256,9 +1256,9 @@ class FileType(object):
# the special argument "-" means sys.std{in,out}
if string == '-':
if 'r' in self._mode:
- return _sys.stdin
- elif 'w' in self._mode:
- return _sys.stdout
+ return _sys.stdin.buffer if 'b' in self._mode else _sys.stdin
+ elif any(c in self._mode for c in 'wax'):
+ return _sys.stdout.buffer if 'b' in self._mode else _sys.stdout
else:
msg = _('argument "-" with mode %r') % self._mode
raise ValueError(msg)
diff --git a/contrib/tools/python3/src/Lib/asyncio/locks.py b/contrib/tools/python3/src/Lib/asyncio/locks.py
index f1ce732478..d17d7ccd81 100644
--- a/contrib/tools/python3/src/Lib/asyncio/locks.py
+++ b/contrib/tools/python3/src/Lib/asyncio/locks.py
@@ -378,6 +378,7 @@ class Semaphore(_ContextManagerMixin):
warnings.warn("The loop argument is deprecated since Python 3.8, "
"and scheduled for removal in Python 3.10.",
DeprecationWarning, stacklevel=2)
+ self._wakeup_scheduled = False
def __repr__(self):
res = super().__repr__()
@@ -391,6 +392,7 @@ class Semaphore(_ContextManagerMixin):
waiter = self._waiters.popleft()
if not waiter.done():
waiter.set_result(None)
+ self._wakeup_scheduled = True
return
def locked(self):
@@ -406,16 +408,17 @@ class Semaphore(_ContextManagerMixin):
called release() to make it larger than 0, and then return
True.
"""
- while self._value <= 0:
+ # _wakeup_scheduled is set if *another* task is scheduled to wakeup
+ # but its acquire() is not resumed yet
+ while self._wakeup_scheduled or self._value <= 0:
fut = self._loop.create_future()
self._waiters.append(fut)
try:
await fut
- except:
- # See the similar code in Queue.get.
- fut.cancel()
- if self._value > 0 and not fut.cancelled():
- self._wake_up_next()
+ # reset _wakeup_scheduled *after* waiting for a future
+ self._wakeup_scheduled = False
+ except exceptions.CancelledError:
+ self._wake_up_next()
raise
self._value -= 1
return True
diff --git a/contrib/tools/python3/src/Lib/doctest.py b/contrib/tools/python3/src/Lib/doctest.py
index 2910bebd8d..54ae93bcf1 100644
--- a/contrib/tools/python3/src/Lib/doctest.py
+++ b/contrib/tools/python3/src/Lib/doctest.py
@@ -2162,6 +2162,7 @@ class DocTestCase(unittest.TestCase):
unittest.TestCase.__init__(self)
self._dt_optionflags = optionflags
self._dt_checker = checker
+ self._dt_globs = test.globs.copy()
self._dt_test = test
self._dt_setUp = setUp
self._dt_tearDown = tearDown
@@ -2178,7 +2179,9 @@ class DocTestCase(unittest.TestCase):
if self._dt_tearDown is not None:
self._dt_tearDown(test)
+ # restore the original globs
test.globs.clear()
+ test.globs.update(self._dt_globs)
def runTest(self):
test = self._dt_test
diff --git a/contrib/tools/python3/src/Lib/pydoc.py b/contrib/tools/python3/src/Lib/pydoc.py
index 4f9d227ff4..ead6785307 100755
--- a/contrib/tools/python3/src/Lib/pydoc.py
+++ b/contrib/tools/python3/src/Lib/pydoc.py
@@ -69,6 +69,7 @@ import sys
import sysconfig
import time
import tokenize
+import types
import urllib.parse
import warnings
from collections import deque
@@ -90,13 +91,16 @@ def pathdirs():
normdirs.append(normdir)
return dirs
+def _isclass(object):
+ return inspect.isclass(object) and not isinstance(object, types.GenericAlias)
+
def _findclass(func):
cls = sys.modules.get(func.__module__)
if cls is None:
return None
for name in func.__qualname__.split('.')[:-1]:
cls = getattr(cls, name)
- if not inspect.isclass(cls):
+ if not _isclass(cls):
return None
return cls
@@ -104,7 +108,7 @@ def _finddoc(obj):
if inspect.ismethod(obj):
name = obj.__func__.__name__
self = obj.__self__
- if (inspect.isclass(self) and
+ if (_isclass(self) and
getattr(getattr(self, name, None), '__func__') is obj.__func__):
# classmethod
cls = self
@@ -118,7 +122,7 @@ def _finddoc(obj):
elif inspect.isbuiltin(obj):
name = obj.__name__
self = obj.__self__
- if (inspect.isclass(self) and
+ if (_isclass(self) and
self.__qualname__ + '.' + name == obj.__qualname__):
# classmethod
cls = self
@@ -205,7 +209,7 @@ def classname(object, modname):
def isdata(object):
"""Check if an object is of a type that probably means it's data."""
- return not (inspect.ismodule(object) or inspect.isclass(object) or
+ return not (inspect.ismodule(object) or _isclass(object) or
inspect.isroutine(object) or inspect.isframe(object) or
inspect.istraceback(object) or inspect.iscode(object))
@@ -470,7 +474,7 @@ class Doc:
# by lacking a __name__ attribute) and an instance.
try:
if inspect.ismodule(object): return self.docmodule(*args)
- if inspect.isclass(object): return self.docclass(*args)
+ if _isclass(object): return self.docclass(*args)
if inspect.isroutine(object): return self.docroutine(*args)
except AttributeError:
pass
@@ -775,7 +779,7 @@ class HTMLDoc(Doc):
modules = inspect.getmembers(object, inspect.ismodule)
classes, cdict = [], {}
- for key, value in inspect.getmembers(object, inspect.isclass):
+ for key, value in inspect.getmembers(object, _isclass):
# if __all__ exists, believe it. Otherwise use old heuristic.
if (all is not None or
(inspect.getmodule(value) or object) is object):
@@ -1217,7 +1221,7 @@ location listed above.
result = result + self.section('DESCRIPTION', desc)
classes = []
- for key, value in inspect.getmembers(object, inspect.isclass):
+ for key, value in inspect.getmembers(object, _isclass):
# if __all__ exists, believe it. Otherwise use old heuristic.
if (all is not None
or (inspect.getmodule(value) or object) is object):
@@ -1698,7 +1702,7 @@ def describe(thing):
return 'member descriptor %s.%s.%s' % (
thing.__objclass__.__module__, thing.__objclass__.__name__,
thing.__name__)
- if inspect.isclass(thing):
+ if _isclass(thing):
return 'class ' + thing.__name__
if inspect.isfunction(thing):
return 'function ' + thing.__name__
@@ -1759,7 +1763,7 @@ def render_doc(thing, title='Python Library Documentation: %s', forceload=0,
desc += ' in module ' + module.__name__
if not (inspect.ismodule(object) or
- inspect.isclass(object) or
+ _isclass(object) or
inspect.isroutine(object) or
inspect.isdatadescriptor(object) or
_getdoc(object)):
diff --git a/contrib/tools/python3/src/Lib/pydoc_data/topics.py b/contrib/tools/python3/src/Lib/pydoc_data/topics.py
index 0e63c31f1b..2546eb933b 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 Tue Mar 15 21:44:32 2022
+# Autogenerated by Sphinx on Wed Mar 23 22:08:02 2022
topics = {'assert': 'The "assert" statement\n'
'**********************\n'
'\n'
@@ -2416,11 +2416,11 @@ topics = {'assert': 'The "assert" statement\n'
'resulting\n'
'object is “compatible” with the exception. An object is '
'compatible\n'
- 'with an exception if it is the class or a base class of the '
- 'exception\n'
- 'object, or a tuple containing an item that is the class or a '
+ 'with an exception if the object is the class or a *non-virtual '
'base\n'
- 'class of the exception object.\n'
+ 'class* of the exception object, or a tuple containing an item '
+ 'that is\n'
+ 'the class or a non-virtual base class of the exception object.\n'
'\n'
'If no except clause matches the exception, the search for an '
'exception\n'
@@ -3567,15 +3567,17 @@ topics = {'assert': 'The "assert" statement\n'
'on members\n'
' of hashed collections including "set", "frozenset", and '
'"dict".\n'
- ' "__hash__()" should return an integer. The only required '
- 'property\n'
- ' is that objects which compare equal have the same hash '
- 'value; it is\n'
- ' advised to mix together the hash values of the '
- 'components of the\n'
- ' object that also play a part in comparison of objects by '
- 'packing\n'
- ' them into a tuple and hashing the tuple. Example:\n'
+ ' The "__hash__()" method should return an integer. The '
+ 'only required\n'
+ ' property is that objects which compare equal have the '
+ 'same hash\n'
+ ' value; it is advised to mix together the hash values of '
+ 'the\n'
+ ' components of the object that also play a part in '
+ 'comparison of\n'
+ ' objects by packing them into a tuple and hashing the '
+ 'tuple.\n'
+ ' Example:\n'
'\n'
' def __hash__(self):\n'
' return hash((self.name, self.nick, self.color))\n'
@@ -4559,11 +4561,11 @@ topics = {'assert': 'The "assert" statement\n'
'clause is\n'
'selected depending on the class of the instance: it must '
'reference the\n'
- 'class of the instance or a base class thereof. The instance '
- 'can be\n'
- 'received by the handler and can carry additional information '
- 'about the\n'
- 'exceptional condition.\n'
+ 'class of the instance or a *non-virtual base class* thereof. '
+ 'The\n'
+ 'instance can be received by the handler and can carry '
+ 'additional\n'
+ 'information about the exceptional condition.\n'
'\n'
'Note:\n'
'\n'
@@ -4886,11 +4888,11 @@ topics = {'assert': 'The "assert" statement\n'
'clause is\n'
'selected depending on the class of the instance: it must '
'reference the\n'
- 'class of the instance or a base class thereof. The instance '
- 'can be\n'
- 'received by the handler and can carry additional information '
- 'about the\n'
- 'exceptional condition.\n'
+ 'class of the instance or a *non-virtual base class* thereof. '
+ 'The\n'
+ 'instance can be received by the handler and can carry '
+ 'additional\n'
+ 'information about the exceptional condition.\n'
'\n'
'Note:\n'
'\n'
@@ -8440,15 +8442,17 @@ topics = {'assert': 'The "assert" statement\n'
'on members\n'
' of hashed collections including "set", "frozenset", and '
'"dict".\n'
- ' "__hash__()" should return an integer. The only required '
- 'property\n'
- ' is that objects which compare equal have the same hash '
- 'value; it is\n'
- ' advised to mix together the hash values of the components '
- 'of the\n'
- ' object that also play a part in comparison of objects by '
- 'packing\n'
- ' them into a tuple and hashing the tuple. Example:\n'
+ ' The "__hash__()" method should return an integer. The '
+ 'only required\n'
+ ' property is that objects which compare equal have the '
+ 'same hash\n'
+ ' value; it is advised to mix together the hash values of '
+ 'the\n'
+ ' components of the object that also play a part in '
+ 'comparison of\n'
+ ' objects by packing them into a tuple and hashing the '
+ 'tuple.\n'
+ ' Example:\n'
'\n'
' def __hash__(self):\n'
' return hash((self.name, self.nick, self.color))\n'
@@ -11531,10 +11535,10 @@ topics = {'assert': 'The "assert" statement\n'
'exception. For an except clause with an expression, that expression\n'
'is evaluated, and the clause matches the exception if the resulting\n'
'object is “compatible” with the exception. An object is compatible\n'
- 'with an exception if it is the class or a base class of the '
- 'exception\n'
- 'object, or a tuple containing an item that is the class or a base\n'
- 'class of the exception object.\n'
+ 'with an exception if the object is the class or a *non-virtual base\n'
+ 'class* of the exception object, or a tuple containing an item that '
+ 'is\n'
+ 'the class or a non-virtual base class of the exception object.\n'
'\n'
'If no except clause matches the exception, the search for an '
'exception\n'
diff --git a/contrib/tools/python3/src/Lib/sre_parse.py b/contrib/tools/python3/src/Lib/sre_parse.py
index 83119168e6..53706676e9 100644
--- a/contrib/tools/python3/src/Lib/sre_parse.py
+++ b/contrib/tools/python3/src/Lib/sre_parse.py
@@ -807,9 +807,11 @@ def _parse(source, state, verbose, nested, first=False):
if not first or subpattern:
import warnings
warnings.warn(
- 'Flags not at the start of the expression %r%s' % (
+ 'Flags not at the start of the expression %r%s'
+ ' but at position %d' % (
source.string[:20], # truncate long regexes
' (truncated)' if len(source.string) > 20 else '',
+ start,
),
DeprecationWarning, stacklevel=nested + 6
)
diff --git a/contrib/tools/python3/src/Lib/unittest/main.py b/contrib/tools/python3/src/Lib/unittest/main.py
index e62469aa2a..88a188c545 100644
--- a/contrib/tools/python3/src/Lib/unittest/main.py
+++ b/contrib/tools/python3/src/Lib/unittest/main.py
@@ -39,7 +39,7 @@ def _convert_name(name):
name = rel_path
# on Windows both '\' and '/' are used as path
# separators. Better to replace both than rely on os.path.sep
- return name[:-3].replace('\\', '.').replace('/', '.')
+ return os.path.normpath(name)[:-3].replace('\\', '.').replace('/', '.')
return name
def _convert_names(names):
diff --git a/contrib/tools/python3/src/Lib/zipfile.py b/contrib/tools/python3/src/Lib/zipfile.py
index f72c6a4e0c..1e942a503e 100644
--- a/contrib/tools/python3/src/Lib/zipfile.py
+++ b/contrib/tools/python3/src/Lib/zipfile.py
@@ -720,7 +720,9 @@ class _SharedFile:
self._lock = lock
self._writing = writing
self.seekable = file.seekable
- self.tell = file.tell
+
+ def tell(self):
+ return self._pos
def seek(self, offset, whence=0):
with self._lock:
diff --git a/contrib/tools/python3/src/Modules/_hashopenssl.c b/contrib/tools/python3/src/Modules/_hashopenssl.c
index 4873bb11aa..4db058c062 100644
--- a/contrib/tools/python3/src/Modules/_hashopenssl.c
+++ b/contrib/tools/python3/src/Modules/_hashopenssl.c
@@ -1860,15 +1860,21 @@ typedef struct _internal_name_mapper_state {
/* A callback function to pass to OpenSSL's OBJ_NAME_do_all(...) */
static void
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+_openssl_hash_name_mapper(EVP_MD *md, void *arg)
+#else
_openssl_hash_name_mapper(const EVP_MD *md, const char *from,
const char *to, void *arg)
+#endif
{
_InternalNameMapperState *state = (_InternalNameMapperState *)arg;
PyObject *py_name;
assert(state != NULL);
- if (md == NULL)
+ // ignore all undefined providers
+ if ((md == NULL) || (EVP_MD_nid(md) == NID_undef)) {
return;
+ }
py_name = py_digest_name(md);
if (py_name == NULL) {
@@ -1894,7 +1900,12 @@ hashlib_md_meth_names(PyObject *module)
return -1;
}
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ // get algorithms from all activated providers in default context
+ EVP_MD_do_all_provided(NULL, &_openssl_hash_name_mapper, &state);
+#else
EVP_MD_do_all(&_openssl_hash_name_mapper, &state);
+#endif
if (state.error) {
Py_DECREF(state.set);
diff --git a/contrib/tools/python3/src/Modules/_sre.c b/contrib/tools/python3/src/Modules/_sre.c
index 8225c36da1..338530e2dc 100644
--- a/contrib/tools/python3/src/Modules/_sre.c
+++ b/contrib/tools/python3/src/Modules/_sre.c
@@ -2391,6 +2391,25 @@ scanner_dealloc(ScannerObject* self)
PyObject_DEL(self);
}
+static int
+scanner_begin(ScannerObject* self)
+{
+ if (self->executing) {
+ PyErr_SetString(PyExc_ValueError,
+ "regular expression scanner already executing");
+ return 0;
+ }
+ self->executing = 1;
+ return 1;
+}
+
+static void
+scanner_end(ScannerObject* self)
+{
+ assert(self->executing);
+ self->executing = 0;
+}
+
/*[clinic input]
_sre.SRE_Scanner.match
@@ -2404,16 +2423,23 @@ _sre_SRE_Scanner_match_impl(ScannerObject *self)
PyObject* match;
Py_ssize_t status;
- if (state->start == NULL)
+ if (!scanner_begin(self)) {
+ return NULL;
+ }
+ if (state->start == NULL) {
+ scanner_end(self);
Py_RETURN_NONE;
+ }
state_reset(state);
state->ptr = state->start;
status = sre_match(state, PatternObject_GetCode(self->pattern));
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
+ scanner_end(self);
return NULL;
+ }
match = pattern_new_match((PatternObject*) self->pattern,
state, status);
@@ -2425,6 +2451,7 @@ _sre_SRE_Scanner_match_impl(ScannerObject *self)
state->start = state->ptr;
}
+ scanner_end(self);
return match;
}
@@ -2442,16 +2469,23 @@ _sre_SRE_Scanner_search_impl(ScannerObject *self)
PyObject* match;
Py_ssize_t status;
- if (state->start == NULL)
+ if (!scanner_begin(self)) {
+ return NULL;
+ }
+ if (state->start == NULL) {
+ scanner_end(self);
Py_RETURN_NONE;
+ }
state_reset(state);
state->ptr = state->start;
status = sre_search(state, PatternObject_GetCode(self->pattern));
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
+ scanner_end(self);
return NULL;
+ }
match = pattern_new_match((PatternObject*) self->pattern,
state, status);
@@ -2463,6 +2497,7 @@ _sre_SRE_Scanner_search_impl(ScannerObject *self)
state->start = state->ptr;
}
+ scanner_end(self);
return match;
}
@@ -2476,6 +2511,7 @@ pattern_scanner(PatternObject *self, PyObject *string, Py_ssize_t pos, Py_ssize_
if (!scanner)
return NULL;
scanner->pattern = NULL;
+ scanner->executing = 0;
/* create search state object */
if (!state_init(&scanner->state, self, string, pos, endpos)) {
diff --git a/contrib/tools/python3/src/Modules/binascii.c b/contrib/tools/python3/src/Modules/binascii.c
index 1f3248b604..3777580a79 100644
--- a/contrib/tools/python3/src/Modules/binascii.c
+++ b/contrib/tools/python3/src/Modules/binascii.c
@@ -1120,16 +1120,20 @@ binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc)
/*[clinic end generated code: output=52cf59056a78593b input=bbe340bc99d25aa8]*/
#ifdef USE_ZLIB_CRC32
-/* This was taken from zlibmodule.c PyZlib_crc32 (but is PY_SSIZE_T_CLEAN) */
+/* The same core as zlibmodule.c zlib_crc32_impl. */
{
- const Byte *buf;
- Py_ssize_t len;
- int signed_val;
-
- buf = (Byte*)data->buf;
- len = data->len;
- signed_val = crc32(crc, buf, len);
- return (unsigned int)signed_val & 0xffffffffU;
+ unsigned char *buf = data->buf;
+ Py_ssize_t len = data->len;
+
+ /* Avoid truncation of length for very large buffers. crc32() takes
+ length as an unsigned int, which may be narrower than Py_ssize_t. */
+ while ((size_t)len > UINT_MAX) {
+ crc = crc32(crc, buf, UINT_MAX);
+ buf += (size_t) UINT_MAX;
+ len -= (size_t) UINT_MAX;
+ }
+ crc = crc32(crc, buf, (unsigned int)len);
+ return crc & 0xffffffff;
}
#else /* USE_ZLIB_CRC32 */
{ /* By Jim Ahlstrom; All rights transferred to CNRI */
diff --git a/contrib/tools/python3/src/Modules/faulthandler.c b/contrib/tools/python3/src/Modules/faulthandler.c
index 764ff439d7..16f98ace3b 100644
--- a/contrib/tools/python3/src/Modules/faulthandler.c
+++ b/contrib/tools/python3/src/Modules/faulthandler.c
@@ -21,9 +21,9 @@
# define FAULTHANDLER_USE_ALT_STACK
#endif
-#if defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_LINUX_AUXVEC_H)
-# include <linux/auxvec.h>
-# include <sys/auxv.h>
+#if defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_LINUX_AUXVEC_H) && defined(HAVE_SYS_AUXV_H)
+# include <linux/auxvec.h> // AT_MINSIGSTKSZ
+# include <sys/auxv.h> // getauxval()
#endif
/* Allocate at maximum 100 MiB of the stack to raise the stack overflow */
diff --git a/contrib/tools/python3/src/Modules/sre.h b/contrib/tools/python3/src/Modules/sre.h
index 9b0d8b1904..785adbd003 100644
--- a/contrib/tools/python3/src/Modules/sre.h
+++ b/contrib/tools/python3/src/Modules/sre.h
@@ -89,6 +89,7 @@ typedef struct {
PyObject_HEAD
PyObject* pattern;
SRE_STATE state;
+ int executing;
} ScannerObject;
#endif
diff --git a/contrib/tools/python3/src/README.rst b/contrib/tools/python3/src/README.rst
index 8856328f9d..d3b2521a87 100644
--- a/contrib/tools/python3/src/README.rst
+++ b/contrib/tools/python3/src/README.rst
@@ -1,4 +1,4 @@
-This is Python version 3.9.11
+This is Python version 3.9.12
=============================
.. image:: https://travis-ci.org/python/cpython.svg?branch=3.9