aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Include
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-05-06 12:56:16 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-05-06 12:56:16 +0000
commitf92674dbdb92b9e717f952166ffa8307beec4251 (patch)
tree90180e24c75a6be69d35b81d2ec58395a8380c78 /contrib/tools/python3/Include
parentda52d326c570ca0b3284ba4bb5f1a380360afaf5 (diff)
parent86fa90c3f199cb8af7bb07188a11da49f5e8e984 (diff)
downloadydb-f92674dbdb92b9e717f952166ffa8307beec4251.tar.gz
Merge branch 'rightlib' into mergelibs-240506-1255
Diffstat (limited to 'contrib/tools/python3/Include')
-rw-r--r--contrib/tools/python3/Include/Python.h6
-rw-r--r--contrib/tools/python3/Include/cpython/code.h2
-rw-r--r--contrib/tools/python3/Include/cpython/longintrepr.h3
-rw-r--r--contrib/tools/python3/Include/cpython/pystate.h20
-rw-r--r--contrib/tools/python3/Include/internal/pycore_instruments.h2
-rw-r--r--contrib/tools/python3/Include/internal/pycore_symtable.h24
-rw-r--r--contrib/tools/python3/Include/longobject.h19
-rw-r--r--contrib/tools/python3/Include/object.h3
-rw-r--r--contrib/tools/python3/Include/patchlevel.h4
-rw-r--r--contrib/tools/python3/Include/pyexpat.h4
-rw-r--r--contrib/tools/python3/Include/pyport.h5
11 files changed, 64 insertions, 28 deletions
diff --git a/contrib/tools/python3/Include/Python.h b/contrib/tools/python3/Include/Python.h
index 52a7aac6ba..5eddda6336 100644
--- a/contrib/tools/python3/Include/Python.h
+++ b/contrib/tools/python3/Include/Python.h
@@ -49,6 +49,9 @@
#include "bytearrayobject.h"
#include "bytesobject.h"
#include "unicodeobject.h"
+#include "cpython/initconfig.h"
+#include "pystate.h"
+#include "pyerrors.h"
#include "longobject.h"
#include "cpython/longintrepr.h"
#include "boolobject.h"
@@ -74,8 +77,6 @@
#include "sliceobject.h"
#include "cpython/cellobject.h"
#include "iterobject.h"
-#include "cpython/initconfig.h"
-#include "pystate.h"
#include "cpython/genobject.h"
#include "descrobject.h"
#include "genericaliasobject.h"
@@ -85,7 +86,6 @@
#include "cpython/picklebufobject.h"
#include "cpython/pytime.h"
#include "codecs.h"
-#include "pyerrors.h"
#include "pythread.h"
#include "cpython/context.h"
#include "modsupport.h"
diff --git a/contrib/tools/python3/Include/cpython/code.h b/contrib/tools/python3/Include/cpython/code.h
index 03834b20c3..311cffec11 100644
--- a/contrib/tools/python3/Include/cpython/code.h
+++ b/contrib/tools/python3/Include/cpython/code.h
@@ -75,7 +75,7 @@ typedef struct {
PyObject *_co_freevars;
} _PyCoCached;
-/* Ancilliary data structure used for instrumentation.
+/* Ancillary data structure used for instrumentation.
Line instrumentation creates an array of
these. One entry per code unit.*/
typedef struct {
diff --git a/contrib/tools/python3/Include/cpython/longintrepr.h b/contrib/tools/python3/Include/cpython/longintrepr.h
index 692c69ba76..78ac79a7cb 100644
--- a/contrib/tools/python3/Include/cpython/longintrepr.h
+++ b/contrib/tools/python3/Include/cpython/longintrepr.h
@@ -116,9 +116,10 @@ _PyLong_IsCompact(const PyLongObject* op) {
static inline Py_ssize_t
_PyLong_CompactValue(const PyLongObject *op)
{
+ Py_ssize_t sign;
assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS));
assert(PyUnstable_Long_IsCompact(op));
- Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
+ sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
return sign * (Py_ssize_t)op->long_value.ob_digit[0];
}
diff --git a/contrib/tools/python3/Include/cpython/pystate.h b/contrib/tools/python3/Include/cpython/pystate.h
index 628f2e0996..32789e17bd 100644
--- a/contrib/tools/python3/Include/cpython/pystate.h
+++ b/contrib/tools/python3/Include/cpython/pystate.h
@@ -251,13 +251,25 @@ struct _ts {
/* WASI has limited call stack. Python's recursion limit depends on code
layout, optimization, and WASI runtime. Wasmtime can handle about 700
recursions, sometimes less. 500 is a more conservative limit. */
-#ifndef C_RECURSION_LIMIT
-# ifdef __wasi__
-# define C_RECURSION_LIMIT 500
+#ifdef Py_DEBUG
+# if defined(__wasi__)
+# define C_RECURSION_LIMIT 150
# else
- // This value is duplicated in Lib/test/support/__init__.py
# define C_RECURSION_LIMIT 1500
# endif
+#else
+# if defined(__wasi__)
+# define C_RECURSION_LIMIT 500
+# elif defined(__s390x__)
+# define C_RECURSION_LIMIT 800
+# elif defined(_WIN32)
+# define C_RECURSION_LIMIT 3000
+# elif defined(_Py_ADDRESS_SANITIZER)
+# define C_RECURSION_LIMIT 4000
+# else
+ // This value is duplicated in Lib/test/support/__init__.py
+# define C_RECURSION_LIMIT 10000
+# endif
#endif
/* other API */
diff --git a/contrib/tools/python3/Include/internal/pycore_instruments.h b/contrib/tools/python3/Include/internal/pycore_instruments.h
index 87f70d2dc0..b8591563d7 100644
--- a/contrib/tools/python3/Include/internal/pycore_instruments.h
+++ b/contrib/tools/python3/Include/internal/pycore_instruments.h
@@ -40,7 +40,7 @@ extern "C" {
#define PY_MONITORING_EVENT_RERAISE 14
-/* Ancilliary events */
+/* Ancillary events */
#define PY_MONITORING_EVENT_C_RETURN 15
#define PY_MONITORING_EVENT_C_RAISE 16
diff --git a/contrib/tools/python3/Include/internal/pycore_symtable.h b/contrib/tools/python3/Include/internal/pycore_symtable.h
index c8e0578a23..b2fef17720 100644
--- a/contrib/tools/python3/Include/internal/pycore_symtable.h
+++ b/contrib/tools/python3/Include/internal/pycore_symtable.h
@@ -109,18 +109,18 @@ extern PyObject* _Py_Mangle(PyObject *p, PyObject *name);
/* Flags for def-use information */
-#define DEF_GLOBAL 1 /* global stmt */
-#define DEF_LOCAL 2 /* assignment in code block */
-#define DEF_PARAM 2<<1 /* formal parameter */
-#define DEF_NONLOCAL 2<<2 /* nonlocal stmt */
-#define USE 2<<3 /* name is used */
-#define DEF_FREE 2<<4 /* name used but not defined in nested block */
-#define DEF_FREE_CLASS 2<<5 /* free variable from class's method */
-#define DEF_IMPORT 2<<6 /* assignment occurred via import */
-#define DEF_ANNOT 2<<7 /* this name is annotated */
-#define DEF_COMP_ITER 2<<8 /* this name is a comprehension iteration variable */
-#define DEF_TYPE_PARAM 2<<9 /* this name is a type parameter */
-#define DEF_COMP_CELL 2<<10 /* this name is a cell in an inlined comprehension */
+#define DEF_GLOBAL 1 /* global stmt */
+#define DEF_LOCAL 2 /* assignment in code block */
+#define DEF_PARAM (2<<1) /* formal parameter */
+#define DEF_NONLOCAL (2<<2) /* nonlocal stmt */
+#define USE (2<<3) /* name is used */
+#define DEF_FREE (2<<4) /* name used but not defined in nested block */
+#define DEF_FREE_CLASS (2<<5) /* free variable from class's method */
+#define DEF_IMPORT (2<<6) /* assignment occurred via import */
+#define DEF_ANNOT (2<<7) /* this name is annotated */
+#define DEF_COMP_ITER (2<<8) /* this name is a comprehension iteration variable */
+#define DEF_TYPE_PARAM (2<<9) /* this name is a type parameter */
+#define DEF_COMP_CELL (2<<10) /* this name is a cell in an inlined comprehension */
#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT)
diff --git a/contrib/tools/python3/Include/longobject.h b/contrib/tools/python3/Include/longobject.h
index e090dd024a..c8b7497353 100644
--- a/contrib/tools/python3/Include/longobject.h
+++ b/contrib/tools/python3/Include/longobject.h
@@ -34,7 +34,24 @@ PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT
#define _Py_PARSE_PID "i"
#define PyLong_FromPid PyLong_FromLong
-#define PyLong_AsPid PyLong_AsLong
+# ifndef Py_LIMITED_API
+# define PyLong_AsPid _PyLong_AsInt
+# elif SIZEOF_INT == SIZEOF_LONG
+# define PyLong_AsPid PyLong_AsLong
+# else
+static inline int
+PyLong_AsPid(PyObject *obj)
+{
+ int overflow;
+ long result = PyLong_AsLongAndOverflow(obj, &overflow);
+ if (overflow || result > INT_MAX || result < INT_MIN) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Python int too large to convert to C int");
+ return -1;
+ }
+ return (int)result;
+}
+# endif
#elif SIZEOF_PID_T == SIZEOF_LONG
#define _Py_PARSE_PID "l"
#define PyLong_FromPid PyLong_FromLong
diff --git a/contrib/tools/python3/Include/object.h b/contrib/tools/python3/Include/object.h
index 5c30c77bc2..0d94cf8255 100644
--- a/contrib/tools/python3/Include/object.h
+++ b/contrib/tools/python3/Include/object.h
@@ -230,8 +230,7 @@ PyAPI_DATA(PyTypeObject) PyBool_Type;
static inline Py_ssize_t Py_SIZE(PyObject *ob) {
assert(ob->ob_type != &PyLong_Type);
assert(ob->ob_type != &PyBool_Type);
- PyVarObject *var_ob = _PyVarObject_CAST(ob);
- return var_ob->ob_size;
+ return _PyVarObject_CAST(ob)->ob_size;
}
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
# define Py_SIZE(ob) Py_SIZE(_PyObject_CAST(ob))
diff --git a/contrib/tools/python3/Include/patchlevel.h b/contrib/tools/python3/Include/patchlevel.h
index e7316df367..24e6579dbb 100644
--- a/contrib/tools/python3/Include/patchlevel.h
+++ b/contrib/tools/python3/Include/patchlevel.h
@@ -18,12 +18,12 @@
/*--start constants--*/
#define PY_MAJOR_VERSION 3
#define PY_MINOR_VERSION 12
-#define PY_MICRO_VERSION 2
+#define PY_MICRO_VERSION 3
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL 0
/* Version as a string */
-#define PY_VERSION "3.12.2"
+#define PY_VERSION "3.12.3"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/contrib/tools/python3/Include/pyexpat.h b/contrib/tools/python3/Include/pyexpat.h
index 07020b5dc9..9824d099c3 100644
--- a/contrib/tools/python3/Include/pyexpat.h
+++ b/contrib/tools/python3/Include/pyexpat.h
@@ -48,8 +48,10 @@ struct PyExpat_CAPI
enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding);
int (*DefaultUnknownEncodingHandler)(
void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
- /* might be none for expat < 2.1.0 */
+ /* might be NULL for expat < 2.1.0 */
int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
+ /* might be NULL for expat < 2.6.0 */
+ XML_Bool (*SetReparseDeferralEnabled)(XML_Parser parser, XML_Bool enabled);
/* always add new stuff to the end! */
};
diff --git a/contrib/tools/python3/Include/pyport.h b/contrib/tools/python3/Include/pyport.h
index 35eca7234c..30b9c8ebc4 100644
--- a/contrib/tools/python3/Include/pyport.h
+++ b/contrib/tools/python3/Include/pyport.h
@@ -748,6 +748,11 @@ extern char * _getpty(int *, int, mode_t, int);
# define _Py_ADDRESS_SANITIZER
# endif
# endif
+# if __has_feature(thread_sanitizer)
+# if !defined(_Py_THREAD_SANITIZER)
+# define _Py_THREAD_SANITIZER
+# endif
+# endif
#elif defined(__GNUC__)
# if defined(__SANITIZE_ADDRESS__)
# define _Py_ADDRESS_SANITIZER