diff options
| author | Alexander Smirnov <[email protected]> | 2024-09-26 14:44:45 +0000 |
|---|---|---|
| committer | Alexander Smirnov <[email protected]> | 2024-09-26 14:44:45 +0000 |
| commit | c853e78c5e416ede1d99665049657f2e304872e4 (patch) | |
| tree | b6e2e59629b8e0f863eec9a700121ca3f7416f28 /contrib | |
| parent | 7d208c76420539a7e44f2393c66e7d0444744517 (diff) | |
| parent | 47e779420bb80722978c1ffd518245bffd886a50 (diff) | |
Merge branch 'rightlib' into mergelibs-240926-1443
Diffstat (limited to 'contrib')
64 files changed, 657 insertions, 221 deletions
diff --git a/contrib/libs/croaring/include/roaring/memory.h b/contrib/libs/croaring/include/roaring/memory.h index ad9a64f5e22..6ec3d348dcf 100644 --- a/contrib/libs/croaring/include/roaring/memory.h +++ b/contrib/libs/croaring/include/roaring/memory.h @@ -1,12 +1,12 @@ #ifndef INCLUDE_ROARING_MEMORY_H_ #define INCLUDE_ROARING_MEMORY_H_ +#include <stddef.h> // for size_t + #ifdef __cplusplus extern "C" { #endif -#include <stddef.h> // for size_t - typedef void* (*roaring_malloc_p)(size_t); typedef void* (*roaring_realloc_p)(void*, size_t); typedef void* (*roaring_calloc_p)(size_t, size_t); diff --git a/contrib/libs/croaring/include/roaring/portability.h b/contrib/libs/croaring/include/roaring/portability.h index 5aebe193c9c..897feedbf8b 100644 --- a/contrib/libs/croaring/include/roaring/portability.h +++ b/contrib/libs/croaring/include/roaring/portability.h @@ -585,6 +585,8 @@ static inline uint32_t croaring_refcount_get(const croaring_refcount_t *val) { #if defined(__GNUC__) || defined(__clang__) #define CROARING_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define CROARING_DEPRECATED __declspec(deprecated) #else #define CROARING_DEPRECATED #endif // defined(__GNUC__) || defined(__clang__) diff --git a/contrib/libs/croaring/include/roaring/roaring64.h b/contrib/libs/croaring/include/roaring/roaring64.h index c71bccb9179..fd89feb5e08 100644 --- a/contrib/libs/croaring/include/roaring/roaring64.h +++ b/contrib/libs/croaring/include/roaring/roaring64.h @@ -1,6 +1,7 @@ #ifndef ROARING64_H #define ROARING64_H +#include <roaring.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> @@ -93,6 +94,14 @@ roaring64_bitmap_t *roaring64_bitmap_of_ptr(size_t n_args, #endif /** + * Create a new bitmap by moving containers from a 32 bit roaring bitmap. + * + * After calling this function, the original bitmap will be empty, and the + * returned bitmap will contain all the values from the original bitmap. + */ +roaring64_bitmap_t *roaring64_bitmap_move_from_roaring32(roaring_bitmap_t *r); + +/** * Create a new bitmap containing all the values in [min, max) that are at a * distance k*step from min. */ diff --git a/contrib/libs/croaring/include/roaring/roaring_version.h b/contrib/libs/croaring/include/roaring/roaring_version.h index 3f7519449e5..0d136bbbd3d 100644 --- a/contrib/libs/croaring/include/roaring/roaring_version.h +++ b/contrib/libs/croaring/include/roaring/roaring_version.h @@ -2,11 +2,11 @@ // /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand #ifndef ROARING_INCLUDE_ROARING_VERSION #define ROARING_INCLUDE_ROARING_VERSION -#define ROARING_VERSION "4.1.1" +#define ROARING_VERSION "4.1.2" enum { ROARING_VERSION_MAJOR = 4, ROARING_VERSION_MINOR = 1, - ROARING_VERSION_REVISION = 1 + ROARING_VERSION_REVISION = 2 }; #endif // ROARING_INCLUDE_ROARING_VERSION // clang-format on
\ No newline at end of file diff --git a/contrib/libs/croaring/src/roaring64.c b/contrib/libs/croaring/src/roaring64.c index d41507b3c4d..e63d3d965ca 100644 --- a/contrib/libs/croaring/src/roaring64.c +++ b/contrib/libs/croaring/src/roaring64.c @@ -178,6 +178,43 @@ roaring64_bitmap_t *roaring64_bitmap_copy(const roaring64_bitmap_t *r) { return result; } +/** + * Steal the containers from a 32-bit bitmap and insert them into a 64-bit + * bitmap (with an offset) + * + * After calling this function, the original bitmap will be empty, and the + * returned bitmap will contain all the values from the original bitmap. + */ +static void move_from_roaring32_offset(roaring64_bitmap_t *dst, + roaring_bitmap_t *src, + uint32_t high_bits) { + uint64_t key_base = ((uint64_t)high_bits) << 32; + uint32_t r32_size = ra_get_size(&src->high_low_container); + for (uint32_t i = 0; i < r32_size; ++i) { + uint16_t key = ra_get_key_at_index(&src->high_low_container, i); + uint8_t typecode; + container_t *container = ra_get_container_at_index( + &src->high_low_container, (uint16_t)i, &typecode); + + uint8_t high48[ART_KEY_BYTES]; + uint64_t high48_bits = key_base | ((uint64_t)key << 16); + split_key(high48_bits, high48); + leaf_t *leaf = create_leaf(container, typecode); + art_insert(&dst->art, high48, (art_val_t *)leaf); + } + // We stole all the containers, so leave behind a size of zero + src->high_low_container.size = 0; +} + +roaring64_bitmap_t *roaring64_bitmap_move_from_roaring32( + roaring_bitmap_t *bitmap32) { + roaring64_bitmap_t *result = roaring64_bitmap_create(); + + move_from_roaring32_offset(result, bitmap32, 0); + + return result; +} + roaring64_bitmap_t *roaring64_bitmap_from_range(uint64_t min, uint64_t max, uint64_t step) { if (step == 0 || max <= min) { @@ -1947,22 +1984,8 @@ roaring64_bitmap_t *roaring64_bitmap_portable_deserialize_safe( read_bytes += bitmap32_size; // Insert all containers of the 32-bit bitmap into the 64-bit bitmap. - uint32_t r32_size = ra_get_size(&bitmap32->high_low_container); - for (size_t i = 0; i < r32_size; ++i) { - uint16_t key16 = - ra_get_key_at_index(&bitmap32->high_low_container, (uint16_t)i); - uint8_t typecode; - container_t *container = ra_get_container_at_index( - &bitmap32->high_low_container, (uint16_t)i, &typecode); - - uint64_t high48_bits = - (((uint64_t)high32) << 32) | (((uint64_t)key16) << 16); - uint8_t high48[ART_KEY_BYTES]; - split_key(high48_bits, high48); - leaf_t *leaf = create_leaf(container, typecode); - art_insert(&r->art, high48, (art_val_t *)leaf); - } - roaring_bitmap_free_without_containers(bitmap32); + move_from_roaring32_offset(r, bitmap32, high32); + roaring_bitmap_free(bitmap32); } return r; } diff --git a/contrib/libs/croaring/ya.make b/contrib/libs/croaring/ya.make index f6a661c0b79..55acab56734 100644 --- a/contrib/libs/croaring/ya.make +++ b/contrib/libs/croaring/ya.make @@ -10,9 +10,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(4.1.1) +VERSION(4.1.2) -ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.1.1.tar.gz) +ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.1.2.tar.gz) ADDINCL( GLOBAL contrib/libs/croaring/include diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h index beb10f7f4f2..60969e17514 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h @@ -144,7 +144,7 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {_Iter __tmp = current; return *--__tmp;} -#if _LIBCPP_STD_VER >= 20 +#if (_LIBCPP_STD_VER >= 20) && !defined(__NVCC__) _LIBCPP_INLINE_VISIBILITY constexpr pointer operator->() const requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); } diff --git a/contrib/libs/cxxsupp/libcxxrt/exception.cc b/contrib/libs/cxxsupp/libcxxrt/exception.cc index 6f8c223b34d..2fe90c3e1c6 100644 --- a/contrib/libs/cxxsupp/libcxxrt/exception.cc +++ b/contrib/libs/cxxsupp/libcxxrt/exception.cc @@ -282,7 +282,7 @@ namespace std { // Forward declaration of standard library terminate() function used to // abort execution. - void terminate(void) _LIBCXXRT_NOEXCEPT; + [[noreturn]] void terminate(void) _LIBCXXRT_NOEXCEPT; } using namespace ABI_NAMESPACE; @@ -1636,7 +1636,7 @@ namespace std * Terminates the program, calling a custom terminate implementation if * required. */ - void terminate() _LIBCXXRT_NOEXCEPT + [[noreturn]] void terminate() _LIBCXXRT_NOEXCEPT { static __cxa_thread_info *info = thread_info(); if (0 != info && 0 != info->terminateHandler) diff --git a/contrib/libs/cxxsupp/libcxxrt/ya.make b/contrib/libs/cxxsupp/libcxxrt/ya.make index a3632f35d44..bb32702ba56 100644 --- a/contrib/libs/cxxsupp/libcxxrt/ya.make +++ b/contrib/libs/cxxsupp/libcxxrt/ya.make @@ -11,9 +11,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(2024-08-06) +VERSION(2024-09-24) -ORIGINAL_SOURCE(https://github.com/libcxxrt/libcxxrt/archive/7a3ef57f64be0f2f2a156af011adfbe76c7dce74.tar.gz) +ORIGINAL_SOURCE(https://github.com/libcxxrt/libcxxrt/archive/40e4fa2049930412a2c43cdf0c39b6b5aa735341.tar.gz) ADDINCL( contrib/libs/cxxsupp/libcxxrt diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set.h b/contrib/libs/protobuf/src/google/protobuf/extension_set.h index c17bf4dc8a6..a68db9efc1f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set.h +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set.h @@ -1564,4 +1564,5 @@ void LinkExtensionReflection( } // namespace google #include "google/protobuf/port_undef.inc" + #endif // GOOGLE_PROTOBUF_EXTENSION_SET_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/json/internal/parser.cc b/contrib/libs/protobuf/src/google/protobuf/json/internal/parser.cc index 0da57a1f056..3bacf60c3b2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/json/internal/parser.cc +++ b/contrib/libs/protobuf/src/google/protobuf/json/internal/parser.cc @@ -972,11 +972,9 @@ y_absl::Status ParseFieldMask(JsonLexer& lex, const Desc<Traits>& desc, // Assume approximately six-letter words, so add one extra space for an // underscore for every six bytes. snake_path.reserve(path.size() * 7 / 6); - - // Port from protobuf 21.x for entity/ugc (TODO remove?). + // Port from protobuf 21.x bool is_quoted = false; bool is_escaping = false; - for (char c : path) { // Outputs quoted string as-is. if (is_quoted) { diff --git a/contrib/libs/protobuf/ya.make b/contrib/libs/protobuf/ya.make index ef458741f3b..e72de69ce99 100644 --- a/contrib/libs/protobuf/ya.make +++ b/contrib/libs/protobuf/ya.make @@ -43,9 +43,9 @@ ENDIF() PEERDIR( contrib/libs/zlib - library/cpp/sanitizer/include - contrib/restricted/abseil-cpp-tstring/y_absl/status contrib/restricted/abseil-cpp-tstring/y_absl/log + contrib/restricted/abseil-cpp-tstring/y_absl/status + library/cpp/sanitizer/include ) ADDINCL( diff --git a/contrib/python/cffi/py3/.dist-info/METADATA b/contrib/python/cffi/py3/.dist-info/METADATA index a0d90a31e92..60b0779f688 100644 --- a/contrib/python/cffi/py3/.dist-info/METADATA +++ b/contrib/python/cffi/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: cffi -Version: 1.17.0 +Version: 1.17.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff --git a/contrib/python/cffi/py3/c/_cffi_backend.c b/contrib/python/cffi/py3/c/_cffi_backend.c index aa4ec48ba97..4ba773a1753 100644 --- a/contrib/python/cffi/py3/c/_cffi_backend.c +++ b/contrib/python/cffi/py3/c/_cffi_backend.c @@ -2,7 +2,7 @@ #include <Python.h> #include "structmember.h" -#define CFFI_VERSION "1.17.0" +#define CFFI_VERSION "1.17.1" #ifdef MS_WIN32 #include <windows.h> diff --git a/contrib/python/cffi/py3/cffi/__init__.py b/contrib/python/cffi/py3/cffi/__init__.py index deeacc57cde..2e35a38c9ce 100644 --- a/contrib/python/cffi/py3/cffi/__init__.py +++ b/contrib/python/cffi/py3/cffi/__init__.py @@ -5,8 +5,8 @@ from .api import FFI from .error import CDefError, FFIError, VerificationError, VerificationMissing from .error import PkgConfigError -__version__ = "1.17.0" -__version_info__ = (1, 17, 0) +__version__ = "1.17.1" +__version_info__ = (1, 17, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/contrib/python/cffi/py3/cffi/_embedding.h b/contrib/python/cffi/py3/cffi/_embedding.h index 0eeeea831df..94d8b30a9e3 100644 --- a/contrib/python/cffi/py3/cffi/_embedding.h +++ b/contrib/python/cffi/py3/cffi/_embedding.h @@ -225,7 +225,7 @@ static int _cffi_initialize_python(void) if (f != NULL && f != Py_None) { PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME - "\ncompiled with cffi version: 1.17.0" + "\ncompiled with cffi version: 1.17.1" "\n_cffi_backend module: ", f); modules = PyImport_GetModuleDict(); mod = PyDict_GetItemString(modules, "_cffi_backend"); diff --git a/contrib/python/cffi/py3/cffi/_shimmed_dist_utils.py b/contrib/python/cffi/py3/cffi/_shimmed_dist_utils.py index 611bf40f40f..c3d23128189 100644 --- a/contrib/python/cffi/py3/cffi/_shimmed_dist_utils.py +++ b/contrib/python/cffi/py3/cffi/_shimmed_dist_utils.py @@ -30,7 +30,11 @@ try: from distutils.log import set_threshold, set_verbosity if sys.platform == 'win32': - from distutils.msvc9compiler import MSVCCompiler + try: + # FUTURE: msvc9compiler module was removed in setuptools 74; consider removing, as it's only used by an ancient patch in `recompiler` + from distutils.msvc9compiler import MSVCCompiler + except ImportError: + MSVCCompiler = None except Exception as ex: if sys.version_info >= (3, 12): raise Exception("This CFFI feature requires setuptools on Python >= 3.12. Please install the setuptools package.") from ex diff --git a/contrib/python/cffi/py3/cffi/api.py b/contrib/python/cffi/py3/cffi/api.py index edeb7928107..5a474f3da92 100644 --- a/contrib/python/cffi/py3/cffi/api.py +++ b/contrib/python/cffi/py3/cffi/api.py @@ -693,7 +693,8 @@ class FFI(object): raise TypeError("emit_c_code() is only for C extension modules, " "not for dlopen()-style pure Python modules") recompile(self, module_name, source, - c_file=filename, call_c_compiler=False, **kwds) + c_file=filename, call_c_compiler=False, + uses_ffiplatform=False, **kwds) def emit_python_code(self, filename): from .recompiler import recompile @@ -705,7 +706,8 @@ class FFI(object): raise TypeError("emit_python_code() is only for dlopen()-style " "pure Python modules, not for C extension modules") recompile(self, module_name, source, - c_file=filename, call_c_compiler=False, **kwds) + c_file=filename, call_c_compiler=False, + uses_ffiplatform=False, **kwds) def compile(self, tmpdir='.', verbose=0, target=None, debug=None): """The 'target' argument gives the final file name of the diff --git a/contrib/python/cffi/py3/cffi/recompiler.py b/contrib/python/cffi/py3/cffi/recompiler.py index dd22b21c2ca..c236807fe81 100644 --- a/contrib/python/cffi/py3/cffi/recompiler.py +++ b/contrib/python/cffi/py3/cffi/recompiler.py @@ -1417,6 +1417,10 @@ else: s = s.encode('ascii') super(NativeIO, self).write(s) +def _is_file_like(maybefile): + # compare to xml.etree.ElementTree._get_writer + return hasattr(maybefile, 'write') + def _make_c_or_py_source(ffi, module_name, preamble, target_file, verbose): if verbose: print("generating %s" % (target_file,)) @@ -1424,6 +1428,9 @@ def _make_c_or_py_source(ffi, module_name, preamble, target_file, verbose): target_is_python=(preamble is None)) recompiler.collect_type_table() recompiler.collect_step_tables() + if _is_file_like(target_file): + recompiler.write_source_to_f(target_file, preamble) + return True f = NativeIO() recompiler.write_source_to_f(f, preamble) output = f.getvalue() @@ -1481,9 +1488,12 @@ def _unpatch_meths(patchlist): def _patch_for_embedding(patchlist): if sys.platform == 'win32': # we must not remove the manifest when building for embedding! + # FUTURE: this module was removed in setuptools 74; this is likely dead code and should be removed, + # since the toolchain it supports (VS2005-2008) is also long dead. from cffi._shimmed_dist_utils import MSVCCompiler - _patch_meth(patchlist, MSVCCompiler, '_remove_visual_c_ref', - lambda self, manifest_file: manifest_file) + if MSVCCompiler is not None: + _patch_meth(patchlist, MSVCCompiler, '_remove_visual_c_ref', + lambda self, manifest_file: manifest_file) if sys.platform == 'darwin': # we must not make a '-bundle', but a '-dynamiclib' instead @@ -1517,12 +1527,16 @@ def _patch_for_target(patchlist, target): def recompile(ffi, module_name, preamble, tmpdir='.', call_c_compiler=True, c_file=None, source_extension='.c', extradir=None, - compiler_verbose=1, target=None, debug=None, **kwds): + compiler_verbose=1, target=None, debug=None, + uses_ffiplatform=True, **kwds): if not isinstance(module_name, str): module_name = module_name.encode('ascii') if ffi._windows_unicode: ffi._apply_windows_unicode(kwds) if preamble is not None: + if call_c_compiler and _is_file_like(c_file): + raise TypeError("Writing to file-like objects is not supported " + "with call_c_compiler=True") embedding = (ffi._embedding is not None) if embedding: ffi._apply_embedding_fix(kwds) @@ -1541,7 +1555,10 @@ def recompile(ffi, module_name, preamble, tmpdir='.', call_c_compiler=True, else: target = '*' # - ext = ffiplatform.get_extension(ext_c_file, module_name, **kwds) + if uses_ffiplatform: + ext = ffiplatform.get_extension(ext_c_file, module_name, **kwds) + else: + ext = None updated = make_c_source(ffi, module_name, preamble, c_file, verbose=compiler_verbose) if call_c_compiler: diff --git a/contrib/python/cffi/py3/ya.make b/contrib/python/cffi/py3/ya.make index 30e438d17e2..90ddf448de4 100644 --- a/contrib/python/cffi/py3/ya.make +++ b/contrib/python/cffi/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(1.17.0) +VERSION(1.17.1) LICENSE(MIT) diff --git a/contrib/python/executing/.dist-info/METADATA b/contrib/python/executing/.dist-info/METADATA index b598e4907d6..45ff9aa8813 100644 --- a/contrib/python/executing/.dist-info/METADATA +++ b/contrib/python/executing/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: executing -Version: 2.0.1 +Version: 2.1.0 Summary: Get the currently executing AST node of a frame, and other information Home-page: https://github.com/alexmojaki/executing Author: Alex Hall @@ -9,25 +9,23 @@ License: MIT Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 -Requires-Python: >=3.5 +Classifier: Programming Language :: Python :: 3.13 +Requires-Python: >=3.8 Description-Content-Type: text/markdown License-File: LICENSE.txt Provides-Extra: tests -Requires-Dist: asttokens >=2.1.0 ; extra == 'tests' -Requires-Dist: ipython ; extra == 'tests' -Requires-Dist: pytest ; extra == 'tests' -Requires-Dist: coverage ; extra == 'tests' -Requires-Dist: coverage-enable-subprocess ; extra == 'tests' -Requires-Dist: littleutils ; extra == 'tests' -Requires-Dist: rich ; (python_version >= "3.11") and extra == 'tests' +Requires-Dist: asttokens>=2.1.0; extra == "tests" +Requires-Dist: ipython; extra == "tests" +Requires-Dist: pytest; extra == "tests" +Requires-Dist: coverage; extra == "tests" +Requires-Dist: coverage-enable-subprocess; extra == "tests" +Requires-Dist: littleutils; extra == "tests" +Requires-Dist: rich; python_version >= "3.11" and extra == "tests" # executing diff --git a/contrib/python/executing/executing/_position_node_finder.py b/contrib/python/executing/executing/_position_node_finder.py index 8ca21a67bd5..7a814150da6 100644 --- a/contrib/python/executing/executing/_position_node_finder.py +++ b/contrib/python/executing/executing/_position_node_finder.py @@ -72,7 +72,7 @@ def mangled_name(node: EnhancedAST) -> str: @lru_cache(128) # pragma: no mutate def get_instructions(code: CodeType) -> list[dis.Instruction]: - return list(dis.get_instructions(code, show_caches=True)) + return list(dis.get_instructions(code)) types_cmp_issue_fix = ( @@ -114,7 +114,7 @@ class PositionNodeFinder(object): """ def __init__(self, frame: FrameType, stmts: Set[EnhancedAST], tree: ast.Module, lasti: int, source: Source): - self.bc_list = get_instructions(frame.f_code) + self.bc_dict={bc.offset:bc for bc in get_instructions(frame.f_code) } self.source = source self.decorator: Optional[EnhancedAST] = None @@ -141,7 +141,7 @@ class PositionNodeFinder(object): # we ignore here the start position and try to find the ast-node just by end position and expected node type # This is save, because there can only be one attribute ending at a specific point in the source code. typ = (ast.Attribute,) - elif self.opname(lasti) == "CALL": + elif self.opname(lasti) in ("CALL", "CALL_KW"): # A CALL instruction can be a method call, in which case the lineno and col_offset gets changed by the compiler. # Therefore we ignoring here this attributes and searchnig for a Call-node only by end_col_offset and end_lineno. # This is save, because there can only be one method ending at a specific point in the source code. @@ -156,13 +156,18 @@ class PositionNodeFinder(object): typ=typ, ) - self.known_issues(self.result, self.instruction(lasti)) + instruction = self.instruction(lasti) + assert instruction is not None + + self.result = self.fix_result(self.result, instruction) + + self.known_issues(self.result, instruction) self.test_for_decorator(self.result, lasti) # verify if self.decorator is None: - self.verify(self.result, self.instruction(lasti)) + self.verify(self.result, instruction) else: assert_(self.decorator in self.result.decorator_list) @@ -213,6 +218,32 @@ class PositionNodeFinder(object): if sys.version_info < (3, 12): index += 4 + def fix_result( + self, node: EnhancedAST, instruction: dis.Instruction + ) -> EnhancedAST: + if ( + sys.version_info >= (3, 12, 5) + and instruction.opname in ("GET_ITER", "FOR_ITER") + and isinstance(node.parent, ast.For) + and node is node.parent.iter + ): + # node positions have changed in 3.12.5 + # https://github.com/python/cpython/issues/93691 + # `for` calls __iter__ and __next__ during execution, the calling + # expression of these calls was the ast.For node since cpython 3.11 (see test_iter). + # cpython 3.12.5 changed this to the `iter` node of the loop, to make tracebacks easier to read. + # This keeps backward compatibility with older executing versions. + + # there are also cases like: + # + # for a in iter(l): pass + # + # where `iter(l)` would be otherwise the resulting node for the `iter()` call and the __iter__ call of the for implementation. + # keeping the old behaviour makes it possible to distinguish both cases. + + return node.parent + return node + def known_issues(self, node: EnhancedAST, instruction: dis.Instruction) -> None: if instruction.opname in ("COMPARE_OP", "IS_OP", "CONTAINS_OP") and isinstance( node, types_cmp_issue @@ -324,6 +355,35 @@ class PositionNodeFinder(object): ): raise KnownIssue("exception generation maps to condition") + if sys.version_info >= (3, 13): + if instruction.opname in ( + "STORE_FAST_STORE_FAST", + "STORE_FAST_LOAD_FAST", + "LOAD_FAST_LOAD_FAST", + ): + raise KnownIssue(f"can not map {instruction.opname} to two ast nodes") + + if instruction.opname == "LOAD_FAST" and instruction.argval == "__class__": + # example: + # class T: + # def a(): + # super() + # some_node # <- there is a LOAD_FAST for this node because we use super() + + raise KnownIssue( + f"loading of __class__ is accociated with a random node at the end of a class if you use super()" + ) + + if ( + instruction.opname == "COMPARE_OP" + and isinstance(node, ast.UnaryOp) + and isinstance(node.operand,ast.Compare) + and isinstance(node.op, ast.Not) + ): + # work around for + # https://github.com/python/cpython/issues/114671 + self.result = node.operand + @staticmethod def is_except_cleanup(inst: dis.Instruction, node: EnhancedAST) -> bool: if inst.opname not in ( @@ -703,6 +763,52 @@ class PositionNodeFinder(object): if node_match(ast.FormattedValue) and inst_match("FORMAT_VALUE"): return + if sys.version_info >= (3, 13): + + if inst_match("NOP"): + return + + if inst_match("TO_BOOL") and node_match(ast.BoolOp): + return + + if inst_match("CALL_KW") and node_match((ast.Call, ast.ClassDef)): + return + + if inst_match("LOAD_FAST", argval=".type_params"): + return + + if inst_match("LOAD_FAST", argval="__classdict__"): + return + + if inst_match("LOAD_FAST") and node_match( + ( + ast.FunctionDef, + ast.ClassDef, + ast.TypeAlias, + ast.TypeVar, + ast.Lambda, + ast.AsyncFunctionDef, + ) + ): + # These are loads for closure variables. + # It is difficult to check that this is actually closure variable, see: + # https://github.com/alexmojaki/executing/pull/80#discussion_r1716027317 + return + + if ( + inst_match("LOAD_FAST") + and node_match(ast.TypeAlias) + and node.name.id == instruction.argval + ): + return + + if inst_match("STORE_NAME",argval="__static_attributes__"): + # the node is the first node in the body + return + + if inst_match("LOAD_FAST") and isinstance(node.parent,ast.TypeVar): + return + # old verifier @@ -771,11 +877,14 @@ class PositionNodeFinder(object): raise VerifierFailure(title, node, instruction) - def instruction(self, index: int) -> dis.Instruction: - return self.bc_list[index // 2] + def instruction(self, index: int) -> Optional[dis.Instruction]: + return self.bc_dict.get(index,None) def opname(self, index: int) -> str: - return self.instruction(index).opname + i=self.instruction(index) + if i is None: + return "CACHE" + return i.opname extra_node_types=() if sys.version_info >= (3,12): @@ -798,7 +907,10 @@ class PositionNodeFinder(object): *extra_node_types, ), ) -> EnhancedAST: - position = self.instruction(index).positions + instruction = self.instruction(index) + assert instruction is not None + + position = instruction.positions assert position is not None and position.lineno is not None return only( diff --git a/contrib/python/executing/executing/executing.py b/contrib/python/executing/executing/executing.py index 7727c42232d..5cf117e18c5 100644 --- a/contrib/python/executing/executing/executing.py +++ b/contrib/python/executing/executing/executing.py @@ -273,16 +273,15 @@ class Source(object): node_finder = NodeFinder(frame, stmts, tree, lasti, source) node = node_finder.result decorator = node_finder.decorator + + if node: + new_stmts = {statement_containing_node(node)} + assert_(new_stmts <= stmts) + stmts = new_stmts except Exception: if TESTING: raise - assert stmts is not None - if node: - new_stmts = {statement_containing_node(node)} - assert_(new_stmts <= stmts) - stmts = new_stmts - executing_cache[key] = args = source, node, stmts, decorator return Executing(frame, *args) diff --git a/contrib/python/executing/executing/version.py b/contrib/python/executing/executing/version.py index 9d909dcc3cc..b15121b0fec 100644 --- a/contrib/python/executing/executing/version.py +++ b/contrib/python/executing/executing/version.py @@ -1 +1 @@ -__version__ = '2.0.1'
\ No newline at end of file +__version__ = '2.1.0'
\ No newline at end of file diff --git a/contrib/python/executing/ya.make b/contrib/python/executing/ya.make index b6765022820..b437b26981c 100644 --- a/contrib/python/executing/ya.make +++ b/contrib/python/executing/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(2.0.1) +VERSION(2.1.0) LICENSE(MIT) diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index d1e09fb0ef6..b78a2eeab38 100644 --- a/contrib/python/hypothesis/py3/.dist-info/METADATA +++ b/contrib/python/hypothesis/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesis -Version: 6.111.2 +Version: 6.112.0 Summary: A library for property-based testing Home-page: https://hypothesis.works Author: David R. MacIver and Zac Hatfield-Dodds diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py index 18f3bd9b8a4..0f4f1138f34 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py @@ -111,11 +111,12 @@ class FloatKWargs(TypedDict): class StringKWargs(TypedDict): intervals: IntervalSet min_size: int - max_size: Optional[int] + max_size: int class BytesKWargs(TypedDict): - size: int + min_size: int + max_size: int class BooleanKWargs(TypedDict): @@ -206,7 +207,7 @@ NASTY_FLOATS.extend([-x for x in NASTY_FLOATS]) FLOAT_INIT_LOGIC_CACHE = LRUCache(4096) POOLED_KWARGS_CACHE = LRUCache(4096) -DRAW_STRING_DEFAULT_MAX_SIZE = 10**10 # "arbitrarily large" +COLLECTION_DEFAULT_MAX_SIZE = 10**10 # "arbitrarily large" class Example: @@ -1036,7 +1037,7 @@ class IRNode: return self.value == (minimal_char * self.kwargs["min_size"]) if self.ir_type == "bytes": # smallest size and all-zero value. - return len(self.value) == self.kwargs["size"] and not any(self.value) + return len(self.value) == self.kwargs["min_size"] and not any(self.value) raise NotImplementedError(f"unhandled ir_type {self.ir_type}") @@ -1095,7 +1096,9 @@ def ir_value_permitted(value, ir_type, kwargs): return False return all(ord(c) in kwargs["intervals"] for c in value) elif ir_type == "bytes": - return len(value) == kwargs["size"] + if len(value) < kwargs["min_size"]: + return False + return kwargs["max_size"] is None or len(value) <= kwargs["max_size"] elif ir_type == "boolean": if kwargs["p"] <= 2 ** (-64): return value is False @@ -1314,7 +1317,7 @@ class PrimitiveProvider(abc.ABC): intervals: IntervalSet, *, min_size: int = 0, - max_size: Optional[int] = None, + max_size: int = COLLECTION_DEFAULT_MAX_SIZE, forced: Optional[str] = None, fake_forced: bool = False, ) -> str: @@ -1322,7 +1325,12 @@ class PrimitiveProvider(abc.ABC): @abc.abstractmethod def draw_bytes( - self, size: int, *, forced: Optional[bytes] = None, fake_forced: bool = False + self, + min_size: int = 0, + max_size: int = COLLECTION_DEFAULT_MAX_SIZE, + *, + forced: Optional[bytes] = None, + fake_forced: bool = False, ) -> bytes: raise NotImplementedError @@ -1606,14 +1614,10 @@ class HypothesisProvider(PrimitiveProvider): intervals: IntervalSet, *, min_size: int = 0, - max_size: Optional[int] = None, + max_size: int = COLLECTION_DEFAULT_MAX_SIZE, forced: Optional[str] = None, fake_forced: bool = False, ) -> str: - if max_size is None: - max_size = DRAW_STRING_DEFAULT_MAX_SIZE - - assert forced is None or min_size <= len(forced) <= max_size assert self._cd is not None average_size = min( @@ -1663,17 +1667,40 @@ class HypothesisProvider(PrimitiveProvider): return "".join(chars) def draw_bytes( - self, size: int, *, forced: Optional[bytes] = None, fake_forced: bool = False + self, + min_size: int = 0, + max_size: int = COLLECTION_DEFAULT_MAX_SIZE, + *, + forced: Optional[bytes] = None, + fake_forced: bool = False, ) -> bytes: - forced_i = None - if forced is not None: - forced_i = int_from_bytes(forced) - size = len(forced) - assert self._cd is not None - return self._cd.draw_bits( - 8 * size, forced=forced_i, fake_forced=fake_forced - ).to_bytes(size, "big") + + buf = bytearray() + average_size = min( + max(min_size * 2, min_size + 5), + 0.5 * (min_size + max_size), + ) + elements = many( + self._cd, + min_size=min_size, + max_size=max_size, + average_size=average_size, + forced=None if forced is None else len(forced), + fake_forced=fake_forced, + observe=False, + ) + while elements.more(): + forced_i: Optional[int] = None + if forced is not None: + # implicit conversion from bytes to int by indexing here + forced_i = forced[elements.count - 1] + + buf += self._cd.draw_bits( + 8, forced=forced_i, fake_forced=fake_forced + ).to_bytes(1, "big") + + return bytes(buf) def _draw_float( self, @@ -2216,12 +2243,13 @@ class ConjectureData: intervals: IntervalSet, *, min_size: int = 0, - max_size: Optional[int] = None, + max_size: int = COLLECTION_DEFAULT_MAX_SIZE, forced: Optional[str] = None, fake_forced: bool = False, observe: bool = True, ) -> str: - assert forced is None or min_size <= len(forced) + assert forced is None or min_size <= len(forced) <= max_size + assert min_size >= 0 kwargs: StringKWargs = self._pooled_kwargs( "string", @@ -2255,17 +2283,19 @@ class ConjectureData: def draw_bytes( self, - # TODO move to min_size and max_size here. - size: int, + min_size: int = 0, + max_size: int = COLLECTION_DEFAULT_MAX_SIZE, *, forced: Optional[bytes] = None, fake_forced: bool = False, observe: bool = True, ) -> bytes: - assert forced is None or len(forced) == size - assert size >= 0 + assert forced is None or min_size <= len(forced) <= max_size + assert min_size >= 0 - kwargs: BytesKWargs = self._pooled_kwargs("bytes", {"size": size}) + kwargs: BytesKWargs = self._pooled_kwargs( + "bytes", {"min_size": min_size, "max_size": max_size} + ) if self.ir_tree_nodes is not None and observe: node_value = self._pop_ir_tree_node("bytes", kwargs, forced=forced) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py index 60c1610bc31..87a0c988c88 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py @@ -146,9 +146,31 @@ class Conclusion: MAX_CHILDREN_EFFECTIVELY_INFINITE = 100_000 -def compute_max_children(ir_type, kwargs): - from hypothesis.internal.conjecture.data import DRAW_STRING_DEFAULT_MAX_SIZE +def _count_distinct_strings(*, alphabet_size, min_size, max_size): + # We want to estimate if we're going to have more children than + # MAX_CHILDREN_EFFECTIVELY_INFINITE, without computing a potentially + # extremely expensive pow. We'll check if the number of strings in + # the largest string size alone is enough to put us over this limit. + # We'll also employ a trick of estimating against log, which is cheaper + # than computing a pow. + # + # x = max_size + # y = alphabet_size + # n = MAX_CHILDREN_EFFECTIVELY_INFINITE + # + # x**y > n + # <=> log(x**y) > log(n) + # <=> y * log(x) > log(n) + definitely_too_large = max_size * math.log(alphabet_size) > math.log( + MAX_CHILDREN_EFFECTIVELY_INFINITE + ) + if definitely_too_large: + return MAX_CHILDREN_EFFECTIVELY_INFINITE + return sum(alphabet_size**k for k in range(min_size, max_size + 1)) + + +def compute_max_children(ir_type, kwargs): if ir_type == "integer": min_value = kwargs["min_value"] max_value = kwargs["max_value"] @@ -178,50 +200,27 @@ def compute_max_children(ir_type, kwargs): return 1 return 2 elif ir_type == "bytes": - return 2 ** (8 * kwargs["size"]) + return _count_distinct_strings( + alphabet_size=2**8, min_size=kwargs["min_size"], max_size=kwargs["max_size"] + ) elif ir_type == "string": min_size = kwargs["min_size"] max_size = kwargs["max_size"] intervals = kwargs["intervals"] - if max_size is None: - max_size = DRAW_STRING_DEFAULT_MAX_SIZE - if len(intervals) == 0: # Special-case the empty alphabet to avoid an error in math.log(0). # Only possibility is the empty string. return 1 - # We want to estimate if we're going to have more children than - # MAX_CHILDREN_EFFECTIVELY_INFINITE, without computing a potentially - # extremely expensive pow. We'll check if the number of strings in - # the largest string size alone is enough to put us over this limit. - # We'll also employ a trick of estimating against log, which is cheaper - # than computing a pow. - # - # x = max_size - # y = len(intervals) - # n = MAX_CHILDREN_EFFECTIVELY_INFINITE - # - # x**y > n - # <=> log(x**y) > log(n) - # <=> y * log(x) > log(n) - - # avoid math.log(1) == 0 and incorrectly failing the below estimate, - # even when we definitely are too large. - if len(intervals) == 1: - definitely_too_large = max_size > MAX_CHILDREN_EFFECTIVELY_INFINITE - else: - definitely_too_large = max_size * math.log(len(intervals)) > math.log( - MAX_CHILDREN_EFFECTIVELY_INFINITE - ) - - if definitely_too_large: + # avoid math.log(1) == 0 and incorrectly failing our effectively_infinite + # estimate, even when we definitely are too large. + if len(intervals) == 1 and max_size > MAX_CHILDREN_EFFECTIVELY_INFINITE: return MAX_CHILDREN_EFFECTIVELY_INFINITE - # number of strings of length k, for each k in [min_size, max_size]. - return sum(len(intervals) ** k for k in range(min_size, max_size + 1)) - + return _count_distinct_strings( + alphabet_size=len(intervals), min_size=min_size, max_size=max_size + ) elif ir_type == "float": min_value = kwargs["min_value"] max_value = kwargs["max_value"] @@ -306,8 +305,8 @@ def all_children(ir_type, kwargs): else: yield from [False, True] if ir_type == "bytes": - size = kwargs["size"] - yield from (int_to_bytes(i, size) for i in range(2 ** (8 * size))) + for size in range(kwargs["min_size"], kwargs["max_size"] + 1): + yield from (int_to_bytes(i, size) for i in range(2 ** (8 * size))) if ir_type == "string": min_size = kwargs["min_size"] max_size = kwargs["max_size"] diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinker.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinker.py index 3be703a18e6..d1084e4cdd4 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinker.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinker.py @@ -1075,10 +1075,9 @@ class Shrinker: return False # pragma: no cover if node.ir_type in {"string", "bytes"}: - size_kwarg = "min_size" if node.ir_type == "string" else "size" # if the size *increased*, we would have to guess what to pad with # in order to try fixing up this attempt. Just give up. - if node.kwargs[size_kwarg] <= attempt_kwargs[size_kwarg]: + if node.kwargs["min_size"] <= attempt_kwargs["min_size"]: return False # the size decreased in our attempt. Try again, but replace with # the min_size that we would have gotten, and truncate the value @@ -1089,7 +1088,7 @@ class Shrinker: initial_attempt[node.index].copy( with_kwargs=attempt_kwargs, with_value=initial_attempt[node.index].value[ - : attempt_kwargs[size_kwarg] + : attempt_kwargs["min_size"] ], ) ] diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinking/bytes.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinking/bytes.py index 3ba75a2719b..7fbc26fd248 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinking/bytes.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/shrinking/bytes.py @@ -8,17 +8,16 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. -from hypothesis.internal.compat import int_from_bytes, int_to_bytes +from hypothesis.internal.conjecture.shrinking.collection import Collection from hypothesis.internal.conjecture.shrinking.integer import Integer -class Bytes(Integer): +class Bytes(Collection): def __init__(self, initial, predicate, **kwargs): - # shrink by interpreting the bytes as an integer. - # move to Collection.shrink when we support variable-size bytes, - # because b'\x00\x02' could shrink to either b'\x00\x01' or b'\x02'. super().__init__( - int_from_bytes(initial), - lambda n: predicate(int_to_bytes(n, len(initial))), + # implicit conversion from bytes to list of integers here + list(initial), + lambda val: predicate(bytes(val)), + ElementShrinker=Integer, **kwargs, ) diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strings.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strings.py index b6e6dd8deb3..53d81b73949 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strings.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strings.py @@ -12,15 +12,16 @@ import copy import re import warnings from functools import lru_cache, partial +from typing import Optional from hypothesis.errors import HypothesisWarning, InvalidArgument from hypothesis.internal import charmap +from hypothesis.internal.conjecture.data import COLLECTION_DEFAULT_MAX_SIZE from hypothesis.internal.filtering import max_len, min_len from hypothesis.internal.intervalsets import IntervalSet from hypothesis.internal.reflection import get_pretty_function_description from hypothesis.strategies._internal.collections import ListStrategy from hypothesis.strategies._internal.lazy import unwrap_strategies -from hypothesis.strategies._internal.numbers import IntegersStrategy from hypothesis.strategies._internal.strategies import ( OneOfStrategy, SampledFromStrategy, @@ -158,7 +159,13 @@ class TextStrategy(ListStrategy): elems = unwrap_strategies(self.element_strategy) if isinstance(elems, OneCharStringStrategy): return data.draw_string( - elems.intervals, min_size=self.min_size, max_size=self.max_size + elems.intervals, + min_size=self.min_size, + max_size=( + COLLECTION_DEFAULT_MAX_SIZE + if self.max_size == float("inf") + else self.max_size + ), ) return "".join(super().do_draw(data)) @@ -224,9 +231,13 @@ def _string_filter_rewrite(self, kind, condition): stacklevel=2, ) - elems = unwrap_strategies(self.element_strategy) if ( - (kind is bytes or isinstance(elems, OneCharStringStrategy)) + ( + kind is bytes + or isinstance( + unwrap_strategies(self.element_strategy), OneCharStringStrategy + ) + ) and isinstance(pattern := getattr(condition, "__self__", None), re.Pattern) and isinstance(pattern.pattern, kind) ): @@ -331,15 +342,15 @@ def _identifier_characters(): return id_start, id_continue -class BytesStrategy(ListStrategy): - def __init__(self, min_size, max_size): - super().__init__(IntegersStrategy(0, 255), min_size=min_size, max_size=max_size) +class BytesStrategy(SearchStrategy): + def __init__(self, min_size: int, max_size: Optional[int]): + self.min_size = min_size + self.max_size = ( + max_size if max_size is not None else COLLECTION_DEFAULT_MAX_SIZE + ) def do_draw(self, data): - # TODO: refactor the underlying provider to support variable-length bytes - if self.min_size == self.max_size: - return bytes(data.draw_bytes(self.min_size)) - return bytes(super().do_draw(data)) + return data.draw_bytes(self.min_size, self.max_size) _nonempty_filters = ( *ListStrategy._nonempty_filters, @@ -353,4 +364,4 @@ class BytesStrategy(ListStrategy): def filter(self, condition): if (new := _string_filter_rewrite(self, bytes, condition)) is not None: return new - return super().filter(condition) + return ListStrategy.filter(self, condition) diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index af1b866e64e..2c69dd8977a 100644 --- a/contrib/python/hypothesis/py3/hypothesis/version.py +++ b/contrib/python/hypothesis/py3/hypothesis/version.py @@ -8,5 +8,5 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. -__version_info__ = (6, 111, 2) +__version_info__ = (6, 112, 0) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index f7183e57f13..ce520eaa5f5 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.111.2) +VERSION(6.112.0) LICENSE(MPL-2.0) diff --git a/contrib/python/more-itertools/py3/.dist-info/METADATA b/contrib/python/more-itertools/py3/.dist-info/METADATA index c346b408809..a06c9b0a570 100644 --- a/contrib/python/more-itertools/py3/.dist-info/METADATA +++ b/contrib/python/more-itertools/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: more-itertools -Version: 10.4.0 +Version: 10.5.0 Summary: More routines for operating on iterables, beyond itertools Keywords: itertools,iterator,iteration,filter,peek,peekable,chunk,chunked Author-email: Erik Rose <[email protected]> diff --git a/contrib/python/more-itertools/py3/more_itertools/__init__.py b/contrib/python/more-itertools/py3/more_itertools/__init__.py index 2e2fcbbe7b3..583fb574578 100644 --- a/contrib/python/more-itertools/py3/more_itertools/__init__.py +++ b/contrib/python/more-itertools/py3/more_itertools/__init__.py @@ -3,4 +3,4 @@ from .more import * # noqa from .recipes import * # noqa -__version__ = '10.4.0' +__version__ = '10.5.0' diff --git a/contrib/python/more-itertools/py3/more_itertools/more.py b/contrib/python/more-itertools/py3/more_itertools/more.py index 3bf2c76b765..64fab261858 100644 --- a/contrib/python/more-itertools/py3/more_itertools/more.py +++ b/contrib/python/more-itertools/py3/more_itertools/more.py @@ -3017,7 +3017,7 @@ def circular_shifts(iterable, steps=1): n = len(buffer) n //= math.gcd(n, steps) - for __ in repeat(None, n): + for _ in repeat(None, n): buffer.rotate(steps) yield tuple(buffer) diff --git a/contrib/python/more-itertools/py3/more_itertools/more.pyi b/contrib/python/more-itertools/py3/more_itertools/more.pyi index f1a155dce7d..66e6938e134 100644 --- a/contrib/python/more-itertools/py3/more_itertools/more.pyi +++ b/contrib/python/more-itertools/py3/more_itertools/more.pyi @@ -3,8 +3,8 @@ from __future__ import annotations import sys +import types -from types import TracebackType from typing import ( Any, Callable, @@ -42,7 +42,7 @@ _Raisable = BaseException | Type[BaseException] # The type of isinstance's second argument (from typeshed builtins) if sys.version_info >= (3, 10): - _ClassInfo = type | UnionType | tuple[_ClassInfo, ...] + _ClassInfo = type | types.UnionType | tuple[_ClassInfo, ...] else: _ClassInfo = type | tuple[_ClassInfo, ...] @@ -619,7 +619,7 @@ class callback_iter(Generic[_T], Iterator[_T]): self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, - traceback: TracebackType | None, + traceback: types.TracebackType | None, ) -> bool | None: ... def __iter__(self) -> callback_iter[_T]: ... def __next__(self) -> _T: ... diff --git a/contrib/python/more-itertools/py3/more_itertools/recipes.py b/contrib/python/more-itertools/py3/more_itertools/recipes.py index a21a1f5d88d..67f76fa899e 100644 --- a/contrib/python/more-itertools/py3/more_itertools/recipes.py +++ b/contrib/python/more-itertools/py3/more_itertools/recipes.py @@ -218,7 +218,12 @@ def all_equal(iterable, key=None): True """ - return len(list(islice(groupby(iterable, key), 2))) <= 1 + iterator = groupby(iterable, key) + for first in iterator: + for second in iterator: + return False + return True + return True def quantify(iterable, pred=bool): diff --git a/contrib/python/more-itertools/py3/tests/test_recipes.py b/contrib/python/more-itertools/py3/tests/test_recipes.py index d3762d49dbe..684a6fcd0b1 100644 --- a/contrib/python/more-itertools/py3/tests/test_recipes.py +++ b/contrib/python/more-itertools/py3/tests/test_recipes.py @@ -2,11 +2,12 @@ from decimal import Decimal from doctest import DocTestSuite from fractions import Fraction from functools import reduce -from itertools import combinations, count, permutations +from itertools import combinations, count, groupby, permutations from operator import mul from math import factorial from sys import version_info from unittest import TestCase, skipIf +from unittest.mock import patch import more_itertools as mi @@ -158,6 +159,22 @@ class AllEqualTests(TestCase): self.assertTrue(mi.all_equal('4٤໔4৪', key=int)) self.assertFalse(mi.all_equal('Abc', key=str.casefold)) + @patch('more_itertools.recipes.groupby', autospec=True) + def test_groupby_calls(self, mock_groupby): + next_count = 0 + + class _groupby(groupby): + def __next__(true_self): + nonlocal next_count + next_count += 1 + return super().__next__() + + mock_groupby.side_effect = _groupby + iterable = iter('aaaaa') + self.assertTrue(mi.all_equal(iterable)) + self.assertEqual(list(iterable), []) + self.assertEqual(next_count, 2) + class QuantifyTests(TestCase): """Tests for ``quantify()``""" diff --git a/contrib/python/more-itertools/py3/ya.make b/contrib/python/more-itertools/py3/ya.make index ee8f86bc142..45df93175b6 100644 --- a/contrib/python/more-itertools/py3/ya.make +++ b/contrib/python/more-itertools/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(10.4.0) +VERSION(10.5.0) LICENSE(MIT) diff --git a/contrib/python/types-protobuf/.dist-info/METADATA b/contrib/python/types-protobuf/.dist-info/METADATA index c7742acc49e..ce1d526999c 100644 --- a/contrib/python/types-protobuf/.dist-info/METADATA +++ b/contrib/python/types-protobuf/.dist-info/METADATA @@ -1,9 +1,9 @@ Metadata-Version: 2.1 Name: types-protobuf -Version: 5.27.0.20240626 +Version: 5.27.0.20240907 Summary: Typing stubs for protobuf Home-page: https://github.com/python/typeshed -License: Apache-2.0 license +License: Apache-2.0 Project-URL: GitHub, https://github.com/python/typeshed Project-URL: Changes, https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/protobuf.md Project-URL: Issue tracker, https://github.com/python/typeshed/issues @@ -38,6 +38,7 @@ If you find that annotations are missing, feel free to contribute and help compl See https://github.com/python/typeshed/blob/main/README.md for more details. -This package was generated from typeshed commit `b13bb947c3f7a000d4d4ec6ad2868726a289b2b4` and was tested -with mypy 1.10.0, pyright 1.1.369, and +This package was generated from typeshed commit +[`e8e9291c76f50c3bcde79e7bb61060f5c24c054e`](https://github.com/python/typeshed/commit/e8e9291c76f50c3bcde79e7bb61060f5c24c054e) and was tested +with mypy 1.11.1, pyright 1.1.379, and pytype 2024.4.11. diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi index 30a37353c12..aaa97043921 100644 --- a/contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi +++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi @@ -33,7 +33,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]): def append(self, value: _ScalarV) -> None: ... def insert(self, key: int, value: _ScalarV) -> None: ... def extend(self, elem_seq: Iterable[_ScalarV] | None) -> None: ... - def MergeFrom(self: _M, other: _M) -> None: ... + def MergeFrom(self: _M, other: _M | Iterable[_ScalarV]) -> None: ... def remove(self, elem: _ScalarV) -> None: ... def pop(self, key: int = -1) -> _ScalarV: ... @overload @@ -49,7 +49,7 @@ class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]): def append(self, value: _MessageV) -> None: ... def insert(self, key: int, value: _MessageV) -> None: ... def extend(self, elem_seq: Iterable[_MessageV]) -> None: ... - def MergeFrom(self: _M, other: _M) -> None: ... + def MergeFrom(self: _M, other: _M | Iterable[_MessageV]) -> None: ... def remove(self, elem: _MessageV) -> None: ... def pop(self, key: int = -1) -> _MessageV: ... def __delitem__(self, key: int | slice) -> None: ... diff --git a/contrib/python/types-protobuf/ya.make b/contrib/python/types-protobuf/ya.make index a4a8846b2c3..f2e94d656ad 100644 --- a/contrib/python/types-protobuf/ya.make +++ b/contrib/python/types-protobuf/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(5.27.0.20240626) +VERSION(5.27.0.20240907) LICENSE(Apache-2.0) diff --git a/contrib/python/ydb/py3/.dist-info/METADATA b/contrib/python/ydb/py3/.dist-info/METADATA index db2f0036b39..7c7c7cdbafd 100644 --- a/contrib/python/ydb/py3/.dist-info/METADATA +++ b/contrib/python/ydb/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: ydb -Version: 3.17.1 +Version: 3.17.2 Summary: YDB Python SDK Home-page: http://github.com/ydb-platform/ydb-python-sdk Author: Yandex LLC diff --git a/contrib/python/ydb/py3/ya.make b/contrib/python/ydb/py3/ya.make index c1ab6d44721..b3e9929330d 100644 --- a/contrib/python/ydb/py3/ya.make +++ b/contrib/python/ydb/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(3.17.1) +VERSION(3.17.2) LICENSE(Apache-2.0) diff --git a/contrib/python/ydb/py3/ydb/table.py b/contrib/python/ydb/py3/ydb/table.py index cfcffb17af3..01f5e52b6ae 100644 --- a/contrib/python/ydb/py3/ydb/table.py +++ b/contrib/python/ydb/py3/ydb/table.py @@ -290,6 +290,7 @@ class TableIndex(object): self._pb.name = name self.name = name self.index_columns = [] + self.data_columns = [] # output only. self.status = None @@ -307,6 +308,12 @@ class TableIndex(object): self.index_columns.append(column) return self + def with_data_columns(self, *columns): + for column in columns: + self._pb.data_columns.append(column) + self.data_columns.append(column) + return self + def to_pb(self): return self._pb diff --git a/contrib/python/ydb/py3/ydb/ydb_version.py b/contrib/python/ydb/py3/ydb/ydb_version.py index b0ef9f368d2..1115cbbcb9f 100644 --- a/contrib/python/ydb/py3/ydb/ydb_version.py +++ b/contrib/python/ydb/py3/ydb/ydb_version.py @@ -1 +1 @@ -VERSION = "3.17.1" +VERSION = "3.17.2" diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/debugging/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/debugging/ya.make index b4b02674490..b8fee8b0708 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/debugging/ya.make +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/debugging/ya.make @@ -19,21 +19,21 @@ ADDINCL( NO_COMPILER_WARNINGS() -IF(NOT Y_ABSL_DONT_USE_DEBUG) -SRCS( - failure_signal_handler.cc - internal/address_is_readable.cc - internal/decode_rust_punycode.cc - internal/demangle.cc - internal/demangle_rust.cc - internal/elf_mem_image.cc - internal/examine_stack.cc - internal/utf8_for_code_point.cc - internal/vdso_support.cc - leak_check.cc - stacktrace.cc - symbolize.cc -) +IF (NOT Y_ABSL_DONT_USE_DEBUG) + SRCS( + failure_signal_handler.cc + internal/address_is_readable.cc + internal/decode_rust_punycode.cc + internal/demangle.cc + internal/demangle_rust.cc + internal/elf_mem_image.cc + internal/examine_stack.cc + internal/utf8_for_code_point.cc + internal/vdso_support.cc + leak_check.cc + stacktrace.cc + symbolize.cc + ) ENDIF() END() diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/log/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/log/ya.make index 74000ae8eef..746cf7a0cdf 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/log/ya.make +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/log/ya.make @@ -32,8 +32,10 @@ ENDIF() NO_COMPILER_WARNINGS() -IF(Y_ABSL_DONT_USE_DEBUG) - CFLAGS(-DY_ABSL_DONT_USE_DEBUG_LIBRARY=1) +IF (Y_ABSL_DONT_USE_DEBUG) + CFLAGS( + -DY_ABSL_DONT_USE_DEBUG_LIBRARY=1 + ) ENDIF() SRCS( diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h index 984562257db..8451cc504bb 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h @@ -49,6 +49,16 @@ struct ResizeUninitializedTraits< } }; +template <typename string_type> +struct ResizeUninitializedTraits< + string_type, y_absl::void_t<decltype(std::declval<string_type&>() + .ReserveAndResize(237))> > { + using HasMember = std::true_type; + static void Resize(string_type* s, size_t new_size) { + s->ReserveAndResize(new_size); + } +}; + // Returns true if the TString implementation supports a resize where // the new characters added to the TString are left untouched. // @@ -98,6 +108,15 @@ struct AppendUninitializedTraits< } }; +template <typename string_type> +struct AppendUninitializedTraits< + string_type, y_absl::void_t<decltype(std::declval<string_type&>() + .ReserveAndResize(237))> > { + static void Append(string_type* s, size_t n) { + s->ReserveAndResize(s->size() + n); + } +}; + // Like STLStringResizeUninitialized(str, new_size), except guaranteed to use // exponential growth so that the amortized complexity of increasing the string // size by a small amount is O(1), in contrast to O(str->size()) in the case of diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make index 74d25c05f58..a2d57d8f204 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make @@ -19,12 +19,14 @@ ADDINCL( NO_COMPILER_WARNINGS() -SRCDIR(contrib/restricted/abseil-cpp-tstring/y_absl) - -IF(Y_ABSL_DONT_USE_DEBUG) - CFLAGS(-DY_ABSL_DONT_USE_DEBUG_LIBRARY=1) +IF (Y_ABSL_DONT_USE_DEBUG) + CFLAGS( + -DY_ABSL_DONT_USE_DEBUG_LIBRARY=1 + ) ENDIF() +SRCDIR(contrib/restricted/abseil-cpp-tstring/y_absl) + SRCS( crc/crc32c.cc crc/internal/cpu_detect.cc diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc index 8fb7c97e393..ac0cd051414 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/mutex.cc @@ -434,14 +434,10 @@ static SynchEvent* GetSynchEvent(const void* addr) { // if event recording is on static void PostSynchEvent(void* obj, int ev) { SynchEvent* e = GetSynchEvent(obj); -#ifdef Y_ABSL_DONT_USE_DEBUG_LIBRARY - constexpr bool DONT_COLLECT_STACK_TRACE = 1; -#else - constexpr bool DONT_COLLECT_STACK_TRACE = 0; -#endif +#ifndef Y_ABSL_DONT_USE_DEBUG_LIBRARY // logging is on if event recording is on and either there's no event struct, // or it explicitly says to log - if ((e == nullptr || e->log) && !DONT_COLLECT_STACK_TRACE) { + if (e == nullptr || e->log) { void* pcs[40]; int n = y_absl::GetStackTrace(pcs, Y_ABSL_ARRAYSIZE(pcs), 1); // A buffer with enough space for the ASCII for all the PCs, even on a @@ -460,6 +456,7 @@ static void PostSynchEvent(void* obj, int ev) { Y_ABSL_RAW_LOG(INFO, "%s%p %s %s", event_properties[ev].msg, obj, (e == nullptr ? "" : e->name), buffer); } +#endif const int flags = event_properties[ev].flags; if ((flags & SYNCH_F_LCK) != 0 && e != nullptr && e->invariant != nullptr) { // Calling the invariant as is causes problems under ThreadSanitizer. @@ -1325,6 +1322,7 @@ static inline void DebugOnlyLockLeave(Mutex* mu) { static char* StackString(void** pcs, int n, char* buf, int maxlen, bool symbolize) { +#ifndef Y_ABSL_DONT_USE_DEBUG_LIBRARY static constexpr int kSymLen = 200; char sym[kSymLen]; int len = 0; @@ -1344,12 +1342,21 @@ static char* StackString(void** pcs, int n, char* buf, int maxlen, len += strlen(&buf[len]); } return buf; +#else + buf[0] = 0; + return buf; +#endif } static char* CurrentStackString(char* buf, int maxlen, bool symbolize) { +#ifndef Y_ABSL_DONT_USE_DEBUG_LIBRARY void* pcs[40]; return StackString(pcs, y_absl::GetStackTrace(pcs, Y_ABSL_ARRAYSIZE(pcs), 2), buf, maxlen, symbolize); +#else + buf[0] = 0; + return buf; +#endif } namespace { @@ -1375,7 +1382,11 @@ struct ScopedDeadlockReportBuffers { // Helper to pass to GraphCycles::UpdateStackTrace. int GetStack(void** stack, int max_depth) { +#ifndef Y_ABSL_DONT_USE_DEBUG_LIBRARY return y_absl::GetStackTrace(stack, max_depth, 3); +#else + return 0; +#endif } } // anonymous namespace diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/ya.make index a4eee05708c..82ecd4b5ff9 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/ya.make +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/synchronization/ya.make @@ -20,12 +20,14 @@ ADDINCL( GLOBAL contrib/restricted/abseil-cpp-tstring ) -IF(Y_ABSL_DONT_USE_DEBUG) - CFLAGS(-DY_ABSL_DONT_USE_DEBUG_LIBRARY=1) -ENDIF() - NO_COMPILER_WARNINGS() +IF (Y_ABSL_DONT_USE_DEBUG) + CFLAGS( + -DY_ABSL_DONT_USE_DEBUG_LIBRARY=1 + ) +ENDIF() + SRCS( barrier.cc blocking_counter.cc diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp index 3e810c89f77..8e831973218 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp @@ -583,7 +583,9 @@ #if defined(BOOST_ASIO_HAS_ALIGNOF) # define BOOST_ASIO_ALIGNOF(T) alignof(T) -# if defined(__GNUC__) +# if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) +# define BOOST_ASIO_DEFAULT_ALIGN __STDCPP_DEFAULT_NEW_ALIGNMENT__ +# elif defined(__GNUC__) # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) # define BOOST_ASIO_DEFAULT_ALIGN alignof(std::max_align_t) # else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) @@ -603,9 +605,11 @@ # if (__cplusplus >= 201703) # if defined(__clang__) # if defined(BOOST_ASIO_HAS_CLANG_LIBCXX) -# if (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) +# if (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) \ + && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1 # endif // (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) + // && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) # elif defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1 # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) @@ -1471,6 +1475,13 @@ # endif // !defined(BOOST_ASIO_HAS_TIMERFD) #endif // defined(__linux__) +// Linux: io_uring is used instead of epoll. +#if !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT) +# if !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING) +# define BOOST_ASIO_HAS_IO_URING_AS_DEFAULT 1 +# endif // !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING) +#endif // !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT) + // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue. #if (defined(__MACH__) && defined(__APPLE__)) \ || defined(__FreeBSD__) \ @@ -1572,6 +1583,34 @@ # endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS) #endif // !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) +// Files. +#if !defined(BOOST_ASIO_HAS_FILE) +# if !defined(BOOST_ASIO_DISABLE_FILE) +# if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) +# define BOOST_ASIO_HAS_FILE 1 +# elif defined(BOOST_ASIO_HAS_IO_URING) +# define BOOST_ASIO_HAS_FILE 1 +# endif // defined(BOOST_ASIO_HAS_IO_URING) +# endif // !defined(BOOST_ASIO_DISABLE_FILE) +#endif // !defined(BOOST_ASIO_HAS_FILE) + +// Pipes. +#if !defined(BOOST_ASIO_HAS_PIPE) +# if defined(BOOST_ASIO_HAS_IOCP) \ + || !defined(BOOST_ASIO_WINDOWS) \ + && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ + && !defined(__CYGWIN__) +# if !defined(__SYMBIAN32__) +# if !defined(BOOST_ASIO_DISABLE_PIPE) +# define BOOST_ASIO_HAS_PIPE 1 +# endif // !defined(BOOST_ASIO_DISABLE_PIPE) +# endif // !defined(__SYMBIAN32__) +# endif // defined(BOOST_ASIO_HAS_IOCP) + // || !defined(BOOST_ASIO_WINDOWS) + // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) + // && !defined(__CYGWIN__) +#endif // !defined(BOOST_ASIO_HAS_PIPE) + // Can use sigaction() instead of signal(). #if !defined(BOOST_ASIO_HAS_SIGACTION) # if !defined(BOOST_ASIO_DISABLE_SIGACTION) diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/is_buffer_sequence.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/is_buffer_sequence.hpp index 53d33ad445a..402e6801991 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/is_buffer_sequence.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/is_buffer_sequence.hpp @@ -25,6 +25,8 @@ namespace asio { class mutable_buffer; class const_buffer; +class mutable_registered_buffer; +class const_registered_buffer; namespace detail { @@ -259,6 +261,30 @@ struct is_buffer_sequence<const_buffer, mutable_buffer> { }; +template <> +struct is_buffer_sequence<mutable_registered_buffer, mutable_buffer> + : true_type +{ +}; + +template <> +struct is_buffer_sequence<mutable_registered_buffer, const_buffer> + : true_type +{ +}; + +template <> +struct is_buffer_sequence<const_registered_buffer, const_buffer> + : true_type +{ +}; + +template <> +struct is_buffer_sequence<const_registered_buffer, mutable_buffer> + : false_type +{ +}; + template <typename T> struct is_dynamic_buffer_class_v1 : integral_constant<bool, diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/pop_options.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/pop_options.hpp index c34eb983b4b..89008ccdb99 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/pop_options.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/pop_options.hpp @@ -146,4 +146,8 @@ # endif # endif +# pragma pop_macro ("emit") +# pragma pop_macro ("signal") +# pragma pop_macro ("slot") + #endif diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/push_options.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/push_options.hpp index 1a709cb1d44..020e97be440 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/push_options.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/push_options.hpp @@ -169,6 +169,7 @@ # pragma warning (disable:4127) # pragma warning (disable:4180) # pragma warning (disable:4244) +# pragma warning (disable:4265) # pragma warning (disable:4355) # pragma warning (disable:4510) # pragma warning (disable:4512) diff --git a/contrib/restricted/boost/asio/ya.make b/contrib/restricted/boost/asio/ya.make index 58792d23501..3a2909b0164 100644 --- a/contrib/restricted/boost/asio/ya.make +++ b/contrib/restricted/boost/asio/ya.make @@ -9,9 +9,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.77.0) +VERSION(1.78.0) -ORIGINAL_SOURCE(https://github.com/boostorg/asio/archive/boost-1.77.0.tar.gz) +ORIGINAL_SOURCE(https://github.com/boostorg/asio/archive/boost-1.78.0.tar.gz) PEERDIR( contrib/libs/openssl @@ -37,4 +37,8 @@ ADDINCL( GLOBAL contrib/restricted/boost/asio/include ) +NO_COMPILER_WARNINGS() + +NO_UTIL() + END() diff --git a/contrib/restricted/fast_float/README.md b/contrib/restricted/fast_float/README.md index 9c2e188fa94..316f813e3a7 100644 --- a/contrib/restricted/fast_float/README.md +++ b/contrib/restricted/fast_float/README.md @@ -144,6 +144,51 @@ print the number 22250738585072012 three times: std::cout << "parsed the number "<< i << std::endl; ``` +## Behavior of result_out_of_range + +When parsing floating-point values, the numbers can sometimes be too small (e.g., `1e-1000`) or +too large (e.g., `1e1000`). The C language established the precedent that these small values are out of range. +In such cases, it is customary to parse small values to zero and large +values to infinity. That is the behaviour of the C language (e.g., `stdtod`). That is the behaviour followed by the fast_float library. + + + +Specifically, we follow Jonathan Wakely's interpretation of the standard: + +> In any case, the resulting value is one of at most two floating-point values closest to the value of the string matching the pattern. + +It is also the approach taken by the [Microsoft C++ library](https://github.com/microsoft/STL/blob/62205ab155d093e71dd9588a78f02c5396c3c14b/tests/std/tests/P0067R5_charconv/test.cpp#L943-L946). + +Hence, we have the following examples: + +```cpp + double result = -1; + std::string str = "3e-1000"; + auto r = fast_float::from_chars(str.data(), str.data() + str.size(), result); + // r.ec == std::errc::result_out_of_range + // r.ptr == str.data() + 7 + // result == 0 +``` + + +```cpp + double result = -1; + std::string str = "3e1000"; + auto r = fast_float::from_chars(str.data(), str.data() + str.size(), result); + // r.ec == std::errc::result_out_of_range + // r.ptr == str.data() + 6 + // result == std::numeric_limits<double>::infinity() +``` + +Users who wish for the value to be left unmodified given `std::errc::result_out_of_range` may do so by adding two lines of code: + +```cpp + double old_result = result; // make copy + auto r = fast_float::from_chars(start, end, result); + if(r.ec == std::errc::result_out_of_range) { result = old_result; } +``` + + ## C++20: compile-time evaluation (constexpr) In C++20, you may use `fast_float::from_chars` to parse strings @@ -290,6 +335,7 @@ int main() { The fast_float library is part of: - GCC (as of version 12): the `from_chars` function in GCC relies on fast_float. +- [Chromium](https://github.com/Chromium/Chromium), the engine behind Google Chrome and Microsoft Edge, - [WebKit](https://github.com/WebKit/WebKit), the engine behind Safari (Apple's web browser) - [DuckDB](https://duckdb.org) - [Apache Arrow](https://github.com/apache/arrow/pull/8494) where it multiplied the number parsing speed by two or three times @@ -369,6 +415,16 @@ target_link_libraries(myprogram PUBLIC fast_float) You should change the `GIT_TAG` line so that you recover the version you wish to use. +You may also use [CPM](https://github.com/cpm-cmake/CPM.cmake), like so: + +``` +CPMAddPackage( + NAME fast_float + GITHUB_REPOSITORY "fastfloat/fast_float" + GIT_TAG v6.1.4) +``` + + ## Using as single header The script `script/amalgamate.py` may be used to generate a single header @@ -379,7 +435,13 @@ the command line help. You may directly download automatically generated single-header files: -https://github.com/fastfloat/fast_float/releases/download/v6.1.4/fast_float.h +https://github.com/fastfloat/fast_float/releases/download/v6.1.5/fast_float.h + +## Packages + +- The fast_float library is part of the [Conan package manager](https://conan.io/center/recipes/fast_float). +- It is part of the [brew package manager](https://formulae.brew.sh/formula/fast_float). +- Some Linux distribution like Fedora include fast_float (e.g., as `fast_float-devel`). ## RFC 7159 diff --git a/contrib/restricted/fast_float/include/fast_float/bigint.h b/contrib/restricted/fast_float/include/fast_float/bigint.h index 92c3d5b1920..03a5caa4a53 100644 --- a/contrib/restricted/fast_float/include/fast_float/bigint.h +++ b/contrib/restricted/fast_float/include/fast_float/bigint.h @@ -404,12 +404,16 @@ template <typename = void> struct pow5_tables { #endif }; +#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE + template <typename T> constexpr uint32_t pow5_tables<T>::large_step; template <typename T> constexpr uint64_t pow5_tables<T>::small_power_of_5[]; template <typename T> constexpr limb pow5_tables<T>::large_power_of_5[]; +#endif + // big integer type. implements a small subset of big integer // arithmetic, using simple algorithms since asymptotically // faster algorithms are slower for a small number of limbs. diff --git a/contrib/restricted/fast_float/include/fast_float/constexpr_feature_detect.h b/contrib/restricted/fast_float/include/fast_float/constexpr_feature_detect.h index 18daf409419..7624beafcac 100644 --- a/contrib/restricted/fast_float/include/fast_float/constexpr_feature_detect.h +++ b/contrib/restricted/fast_float/include/fast_float/constexpr_feature_detect.h @@ -37,4 +37,10 @@ #define FASTFLOAT_IS_CONSTEXPR 0 #endif +#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +#define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 0 +#else +#define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 1 +#endif + #endif // FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H diff --git a/contrib/restricted/fast_float/include/fast_float/fast_table.h b/contrib/restricted/fast_float/include/fast_float/fast_table.h index 097e27b14b7..69f9b2c9245 100644 --- a/contrib/restricted/fast_float/include/fast_float/fast_table.h +++ b/contrib/restricted/fast_float/include/fast_float/fast_table.h @@ -693,10 +693,14 @@ template <class unused = void> struct powers_template { }; }; +#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE + template <class unused> constexpr uint64_t powers_template<unused>::power_of_five_128[number_of_entries]; +#endif + using powers = powers_template<>; } // namespace fast_float diff --git a/contrib/restricted/fast_float/include/fast_float/float_common.h b/contrib/restricted/fast_float/include/fast_float/float_common.h index 909765450de..82ab7b0c6b4 100644 --- a/contrib/restricted/fast_float/include/fast_float/float_common.h +++ b/contrib/restricted/fast_float/include/fast_float/float_common.h @@ -343,7 +343,8 @@ full_multiplication(uint64_t a, uint64_t b) { // But MinGW on ARM64 doesn't have native support for 64-bit multiplications answer.high = __umulh(a, b); answer.low = a * b; -#elif defined(FASTFLOAT_32BIT) || (defined(_WIN64) && !defined(__clang__)) +#elif defined(FASTFLOAT_32BIT) || \ + (defined(_WIN64) && !defined(__clang__) && !defined(_M_ARM64)) answer.low = _umul128(a, b, &answer.high); // _umul128 not available on ARM64 #elif defined(FASTFLOAT_64BIT) && defined(__SIZEOF_INT128__) __uint128_t r = ((__uint128_t)a) * b; @@ -442,12 +443,16 @@ template <typename U> struct binary_format_lookup_tables<double, U> { constant_55555 * 5 * 5 * 5 * 5)}; }; +#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE + template <typename U> constexpr double binary_format_lookup_tables<double, U>::powers_of_ten[]; template <typename U> constexpr uint64_t binary_format_lookup_tables<double, U>::max_mantissa[]; +#endif + template <typename U> struct binary_format_lookup_tables<float, U> { static constexpr float powers_of_ten[] = {1e0f, 1e1f, 1e2f, 1e3f, 1e4f, 1e5f, 1e6f, 1e7f, 1e8f, 1e9f, 1e10f}; @@ -469,12 +474,16 @@ template <typename U> struct binary_format_lookup_tables<float, U> { 0x1000000 / (constant_55555 * constant_55555 * 5)}; }; +#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE + template <typename U> constexpr float binary_format_lookup_tables<float, U>::powers_of_ten[]; template <typename U> constexpr uint64_t binary_format_lookup_tables<float, U>::max_mantissa[]; +#endif + template <> inline constexpr int binary_format<double>::min_exponent_fast_path() { #if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0) @@ -677,8 +686,12 @@ template <typename = void> struct space_lut { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; }; +#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE + template <typename T> constexpr bool space_lut<T>::value[]; +#endif + inline constexpr bool is_space(uint8_t c) { return space_lut<>::value[c]; } #endif @@ -759,12 +772,16 @@ template <typename = void> struct int_luts { 3379220508056640625, 4738381338321616896}; }; +#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE + template <typename T> constexpr uint8_t int_luts<T>::chdigit[]; template <typename T> constexpr size_t int_luts<T>::maxdigits_u64[]; template <typename T> constexpr uint64_t int_luts<T>::min_safe_u64[]; +#endif + template <typename UC> fastfloat_really_inline constexpr uint8_t ch_to_digit(UC c) { return int_luts<>::chdigit[static_cast<unsigned char>(c)]; diff --git a/contrib/restricted/fast_float/ya.make b/contrib/restricted/fast_float/ya.make index 2149e7dfee6..92f9329ca01 100644 --- a/contrib/restricted/fast_float/ya.make +++ b/contrib/restricted/fast_float/ya.make @@ -10,9 +10,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(6.1.4) +VERSION(6.1.5) -ORIGINAL_SOURCE(https://github.com/fastfloat/fast_float/archive/v6.1.4.tar.gz) +ORIGINAL_SOURCE(https://github.com/fastfloat/fast_float/archive/v6.1.5.tar.gz) NO_COMPILER_WARNINGS() |
