summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Include/cpython
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-04-18 12:39:32 +0300
committershadchin <[email protected]>2022-04-18 12:39:32 +0300
commitd4be68e361f4258cf0848fc70018dfe37a2acc24 (patch)
tree153e294cd97ac8b5d7a989612704a0c1f58e8ad4 /contrib/tools/python3/src/Include/cpython
parent260c02f5ccf242d9d9b8a873afaf6588c00237d6 (diff)
IGNIETFERRO-1816 Update Python 3 from 3.9.12 to 3.10.4
ref:9f96be6d02ee8044fdd6f124b799b270c20ce641
Diffstat (limited to 'contrib/tools/python3/src/Include/cpython')
-rw-r--r--contrib/tools/python3/src/Include/cpython/abstract.h23
-rw-r--r--contrib/tools/python3/src/Include/cpython/bytesobject.h2
-rw-r--r--contrib/tools/python3/src/Include/cpython/ceval.h8
-rw-r--r--contrib/tools/python3/src/Include/cpython/code.h33
-rw-r--r--contrib/tools/python3/src/Include/cpython/compile.h54
-rw-r--r--contrib/tools/python3/src/Include/cpython/dictobject.h14
-rw-r--r--contrib/tools/python3/src/Include/cpython/fileobject.h8
-rw-r--r--contrib/tools/python3/src/Include/cpython/fileutils.h17
-rw-r--r--contrib/tools/python3/src/Include/cpython/frameobject.h50
-rw-r--r--contrib/tools/python3/src/Include/cpython/import.h11
-rw-r--r--contrib/tools/python3/src/Include/cpython/initconfig.h287
-rw-r--r--contrib/tools/python3/src/Include/cpython/interpreteridobject.h8
-rw-r--r--contrib/tools/python3/src/Include/cpython/listobject.h13
-rw-r--r--contrib/tools/python3/src/Include/cpython/object.h34
-rw-r--r--contrib/tools/python3/src/Include/cpython/objimpl.h51
-rw-r--r--contrib/tools/python3/src/Include/cpython/odictobject.h43
-rw-r--r--contrib/tools/python3/src/Include/cpython/picklebufobject.h31
-rw-r--r--contrib/tools/python3/src/Include/cpython/pyctype.h39
-rw-r--r--contrib/tools/python3/src/Include/cpython/pydebug.h38
-rw-r--r--contrib/tools/python3/src/Include/cpython/pyerrors.h38
-rw-r--r--contrib/tools/python3/src/Include/cpython/pyfpe.h15
-rw-r--r--contrib/tools/python3/src/Include/cpython/pylifecycle.h16
-rw-r--r--contrib/tools/python3/src/Include/cpython/pymem.h10
-rw-r--r--contrib/tools/python3/src/Include/cpython/pystate.h72
-rw-r--r--contrib/tools/python3/src/Include/cpython/pythonrun.h121
-rw-r--r--contrib/tools/python3/src/Include/cpython/pytime.h249
-rw-r--r--contrib/tools/python3/src/Include/cpython/sysmodule.h8
-rw-r--r--contrib/tools/python3/src/Include/cpython/traceback.h8
-rw-r--r--contrib/tools/python3/src/Include/cpython/tupleobject.h10
-rw-r--r--contrib/tools/python3/src/Include/cpython/unicodeobject.h86
30 files changed, 827 insertions, 570 deletions
diff --git a/contrib/tools/python3/src/Include/cpython/abstract.h b/contrib/tools/python3/src/Include/cpython/abstract.h
index 0f1304d26af..db850219645 100644
--- a/contrib/tools/python3/src/Include/cpython/abstract.h
+++ b/contrib/tools/python3/src/Include/cpython/abstract.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* === Object Protocol ================================================== */
#ifdef PY_SSIZE_T_CLEAN
@@ -123,7 +119,7 @@ static inline PyObject *
PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{
- PyThreadState *tstate = PyThreadState_GET();
+ PyThreadState *tstate = PyThreadState_Get();
return _PyObject_VectorcallTstate(tstate, callable,
args, nargsf, kwnames);
}
@@ -159,7 +155,7 @@ _PyObject_FastCallTstate(PyThreadState *tstate, PyObject *func, PyObject *const
static inline PyObject *
_PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
{
- PyThreadState *tstate = PyThreadState_GET();
+ PyThreadState *tstate = PyThreadState_Get();
return _PyObject_FastCallTstate(tstate, func, args, nargs);
}
@@ -168,7 +164,7 @@ _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
PyObject_CallNoArgs(). */
static inline PyObject *
_PyObject_CallNoArg(PyObject *func) {
- PyThreadState *tstate = PyThreadState_GET();
+ PyThreadState *tstate = PyThreadState_Get();
return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
}
@@ -183,7 +179,7 @@ PyObject_CallOneArg(PyObject *func, PyObject *arg)
assert(arg != NULL);
args = _args + 1; // For PY_VECTORCALL_ARGUMENTS_OFFSET
args[0] = arg;
- tstate = PyThreadState_GET();
+ tstate = PyThreadState_Get();
nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET;
return _PyObject_VectorcallTstate(tstate, func, args, nargsf, NULL);
}
@@ -329,12 +325,6 @@ PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf,
/* Releases a Py_buffer obtained from getbuffer ParseTuple's "s*". */
PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
-/* ==== Iterators ================================================ */
-
-#define PyIter_Check(obj) \
- (Py_TYPE(obj)->tp_iternext != NULL && \
- Py_TYPE(obj)->tp_iternext != &_PyObject_NextNotImplemented)
-
/* === Sequence protocol ================================================ */
/* Assume tp_as_sequence and sq_item exist and that 'i' does not
@@ -379,6 +369,5 @@ PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
/* Convert Python int to Py_ssize_t. Do nothing if the argument is None. */
PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *);
-#ifdef __cplusplus
-}
-#endif
+/* Same as PyNumber_Index but can return an instance of a subclass of int. */
+PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o);
diff --git a/contrib/tools/python3/src/Include/cpython/bytesobject.h b/contrib/tools/python3/src/Include/cpython/bytesobject.h
index f284c5835df..6b3f55224fc 100644
--- a/contrib/tools/python3/src/Include/cpython/bytesobject.h
+++ b/contrib/tools/python3/src/Include/cpython/bytesobject.h
@@ -10,7 +10,7 @@ typedef struct {
/* Invariants:
* ob_sval contains space for 'ob_size+1' elements.
* ob_sval[ob_size] == 0.
- * ob_shash is the hash of the string or -1 if not computed yet.
+ * ob_shash is the hash of the byte string or -1 if not computed yet.
*/
} PyBytesObject;
diff --git a/contrib/tools/python3/src/Include/cpython/ceval.h b/contrib/tools/python3/src/Include/cpython/ceval.h
index e1922a677bd..06338928f67 100644
--- a/contrib/tools/python3/src/Include/cpython/ceval.h
+++ b/contrib/tools/python3/src/Include/cpython/ceval.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
@@ -32,7 +28,3 @@ PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc);
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/code.h b/contrib/tools/python3/src/Include/cpython/code.h
index cda28ac6ee9..fa6408521cf 100644
--- a/contrib/tools/python3/src/Include/cpython/code.h
+++ b/contrib/tools/python3/src/Include/cpython/code.h
@@ -38,7 +38,7 @@ struct PyCodeObject {
Py_ssize_t *co_cell2arg; /* Maps cell vars which are arguments. */
PyObject *co_filename; /* unicode (where it was loaded from) */
PyObject *co_name; /* unicode (name, for reference) */
- PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See
+ PyObject *co_linetable; /* string (encoding addr<->lineno mapping) See
Objects/lnotab_notes.txt for details. */
void *co_zombieframe; /* for optimization only (see frameobject.c) */
PyObject *co_weakreflist; /* to support weakrefs to code objects */
@@ -135,16 +135,23 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
/* for internal use only */
-typedef struct _addr_pair {
- int ap_lower;
- int ap_upper;
-} PyAddrPair;
+struct _opaque {
+ int computed_line;
+ const char *lo_next;
+ const char *limit;
+};
+
+typedef struct _line_offsets {
+ int ar_start;
+ int ar_end;
+ int ar_line;
+ struct _opaque opaque;
+} PyCodeAddressRange;
/* Update *bounds to describe the first and one-past-the-last instructions in the
same line as lasti. Return the number of that line.
*/
-PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
- int lasti, PyAddrPair *bounds);
+PyAPI_FUNC(int) _PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds);
/* Create a comparable key used to compare constants taking in account the
* object type. It is used to make sure types are not coerced (e.g., float and
@@ -163,3 +170,15 @@ PyAPI_FUNC(int) _PyCode_GetExtra(PyObject *code, Py_ssize_t index,
void **extra);
PyAPI_FUNC(int) _PyCode_SetExtra(PyObject *code, Py_ssize_t index,
void *extra);
+
+/** API for initializing the line number table. */
+int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
+
+/** Out of process API for initializing the line number table. */
+void PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range);
+
+/** API for traversing the line number table. */
+int PyLineTable_NextAddressRange(PyCodeAddressRange *range);
+int PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
+
+
diff --git a/contrib/tools/python3/src/Include/cpython/compile.h b/contrib/tools/python3/src/Include/cpython/compile.h
new file mode 100644
index 00000000000..518a3764992
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/compile.h
@@ -0,0 +1,54 @@
+#ifndef Py_CPYTHON_COMPILE_H
+# error "this header file must not be included directly"
+#endif
+
+/* Public interface */
+#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
+ CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
+ CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
+ CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
+#define PyCF_MASK_OBSOLETE (CO_NESTED)
+
+/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique.
+ PyCF_ constants can use bits from 0x0100 to 0x10000.
+ CO_FUTURE_ constants use bits starting at 0x20000. */
+#define PyCF_SOURCE_IS_UTF8 0x0100
+#define PyCF_DONT_IMPLY_DEDENT 0x0200
+#define PyCF_ONLY_AST 0x0400
+#define PyCF_IGNORE_COOKIE 0x0800
+#define PyCF_TYPE_COMMENTS 0x1000
+#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
+#define PyCF_ALLOW_INCOMPLETE_INPUT 0x4000
+#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
+ PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT | \
+ PyCF_ALLOW_INCOMPLETE_INPUT)
+
+typedef struct {
+ int cf_flags; /* bitmask of CO_xxx flags relevant to future */
+ int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */
+} PyCompilerFlags;
+
+#define _PyCompilerFlags_INIT \
+ (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
+
+/* Future feature support */
+
+typedef struct {
+ int ff_features; /* flags set by future statements */
+ int ff_lineno; /* line number of last future statement */
+} PyFutureFeatures;
+
+#define FUTURE_NESTED_SCOPES "nested_scopes"
+#define FUTURE_GENERATORS "generators"
+#define FUTURE_DIVISION "division"
+#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
+#define FUTURE_WITH_STATEMENT "with_statement"
+#define FUTURE_PRINT_FUNCTION "print_function"
+#define FUTURE_UNICODE_LITERALS "unicode_literals"
+#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
+#define FUTURE_GENERATOR_STOP "generator_stop"
+#define FUTURE_ANNOTATIONS "annotations"
+
+#define PY_INVALID_STACK_EFFECT INT_MAX
+PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
+PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
diff --git a/contrib/tools/python3/src/Include/cpython/dictobject.h b/contrib/tools/python3/src/Include/cpython/dictobject.h
index 50f4c4a9e55..641d7bdc48e 100644
--- a/contrib/tools/python3/src/Include/cpython/dictobject.h
+++ b/contrib/tools/python3/src/Include/cpython/dictobject.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct _dictkeysobject PyDictKeysObject;
/* The ma_values pointer is NULL for a combined table
@@ -45,13 +41,13 @@ PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key,
PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key,
int (*predicate)(PyObject *value));
PyDictKeysObject *_PyDict_NewKeysForClass(void);
-PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
PyAPI_FUNC(int) _PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
/* Get the number of items of a dictionary. */
#define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used)
-PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
+PyAPI_FUNC(int) _PyDict_Contains_KnownHash(PyObject *, PyObject *, Py_hash_t);
+PyAPI_FUNC(int) _PyDict_ContainsId(PyObject *, struct _Py_Identifier *);
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
@@ -68,7 +64,6 @@ PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
argument is raised.
*/
PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override);
-PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key);
PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item);
PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
@@ -76,6 +71,7 @@ PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
+Py_ssize_t _PyDict_GetItemHint(PyDictObject *, PyObject *, Py_ssize_t, PyObject **);
/* _PyDictView */
@@ -86,7 +82,3 @@ typedef struct {
PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *);
PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/fileobject.h b/contrib/tools/python3/src/Include/cpython/fileobject.h
index 3005ce1f00f..cff2243d625 100644
--- a/contrib/tools/python3/src/Include/cpython/fileobject.h
+++ b/contrib/tools/python3/src/Include/cpython/fileobject.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
/* The std printer acts as a preliminary sys.stderr until the new io
@@ -19,6 +15,4 @@ PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path);
PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path);
PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData);
-#ifdef __cplusplus
-}
-#endif
+PyAPI_FUNC(int) _PyLong_FileDescriptor_Converter(PyObject *, void *);
diff --git a/contrib/tools/python3/src/Include/cpython/fileutils.h b/contrib/tools/python3/src/Include/cpython/fileutils.h
index e79d03e24f5..ccf37e9468d 100644
--- a/contrib/tools/python3/src/Include/cpython/fileutils.h
+++ b/contrib/tools/python3/src/Include/cpython/fileutils.h
@@ -32,6 +32,9 @@ PyAPI_FUNC(int) _Py_EncodeLocaleEx(
int current_locale,
_Py_error_handler errors);
+PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
+ const wchar_t *text,
+ size_t *error_pos);
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
@@ -95,10 +98,6 @@ PyAPI_FUNC(FILE *) _Py_wfopen(
const wchar_t *path,
const wchar_t *mode);
-PyAPI_FUNC(FILE*) _Py_fopen(
- const char *pathname,
- const char *mode);
-
PyAPI_FUNC(FILE*) _Py_fopen_obj(
PyObject *path,
const char *mode);
@@ -162,4 +161,12 @@ PyAPI_FUNC(int) _Py_dup(int fd);
PyAPI_FUNC(int) _Py_get_blocking(int fd);
PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
-#endif /* !MS_WINDOWS */
+#else /* MS_WINDOWS */
+PyAPI_FUNC(void*) _Py_get_osfhandle_noraise(int fd);
+
+PyAPI_FUNC(void*) _Py_get_osfhandle(int fd);
+
+PyAPI_FUNC(int) _Py_open_osfhandle_noraise(void *handle, int flags);
+
+PyAPI_FUNC(int) _Py_open_osfhandle(void *handle, int flags);
+#endif /* MS_WINDOWS */
diff --git a/contrib/tools/python3/src/Include/cpython/frameobject.h b/contrib/tools/python3/src/Include/cpython/frameobject.h
index 36a51baae87..5122ec41a3d 100644
--- a/contrib/tools/python3/src/Include/cpython/frameobject.h
+++ b/contrib/tools/python3/src/Include/cpython/frameobject.h
@@ -4,9 +4,20 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* These values are chosen so that the inline functions below all
+ * compare f_state to zero.
+ */
+enum _framestate {
+ FRAME_CREATED = -2,
+ FRAME_SUSPENDED = -1,
+ FRAME_EXECUTING = 0,
+ FRAME_RETURNED = 1,
+ FRAME_UNWINDING = 2,
+ FRAME_RAISED = 3,
+ FRAME_CLEARED = 4
+};
+
+typedef signed char PyFrameState;
typedef struct {
int b_type; /* what kind of block this is */
@@ -22,11 +33,8 @@ struct _frame {
PyObject *f_globals; /* global symbol table (PyDictObject) */
PyObject *f_locals; /* local symbol table (any mapping) */
PyObject **f_valuestack; /* points after the last local */
- /* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
- Frame evaluation usually NULLs it, but a frame that yields sets it
- to the current stack top. */
- PyObject **f_stacktop;
PyObject *f_trace; /* Trace function */
+ int f_stackdepth; /* Depth of value stack */
char f_trace_lines; /* Emit per-line trace events? */
char f_trace_opcodes; /* Emit per-opcode trace events? */
@@ -34,18 +42,24 @@ struct _frame {
PyObject *f_gen;
int f_lasti; /* Last instruction if called */
- /* Call PyFrame_GetLineNumber() instead of reading this field
- directly. As of 2.3 f_lineno is only valid when tracing is
- active (i.e. when f_trace is set). At other times we use
- PyCode_Addr2Line to calculate the line from the current
- bytecode index. */
- int f_lineno; /* Current line number */
+ int f_lineno; /* Current line number. Only valid if non-zero */
int f_iblock; /* index in f_blockstack */
- char f_executing; /* whether the frame is still executing */
+ PyFrameState f_state; /* What state the frame is in */
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
};
+static inline int _PyFrame_IsRunnable(struct _frame *f) {
+ return f->f_state < FRAME_EXECUTING;
+}
+
+static inline int _PyFrame_IsExecuting(struct _frame *f) {
+ return f->f_state == FRAME_EXECUTING;
+}
+
+static inline int _PyFrameHasCompleted(struct _frame *f) {
+ return f->f_state > FRAME_EXECUTING;
+}
/* Standard object interface */
@@ -57,8 +71,8 @@ PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
PyObject *, PyObject *);
/* only internal use */
-PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *,
- PyObject *, PyObject *);
+PyFrameObject*
+_PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *);
/* The rest of the interface is specific for frame objects */
@@ -78,7 +92,3 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/import.h b/contrib/tools/python3/src/Include/cpython/import.h
index c1b47121f12..dd5bbdbad78 100644
--- a/contrib/tools/python3/src/Include/cpython/import.h
+++ b/contrib/tools/python3/src/Include/cpython/import.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
PyMODINIT_FUNC PyInit__imp(void);
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
@@ -17,7 +13,8 @@ PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module);
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
-PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
+/* Obsolete since 3.5, will be removed in 3.11. */
+Py_DEPRECATED(3.10) PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
PyObject *mod,
@@ -44,7 +41,3 @@ struct _frozen {
collection of frozen modules: */
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/initconfig.h b/contrib/tools/python3/src/Include/cpython/initconfig.h
index 0a256d4b5b0..583165bee48 100644
--- a/contrib/tools/python3/src/Include/cpython/initconfig.h
+++ b/contrib/tools/python3/src/Include/cpython/initconfig.h
@@ -44,7 +44,7 @@ PyAPI_FUNC(PyStatus) PyWideStringList_Insert(PyWideStringList *list,
/* --- PyPreConfig ----------------------------------------------- */
-typedef struct {
+typedef struct PyPreConfig {
int _config_init; /* _PyConfigInitEnum value */
/* Parse Py_PreInitializeFromBytesArgs() arguments?
@@ -130,298 +130,85 @@ PyAPI_FUNC(void) PyPreConfig_InitIsolatedConfig(PyPreConfig *config);
/* --- PyConfig ---------------------------------------------- */
-typedef struct {
+/* This structure is best documented in the Doc/c-api/init_config.rst file. */
+typedef struct PyConfig {
int _config_init; /* _PyConfigInitEnum value */
- int isolated; /* Isolated mode? see PyPreConfig.isolated */
- int use_environment; /* Use environment variables? see PyPreConfig.use_environment */
- int dev_mode; /* Python Development Mode? See PyPreConfig.dev_mode */
-
- /* Install signal handlers? Yes by default. */
+ int isolated;
+ int use_environment;
+ int dev_mode;
int install_signal_handlers;
-
- int use_hash_seed; /* PYTHONHASHSEED=x */
+ int use_hash_seed;
unsigned long hash_seed;
-
- /* Enable faulthandler?
- Set to 1 by -X faulthandler and PYTHONFAULTHANDLER. -1 means unset. */
int faulthandler;
-
- /* Enable PEG parser?
- 1 by default, set to 0 by -X oldparser and PYTHONOLDPARSER */
- int _use_peg_parser;
-
- /* Enable tracemalloc?
- Set by -X tracemalloc=N and PYTHONTRACEMALLOC. -1 means unset */
int tracemalloc;
-
- int import_time; /* PYTHONPROFILEIMPORTTIME, -X importtime */
- int show_ref_count; /* -X showrefcount */
- int dump_refs; /* PYTHONDUMPREFS */
- int malloc_stats; /* PYTHONMALLOCSTATS */
-
- /* Python filesystem encoding and error handler:
- sys.getfilesystemencoding() and sys.getfilesystemencodeerrors().
-
- Default encoding and error handler:
-
- * if Py_SetStandardStreamEncoding() has been called: they have the
- highest priority;
- * PYTHONIOENCODING environment variable;
- * The UTF-8 Mode uses UTF-8/surrogateescape;
- * If Python forces the usage of the ASCII encoding (ex: C locale
- or POSIX locale on FreeBSD or HP-UX), use ASCII/surrogateescape;
- * locale encoding: ANSI code page on Windows, UTF-8 on Android and
- VxWorks, LC_CTYPE locale encoding on other platforms;
- * On Windows, "surrogateescape" error handler;
- * "surrogateescape" error handler if the LC_CTYPE locale is "C" or "POSIX";
- * "surrogateescape" error handler if the LC_CTYPE locale has been coerced
- (PEP 538);
- * "strict" error handler.
-
- Supported error handlers: "strict", "surrogateescape" and
- "surrogatepass". The surrogatepass error handler is only supported
- if Py_DecodeLocale() and Py_EncodeLocale() use directly the UTF-8 codec;
- it's only used on Windows.
-
- initfsencoding() updates the encoding to the Python codec name.
- For example, "ANSI_X3.4-1968" is replaced with "ascii".
-
- On Windows, sys._enablelegacywindowsfsencoding() sets the
- encoding/errors to mbcs/replace at runtime.
-
-
- See Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors.
- */
+ int import_time;
+ int show_ref_count;
+ int dump_refs;
+ int malloc_stats;
wchar_t *filesystem_encoding;
wchar_t *filesystem_errors;
-
- wchar_t *pycache_prefix; /* PYTHONPYCACHEPREFIX, -X pycache_prefix=PATH */
- int parse_argv; /* Parse argv command line arguments? */
-
- /* Command line arguments (sys.argv).
-
- Set parse_argv to 1 to parse argv as Python command line arguments
- and then strip Python arguments from argv.
-
- If argv is empty, an empty string is added to ensure that sys.argv
- always exists and is never empty. */
+ wchar_t *pycache_prefix;
+ int parse_argv;
+ PyWideStringList orig_argv;
PyWideStringList argv;
-
- /* Program name:
-
- - If Py_SetProgramName() was called, use its value.
- - On macOS, use PYTHONEXECUTABLE environment variable if set.
- - If WITH_NEXT_FRAMEWORK macro is defined, use __PYVENV_LAUNCHER__
- environment variable is set.
- - Use argv[0] if available and non-empty.
- - Use "python" on Windows, or "python3 on other platforms. */
- wchar_t *program_name;
-
- PyWideStringList xoptions; /* Command line -X options */
-
- /* Warnings options: lowest to highest priority. warnings.filters
- is built in the reverse order (highest to lowest priority). */
+ PyWideStringList xoptions;
PyWideStringList warnoptions;
-
- /* If equal to zero, disable the import of the module site and the
- site-dependent manipulations of sys.path that it entails. Also disable
- these manipulations if site is explicitly imported later (call
- site.main() if you want them to be triggered).
-
- Set to 0 by the -S command line option. If set to -1 (default), it is
- set to !Py_NoSiteFlag. */
int site_import;
-
- /* Bytes warnings:
-
- * If equal to 1, issue a warning when comparing bytes or bytearray with
- str or bytes with int.
- * If equal or greater to 2, issue an error.
-
- Incremented by the -b command line option. If set to -1 (default), inherit
- Py_BytesWarningFlag value. */
int bytes_warning;
-
- /* If greater than 0, enable inspect: when a script is passed as first
- argument or the -c option is used, enter interactive mode after
- executing the script or the command, even when sys.stdin does not appear
- to be a terminal.
-
- Incremented by the -i command line option. Set to 1 if the PYTHONINSPECT
- environment variable is non-empty. If set to -1 (default), inherit
- Py_InspectFlag value. */
+ int warn_default_encoding;
int inspect;
-
- /* If greater than 0: enable the interactive mode (REPL).
-
- Incremented by the -i command line option. If set to -1 (default),
- inherit Py_InteractiveFlag value. */
int interactive;
-
- /* Optimization level.
-
- Incremented by the -O command line option. Set by the PYTHONOPTIMIZE
- environment variable. If set to -1 (default), inherit Py_OptimizeFlag
- value. */
int optimization_level;
-
- /* If greater than 0, enable the debug mode: turn on parser debugging
- output (for expert only, depending on compilation options).
-
- Incremented by the -d command line option. Set by the PYTHONDEBUG
- environment variable. If set to -1 (default), inherit Py_DebugFlag
- value. */
int parser_debug;
-
- /* If equal to 0, Python won't try to write ``.pyc`` files on the
- import of source modules.
-
- Set to 0 by the -B command line option and the PYTHONDONTWRITEBYTECODE
- environment variable. If set to -1 (default), it is set to
- !Py_DontWriteBytecodeFlag. */
int write_bytecode;
-
- /* If greater than 0, enable the verbose mode: print a message each time a
- module is initialized, showing the place (filename or built-in module)
- from which it is loaded.
-
- If greater or equal to 2, print a message for each file that is checked
- for when searching for a module. Also provides information on module
- cleanup at exit.
-
- Incremented by the -v option. Set by the PYTHONVERBOSE environment
- variable. If set to -1 (default), inherit Py_VerboseFlag value. */
int verbose;
-
- /* If greater than 0, enable the quiet mode: Don't display the copyright
- and version messages even in interactive mode.
-
- Incremented by the -q option. If set to -1 (default), inherit
- Py_QuietFlag value. */
int quiet;
-
- /* If greater than 0, don't add the user site-packages directory to
- sys.path.
-
- Set to 0 by the -s and -I command line options , and the PYTHONNOUSERSITE
- environment variable. If set to -1 (default), it is set to
- !Py_NoUserSiteDirectory. */
int user_site_directory;
-
- /* If non-zero, configure C standard steams (stdio, stdout,
- stderr):
-
- - Set O_BINARY mode on Windows.
- - If buffered_stdio is equal to zero, make streams unbuffered.
- Otherwise, enable streams buffering if interactive is non-zero. */
int configure_c_stdio;
-
- /* If equal to 0, enable unbuffered mode: force the stdout and stderr
- streams to be unbuffered.
-
- Set to 0 by the -u option. Set by the PYTHONUNBUFFERED environment
- variable.
- If set to -1 (default), it is set to !Py_UnbufferedStdioFlag. */
int buffered_stdio;
-
- /* Encoding of sys.stdin, sys.stdout and sys.stderr.
- Value set from PYTHONIOENCODING environment variable and
- Py_SetStandardStreamEncoding() function.
- See also 'stdio_errors' attribute. */
wchar_t *stdio_encoding;
-
- /* Error handler of sys.stdin and sys.stdout.
- Value set from PYTHONIOENCODING environment variable and
- Py_SetStandardStreamEncoding() function.
- See also 'stdio_encoding' attribute. */
wchar_t *stdio_errors;
-
#ifdef MS_WINDOWS
- /* If greater than zero, use io.FileIO instead of WindowsConsoleIO for sys
- standard streams.
-
- Set to 1 if the PYTHONLEGACYWINDOWSSTDIO environment variable is set to
- a non-empty string. If set to -1 (default), inherit
- Py_LegacyWindowsStdioFlag value.
-
- See PEP 528 for more details. */
int legacy_windows_stdio;
#endif
-
- /* Value of the --check-hash-based-pycs command line option:
-
- - "default" means the 'check_source' flag in hash-based pycs
- determines invalidation
- - "always" causes the interpreter to hash the source file for
- invalidation regardless of value of 'check_source' bit
- - "never" causes the interpreter to always assume hash-based pycs are
- valid
-
- The default value is "default".
-
- See PEP 552 "Deterministic pycs" for more details. */
wchar_t *check_hash_pycs_mode;
/* --- Path configuration inputs ------------ */
-
- /* If greater than 0, suppress _PyPathConfig_Calculate() warnings on Unix.
- The parameter has no effect on Windows.
-
- If set to -1 (default), inherit !Py_FrozenFlag value. */
int pathconfig_warnings;
-
- wchar_t *pythonpath_env; /* PYTHONPATH environment variable */
- wchar_t *home; /* PYTHONHOME environment variable,
- see also Py_SetPythonHome(). */
+ wchar_t *program_name;
+ wchar_t *pythonpath_env;
+ wchar_t *home;
+ wchar_t *platlibdir;
/* --- Path configuration outputs ----------- */
-
- int module_search_paths_set; /* If non-zero, use module_search_paths */
- PyWideStringList module_search_paths; /* sys.path paths. Computed if
- module_search_paths_set is equal
- to zero. */
-
- wchar_t *executable; /* sys.executable */
- wchar_t *base_executable; /* sys._base_executable */
- wchar_t *prefix; /* sys.prefix */
- wchar_t *base_prefix; /* sys.base_prefix */
- wchar_t *exec_prefix; /* sys.exec_prefix */
- wchar_t *base_exec_prefix; /* sys.base_exec_prefix */
- wchar_t *platlibdir; /* sys.platlibdir */
+ int module_search_paths_set;
+ PyWideStringList module_search_paths;
+ wchar_t *executable;
+ wchar_t *base_executable;
+ wchar_t *prefix;
+ wchar_t *base_prefix;
+ wchar_t *exec_prefix;
+ wchar_t *base_exec_prefix;
/* --- Parameter only used by Py_Main() ---------- */
-
- /* Skip the first line of the source ('run_filename' parameter), allowing use of non-Unix forms of
- "#!cmd". This is intended for a DOS specific hack only.
-
- Set by the -x command line option. */
int skip_source_first_line;
-
- wchar_t *run_command; /* -c command line argument */
- wchar_t *run_module; /* -m command line argument */
- wchar_t *run_filename; /* Trailing command line argument without -c or -m */
+ wchar_t *run_command;
+ wchar_t *run_module;
+ wchar_t *run_filename;
/* --- Private fields ---------------------------- */
- /* Install importlib? If set to 0, importlib is not initialized at all.
- Needed by freeze_importlib. */
+ // Install importlib? If equals to 0, importlib is not initialized at all.
+ // Needed by freeze_importlib.
int _install_importlib;
- /* If equal to 0, stop Python initialization before the "main" phase */
+ // If equal to 0, stop Python initialization before the "main" phase.
int _init_main;
- /* If non-zero, disallow threads, subprocesses, and fork.
- Default: 0. */
+ // If non-zero, disallow threads, subprocesses, and fork.
+ // Default: 0.
int _isolated_interpreter;
-
- /* Original command line arguments. If _orig_argv is empty and _argv is
- not equal to [''], PyConfig_Read() copies the configuration 'argv' list
- into '_orig_argv' list before modifying 'argv' list (if parse_argv
- is non-zero).
-
- _PyConfig_Write() initializes Py_GetArgcArgv() to this list. */
- PyWideStringList _orig_argv;
} PyConfig;
PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config);
@@ -452,7 +239,7 @@ PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
/* Get the original command line arguments, before Python modified them.
- See also PyConfig._orig_argv. */
+ See also PyConfig.orig_argv. */
PyAPI_FUNC(void) Py_GetArgcArgv(int *argc, wchar_t ***argv);
#ifdef __cplusplus
diff --git a/contrib/tools/python3/src/Include/cpython/interpreteridobject.h b/contrib/tools/python3/src/Include/cpython/interpreteridobject.h
index 67ec5873542..5076584209b 100644
--- a/contrib/tools/python3/src/Include/cpython/interpreteridobject.h
+++ b/contrib/tools/python3/src/Include/cpython/interpreteridobject.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Interpreter ID Object */
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
@@ -13,7 +9,3 @@ PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/listobject.h b/contrib/tools/python3/src/Include/cpython/listobject.h
index 74fe3301a7a..e3239152c49 100644
--- a/contrib/tools/python3/src/Include/cpython/listobject.h
+++ b/contrib/tools/python3/src/Include/cpython/listobject.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct {
PyObject_VAR_HEAD
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
@@ -30,14 +26,9 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
/* Macro, trading safety for speed */
-/* Cast argument to PyTupleObject* type. */
+/* Cast argument to PyListObject* type. */
#define _PyList_CAST(op) (assert(PyList_Check(op)), (PyListObject *)(op))
#define PyList_GET_ITEM(op, i) (_PyList_CAST(op)->ob_item[i])
-#define PyList_SET_ITEM(op, i, v) (_PyList_CAST(op)->ob_item[i] = (v))
+#define PyList_SET_ITEM(op, i, v) ((void)(_PyList_CAST(op)->ob_item[i] = (v)))
#define PyList_GET_SIZE(op) Py_SIZE(_PyList_CAST(op))
-#define _PyList_ITEMS(op) (_PyList_CAST(op)->ob_item)
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/object.h b/contrib/tools/python3/src/Include/cpython/object.h
index 444f832f5bd..84c60e55d5c 100644
--- a/contrib/tools/python3/src/Include/cpython/object.h
+++ b/contrib/tools/python3/src/Include/cpython/object.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
PyAPI_FUNC(void) _Py_NewReference(PyObject *op);
#ifdef Py_TRACE_REFS
@@ -13,10 +9,6 @@ PyAPI_FUNC(void) _Py_NewReference(PyObject *op);
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
#endif
-/* Update the Python traceback of an object. This function must be called
- when a memory block is reused from a free list. */
-PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op);
-
#ifdef Py_REF_DEBUG
PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
#endif
@@ -43,12 +35,13 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
_PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*.
*/
typedef struct _Py_Identifier {
- struct _Py_Identifier *next;
const char* string;
- PyObject *object;
+ // Index in PyInterpreterState.unicode.ids.array. It is process-wide
+ // unique and must be initialized to -1.
+ Py_ssize_t index;
} _Py_Identifier;
-#define _Py_static_string_init(value) { .next = NULL, .string = value, .object = NULL }
+#define _Py_static_string_init(value) { .string = value, .index = -1 }
#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value)
#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
@@ -175,10 +168,13 @@ typedef struct {
objobjargproc mp_ass_subscript;
} PyMappingMethods;
+typedef PySendResult (*sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
+
typedef struct {
unaryfunc am_await;
unaryfunc am_aiter;
unaryfunc am_anext;
+ sendfunc am_send;
} PyAsyncMethods;
typedef struct {
@@ -190,6 +186,8 @@ typedef struct {
* backwards-compatibility */
typedef Py_ssize_t printfunc;
+// If this structure is modified, Doc/includes/typestruct.h should be updated
+// as well.
struct _typeobject {
PyObject_VAR_HEAD
const char *tp_name; /* For printing, in format "<module>.<name>" */
@@ -249,6 +247,7 @@ struct _typeobject {
struct PyMethodDef *tp_methods;
struct PyMemberDef *tp_members;
struct PyGetSetDef *tp_getset;
+ // Strong reference on a heap type, borrowed reference on a static type
struct _typeobject *tp_base;
PyObject *tp_dict;
descrgetfunc tp_descr_get;
@@ -304,6 +303,8 @@ PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, _Py_Identifier *);
PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *);
PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *);
PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *);
+struct PyModuleDef;
+PyAPI_FUNC(PyObject *) _PyType_GetModuleByDef(PyTypeObject *, struct PyModuleDef *);
struct _Py_Identifier;
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
@@ -314,7 +315,6 @@ PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *);
PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *);
PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, struct _Py_Identifier *);
PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, struct _Py_Identifier *, PyObject *);
-PyAPI_FUNC(int) _PyObject_HasAttrId(PyObject *, struct _Py_Identifier *);
/* Replacements of PyObject_GetAttr() and _PyObject_GetAttrId() which
don't raise AttributeError.
@@ -519,6 +519,8 @@ struct _ts;
/* Python 3.9 private API, invoked by the macros below. */
PyAPI_FUNC(int) _PyTrash_begin(struct _ts *tstate, PyObject *op);
PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate);
+/* Python 3.10 private API, invoked by the Py_TRASHCAN_BEGIN(). */
+PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc);
#define PyTrash_UNWIND_LEVEL 50
@@ -528,7 +530,7 @@ PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate);
/* If "cond" is false, then _tstate remains NULL and the deallocator \
* is run normally without involving the trashcan */ \
if (cond) { \
- _tstate = PyThreadState_GET(); \
+ _tstate = PyThreadState_Get(); \
if (_PyTrash_begin(_tstate, _PyObject_CAST(op))) { \
break; \
} \
@@ -542,13 +544,9 @@ PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate);
#define Py_TRASHCAN_BEGIN(op, dealloc) \
Py_TRASHCAN_BEGIN_CONDITION(op, \
- Py_TYPE(op)->tp_dealloc == (destructor)(dealloc))
+ _PyTrash_cond(_PyObject_CAST(op), (destructor)dealloc))
/* For backwards compatibility, these macros enable the trashcan
* unconditionally */
#define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1)
#define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/objimpl.h b/contrib/tools/python3/src/Include/cpython/objimpl.h
index b835936db70..d83700e2a46 100644
--- a/contrib/tools/python3/src/Include/cpython/objimpl.h
+++ b/contrib/tools/python3/src/Include/cpython/objimpl.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
@@ -41,8 +37,9 @@ extern "C" {
PyObject *op;
op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
- if (op == NULL)
- return PyErr_NoMemory();
+ if (op == NULL) {
+ return PyErr_NoMemory();
+ }
PyObject_Init(op, &YourTypeStruct);
@@ -55,40 +52,6 @@ extern "C" {
the 1st step is performed automatically for you, so in a C++ class
constructor you would start directly with PyObject_Init/InitVar. */
-
-/* Inline functions trading binary compatibility for speed:
- PyObject_INIT() is the fast version of PyObject_Init(), and
- PyObject_INIT_VAR() is the fast version of PyObject_InitVar().
-
- These inline functions must not be called with op=NULL. */
-static inline PyObject*
-_PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
-{
- assert(op != NULL);
- Py_SET_TYPE(op, typeobj);
- if (PyType_GetFlags(typeobj) & Py_TPFLAGS_HEAPTYPE) {
- Py_INCREF(typeobj);
- }
- _Py_NewReference(op);
- return op;
-}
-
-#define PyObject_INIT(op, typeobj) \
- _PyObject_INIT(_PyObject_CAST(op), (typeobj))
-
-static inline PyVarObject*
-_PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)
-{
- assert(op != NULL);
- Py_SET_SIZE(op, size);
- PyObject_INIT((PyObject *)op, typeobj);
- return op;
-}
-
-#define PyObject_INIT_VAR(op, typeobj, size) \
- _PyObject_INIT_VAR(_PyVarObject_CAST(op), (typeobj), (size))
-
-
/* This function returns the number of allocated memory blocks, regardless of size */
PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
@@ -116,10 +79,6 @@ PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator);
PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator);
-PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void);
-PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void);
-
-
/* Test if an object implements the garbage collector protocol */
PyAPI_FUNC(int) PyObject_IS_GC(PyObject *obj);
@@ -139,7 +98,3 @@ PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size);
#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
PyAPI_FUNC(PyObject **) PyObject_GET_WEAKREFS_LISTPTR(PyObject *op);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/odictobject.h b/contrib/tools/python3/src/Include/cpython/odictobject.h
new file mode 100644
index 00000000000..e070413017d
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/odictobject.h
@@ -0,0 +1,43 @@
+#ifndef Py_ODICTOBJECT_H
+#define Py_ODICTOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* OrderedDict */
+/* This API is optional and mostly redundant. */
+
+#ifndef Py_LIMITED_API
+
+typedef struct _odictobject PyODictObject;
+
+PyAPI_DATA(PyTypeObject) PyODict_Type;
+PyAPI_DATA(PyTypeObject) PyODictIter_Type;
+PyAPI_DATA(PyTypeObject) PyODictKeys_Type;
+PyAPI_DATA(PyTypeObject) PyODictItems_Type;
+PyAPI_DATA(PyTypeObject) PyODictValues_Type;
+
+#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
+#define PyODict_CheckExact(op) Py_IS_TYPE(op, &PyODict_Type)
+#define PyODict_SIZE(op) PyDict_GET_SIZE((op))
+
+PyAPI_FUNC(PyObject *) PyODict_New(void);
+PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
+PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key);
+
+/* wrappers around PyDict* functions */
+#define PyODict_GetItem(od, key) PyDict_GetItem(_PyObject_CAST(od), key)
+#define PyODict_GetItemWithError(od, key) \
+ PyDict_GetItemWithError(_PyObject_CAST(od), key)
+#define PyODict_Contains(od, key) PyDict_Contains(_PyObject_CAST(od), key)
+#define PyODict_Size(od) PyDict_Size(_PyObject_CAST(od))
+#define PyODict_GetItemString(od, key) \
+ PyDict_GetItemString(_PyObject_CAST(od), key)
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_ODICTOBJECT_H */
diff --git a/contrib/tools/python3/src/Include/cpython/picklebufobject.h b/contrib/tools/python3/src/Include/cpython/picklebufobject.h
new file mode 100644
index 00000000000..0df2561dcea
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/picklebufobject.h
@@ -0,0 +1,31 @@
+/* PickleBuffer object. This is built-in for ease of use from third-party
+ * C extensions.
+ */
+
+#ifndef Py_PICKLEBUFOBJECT_H
+#define Py_PICKLEBUFOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_LIMITED_API
+
+PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type;
+
+#define PyPickleBuffer_Check(op) Py_IS_TYPE(op, &PyPickleBuffer_Type)
+
+/* Create a PickleBuffer redirecting to the given buffer-enabled object */
+PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *);
+/* Get the PickleBuffer's underlying view to the original object
+ * (NULL if released)
+ */
+PyAPI_FUNC(const Py_buffer *) PyPickleBuffer_GetBuffer(PyObject *);
+/* Release the PickleBuffer. Returns 0 on success, -1 on error. */
+PyAPI_FUNC(int) PyPickleBuffer_Release(PyObject *);
+
+#endif /* !Py_LIMITED_API */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_PICKLEBUFOBJECT_H */
diff --git a/contrib/tools/python3/src/Include/cpython/pyctype.h b/contrib/tools/python3/src/Include/cpython/pyctype.h
new file mode 100644
index 00000000000..729d93275e6
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/pyctype.h
@@ -0,0 +1,39 @@
+#ifndef Py_LIMITED_API
+#ifndef PYCTYPE_H
+#define PYCTYPE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PY_CTF_LOWER 0x01
+#define PY_CTF_UPPER 0x02
+#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER)
+#define PY_CTF_DIGIT 0x04
+#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT)
+#define PY_CTF_SPACE 0x08
+#define PY_CTF_XDIGIT 0x10
+
+PyAPI_DATA(const unsigned int) _Py_ctype_table[256];
+
+/* Unlike their C counterparts, the following macros are not meant to
+ * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
+ * must be a signed/unsigned char. */
+#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
+#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
+#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)
+#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT)
+#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT)
+#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM)
+#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE)
+
+PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256];
+PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256];
+
+#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
+#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !PYCTYPE_H */
+#endif /* !Py_LIMITED_API */
diff --git a/contrib/tools/python3/src/Include/cpython/pydebug.h b/contrib/tools/python3/src/Include/cpython/pydebug.h
new file mode 100644
index 00000000000..78bcb118be4
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/pydebug.h
@@ -0,0 +1,38 @@
+#ifndef Py_LIMITED_API
+#ifndef Py_PYDEBUG_H
+#define Py_PYDEBUG_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+PyAPI_DATA(int) Py_DebugFlag;
+PyAPI_DATA(int) Py_VerboseFlag;
+PyAPI_DATA(int) Py_QuietFlag;
+PyAPI_DATA(int) Py_InteractiveFlag;
+PyAPI_DATA(int) Py_InspectFlag;
+PyAPI_DATA(int) Py_OptimizeFlag;
+PyAPI_DATA(int) Py_NoSiteFlag;
+PyAPI_DATA(int) Py_BytesWarningFlag;
+PyAPI_DATA(int) Py_FrozenFlag;
+PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
+PyAPI_DATA(int) Py_DontWriteBytecodeFlag;
+PyAPI_DATA(int) Py_NoUserSiteDirectory;
+PyAPI_DATA(int) Py_UnbufferedStdioFlag;
+PyAPI_DATA(int) Py_HashRandomizationFlag;
+PyAPI_DATA(int) Py_IsolatedFlag;
+
+#ifdef MS_WINDOWS
+PyAPI_DATA(int) Py_LegacyWindowsFSEncodingFlag;
+PyAPI_DATA(int) Py_LegacyWindowsStdioFlag;
+#endif
+
+/* this is a wrapper around getenv() that pays attention to
+ Py_IgnoreEnvironmentFlag. It should be used for getting variables like
+ PYTHONPATH and PYTHONHOME from the environment */
+#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_PYDEBUG_H */
+#endif /* Py_LIMITED_API */
diff --git a/contrib/tools/python3/src/Include/cpython/pyerrors.h b/contrib/tools/python3/src/Include/cpython/pyerrors.h
index 9c87b539790..3f952456679 100644
--- a/contrib/tools/python3/src/Include/cpython/pyerrors.h
+++ b/contrib/tools/python3/src/Include/cpython/pyerrors.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Error objects */
/* PyException_HEAD defines the initial segment of every exception class. */
@@ -24,6 +20,8 @@ typedef struct {
PyObject *filename;
PyObject *lineno;
PyObject *offset;
+ PyObject *end_lineno;
+ PyObject *end_offset;
PyObject *text;
PyObject *print_file_and_line;
} PySyntaxErrorObject;
@@ -66,6 +64,17 @@ typedef struct {
PyObject *value;
} PyStopIterationObject;
+typedef struct {
+ PyException_HEAD
+ PyObject *name;
+} PyNameErrorObject;
+
+typedef struct {
+ PyException_HEAD
+ PyObject *obj;
+ PyObject *name;
+} PyAttributeErrorObject;
+
/* Compatibility typedefs */
typedef PyOSErrorObject PyEnvironmentErrorObject;
#ifdef MS_WINDOWS
@@ -82,10 +91,6 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py
PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
-/* */
-
-#define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name)
-
/* Convenience functions */
#ifdef MS_WINDOWS
@@ -145,6 +150,13 @@ PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
int lineno,
int col_offset);
+PyAPI_FUNC(void) PyErr_RangedSyntaxLocationObject(
+ PyObject *filename,
+ int lineno,
+ int col_offset,
+ int end_lineno,
+ int end_col_offset);
+
PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
PyObject *filename,
int lineno);
@@ -173,6 +185,12 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
Py_ssize_t end,
const char *reason /* UTF-8 encoded string */
);
+
+PyAPI_FUNC(PyObject *) _PyErr_ProgramDecodedTextObject(
+ PyObject *filename,
+ int lineno,
+ const char* encoding);
+
PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
PyObject *object,
Py_ssize_t start,
@@ -194,7 +212,3 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(
...);
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, message)
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/pyfpe.h b/contrib/tools/python3/src/Include/cpython/pyfpe.h
new file mode 100644
index 00000000000..cc2def63aa5
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/pyfpe.h
@@ -0,0 +1,15 @@
+#ifndef Py_PYFPE_H
+#define Py_PYFPE_H
+/* Header excluded from the stable API */
+#ifndef Py_LIMITED_API
+
+/* These macros used to do something when Python was built with --with-fpectl,
+ * but support for that was dropped in 3.7. We continue to define them though,
+ * to avoid breaking API users.
+ */
+
+#define PyFPE_START_PROTECT(err_string, leave_stmt)
+#define PyFPE_END_PROTECT(v)
+
+#endif /* !defined(Py_LIMITED_API) */
+#endif /* !Py_PYFPE_H */
diff --git a/contrib/tools/python3/src/Include/cpython/pylifecycle.h b/contrib/tools/python3/src/Include/cpython/pylifecycle.h
index eb523b82e18..5faeb3533b6 100644
--- a/contrib/tools/python3/src/Include/cpython/pylifecycle.h
+++ b/contrib/tools/python3/src/Include/cpython/pylifecycle.h
@@ -2,9 +2,9 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* Py_FrozenMain is kept out of the Limited API until documented and present
+ in all builds of Python */
+PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv);
/* Only used by applications that embed the interpreter and need to
* override the standard encoding determination mechanism
@@ -39,15 +39,11 @@ PyAPI_FUNC(int) Py_RunMain(void);
PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
-/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
- * exit functions.
- */
-PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(PyObject *), PyObject *);
-
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
PyAPI_FUNC(void) _Py_RestoreSignals(void);
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
+PyAPI_FUNC(int) _Py_FdIsInteractive(FILE *fp, PyObject *filename);
PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *);
@@ -66,7 +62,3 @@ PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn);
PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category);
PyAPI_FUNC(PyThreadState *) _Py_NewInterpreter(int isolated_subinterpreter);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/pymem.h b/contrib/tools/python3/src/Include/cpython/pymem.h
index 79f063b1217..d1054d76520 100644
--- a/contrib/tools/python3/src/Include/cpython/pymem.h
+++ b/contrib/tools/python3/src/Include/cpython/pymem.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size);
PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize);
PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size);
@@ -14,8 +10,6 @@ PyAPI_FUNC(void) PyMem_RawFree(void *ptr);
/* Try to get the allocators name set by _PyMem_SetupAllocators(). */
PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void);
-PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
-
/* strdup() using PyMem_RawMalloc() */
PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str);
@@ -102,7 +96,3 @@ PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain,
The function does nothing if Python is not compiled is debug mode. */
PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/pystate.h b/contrib/tools/python3/src/Include/cpython/pystate.h
index 0eb601fd7c5..7c995b93074 100644
--- a/contrib/tools/python3/src/Include/cpython/pystate.h
+++ b/contrib/tools/python3/src/Include/cpython/pystate.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *);
PyAPI_FUNC(void) _PyInterpreterState_RequireIDRef(PyInterpreterState *, int);
@@ -31,6 +27,21 @@ typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
#define PyTrace_OPCODE 7
+typedef struct _cframe {
+ /* This struct will be threaded through the C stack
+ * allowing fast access to per-thread state that needs
+ * to be accessed quickly by the interpreter, but can
+ * be modified outside of the interpreter.
+ *
+ * WARNING: This makes data on the C stack accessible from
+ * heap objects. Care must be taken to maintain stack
+ * discipline and make sure that instances of this struct cannot
+ * accessed outside of their lifetime.
+ */
+ int use_tracing;
+ struct _cframe *previous;
+} CFrame;
+
typedef struct _err_stackitem {
/* This struct represents an entry on the exception stack, which is a
* per-coroutine state. (Coroutine in the computer science sense,
@@ -56,17 +67,17 @@ struct _ts {
/* Borrowed reference to the current frame (it can be NULL) */
PyFrameObject *frame;
int recursion_depth;
- char overflowed; /* The stack has overflowed. Allow 50 more calls
- to handle the runtime error. */
- char recursion_critical; /* The current calls must not cause
- a stack overflow. */
+ int recursion_headroom; /* Allow 50 more calls to handle any errors. */
int stackcheck_counter;
/* 'tracing' keeps track of the execution depth when tracing/profiling.
This is to prevent the actual trace/profile code from being recorded in
the trace/profile. */
int tracing;
- int use_tracing;
+
+ /* Pointer to current CFrame in the C stack frame of the currently,
+ * or most recently, executing _PyEval_EvalFrameDefault. */
+ CFrame *cframe;
Py_tracefunc c_profilefunc;
Py_tracefunc c_tracefunc;
@@ -134,6 +145,8 @@ struct _ts {
/* Unique thread state id. */
uint64_t id;
+ CFrame root_cframe;
+
/* XXX signal handlers should also be here */
};
@@ -171,6 +184,11 @@ PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void);
*/
PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
+/* The implementation of sys._current_exceptions() Returns a dict mapping
+ thread id to that thread's current exception.
+*/
+PyAPI_FUNC(PyObject *) _PyThread_CurrentExceptions(void);
+
/* Routines for advanced debuggers, requested by David Beazley.
Don't use unless you know what you are doing! */
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void);
@@ -192,7 +210,37 @@ PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc(
PyAPI_FUNC(const PyConfig*) _PyInterpreterState_GetConfig(PyInterpreterState *interp);
-// Get the configuration of the currrent interpreter.
+/* Get a copy of the current interpreter configuration.
+
+ Return 0 on success. Raise an exception and return -1 on error.
+
+ The caller must initialize 'config', using PyConfig_InitPythonConfig()
+ for example.
+
+ Python must be preinitialized to call this method.
+ The caller must hold the GIL. */
+PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy(
+ struct PyConfig *config);
+
+/* Set the configuration of the current interpreter.
+
+ This function should be called during or just after the Python
+ initialization.
+
+ Update the sys module with the new configuration. If the sys module was
+ modified directly after the Python initialization, these changes are lost.
+
+ Some configuration like faulthandler or warnoptions can be updated in the
+ configuration, but don't reconfigure Python (don't enable/disable
+ faulthandler and don't reconfigure warnings filters).
+
+ Return 0 on success. Raise an exception and return -1 on error.
+
+ The configuration should come from _PyInterpreterState_GetConfigCopy(). */
+PyAPI_FUNC(int) _PyInterpreterState_SetConfig(
+ const struct PyConfig *config);
+
+// Get the configuration of the current interpreter.
// The caller must hold the GIL.
PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void);
@@ -255,7 +303,3 @@ typedef int (*crossinterpdatafunc)(PyObject *, struct _xid *);
PyAPI_FUNC(int) _PyCrossInterpreterData_RegisterClass(PyTypeObject *, crossinterpdatafunc);
PyAPI_FUNC(crossinterpdatafunc) _PyCrossInterpreterData_Lookup(PyObject *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/pythonrun.h b/contrib/tools/python3/src/Include/cpython/pythonrun.h
new file mode 100644
index 00000000000..2e72d0820d3
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/pythonrun.h
@@ -0,0 +1,121 @@
+#ifndef Py_CPYTHON_PYTHONRUN_H
+# error "this header file must not be included directly"
+#endif
+
+PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) _PyRun_SimpleFileObject(
+ FILE *fp,
+ PyObject *filename,
+ int closeit,
+ PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_AnyFileExFlags(
+ FILE *fp,
+ const char *filename, /* decoded from the filesystem encoding */
+ int closeit,
+ PyCompilerFlags *flags);
+PyAPI_FUNC(int) _PyRun_AnyFileObject(
+ FILE *fp,
+ PyObject *filename,
+ int closeit,
+ PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
+ FILE *fp,
+ const char *filename, /* decoded from the filesystem encoding */
+ int closeit,
+ PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
+ FILE *fp,
+ const char *filename, /* decoded from the filesystem encoding */
+ PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_InteractiveOneObject(
+ FILE *fp,
+ PyObject *filename,
+ PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
+ FILE *fp,
+ const char *filename, /* decoded from the filesystem encoding */
+ PyCompilerFlags *flags);
+PyAPI_FUNC(int) _PyRun_InteractiveLoopObject(
+ FILE *fp,
+ PyObject *filename,
+ PyCompilerFlags *flags);
+
+
+PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
+ PyObject *, PyCompilerFlags *);
+
+PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
+ FILE *fp,
+ const char *filename, /* decoded from the filesystem encoding */
+ int start,
+ PyObject *globals,
+ PyObject *locals,
+ int closeit,
+ PyCompilerFlags *flags);
+
+
+PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
+ const char *str,
+ const char *filename, /* decoded from the filesystem encoding */
+ int start,
+ PyCompilerFlags *flags,
+ int optimize);
+PyAPI_FUNC(PyObject *) Py_CompileStringObject(
+ const char *str,
+ PyObject *filename, int start,
+ PyCompilerFlags *flags,
+ int optimize);
+
+#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
+#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
+
+
+PyAPI_FUNC(const char *) _Py_SourceAsString(
+ PyObject *cmd,
+ const char *funcname,
+ const char *what,
+ PyCompilerFlags *cf,
+ PyObject **cmd_copy);
+
+
+/* A function flavor is also exported by libpython. It is required when
+ libpython is accessed directly rather than using header files which defines
+ macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
+ export functions in pythonXX.dll. */
+PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
+PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
+PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
+PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
+PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
+PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
+PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
+PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
+PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
+PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
+PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
+
+/* Use macros for a bunch of old variants */
+#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
+#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
+#define PyRun_AnyFileEx(fp, name, closeit) \
+ PyRun_AnyFileExFlags(fp, name, closeit, NULL)
+#define PyRun_AnyFileFlags(fp, name, flags) \
+ PyRun_AnyFileExFlags(fp, name, 0, flags)
+#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
+#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
+#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
+#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
+#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
+#define PyRun_File(fp, p, s, g, l) \
+ PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
+#define PyRun_FileEx(fp, p, s, g, l, c) \
+ PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
+#define PyRun_FileFlags(fp, p, s, g, l, flags) \
+ PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
+
+
+/* Stuff with no proper home (yet) */
+PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
+PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
+PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
diff --git a/contrib/tools/python3/src/Include/cpython/pytime.h b/contrib/tools/python3/src/Include/cpython/pytime.h
new file mode 100644
index 00000000000..9589972fa21
--- /dev/null
+++ b/contrib/tools/python3/src/Include/cpython/pytime.h
@@ -0,0 +1,249 @@
+#ifndef Py_LIMITED_API
+#ifndef Py_PYTIME_H
+#define Py_PYTIME_H
+
+struct timeval;
+
+/**************************************************************************
+Symbols and macros to supply platform-independent interfaces to time related
+functions and constants
+**************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* _PyTime_t: Python timestamp with subsecond precision. It can be used to
+ store a duration, and so indirectly a date (related to another date, like
+ UNIX epoch). */
+typedef int64_t _PyTime_t;
+#define _PyTime_MIN INT64_MIN
+#define _PyTime_MAX INT64_MAX
+
+typedef enum {
+ /* Round towards minus infinity (-inf).
+ For example, used to read a clock. */
+ _PyTime_ROUND_FLOOR=0,
+ /* Round towards infinity (+inf).
+ For example, used for timeout to wait "at least" N seconds. */
+ _PyTime_ROUND_CEILING=1,
+ /* Round to nearest with ties going to nearest even integer.
+ For example, used to round from a Python float. */
+ _PyTime_ROUND_HALF_EVEN=2,
+ /* Round away from zero
+ For example, used for timeout. _PyTime_ROUND_CEILING rounds
+ -1e-9 to 0 milliseconds which causes bpo-31786 issue.
+ _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps
+ the timeout sign as expected. select.poll(timeout) must block
+ for negative values." */
+ _PyTime_ROUND_UP=3,
+ /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be
+ used for timeouts. */
+ _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP
+} _PyTime_round_t;
+
+
+/* Convert a time_t to a PyLong. */
+PyAPI_FUNC(PyObject *) _PyLong_FromTime_t(
+ time_t sec);
+
+/* Convert a PyLong to a time_t. */
+PyAPI_FUNC(time_t) _PyLong_AsTime_t(
+ PyObject *obj);
+
+/* Convert a number of seconds, int or float, to time_t. */
+PyAPI_FUNC(int) _PyTime_ObjectToTime_t(
+ PyObject *obj,
+ time_t *sec,
+ _PyTime_round_t);
+
+/* Convert a number of seconds, int or float, to a timeval structure.
+ usec is in the range [0; 999999] and rounded towards zero.
+ For example, -1.2 is converted to (-2, 800000). */
+PyAPI_FUNC(int) _PyTime_ObjectToTimeval(
+ PyObject *obj,
+ time_t *sec,
+ long *usec,
+ _PyTime_round_t);
+
+/* Convert a number of seconds, int or float, to a timespec structure.
+ nsec is in the range [0; 999999999] and rounded towards zero.
+ For example, -1.2 is converted to (-2, 800000000). */
+PyAPI_FUNC(int) _PyTime_ObjectToTimespec(
+ PyObject *obj,
+ time_t *sec,
+ long *nsec,
+ _PyTime_round_t);
+
+
+/* Create a timestamp from a number of seconds. */
+PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds);
+
+/* Macro to create a timestamp from a number of seconds, no integer overflow.
+ Only use the macro for small values, prefer _PyTime_FromSeconds(). */
+#define _PYTIME_FROMSECONDS(seconds) \
+ ((_PyTime_t)(seconds) * (1000 * 1000 * 1000))
+
+/* Create a timestamp from a number of nanoseconds. */
+PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(_PyTime_t ns);
+
+/* Create a timestamp from nanoseconds (Python int). */
+PyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t,
+ PyObject *obj);
+
+/* Convert a number of seconds (Python float or int) to a timestamp.
+ Raise an exception and return -1 on error, return 0 on success. */
+PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t,
+ PyObject *obj,
+ _PyTime_round_t round);
+
+/* Convert a number of milliseconds (Python float or int, 10^-3) to a timestamp.
+ Raise an exception and return -1 on error, return 0 on success. */
+PyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t,
+ PyObject *obj,
+ _PyTime_round_t round);
+
+/* Convert a timestamp to a number of seconds as a C double. */
+PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t);
+
+/* Convert timestamp to a number of milliseconds (10^-3 seconds). */
+PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t,
+ _PyTime_round_t round);
+
+/* Convert timestamp to a number of microseconds (10^-6 seconds). */
+PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t,
+ _PyTime_round_t round);
+
+/* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int
+ object. */
+PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t);
+
+/* Create a timestamp from a timeval structure.
+ Raise an exception and return -1 on overflow, return 0 on success. */
+PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv);
+
+/* Convert a timestamp to a timeval structure (microsecond resolution).
+ tv_usec is always positive.
+ Raise an exception and return -1 if the conversion overflowed,
+ return 0 on success. */
+PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t,
+ struct timeval *tv,
+ _PyTime_round_t round);
+
+/* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */
+PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t,
+ struct timeval *tv,
+ _PyTime_round_t round);
+
+/* Convert a timestamp to a number of seconds (secs) and microseconds (us).
+ us is always positive. This function is similar to _PyTime_AsTimeval()
+ except that secs is always a time_t type, whereas the timeval structure
+ uses a C long for tv_sec on Windows.
+ Raise an exception and return -1 if the conversion overflowed,
+ return 0 on success. */
+PyAPI_FUNC(int) _PyTime_AsTimevalTime_t(
+ _PyTime_t t,
+ time_t *secs,
+ int *us,
+ _PyTime_round_t round);
+
+#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE)
+/* Create a timestamp from a timespec structure.
+ Raise an exception and return -1 on overflow, return 0 on success. */
+PyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts);
+
+/* Convert a timestamp to a timespec structure (nanosecond resolution).
+ tv_nsec is always positive.
+ Raise an exception and return -1 on error, return 0 on success. */
+PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts);
+#endif
+
+/* Compute ticks * mul / div.
+ The caller must ensure that ((div - 1) * mul) cannot overflow. */
+PyAPI_FUNC(_PyTime_t) _PyTime_MulDiv(_PyTime_t ticks,
+ _PyTime_t mul,
+ _PyTime_t div);
+
+/* Structure used by time.get_clock_info() */
+typedef struct {
+ const char *implementation;
+ int monotonic;
+ int adjustable;
+ double resolution;
+} _Py_clock_info_t;
+
+/* Get the current time from the system clock.
+
+ If the internal clock fails, silently ignore the error and return 0.
+ On integer overflow, silently ignore the overflow and truncated the clock to
+ _PyTime_MIN or _PyTime_MAX.
+
+ Use _PyTime_GetSystemClockWithInfo() to check for failure. */
+PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void);
+
+/* Get the current time from the system clock.
+ * On success, set *t and *info (if not NULL), and return 0.
+ * On error, raise an exception and return -1.
+ */
+PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo(
+ _PyTime_t *t,
+ _Py_clock_info_t *info);
+
+/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
+ The clock is not affected by system clock updates. The reference point of
+ the returned value is undefined, so that only the difference between the
+ results of consecutive calls is valid.
+
+ If the internal clock fails, silently ignore the error and return 0.
+ On integer overflow, silently ignore the overflow and truncated the clock to
+ _PyTime_MIN or _PyTime_MAX.
+
+ Use _PyTime_GetMonotonicClockWithInfo() to check for failure. */
+PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void);
+
+/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
+ The clock is not affected by system clock updates. The reference point of
+ the returned value is undefined, so that only the difference between the
+ results of consecutive calls is valid.
+
+ Fill info (if set) with information of the function used to get the time.
+
+ Return 0 on success, raise an exception and return -1 on error. */
+PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo(
+ _PyTime_t *t,
+ _Py_clock_info_t *info);
+
+
+/* Converts a timestamp to the Gregorian time, using the local time zone.
+ Return 0 on success, raise an exception and return -1 on error. */
+PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm);
+
+/* Converts a timestamp to the Gregorian time, assuming UTC.
+ Return 0 on success, raise an exception and return -1 on error. */
+PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm);
+
+/* Get the performance counter: clock with the highest available resolution to
+ measure a short duration.
+
+ If the internal clock fails, silently ignore the error and return 0.
+ On integer overflow, silently ignore the overflow and truncated the clock to
+ _PyTime_MIN or _PyTime_MAX.
+
+ Use _PyTime_GetPerfCounterWithInfo() to check for failure. */
+PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void);
+
+/* Get the performance counter: clock with the highest available resolution to
+ measure a short duration.
+
+ Fill info (if set) with information of the function used to get the time.
+
+ Return 0 on success, raise an exception and return -1 on error. */
+PyAPI_FUNC(int) _PyTime_GetPerfCounterWithInfo(
+ _PyTime_t *t,
+ _Py_clock_info_t *info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Py_PYTIME_H */
+#endif /* Py_LIMITED_API */
diff --git a/contrib/tools/python3/src/Include/cpython/sysmodule.h b/contrib/tools/python3/src/Include/cpython/sysmodule.h
index 1802b5b3000..fc4c899b3fe 100644
--- a/contrib/tools/python3/src/Include/cpython/sysmodule.h
+++ b/contrib/tools/python3/src/Include/cpython/sysmodule.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key);
PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *);
@@ -18,7 +14,3 @@ PyAPI_FUNC(int) PySys_Audit(
const char *argFormat,
...);
PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/traceback.h b/contrib/tools/python3/src/Include/cpython/traceback.h
index 837470c3ba2..aac5b42c344 100644
--- a/contrib/tools/python3/src/Include/cpython/traceback.h
+++ b/contrib/tools/python3/src/Include/cpython/traceback.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct _traceback {
PyObject_HEAD
struct _traceback *tb_next;
@@ -16,7 +12,3 @@ typedef struct _traceback {
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int);
PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/tupleobject.h b/contrib/tools/python3/src/Include/cpython/tupleobject.h
index 1565f2a5c3d..7cada8848c4 100644
--- a/contrib/tools/python3/src/Include/cpython/tupleobject.h
+++ b/contrib/tools/python3/src/Include/cpython/tupleobject.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct {
PyObject_VAR_HEAD
/* ob_item contains space for 'ob_size' elements.
@@ -27,10 +23,6 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
#define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i])
/* Macro, *only* to be used to fill in brand new tuples */
-#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v)
+#define PyTuple_SET_ITEM(op, i, v) ((void)(_PyTuple_CAST(op)->ob_item[i] = v))
PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/contrib/tools/python3/src/Include/cpython/unicodeobject.h b/contrib/tools/python3/src/Include/cpython/unicodeobject.h
index 1b460c9f189..0761f01efb4 100644
--- a/contrib/tools/python3/src/Include/cpython/unicodeobject.h
+++ b/contrib/tools/python3/src/Include/cpython/unicodeobject.h
@@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Py_UNICODE was the native Unicode storage format (code unit) used by
Python and represents a single Unicode element in the Unicode type.
With PEP 393, Py_UNICODE is deprecated and replaced with a
@@ -15,6 +11,10 @@ extern "C" {
/* --- Internal Unicode Operations ---------------------------------------- */
+#ifndef USE_UNICODE_WCHAR_CACHE
+# define USE_UNICODE_WCHAR_CACHE 1
+#endif /* USE_UNICODE_WCHAR_CACHE */
+
/* Since splitting on whitespace is an important use case, and
whitespace in most situations is solely ASCII whitespace, we
optimize for the common case by using a quick look-up table
@@ -583,7 +583,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string
contains null characters. */
-Py_DEPRECATED(3.3) PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
+PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
PyObject *unicode /* Unicode object */
);
@@ -597,9 +597,6 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize(
Py_ssize_t *size /* location where to save the length */
);
-/* Get the maximum ordinal for a Unicode character. */
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
-
/* --- _PyUnicodeWriter API ----------------------------------------------- */
@@ -730,26 +727,6 @@ PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter(
/* --- Manage the default encoding ---------------------------------------- */
/* Returns a pointer to the default encoding (UTF-8) of the
- Unicode object unicode and the size of the encoded representation
- in bytes stored in *size.
-
- In case of an error, no *size is set.
-
- This function caches the UTF-8 encoded string in the unicodeobject
- and subsequent calls will return the same string. The memory is released
- when the unicodeobject is deallocated.
-
- _PyUnicode_AsStringAndSize is a #define for PyUnicode_AsUTF8AndSize to
- support the previous internal function with the same behaviour.
-*/
-
-PyAPI_FUNC(const char *) PyUnicode_AsUTF8AndSize(
- PyObject *unicode,
- Py_ssize_t *size);
-
-#define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize
-
-/* Returns a pointer to the default encoding (UTF-8) of the
Unicode object unicode.
Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation
@@ -864,6 +841,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeStateful(
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
+
/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape
chars. */
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal(
@@ -1176,53 +1154,8 @@ PyAPI_FUNC(int) _PyUnicode_IsAlpha(
Py_UCS4 ch /* Unicode character */
);
-Py_DEPRECATED(3.3) PyAPI_FUNC(size_t) Py_UNICODE_strlen(
- const Py_UNICODE *u
- );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy(
- Py_UNICODE *s1,
- const Py_UNICODE *s2);
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat(
- Py_UNICODE *s1, const Py_UNICODE *s2);
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy(
- Py_UNICODE *s1,
- const Py_UNICODE *s2,
- size_t n);
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(int) Py_UNICODE_strcmp(
- const Py_UNICODE *s1,
- const Py_UNICODE *s2
- );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(int) Py_UNICODE_strncmp(
- const Py_UNICODE *s1,
- const Py_UNICODE *s2,
- size_t n
- );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(
- const Py_UNICODE *s,
- Py_UNICODE c
- );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
- const Py_UNICODE *s,
- Py_UNICODE c
- );
-
PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
-/* Create a copy of a unicode string ending with a nul character. Return NULL
- and raise a MemoryError exception on memory allocation failure, otherwise
- return a new allocated buffer (use PyMem_Free() to free the buffer). */
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
- PyObject *unicode
- );
-
/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
@@ -1230,8 +1163,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
and where the hash values are equal (i.e. a very probable match) */
PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
-PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);
+PyAPI_FUNC(int) _PyUnicode_WideCharString_Converter(PyObject *, void *);
+PyAPI_FUNC(int) _PyUnicode_WideCharString_Opt_Converter(PyObject *, void *);
-#ifdef __cplusplus
-}
-#endif
+PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);