summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
Diffstat (limited to 'Include')
-rw-r--r--Include/Python-ast.h83
-rw-r--r--Include/Python.h2
-rw-r--r--Include/abstract.h18
-rw-r--r--Include/bytes_methods.h4
-rw-r--r--Include/bytesobject.h1
-rw-r--r--Include/ceval.h2
-rw-r--r--Include/code.h13
-rw-r--r--Include/codecs.h9
-rw-r--r--Include/compile.h1
-rw-r--r--Include/complexobject.h22
-rw-r--r--Include/dictobject.h27
-rw-r--r--Include/fileobject.h11
-rw-r--r--Include/fileutils.h81
-rw-r--r--Include/genobject.h15
-rw-r--r--Include/graminit.h155
-rw-r--r--Include/grammar.h2
-rw-r--r--Include/listobject.h1
-rw-r--r--Include/longobject.h3
-rw-r--r--Include/memoryobject.h4
-rw-r--r--Include/methodobject.h5
-rw-r--r--Include/modsupport.h69
-rw-r--r--Include/moduleobject.h26
-rw-r--r--Include/node.h2
-rw-r--r--Include/object.h25
-rw-r--r--Include/objimpl.h4
-rw-r--r--Include/odictobject.h43
-rw-r--r--Include/opcode.h256
-rw-r--r--Include/osdefs.h5
-rw-r--r--Include/patchlevel.h10
-rw-r--r--Include/pyatomic.h88
-rw-r--r--Include/pydebug.h2
-rw-r--r--Include/pyerrors.h8
-rw-r--r--Include/pylifecycle.h124
-rw-r--r--Include/pymacro.h15
-rw-r--r--Include/pymem.h13
-rw-r--r--Include/pyport.h61
-rw-r--r--Include/pystate.h13
-rw-r--r--Include/pystrhex.h17
-rw-r--r--Include/pythonrun.h113
-rw-r--r--Include/pytime.h176
-rw-r--r--Include/setobject.h96
-rw-r--r--Include/sliceobject.h2
-rw-r--r--Include/symtable.h5
-rw-r--r--Include/token.h15
-rw-r--r--Include/typeslots.h9
-rw-r--r--Include/ucnhash.h2
-rw-r--r--Include/unicodeobject.h8
47 files changed, 1061 insertions, 605 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index 67d677b..3bc015f 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -15,9 +15,9 @@ typedef struct _slice *slice_ty;
typedef enum _boolop { And=1, Or=2 } boolop_ty;
-typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7,
- RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 }
- operator_ty;
+typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7,
+ LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12,
+ FloorDiv=13 } operator_ty;
typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
@@ -63,12 +63,13 @@ struct _mod {
} v;
};
-enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3,
- Delete_kind=4, Assign_kind=5, AugAssign_kind=6, For_kind=7,
- While_kind=8, If_kind=9, With_kind=10, Raise_kind=11,
- Try_kind=12, Assert_kind=13, Import_kind=14,
- ImportFrom_kind=15, Global_kind=16, Nonlocal_kind=17,
- Expr_kind=18, Pass_kind=19, Break_kind=20, Continue_kind=21};
+enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,
+ Return_kind=4, Delete_kind=5, Assign_kind=6,
+ AugAssign_kind=7, For_kind=8, AsyncFor_kind=9, While_kind=10,
+ If_kind=11, With_kind=12, AsyncWith_kind=13, Raise_kind=14,
+ Try_kind=15, Assert_kind=16, Import_kind=17,
+ ImportFrom_kind=18, Global_kind=19, Nonlocal_kind=20,
+ Expr_kind=21, Pass_kind=22, Break_kind=23, Continue_kind=24};
struct _stmt {
enum _stmt_kind kind;
union {
@@ -82,10 +83,16 @@ struct _stmt {
struct {
identifier name;
+ arguments_ty args;
+ asdl_seq *body;
+ asdl_seq *decorator_list;
+ expr_ty returns;
+ } AsyncFunctionDef;
+
+ struct {
+ identifier name;
asdl_seq *bases;
asdl_seq *keywords;
- expr_ty starargs;
- expr_ty kwargs;
asdl_seq *body;
asdl_seq *decorator_list;
} ClassDef;
@@ -117,6 +124,13 @@ struct _stmt {
} For;
struct {
+ expr_ty target;
+ expr_ty iter;
+ asdl_seq *body;
+ asdl_seq *orelse;
+ } AsyncFor;
+
+ struct {
expr_ty test;
asdl_seq *body;
asdl_seq *orelse;
@@ -134,6 +148,11 @@ struct _stmt {
} With;
struct {
+ asdl_seq *items;
+ asdl_seq *body;
+ } AsyncWith;
+
+ struct {
expr_ty exc;
expr_ty cause;
} Raise;
@@ -180,11 +199,11 @@ struct _stmt {
enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,
SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
- Yield_kind=12, YieldFrom_kind=13, Compare_kind=14,
- Call_kind=15, Num_kind=16, Str_kind=17, Bytes_kind=18,
- NameConstant_kind=19, Ellipsis_kind=20, Attribute_kind=21,
- Subscript_kind=22, Starred_kind=23, Name_kind=24,
- List_kind=25, Tuple_kind=26};
+ Await_kind=12, Yield_kind=13, YieldFrom_kind=14,
+ Compare_kind=15, Call_kind=16, Num_kind=17, Str_kind=18,
+ Bytes_kind=19, NameConstant_kind=20, Ellipsis_kind=21,
+ Attribute_kind=22, Subscript_kind=23, Starred_kind=24,
+ Name_kind=25, List_kind=26, Tuple_kind=27};
struct _expr {
enum _expr_kind kind;
union {
@@ -247,6 +266,10 @@ struct _expr {
struct {
expr_ty value;
+ } Await;
+
+ struct {
+ expr_ty value;
} Yield;
struct {
@@ -263,8 +286,6 @@ struct _expr {
expr_ty func;
asdl_seq *args;
asdl_seq *keywords;
- expr_ty starargs;
- expr_ty kwargs;
} Call;
struct {
@@ -406,11 +427,14 @@ mod_ty _Py_Suite(asdl_seq * body, PyArena *arena);
stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
asdl_seq * decorator_list, expr_ty returns, int lineno,
int col_offset, PyArena *arena);
-#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
+#define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7)
+stmt_ty _Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq *
+ body, asdl_seq * decorator_list, expr_ty returns,
+ int lineno, int col_offset, PyArena *arena);
+#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7)
stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords,
- expr_ty starargs, expr_ty kwargs, asdl_seq * body,
- asdl_seq * decorator_list, int lineno, int col_offset,
- PyArena *arena);
+ asdl_seq * body, asdl_seq * decorator_list, int lineno,
+ int col_offset, PyArena *arena);
#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3)
@@ -425,6 +449,9 @@ stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
orelse, int lineno, int col_offset, PyArena *arena);
+#define AsyncFor(a0, a1, a2, a3, a4, a5, a6) _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6)
+stmt_ty _Py_AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
+ orelse, int lineno, int col_offset, PyArena *arena);
#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5)
stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
int col_offset, PyArena *arena);
@@ -434,6 +461,9 @@ stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
#define With(a0, a1, a2, a3, a4) _Py_With(a0, a1, a2, a3, a4)
stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, int lineno, int col_offset,
PyArena *arena);
+#define AsyncWith(a0, a1, a2, a3, a4) _Py_AsyncWith(a0, a1, a2, a3, a4)
+stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, int lineno, int
+ col_offset, PyArena *arena);
#define Raise(a0, a1, a2, a3, a4) _Py_Raise(a0, a1, a2, a3, a4)
stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
PyArena *arena);
@@ -496,6 +526,8 @@ expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
col_offset, PyArena *arena);
+#define Await(a0, a1, a2, a3) _Py_Await(a0, a1, a2, a3)
+expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, PyArena *arena);
#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
#define YieldFrom(a0, a1, a2, a3) _Py_YieldFrom(a0, a1, a2, a3)
@@ -504,10 +536,9 @@ expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, PyArena
#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5)
expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
int lineno, int col_offset, PyArena *arena);
-#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
- starargs, expr_ty kwargs, int lineno, int col_offset, PyArena
- *arena);
+#define Call(a0, a1, a2, a3, a4, a5) _Py_Call(a0, a1, a2, a3, a4, a5)
+expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int
+ lineno, int col_offset, PyArena *arena);
#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3)
expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
diff --git a/Include/Python.h b/Include/Python.h
index 2dd8290..858dbd1 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -85,6 +85,7 @@
#include "tupleobject.h"
#include "listobject.h"
#include "dictobject.h"
+#include "odictobject.h"
#include "enumobject.h"
#include "setobject.h"
#include "methodobject.h"
@@ -112,6 +113,7 @@
#include "pyarena.h"
#include "modsupport.h"
#include "pythonrun.h"
+#include "pylifecycle.h"
#include "ceval.h"
#include "sysmodule.h"
#include "intrcheck.h"
diff --git a/Include/abstract.h b/Include/abstract.h
index 6e850b8..83dbf94 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -266,6 +266,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
PyObject *args, PyObject *kw);
+#ifndef Py_LIMITED_API
+ PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func,
+ PyObject *result,
+ const char *where);
+#endif
+
/*
Call a callable Python object, callable_object, with
arguments and keywords arguments. The 'args' argument can not be
@@ -658,6 +664,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
o1*o2.
*/
+ PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2);
+
+ /*
+ This is the equivalent of the Python expression: o1 @ o2.
+ */
+
PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2);
/*
@@ -832,6 +844,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
o1 *= o2.
*/
+ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2);
+
+ /*
+ This is the equivalent of the Python expression: o1 @= o2.
+ */
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
PyObject *o2);
diff --git a/Include/bytes_methods.h b/Include/bytes_methods.h
index 1498b8f..11d5f42 100644
--- a/Include/bytes_methods.h
+++ b/Include/bytes_methods.h
@@ -21,8 +21,8 @@ extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
-/* This one gets the raw argument list. */
-extern PyObject* _Py_bytes_maketrans(PyObject *args);
+/* The maketrans() static method. */
+extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to);
/* Shared __doc__ strings. */
extern const char _Py_isspace__doc__[];
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
index 0ee8d36..e379bac 100644
--- a/Include/bytesobject.h
+++ b/Include/bytesobject.h
@@ -62,6 +62,7 @@ PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
+PyAPI_FUNC(PyObject *) _PyBytes_Format(PyObject *, PyObject *);
#endif
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
const char *, Py_ssize_t,
diff --git a/Include/ceval.h b/Include/ceval.h
index 6811367..ec62571 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -23,6 +23,8 @@ PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
+PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject *);
+PyAPI_FUNC(PyObject *) _PyEval_GetCoroutineWrapper(void);
#endif
struct _frame; /* Avoid including frameobject.h */
diff --git a/Include/code.h b/Include/code.h
index 7c7e5bf..56e6ec1 100644
--- a/Include/code.h
+++ b/Include/code.h
@@ -21,7 +21,12 @@ typedef struct {
PyObject *co_varnames; /* tuple of strings (local variable names) */
PyObject *co_freevars; /* tuple of strings (free variable names) */
PyObject *co_cellvars; /* tuple of strings (cell variable names) */
- /* The rest doesn't count for hash or comparisons */
+ /* The rest aren't used in either hash or comparisons, except for
+ co_name (used in both) and co_firstlineno (used only in
+ comparisons). This is done to preserve the name and line number
+ for tracebacks and debuggers; otherwise, constant de-duplication
+ would collapse identical functions/lambdas defined on different lines.
+ */
unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */
PyObject *co_filename; /* unicode (where it was loaded from) */
PyObject *co_name; /* unicode (name, for reference) */
@@ -46,6 +51,11 @@ typedef struct {
*/
#define CO_NOFREE 0x0040
+/* The CO_COROUTINE flag is set for coroutine functions (defined with
+ ``async def`` keywords) */
+#define CO_COROUTINE 0x0080
+#define CO_ITERABLE_COROUTINE 0x0100
+
/* These are no longer used. */
#if 0
#define CO_GENERATOR_ALLOWED 0x1000
@@ -57,6 +67,7 @@ typedef struct {
#define CO_FUTURE_UNICODE_LITERALS 0x20000
#define CO_FUTURE_BARRY_AS_BDFL 0x40000
+#define CO_FUTURE_GENERATOR_STOP 0x80000
/* This value is found in the co_cell2arg array when the associated cell
variable does not correspond to an argument. The maximum number of
diff --git a/Include/codecs.h b/Include/codecs.h
index b3088e4..9e4f305 100644
--- a/Include/codecs.h
+++ b/Include/codecs.h
@@ -71,7 +71,7 @@ PyAPI_FUNC(int) PyCodec_KnownEncoding(
object is passed through the encoder function found for the given
encoding using the error handling method defined by errors. errors
may be NULL to use the default method defined for the codec.
-
+
Raises a LookupError in case no encoder can be found.
*/
@@ -87,7 +87,7 @@ PyAPI_FUNC(PyObject *) PyCodec_Encode(
object is passed through the decoder function found for the given
encoding using the error handling method defined by errors. errors
may be NULL to use the default method defined for the codec.
-
+
Raises a LookupError in case no encoder can be found.
*/
@@ -145,7 +145,7 @@ PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
-/* --- Codec Lookup APIs --------------------------------------------------
+/* --- Codec Lookup APIs --------------------------------------------------
All APIs return a codec object with incremented refcount and are
based on _PyCodec_Lookup(). The same comments w/r to the encoding
@@ -225,6 +225,9 @@ PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
+/* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */
+PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc);
+
PyAPI_DATA(const char *) Py_hexdigits;
#ifdef __cplusplus
diff --git a/Include/compile.h b/Include/compile.h
index c6650d7..ecd8dc1 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -27,6 +27,7 @@ typedef struct {
#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"
struct _mod; /* Declare the existence of this type */
#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
diff --git a/Include/complexobject.h b/Include/complexobject.h
index 1934f3b..cb8c52c 100644
--- a/Include/complexobject.h
+++ b/Include/complexobject.h
@@ -14,21 +14,13 @@ typedef struct {
/* Operations on complex numbers from complexmodule.c */
-#define c_sum _Py_c_sum
-#define c_diff _Py_c_diff
-#define c_neg _Py_c_neg
-#define c_prod _Py_c_prod
-#define c_quot _Py_c_quot
-#define c_pow _Py_c_pow
-#define c_abs _Py_c_abs
-
-PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex);
-PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex);
-PyAPI_FUNC(Py_complex) c_neg(Py_complex);
-PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex);
-PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex);
-PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex);
-PyAPI_FUNC(double) c_abs(Py_complex);
+PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
+PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
+PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
+PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex);
+PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex);
+PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex);
+PyAPI_FUNC(double) _Py_c_abs(Py_complex);
#endif
/* Complex object interface */
diff --git a/Include/dictobject.h b/Include/dictobject.h
index ef122bd..320f9ec 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -27,6 +27,11 @@ typedef struct {
PyObject **ma_values;
} PyDictObject;
+typedef struct {
+ PyObject_HEAD
+ PyDictObject *dv_dict;
+} _PyDictViewObject;
+
#endif /* Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PyDict_Type;
@@ -40,9 +45,9 @@ PyAPI_DATA(PyTypeObject) PyDictValues_Type;
#define PyDict_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
-#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type)
-#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type)
-#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type)
+#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type)
+#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type)
+#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type)
/* This excludes Values, since they are not sets. */
# define PyDictViewSet_Check(op) \
(PyDictKeys_Check(op) || PyDictItems_Check(op))
@@ -50,6 +55,10 @@ PyAPI_DATA(PyTypeObject) PyDictValues_Type;
PyAPI_FUNC(PyObject *) PyDict_New(void);
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
+ Py_hash_t hash);
+#endif
PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key);
PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp,
struct _Py_Identifier *key);
@@ -58,6 +67,10 @@ PyAPI_FUNC(PyObject *) PyDict_SetDefault(
PyObject *mp, PyObject *key, PyObject *defaultobj);
#endif
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key,
+ PyObject *item, Py_hash_t hash);
+#endif
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
PyAPI_FUNC(int) PyDict_Next(
@@ -67,6 +80,7 @@ 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);
+PyObject *_PyDictView_New(PyObject *, PyTypeObject *);
#endif
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
@@ -80,6 +94,9 @@ PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
+PyObject *_PyDict_SizeOf(PyDictObject *);
+PyObject *_PyDict_Pop(PyDictObject *, PyObject *, PyObject *);
+PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
PyAPI_FUNC(int) PyDict_ClearFreeList(void);
@@ -97,6 +114,10 @@ PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
PyObject *other,
int override);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
+#endif
+
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
iterable objects of length 2. If override is true, the last occurrence
of a key wins, else the first. The Python dict constructor dict(seq2)
diff --git a/Include/fileobject.h b/Include/fileobject.h
index 0939744..03155d3 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -32,17 +32,6 @@ PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
-
-#if defined _MSC_VER && _MSC_VER >= 1400
-/* A routine to check if a file descriptor is valid on Windows. Returns 0
- * and sets errno to EBADF if it isn't. This is to avoid Assertions
- * from various functions in the Windows CRT beginning with
- * Visual Studio 2005
- */
-int _PyVerify_fd(int fd);
-#else
-#define _PyVerify_fd(A) (1) /* dummy */
-#endif
#endif /* Py_LIMITED_API */
/* A routine to check if a file descriptor can be select()-ed. */
diff --git a/Include/fileutils.h b/Include/fileutils.h
index e9bad80..b4a683c 100644
--- a/Include/fileutils.h
+++ b/Include/fileutils.h
@@ -7,30 +7,59 @@ extern "C" {
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
-PyAPI_FUNC(wchar_t *) _Py_char2wchar(
+PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
const char *arg,
size_t *size);
-PyAPI_FUNC(char*) _Py_wchar2char(
+PyAPI_FUNC(char*) Py_EncodeLocale(
const wchar_t *text,
size_t *error_pos);
-#if defined(HAVE_STAT) && !defined(MS_WINDOWS)
-PyAPI_FUNC(int) _Py_wstat(
- const wchar_t* path,
- struct stat *buf);
+#ifndef Py_LIMITED_API
+
+#ifdef MS_WINDOWS
+struct _Py_stat_struct {
+ unsigned long st_dev;
+ __int64 st_ino;
+ unsigned short st_mode;
+ int st_nlink;
+ int st_uid;
+ int st_gid;
+ unsigned long st_rdev;
+ __int64 st_size;
+ time_t st_atime;
+ int st_atime_nsec;
+ time_t st_mtime;
+ int st_mtime_nsec;
+ time_t st_ctime;
+ int st_ctime_nsec;
+ unsigned long st_file_attributes;
+};
+#else
+# define _Py_stat_struct stat
#endif
-#ifdef HAVE_STAT
+PyAPI_FUNC(int) _Py_fstat(
+ int fd,
+ struct _Py_stat_struct *status);
+
+PyAPI_FUNC(int) _Py_fstat_noraise(
+ int fd,
+ struct _Py_stat_struct *status);
+#endif /* Py_LIMITED_API */
+
PyAPI_FUNC(int) _Py_stat(
PyObject *path,
- struct stat *statbuf);
-#endif
+ struct stat *status);
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _Py_open(
const char *pathname,
int flags);
+
+PyAPI_FUNC(int) _Py_open_noraise(
+ const char *pathname,
+ int flags);
#endif
PyAPI_FUNC(FILE *) _Py_wfopen(
@@ -45,6 +74,21 @@ PyAPI_FUNC(FILE*) _Py_fopen_obj(
PyObject *path,
const char *mode);
+PyAPI_FUNC(Py_ssize_t) _Py_read(
+ int fd,
+ void *buf,
+ size_t count);
+
+PyAPI_FUNC(Py_ssize_t) _Py_write(
+ int fd,
+ const void *buf,
+ size_t count);
+
+PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
+ int fd,
+ const void *buf,
+ size_t count);
+
#ifdef HAVE_READLINK
PyAPI_FUNC(int) _Py_wreadlink(
const wchar_t *path,
@@ -70,8 +114,27 @@ PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
int *atomic_flag_works);
PyAPI_FUNC(int) _Py_dup(int fd);
+
+#ifndef MS_WINDOWS
+PyAPI_FUNC(int) _Py_get_blocking(int fd);
+
+PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
+#endif /* !MS_WINDOWS */
+
+#if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900
+/* A routine to check if a file descriptor is valid on Windows. Returns 0
+ * and sets errno to EBADF if it isn't. This is to avoid Assertions
+ * from various functions in the Windows CRT beginning with
+ * Visual Studio 2005
+ */
+int _PyVerify_fd(int fd);
+
+#else
+#define _PyVerify_fd(A) (1) /* dummy */
#endif
+#endif /* Py_LIMITED_API */
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/genobject.h b/Include/genobject.h
index 65f1ecf..ee0b130 100644
--- a/Include/genobject.h
+++ b/Include/genobject.h
@@ -25,6 +25,12 @@ typedef struct {
/* List of weak reference. */
PyObject *gi_weakreflist;
+
+ /* Name of the generator. */
+ PyObject *gi_name;
+
+ /* Qualified name of the generator. */
+ PyObject *gi_qualname;
} PyGenObject;
PyAPI_DATA(PyTypeObject) PyGen_Type;
@@ -32,12 +38,21 @@ PyAPI_DATA(PyTypeObject) PyGen_Type;
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
+#define PyGen_CheckCoroutineExact(op) (PyGen_CheckExact(op) && \
+ (((PyCodeObject*) \
+ ((PyGenObject*)op)->gi_code) \
+ ->co_flags & (CO_ITERABLE_COROUTINE | \
+ CO_COROUTINE)))
+
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
+PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *,
+ PyObject *name, PyObject *qualname);
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
PyObject *_PyGen_Send(PyGenObject *, PyObject *);
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
+PyObject *_PyGen_GetAwaitableIter(PyObject *o);
#ifdef __cplusplus
}
diff --git a/Include/graminit.h b/Include/graminit.h
index 3ec949a..d030bc3 100644
--- a/Include/graminit.h
+++ b/Include/graminit.h
@@ -6,79 +6,82 @@
#define decorator 259
#define decorators 260
#define decorated 261
-#define funcdef 262
-#define parameters 263
-#define typedargslist 264
-#define tfpdef 265
-#define varargslist 266
-#define vfpdef 267
-#define stmt 268
-#define simple_stmt 269
-#define small_stmt 270
-#define expr_stmt 271
-#define testlist_star_expr 272
-#define augassign 273
-#define del_stmt 274
-#define pass_stmt 275
-#define flow_stmt 276
-#define break_stmt 277
-#define continue_stmt 278
-#define return_stmt 279
-#define yield_stmt 280
-#define raise_stmt 281
-#define import_stmt 282
-#define import_name 283
-#define import_from 284
-#define import_as_name 285
-#define dotted_as_name 286
-#define import_as_names 287
-#define dotted_as_names 288
-#define dotted_name 289
-#define global_stmt 290
-#define nonlocal_stmt 291
-#define assert_stmt 292
-#define compound_stmt 293
-#define if_stmt 294
-#define while_stmt 295
-#define for_stmt 296
-#define try_stmt 297
-#define with_stmt 298
-#define with_item 299
-#define except_clause 300
-#define suite 301
-#define test 302
-#define test_nocond 303
-#define lambdef 304
-#define lambdef_nocond 305
-#define or_test 306
-#define and_test 307
-#define not_test 308
-#define comparison 309
-#define comp_op 310
-#define star_expr 311
-#define expr 312
-#define xor_expr 313
-#define and_expr 314
-#define shift_expr 315
-#define arith_expr 316
-#define term 317
-#define factor 318
-#define power 319
-#define atom 320
-#define testlist_comp 321
-#define trailer 322
-#define subscriptlist 323
-#define subscript 324
-#define sliceop 325
-#define exprlist 326
-#define testlist 327
-#define dictorsetmaker 328
-#define classdef 329
-#define arglist 330
-#define argument 331
-#define comp_iter 332
-#define comp_for 333
-#define comp_if 334
-#define encoding_decl 335
-#define yield_expr 336
-#define yield_arg 337
+#define async_funcdef 262
+#define funcdef 263
+#define parameters 264
+#define typedargslist 265
+#define tfpdef 266
+#define varargslist 267
+#define vfpdef 268
+#define stmt 269
+#define simple_stmt 270
+#define small_stmt 271
+#define expr_stmt 272
+#define testlist_star_expr 273
+#define augassign 274
+#define del_stmt 275
+#define pass_stmt 276
+#define flow_stmt 277
+#define break_stmt 278
+#define continue_stmt 279
+#define return_stmt 280
+#define yield_stmt 281
+#define raise_stmt 282
+#define import_stmt 283
+#define import_name 284
+#define import_from 285
+#define import_as_name 286
+#define dotted_as_name 287
+#define import_as_names 288
+#define dotted_as_names 289
+#define dotted_name 290
+#define global_stmt 291
+#define nonlocal_stmt 292
+#define assert_stmt 293
+#define compound_stmt 294
+#define async_stmt 295
+#define if_stmt 296
+#define while_stmt 297
+#define for_stmt 298
+#define try_stmt 299
+#define with_stmt 300
+#define with_item 301
+#define except_clause 302
+#define suite 303
+#define test 304
+#define test_nocond 305
+#define lambdef 306
+#define lambdef_nocond 307
+#define or_test 308
+#define and_test 309
+#define not_test 310
+#define comparison 311
+#define comp_op 312
+#define star_expr 313
+#define expr 314
+#define xor_expr 315
+#define and_expr 316
+#define shift_expr 317
+#define arith_expr 318
+#define term 319
+#define factor 320
+#define power 321
+#define atom_expr 322
+#define atom 323
+#define testlist_comp 324
+#define trailer 325
+#define subscriptlist 326
+#define subscript 327
+#define sliceop 328
+#define exprlist 329
+#define testlist 330
+#define dictorsetmaker 331
+#define classdef 332
+#define arglist 333
+#define argument 334
+#define comp_iter 335
+#define comp_for 336
+#define comp_if 337
+#define encoding_decl 338
+#define yield_expr 339
+#define yield_arg 340
diff --git a/Include/grammar.h b/Include/grammar.h
index ba7d19d..85120b9 100644
--- a/Include/grammar.h
+++ b/Include/grammar.h
@@ -37,7 +37,7 @@ typedef struct {
typedef struct {
int s_narcs;
arc *s_arc; /* Array of arcs */
-
+
/* Optional accelerators */
int s_lower; /* Lowest label index */
int s_upper; /* Highest label index */
diff --git a/Include/listobject.h b/Include/listobject.h
index 74cf46f..daa513f 100644
--- a/Include/listobject.h
+++ b/Include/listobject.h
@@ -72,6 +72,7 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
#define PyList_GET_SIZE(op) Py_SIZE(op)
+#define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item)
#endif
#ifdef __cplusplus
diff --git a/Include/longobject.h b/Include/longobject.h
index ff43309..aed59ce 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -198,6 +198,9 @@ PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter(
PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int);
PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int);
+/* For use by the gcd function in mathmodule.c */
+PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *);
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/memoryobject.h b/Include/memoryobject.h
index 382ca92..ab5ee09 100644
--- a/Include/memoryobject.h
+++ b/Include/memoryobject.h
@@ -45,9 +45,6 @@ typedef struct {
} _PyManagedBufferObject;
-/* deprecated, removed in 3.5 */
-#define _Py_MEMORYVIEW_MAX_FORMAT 3 /* must be >= 3 */
-
/* memoryview state flags */
#define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */
#define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */
@@ -62,7 +59,6 @@ typedef struct {
int flags; /* state flags */
Py_ssize_t exports; /* number of buffer re-exports */
Py_buffer view; /* private copy of the exporter's view */
- char format[_Py_MEMORYVIEW_MAX_FORMAT]; /* deprecated, removed in 3.5 */
PyObject *weakreflist;
Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */
} PyMemoryViewObject;
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 3cc2ea9..e2ad804 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -47,7 +47,7 @@ struct PyMethodDef {
typedef struct PyMethodDef PyMethodDef;
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
-PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
+PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
PyObject *);
/* Flag passed to newmethodobject */
@@ -66,7 +66,7 @@ PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
/* METH_COEXIST allows a method to be entered even though a slot has
already filled the entry. When defined, the flag allows a separate
- method, "__contains__" for example, to coexist with a defined
+ method, "__contains__" for example, to coexist with a defined
slot like sq_contains. */
#define METH_COEXIST 0x0040
@@ -77,6 +77,7 @@ typedef struct {
PyMethodDef *m_ml; /* Description of the C function to call */
PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
PyObject *m_module; /* The __module__ attribute, can be anything */
+ PyObject *m_weakreflist; /* List of weak references */
} PyCFunctionObject;
#endif
diff --git a/Include/modsupport.h b/Include/modsupport.h
index 5de0458..829aaf8 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -12,13 +12,13 @@ extern "C" {
/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
to mean Py_ssize_t */
#ifdef PY_SSIZE_T_CLEAN
-#define PyArg_Parse _PyArg_Parse_SizeT
-#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
-#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
-#define PyArg_VaParse _PyArg_VaParse_SizeT
-#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
-#define Py_BuildValue _Py_BuildValue_SizeT
-#define Py_VaBuildValue _Py_VaBuildValue_SizeT
+#define PyArg_Parse _PyArg_Parse_SizeT
+#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
+#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
+#define PyArg_VaParse _PyArg_VaParse_SizeT
+#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
+#define Py_BuildValue _Py_BuildValue_SizeT
+#define Py_VaBuildValue _Py_VaBuildValue_SizeT
#else
PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
#endif
@@ -50,6 +50,13 @@ PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
+/* New in 3.5 */
+PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *);
+PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *);
+PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def);
+#endif
+
#define Py_CLEANUP_SUPPORTED 0x20000
#define PYTHON_API_VERSION 1013
@@ -67,35 +74,35 @@ PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char
Please add a line or two to the top of this log for each API
version change:
- 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
+ 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
- 19-Aug-2002 GvR 1012 Changes to string object struct for
- interning changes, saving 3 bytes.
+ 19-Aug-2002 GvR 1012 Changes to string object struct for
+ interning changes, saving 3 bytes.
- 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
+ 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
PyFrame_New(); Python 2.1a2
14-Mar-2000 GvR 1009 Unicode API added
- 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
+ 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
- 3-Dec-1998 GvR 1008 Python 1.5.2b1
+ 3-Dec-1998 GvR 1008 Python 1.5.2b1
- 18-Jan-1997 GvR 1007 string interning and other speedups
+ 18-Jan-1997 GvR 1007 string interning and other speedups
- 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
+ 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
- 30-Jul-1996 GvR Slice and ellipses syntax added
+ 30-Jul-1996 GvR Slice and ellipses syntax added
- 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
+ 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
- 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
+ 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
- 10-Jan-1995 GvR Renamed globals to new naming scheme
+ 10-Jan-1995 GvR Renamed globals to new naming scheme
- 9-Jan-1995 GvR Initial version (incompatible with older API)
+ 9-Jan-1995 GvR Initial version (incompatible with older API)
*/
/* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
@@ -105,10 +112,11 @@ PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char
#define PYTHON_ABI_STRING "3"
#ifdef Py_TRACE_REFS
- /* When we are tracing reference counts, rename PyModule_Create2 so
+ /* When we are tracing reference counts, rename module creation functions so
modules compiled with incompatible settings will generate a
link-time error. */
#define PyModule_Create2 PyModule_Create2TraceRefs
+ #define PyModule_FromDefAndSpec2 PyModule_FromDefAndSpec2TraceRefs
#endif
PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
@@ -116,12 +124,27 @@ PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
#ifdef Py_LIMITED_API
#define PyModule_Create(module) \
- PyModule_Create2(module, PYTHON_ABI_VERSION)
+ PyModule_Create2(module, PYTHON_ABI_VERSION)
#else
#define PyModule_Create(module) \
- PyModule_Create2(module, PYTHON_API_VERSION)
+ PyModule_Create2(module, PYTHON_API_VERSION)
#endif
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
+/* New in 3.5 */
+PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
+ PyObject *spec,
+ int module_api_version);
+
+#ifdef Py_LIMITED_API
+#define PyModule_FromDefAndSpec(module, spec) \
+ PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION)
+#else
+#define PyModule_FromDefAndSpec(module, spec) \
+ PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION)
+#endif /* Py_LIMITED_API */
+#endif /* New in 3.5 */
+
#ifndef Py_LIMITED_API
PyAPI_DATA(char *) _Py_PackageContext;
#endif
diff --git a/Include/moduleobject.h b/Include/moduleobject.h
index f119364..229d7fa 100644
--- a/Include/moduleobject.h
+++ b/Include/moduleobject.h
@@ -30,6 +30,12 @@ PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *);
PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
+/* New in 3.5 */
+PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*);
+PyAPI_DATA(PyTypeObject) PyModuleDef_Type;
+#endif
+
typedef struct PyModuleDef_Base {
PyObject_HEAD
PyObject* (*m_init)(void);
@@ -44,19 +50,35 @@ typedef struct PyModuleDef_Base {
NULL, /* m_copy */ \
}
+struct PyModuleDef_Slot;
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
+/* New in 3.5 */
+typedef struct PyModuleDef_Slot{
+ int slot;
+ void *value;
+} PyModuleDef_Slot;
+
+#define Py_mod_create 1
+#define Py_mod_exec 2
+
+#ifndef Py_LIMITED_API
+#define _Py_mod_LAST_SLOT 2
+#endif
+
+#endif /* New in 3.5 */
+
typedef struct PyModuleDef{
PyModuleDef_Base m_base;
const char* m_name;
const char* m_doc;
Py_ssize_t m_size;
PyMethodDef *m_methods;
- inquiry m_reload;
+ struct PyModuleDef_Slot* m_slots;
traverseproc m_traverse;
inquiry m_clear;
freefunc m_free;
}PyModuleDef;
-
#ifdef __cplusplus
}
#endif
diff --git a/Include/node.h b/Include/node.h
index 2e4e2ba..654ad85 100644
--- a/Include/node.h
+++ b/Include/node.h
@@ -26,7 +26,7 @@ PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
/* Node access functions */
#define NCH(n) ((n)->n_nchildren)
-
+
#define CHILD(n, i) (&(n)->n_child[i])
#define RCHILD(n, i) (CHILD(n, NCH(n) + i))
#define TYPE(n) ((n)->n_type)
diff --git a/Include/object.h b/Include/object.h
index 5f862ab..8afcbe9 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -65,6 +65,7 @@ whose size is determined when the object is allocated.
#error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG
#endif
+
#ifdef Py_TRACE_REFS
/* Define pointers to support a doubly-linked list of all live heap objects. */
#define _PyObject_HEAD_EXTRA \
@@ -275,6 +276,9 @@ typedef struct {
binaryfunc nb_inplace_true_divide;
unaryfunc nb_index;
+
+ binaryfunc nb_matrix_multiply;
+ binaryfunc nb_inplace_matrix_multiply;
} PyNumberMethods;
typedef struct {
@@ -297,6 +301,11 @@ typedef struct {
objobjargproc mp_ass_subscript;
} PyMappingMethods;
+typedef struct {
+ unaryfunc am_await;
+ unaryfunc am_aiter;
+ unaryfunc am_anext;
+} PyAsyncMethods;
typedef struct {
getbufferproc bf_getbuffer;
@@ -342,7 +351,7 @@ typedef struct _typeobject {
printfunc tp_print;
getattrfunc tp_getattr;
setattrfunc tp_setattr;
- void *tp_reserved; /* formerly known as tp_compare */
+ PyAsyncMethods *tp_as_async; /* formerly known as tp_compare or tp_reserved */
reprfunc tp_repr;
/* Method suites for standard classes */
@@ -449,6 +458,7 @@ typedef struct _heaptypeobject {
/* Note: there's a dependency on the order of these members
in slotptr() in typeobject.c . */
PyTypeObject ht_type;
+ PyAsyncMethods as_async;
PyNumberMethods as_number;
PyMappingMethods as_mapping;
PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
@@ -572,13 +582,6 @@ PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *);
PyAPI_FUNC(int) Py_ReprEnter(PyObject *);
PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
-#ifndef Py_LIMITED_API
-/* Helper for passing objects to printf and the like.
- Leaks refcounts. Don't use it!
-*/
-#define PyObject_REPR(obj) PyUnicode_AsUTF8(PyObject_Repr(obj))
-#endif
-
/* Flag bits for printing: */
#define Py_PRINT_RAW 1 /* No string quotes etc. */
@@ -714,11 +717,17 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
_Py_NegativeRefcount(__FILE__, __LINE__, \
(PyObject *)(OP)); \
}
+/* Py_REF_DEBUG also controls the display of refcounts and memory block
+ * allocations at the interactive prompt and at interpreter shutdown
+ */
+PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void);
+#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs()
#else
#define _Py_INC_REFTOTAL
#define _Py_DEC_REFTOTAL
#define _Py_REF_DEBUG_COMMA
#define _Py_CHECK_REFCNT(OP) /* a semicolon */;
+#define _PY_DEBUG_PRINT_TOTAL_REFS()
#endif /* Py_REF_DEBUG */
#ifdef COUNT_ALLOCS
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 3f21b70..65b6d91 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -95,6 +95,7 @@ PyObject_{New, NewVar, Del}.
the raw memory.
*/
PyAPI_FUNC(void *) PyObject_Malloc(size_t size);
+PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize);
PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size);
PyAPI_FUNC(void) PyObject_Free(void *ptr);
@@ -321,7 +322,8 @@ extern PyGC_Head *_PyGC_generation0;
(!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))
#endif /* Py_LIMITED_API */
-PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t);
+PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size);
+PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size);
PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *);
PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t);
PyAPI_FUNC(void) PyObject_GC_Track(void *);
diff --git a/Include/odictobject.h b/Include/odictobject.h
new file mode 100644
index 0000000..c1d9592
--- /dev/null
+++ b/Include/odictobject.h
@@ -0,0 +1,43 @@
+#ifndef Py_ODICTOBJECT_H
+#define Py_ODICTOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* OrderedDict */
+
+#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;
+
+#endif /* Py_LIMITED_API */
+
+#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
+#define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type)
+#define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used
+#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key)
+
+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 *)od, key)
+#define PyODict_GetItemWithError(od, key) \
+ PyDict_GetItemWithError((PyObject *)od, key)
+#define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key)
+#define PyODict_Size(od) PyDict_Size((PyObject *)od)
+#define PyODict_GetItemString(od, key) \
+ PyDict_GetItemString((PyObject *)od, key)
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_ODICTOBJECT_H */
diff --git a/Include/opcode.h b/Include/opcode.h
index 0936f2d..ca59338 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -1,3 +1,4 @@
+/* Auto-generated by Tools/scripts/generate_opcode_h.py */
#ifndef Py_OPCODE_H
#define Py_OPCODE_H
#ifdef __cplusplus
@@ -5,141 +6,121 @@ extern "C" {
#endif
-/* Instruction opcodes for compiled code */
-
-#define POP_TOP 1
-#define ROT_TWO 2
-#define ROT_THREE 3
-#define DUP_TOP 4
-#define DUP_TOP_TWO 5
-#define NOP 9
-
-#define UNARY_POSITIVE 10
-#define UNARY_NEGATIVE 11
-#define UNARY_NOT 12
-
-#define UNARY_INVERT 15
-
-#define BINARY_POWER 19
-
-#define BINARY_MULTIPLY 20
-
-#define BINARY_MODULO 22
-#define BINARY_ADD 23
-#define BINARY_SUBTRACT 24
-#define BINARY_SUBSCR 25
-#define BINARY_FLOOR_DIVIDE 26
-#define BINARY_TRUE_DIVIDE 27
-#define INPLACE_FLOOR_DIVIDE 28
-#define INPLACE_TRUE_DIVIDE 29
-
-#define STORE_MAP 54
-#define INPLACE_ADD 55
-#define INPLACE_SUBTRACT 56
-#define INPLACE_MULTIPLY 57
-
-#define INPLACE_MODULO 59
-#define STORE_SUBSCR 60
-#define DELETE_SUBSCR 61
-
-#define BINARY_LSHIFT 62
-#define BINARY_RSHIFT 63
-#define BINARY_AND 64
-#define BINARY_XOR 65
-#define BINARY_OR 66
-#define INPLACE_POWER 67
-#define GET_ITER 68
-#define PRINT_EXPR 70
-#define LOAD_BUILD_CLASS 71
-#define YIELD_FROM 72
-
-#define INPLACE_LSHIFT 75
-#define INPLACE_RSHIFT 76
-#define INPLACE_AND 77
-#define INPLACE_XOR 78
-#define INPLACE_OR 79
-#define BREAK_LOOP 80
-#define WITH_CLEANUP 81
-
-#define RETURN_VALUE 83
-#define IMPORT_STAR 84
-
-#define YIELD_VALUE 86
-#define POP_BLOCK 87
-#define END_FINALLY 88
-#define POP_EXCEPT 89
-
-#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
-
-#define STORE_NAME 90 /* Index in name list */
-#define DELETE_NAME 91 /* "" */
-#define UNPACK_SEQUENCE 92 /* Number of sequence items */
-#define FOR_ITER 93
-#define UNPACK_EX 94 /* Num items before variable part +
- (Num items after variable part << 8) */
-
-#define STORE_ATTR 95 /* Index in name list */
-#define DELETE_ATTR 96 /* "" */
-#define STORE_GLOBAL 97 /* "" */
-#define DELETE_GLOBAL 98 /* "" */
-
-#define LOAD_CONST 100 /* Index in const list */
-#define LOAD_NAME 101 /* Index in name list */
-#define BUILD_TUPLE 102 /* Number of tuple items */
-#define BUILD_LIST 103 /* Number of list items */
-#define BUILD_SET 104 /* Number of set items */
-#define BUILD_MAP 105 /* Always zero for now */
-#define LOAD_ATTR 106 /* Index in name list */
-#define COMPARE_OP 107 /* Comparison operator */
-#define IMPORT_NAME 108 /* Index in name list */
-#define IMPORT_FROM 109 /* Index in name list */
-
-#define JUMP_FORWARD 110 /* Number of bytes to skip */
-#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning of code */
-#define JUMP_IF_TRUE_OR_POP 112 /* "" */
-#define JUMP_ABSOLUTE 113 /* "" */
-#define POP_JUMP_IF_FALSE 114 /* "" */
-#define POP_JUMP_IF_TRUE 115 /* "" */
-
-#define LOAD_GLOBAL 116 /* Index in name list */
-
-#define CONTINUE_LOOP 119 /* Start of loop (absolute) */
-#define SETUP_LOOP 120 /* Target address (relative) */
-#define SETUP_EXCEPT 121 /* "" */
-#define SETUP_FINALLY 122 /* "" */
-
-#define LOAD_FAST 124 /* Local variable number */
-#define STORE_FAST 125 /* Local variable number */
-#define DELETE_FAST 126 /* Local variable number */
-
-#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
-/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */
-#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */
-#define MAKE_FUNCTION 132 /* #defaults + #kwdefaults<<8 + #annotations<<16 */
-#define BUILD_SLICE 133 /* Number of items */
-
-#define MAKE_CLOSURE 134 /* same as MAKE_FUNCTION */
-#define LOAD_CLOSURE 135 /* Load free variable from closure */
-#define LOAD_DEREF 136 /* Load and dereference from closure cell */
-#define STORE_DEREF 137 /* Store into cell */
-#define DELETE_DEREF 138 /* Delete closure cell */
-
-/* The next 3 opcodes must be contiguous and satisfy
- (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */
-#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */
-#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */
-#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */
-
-#define SETUP_WITH 143
-
-/* Support for opargs more than 16 bits long */
-#define EXTENDED_ARG 144
-
-#define LIST_APPEND 145
-#define SET_ADD 146
-#define MAP_ADD 147
-
-#define LOAD_CLASSDEREF 148
+ /* Instruction opcodes for compiled code */
+#define POP_TOP 1
+#define ROT_TWO 2
+#define ROT_THREE 3
+#define DUP_TOP 4
+#define DUP_TOP_TWO 5
+#define NOP 9
+#define UNARY_POSITIVE 10
+#define UNARY_NEGATIVE 11
+#define UNARY_NOT 12
+#define UNARY_INVERT 15
+#define BINARY_MATRIX_MULTIPLY 16
+#define INPLACE_MATRIX_MULTIPLY 17
+#define BINARY_POWER 19
+#define BINARY_MULTIPLY 20
+#define BINARY_MODULO 22
+#define BINARY_ADD 23
+#define BINARY_SUBTRACT 24
+#define BINARY_SUBSCR 25
+#define BINARY_FLOOR_DIVIDE 26
+#define BINARY_TRUE_DIVIDE 27
+#define INPLACE_FLOOR_DIVIDE 28
+#define INPLACE_TRUE_DIVIDE 29
+#define GET_AITER 50
+#define GET_ANEXT 51
+#define BEFORE_ASYNC_WITH 52
+#define INPLACE_ADD 55
+#define INPLACE_SUBTRACT 56
+#define INPLACE_MULTIPLY 57
+#define INPLACE_MODULO 59
+#define STORE_SUBSCR 60
+#define DELETE_SUBSCR 61
+#define BINARY_LSHIFT 62
+#define BINARY_RSHIFT 63
+#define BINARY_AND 64
+#define BINARY_XOR 65
+#define BINARY_OR 66
+#define INPLACE_POWER 67
+#define GET_ITER 68
+#define PRINT_EXPR 70
+#define LOAD_BUILD_CLASS 71
+#define YIELD_FROM 72
+#define GET_AWAITABLE 73
+#define INPLACE_LSHIFT 75
+#define INPLACE_RSHIFT 76
+#define INPLACE_AND 77
+#define INPLACE_XOR 78
+#define INPLACE_OR 79
+#define BREAK_LOOP 80
+#define WITH_CLEANUP_START 81
+#define WITH_CLEANUP_FINISH 82
+#define RETURN_VALUE 83
+#define IMPORT_STAR 84
+#define YIELD_VALUE 86
+#define POP_BLOCK 87
+#define END_FINALLY 88
+#define POP_EXCEPT 89
+#define HAVE_ARGUMENT 90
+#define STORE_NAME 90
+#define DELETE_NAME 91
+#define UNPACK_SEQUENCE 92
+#define FOR_ITER 93
+#define UNPACK_EX 94
+#define STORE_ATTR 95
+#define DELETE_ATTR 96
+#define STORE_GLOBAL 97
+#define DELETE_GLOBAL 98
+#define LOAD_CONST 100
+#define LOAD_NAME 101
+#define BUILD_TUPLE 102
+#define BUILD_LIST 103
+#define BUILD_SET 104
+#define BUILD_MAP 105
+#define LOAD_ATTR 106
+#define COMPARE_OP 107
+#define IMPORT_NAME 108
+#define IMPORT_FROM 109
+#define JUMP_FORWARD 110
+#define JUMP_IF_FALSE_OR_POP 111
+#define JUMP_IF_TRUE_OR_POP 112
+#define JUMP_ABSOLUTE 113
+#define POP_JUMP_IF_FALSE 114
+#define POP_JUMP_IF_TRUE 115
+#define LOAD_GLOBAL 116
+#define CONTINUE_LOOP 119
+#define SETUP_LOOP 120
+#define SETUP_EXCEPT 121
+#define SETUP_FINALLY 122
+#define LOAD_FAST 124
+#define STORE_FAST 125
+#define DELETE_FAST 126
+#define RAISE_VARARGS 130
+#define CALL_FUNCTION 131
+#define MAKE_FUNCTION 132
+#define BUILD_SLICE 133
+#define MAKE_CLOSURE 134
+#define LOAD_CLOSURE 135
+#define LOAD_DEREF 136
+#define STORE_DEREF 137
+#define DELETE_DEREF 138
+#define CALL_FUNCTION_VAR 140
+#define CALL_FUNCTION_KW 141
+#define CALL_FUNCTION_VAR_KW 142
+#define SETUP_WITH 143
+#define EXTENDED_ARG 144
+#define LIST_APPEND 145
+#define SET_ADD 146
+#define MAP_ADD 147
+#define LOAD_CLASSDEREF 148
+#define BUILD_LIST_UNPACK 149
+#define BUILD_MAP_UNPACK 150
+#define BUILD_MAP_UNPACK_WITH_CALL 151
+#define BUILD_TUPLE_UNPACK 152
+#define BUILD_SET_UNPACK 153
+#define SETUP_ASYNC_WITH 154
/* EXCEPT_HANDLER is a special, implicit block type which is created when
entering an except handler. It is not an opcode but we define it here
@@ -148,8 +129,9 @@ extern "C" {
#define EXCEPT_HANDLER 257
-enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE,
- PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
+enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE,
+ PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN,
+ PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
diff --git a/Include/osdefs.h b/Include/osdefs.h
index 0c2e34b..bd84c1c 100644
--- a/Include/osdefs.h
+++ b/Include/osdefs.h
@@ -7,15 +7,12 @@ extern "C" {
/* Operating system dependencies */
-/* Mod by chrish: QNX has WATCOM, but isn't DOS */
-#if !defined(__QNX__)
-#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)
+#ifdef MS_WINDOWS
#define SEP L'\\'
#define ALTSEP L'/'
#define MAXPATHLEN 256
#define DELIM L';'
#endif
-#endif
/* Filename separator */
#ifndef SEP
diff --git a/Include/patchlevel.h b/Include/patchlevel.h
index f884cd1..f1773f0 100644
--- a/Include/patchlevel.h
+++ b/Include/patchlevel.h
@@ -17,13 +17,13 @@
/* Version parsed out into numeric values */
/*--start constants--*/
#define PY_MAJOR_VERSION 3
-#define PY_MINOR_VERSION 4
-#define PY_MICRO_VERSION 3
-#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
-#define PY_RELEASE_SERIAL 0
+#define PY_MINOR_VERSION 5
+#define PY_MICRO_VERSION 0
+#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA
+#define PY_RELEASE_SERIAL 2
/* Version as a string */
-#define PY_VERSION "3.4.3+"
+#define PY_VERSION "3.5.0b2+"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/Include/pyatomic.h b/Include/pyatomic.h
index d4e19e0..99816a5 100644
--- a/Include/pyatomic.h
+++ b/Include/pyatomic.h
@@ -1,14 +1,15 @@
-#ifndef Py_LIMITED_API
+/* Issue #23644: <stdatomic.h> is incompatible with C++, see:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 */
+#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H
-/* XXX: When compilers start offering a stdatomic.h with lock-free
- atomic_int and atomic_address types, include that here and rewrite
- the atomic operations in terms of it. */
#include "dynamic_annotations.h"
-#ifdef __cplusplus
-extern "C" {
+#include "pyconfig.h"
+
+#if defined(HAVE_STD_ATOMIC)
+#include <stdatomic.h>
#endif
/* This is modeled after the atomics interface from C1x, according to
@@ -20,6 +21,76 @@ extern "C" {
* Beware, the implementations here are deep magic.
*/
+#if defined(HAVE_STD_ATOMIC)
+
+typedef enum _Py_memory_order {
+ _Py_memory_order_relaxed = memory_order_relaxed,
+ _Py_memory_order_acquire = memory_order_acquire,
+ _Py_memory_order_release = memory_order_release,
+ _Py_memory_order_acq_rel = memory_order_acq_rel,
+ _Py_memory_order_seq_cst = memory_order_seq_cst
+} _Py_memory_order;
+
+typedef struct _Py_atomic_address {
+ _Atomic void *_value;
+} _Py_atomic_address;
+
+typedef struct _Py_atomic_int {
+ atomic_int _value;
+} _Py_atomic_int;
+
+#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
+ atomic_signal_fence(ORDER)
+
+#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
+ atomic_thread_fence(ORDER)
+
+#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
+ atomic_store_explicit(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER)
+
+#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
+ atomic_load_explicit(&(ATOMIC_VAL)->_value, ORDER)
+
+/* Use builtin atomic operations in GCC >= 4.7 */
+#elif defined(HAVE_BUILTIN_ATOMIC)
+
+typedef enum _Py_memory_order {
+ _Py_memory_order_relaxed = __ATOMIC_RELAXED,
+ _Py_memory_order_acquire = __ATOMIC_ACQUIRE,
+ _Py_memory_order_release = __ATOMIC_RELEASE,
+ _Py_memory_order_acq_rel = __ATOMIC_ACQ_REL,
+ _Py_memory_order_seq_cst = __ATOMIC_SEQ_CST
+} _Py_memory_order;
+
+typedef struct _Py_atomic_address {
+ void *_value;
+} _Py_atomic_address;
+
+typedef struct _Py_atomic_int {
+ int _value;
+} _Py_atomic_int;
+
+#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
+ __atomic_signal_fence(ORDER)
+
+#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
+ __atomic_thread_fence(ORDER)
+
+#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
+ (assert((ORDER) == __ATOMIC_RELAXED \
+ || (ORDER) == __ATOMIC_SEQ_CST \
+ || (ORDER) == __ATOMIC_RELEASE), \
+ __atomic_store_n(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER))
+
+#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
+ (assert((ORDER) == __ATOMIC_RELAXED \
+ || (ORDER) == __ATOMIC_SEQ_CST \
+ || (ORDER) == __ATOMIC_ACQUIRE \
+ || (ORDER) == __ATOMIC_CONSUME), \
+ __atomic_load_n(&(ATOMIC_VAL)->_value, ORDER))
+
+#else
+
typedef enum _Py_memory_order {
_Py_memory_order_relaxed,
_Py_memory_order_acquire,
@@ -162,6 +233,7 @@ _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
((ATOMIC_VAL)->_value)
#endif /* !gcc x86 */
+#endif
/* Standardized shortcuts. */
#define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \
@@ -176,9 +248,5 @@ _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
#define _Py_atomic_load_relaxed(ATOMIC_VAL) \
_Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed)
-#ifdef __cplusplus
-}
-#endif
-
#endif /* Py_ATOMIC_H */
#endif /* Py_LIMITED_API */
diff --git a/Include/pydebug.h b/Include/pydebug.h
index 8fe9818..19bec2b 100644
--- a/Include/pydebug.h
+++ b/Include/pydebug.h
@@ -5,6 +5,8 @@
extern "C" {
#endif
+/* These global variable are defined in pylifecycle.c */
+/* XXX (ncoghlan): move these declarations to pylifecycle.h? */
PyAPI_DATA(int) Py_DebugFlag;
PyAPI_DATA(int) Py_VerboseFlag;
PyAPI_DATA(int) Py_QuietFlag;
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index 02f65d6..a019865 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -99,6 +99,7 @@ PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);
#define _Py_NO_RETURN
#endif
+/* Defined in Python/pylifecycle.c */
PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
@@ -146,6 +147,7 @@ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
PyAPI_DATA(PyObject *) PyExc_BaseException;
PyAPI_DATA(PyObject *) PyExc_Exception;
+PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
PyAPI_DATA(PyObject *) PyExc_StopIteration;
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
@@ -244,6 +246,12 @@ PyAPI_FUNC(PyObject *) PyErr_Format(
const char *format, /* ASCII-encoded string */
...
);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
+PyAPI_FUNC(PyObject *) PyErr_FormatV(
+ PyObject *exception,
+ const char *format,
+ va_list vargs);
+#endif
#ifdef MS_WINDOWS
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h
new file mode 100644
index 0000000..ccdebe2
--- /dev/null
+++ b/Include/pylifecycle.h
@@ -0,0 +1,124 @@
+
+/* Interfaces to configure, query, create & destroy the Python runtime */
+
+#ifndef Py_PYLIFECYCLE_H
+#define Py_PYLIFECYCLE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
+PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
+
+PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
+PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
+
+#ifndef Py_LIMITED_API
+/* Only used by applications that embed the interpreter and need to
+ * override the standard encoding determination mechanism
+ */
+PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
+ const char *errors);
+#endif
+
+PyAPI_FUNC(void) Py_Initialize(void);
+PyAPI_FUNC(void) Py_InitializeEx(int);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int);
+#endif
+PyAPI_FUNC(void) Py_Finalize(void);
+PyAPI_FUNC(int) Py_IsInitialized(void);
+PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
+PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
+
+
+/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
+ * exit functions.
+ */
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
+#endif
+PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
+
+PyAPI_FUNC(void) Py_Exit(int);
+
+/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _Py_RestoreSignals(void);
+
+PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
+#endif
+
+/* Bootstrap __main__ (defined in Modules/main.c) */
+PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
+
+/* In getpath.c */
+PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
+PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
+PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
+PyAPI_FUNC(wchar_t *) Py_GetPath(void);
+PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
+#ifdef MS_WINDOWS
+int _Py_CheckPython3();
+#endif
+
+/* In their own files */
+PyAPI_FUNC(const char *) Py_GetVersion(void);
+PyAPI_FUNC(const char *) Py_GetPlatform(void);
+PyAPI_FUNC(const char *) Py_GetCopyright(void);
+PyAPI_FUNC(const char *) Py_GetCompiler(void);
+PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(const char *) _Py_hgidentifier(void);
+PyAPI_FUNC(const char *) _Py_hgversion(void);
+#endif
+
+/* Internal -- various one-time initializations */
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
+PyAPI_FUNC(PyObject *) _PySys_Init(void);
+PyAPI_FUNC(void) _PyImport_Init(void);
+PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
+PyAPI_FUNC(void) _PyImportHooks_Init(void);
+PyAPI_FUNC(int) _PyFrame_Init(void);
+PyAPI_FUNC(int) _PyFloat_Init(void);
+PyAPI_FUNC(int) PyByteArray_Init(void);
+PyAPI_FUNC(void) _PyRandom_Init(void);
+#endif
+
+/* Various internal finalizers */
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _PyExc_Fini(void);
+PyAPI_FUNC(void) _PyImport_Fini(void);
+PyAPI_FUNC(void) PyMethod_Fini(void);
+PyAPI_FUNC(void) PyFrame_Fini(void);
+PyAPI_FUNC(void) PyCFunction_Fini(void);
+PyAPI_FUNC(void) PyDict_Fini(void);
+PyAPI_FUNC(void) PyTuple_Fini(void);
+PyAPI_FUNC(void) PyList_Fini(void);
+PyAPI_FUNC(void) PySet_Fini(void);
+PyAPI_FUNC(void) PyBytes_Fini(void);
+PyAPI_FUNC(void) PyByteArray_Fini(void);
+PyAPI_FUNC(void) PyFloat_Fini(void);
+PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
+PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
+PyAPI_FUNC(void) _PyGC_Fini(void);
+PyAPI_FUNC(void) PySlice_Fini(void);
+PyAPI_FUNC(void) _PyType_Fini(void);
+PyAPI_FUNC(void) _PyRandom_Fini(void);
+
+PyAPI_DATA(PyThreadState *) _Py_Finalizing;
+#endif
+
+/* Signals */
+typedef void (*PyOS_sighandler_t)(int);
+PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
+PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
+
+/* Random */
+PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_PYLIFECYCLE_H */
diff --git a/Include/pymacro.h b/Include/pymacro.h
index 7997c55..3f6f5dc 100644
--- a/Include/pymacro.h
+++ b/Include/pymacro.h
@@ -1,13 +1,26 @@
#ifndef Py_PYMACRO_H
#define Py_PYMACRO_H
+/* Minimum value between x and y */
#define Py_MIN(x, y) (((x) > (y)) ? (y) : (x))
+
+/* Maximum value between x and y */
#define Py_MAX(x, y) (((x) > (y)) ? (x) : (y))
+/* Absolute value of the number x */
+#define Py_ABS(x) ((x) < 0 ? -(x) : (x))
+
+#define _Py_XSTRINGIFY(x) #x
+
+/* Convert the argument to a string. For example, Py_STRINGIFY(123) is replaced
+ with "123" by the preprocessor. Defines are also replaced by their value.
+ For example Py_STRINGIFY(__LINE__) is replaced by the line number, not
+ by "__LINE__". */
+#define Py_STRINGIFY(x) _Py_XSTRINGIFY(x)
+
/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
-
/* Assert a build-time dependency, as an expression.
Your compile will fail if the condition isn't true, or can't be evaluated
diff --git a/Include/pymem.h b/Include/pymem.h
index 2372b86..043db64 100644
--- a/Include/pymem.h
+++ b/Include/pymem.h
@@ -13,6 +13,7 @@ extern "C" {
#ifndef Py_LIMITED_API
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);
PyAPI_FUNC(void) PyMem_RawFree(void *ptr);
#endif
@@ -57,6 +58,7 @@ PyAPI_FUNC(void) PyMem_RawFree(void *ptr);
*/
PyAPI_FUNC(void *) PyMem_Malloc(size_t size);
+PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size);
PyAPI_FUNC(void) PyMem_Free(void *ptr);
@@ -126,22 +128,25 @@ typedef enum {
} PyMemAllocatorDomain;
typedef struct {
- /* user context passed as the first argument to the 3 functions */
+ /* user context passed as the first argument to the 4 functions */
void *ctx;
/* allocate a memory block */
void* (*malloc) (void *ctx, size_t size);
+ /* allocate a memory block initialized by zeros */
+ void* (*calloc) (void *ctx, size_t nelem, size_t elsize);
+
/* allocate or resize a memory block */
void* (*realloc) (void *ctx, void *ptr, size_t new_size);
/* release a memory block */
void (*free) (void *ctx, void *ptr);
-} PyMemAllocator;
+} PyMemAllocatorEx;
/* Get the memory block allocator of the specified domain. */
PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain,
- PyMemAllocator *allocator);
+ PyMemAllocatorEx *allocator);
/* Set the memory block allocator of the specified domain.
@@ -155,7 +160,7 @@ PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain,
PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks
on top on the new allocator. */
PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain,
- PyMemAllocator *allocator);
+ PyMemAllocatorEx *allocator);
/* Setup hooks to detect bugs in the following Python memory allocator
functions:
diff --git a/Include/pyport.h b/Include/pyport.h
index b29f9bd..66e00d4 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -357,28 +357,6 @@ typedef int Py_ssize_clean_t;
* stat() and fstat() fiddling *
*******************************/
-/* We expect that stat and fstat exist on most systems.
- * It's confirmed on Unix, Mac and Windows.
- * If you don't have them, add
- * #define DONT_HAVE_STAT
- * and/or
- * #define DONT_HAVE_FSTAT
- * to your pyconfig.h. Python code beyond this should check HAVE_STAT and
- * HAVE_FSTAT instead.
- * Also
- * #define HAVE_SYS_STAT_H
- * if <sys/stat.h> exists on your platform, and
- * #define HAVE_STAT_H
- * if <stat.h> does.
- */
-#ifndef DONT_HAVE_STAT
-#define HAVE_STAT
-#endif
-
-#ifndef DONT_HAVE_FSTAT
-#define HAVE_FSTAT
-#endif
-
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#elif defined(HAVE_STAT_H)
@@ -588,6 +566,25 @@ extern "C" {
} while (0)
#endif
+#ifdef HAVE_GCC_ASM_FOR_MC68881
+#define HAVE_PY_SET_53BIT_PRECISION 1
+#define _Py_SET_53BIT_PRECISION_HEADER \
+ unsigned int old_fpcr, new_fpcr
+#define _Py_SET_53BIT_PRECISION_START \
+ do { \
+ __asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \
+ /* Set double precision / round to nearest. */ \
+ new_fpcr = (old_fpcr & ~0xf0) | 0x80; \
+ if (new_fpcr != old_fpcr) \
+ __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr)); \
+ } while (0)
+#define _Py_SET_53BIT_PRECISION_END \
+ do { \
+ if (new_fpcr != old_fpcr) \
+ __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \
+ } while (0)
+#endif
+
/* default definitions are empty */
#ifndef HAVE_PY_SET_53BIT_PRECISION
#define _Py_SET_53BIT_PRECISION_HEADER
@@ -880,4 +877,24 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
#define PY_LITTLE_ENDIAN 1
#endif
+#ifdef Py_BUILD_CORE
+/*
+ * Macros to protect CRT calls against instant termination when passed an
+ * invalid parameter (issue23524).
+ */
+#if defined _MSC_VER && _MSC_VER >= 1900
+
+extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
+#define _Py_BEGIN_SUPPRESS_IPH { _invalid_parameter_handler _Py_old_handler = \
+ _set_thread_local_invalid_parameter_handler(_Py_silent_invalid_parameter_handler);
+#define _Py_END_SUPPRESS_IPH _set_thread_local_invalid_parameter_handler(_Py_old_handler); }
+
+#else
+
+#define _Py_BEGIN_SUPPRESS_IPH
+#define _Py_END_SUPPRESS_IPH
+
+#endif /* _MSC_VER >= 1900 */
+#endif /* Py_BUILD_CORE */
+
#endif /* Py_PYPORT_H */
diff --git a/Include/pystate.h b/Include/pystate.h
index 4992c22..a2fd803 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -134,6 +134,9 @@ typedef struct _ts {
void (*on_delete)(void *);
void *on_delete_data;
+ PyObject *coroutine_wrapper;
+ int in_coroutine_wrapper;
+
/* XXX signal handlers should also be here */
} PyThreadState;
@@ -174,12 +177,16 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *);
/* Variable and macro for in-line access to current thread state */
/* Assuming the current thread holds the GIL, this is the
- PyThreadState for the current thread. */
-#ifndef Py_LIMITED_API
+ PyThreadState for the current thread.
+
+ Issue #23644: pyatomic.h is incompatible with C++ (yet). Disable
+ PyThreadState_GET() optimization: declare it as an alias to
+ PyThreadState_Get(), as done for limited API. */
+#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current;
#endif
-#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
+#if defined(Py_DEBUG) || defined(Py_LIMITED_API) || defined(__cplusplus)
#define PyThreadState_GET() PyThreadState_Get()
#else
#define PyThreadState_GET() \
diff --git a/Include/pystrhex.h b/Include/pystrhex.h
new file mode 100644
index 0000000..1dc1255
--- /dev/null
+++ b/Include/pystrhex.h
@@ -0,0 +1,17 @@
+#ifndef Py_STRHEX_H
+#define Py_STRHEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Returns a str() containing the hex representation of argbuf. */
+PyAPI_FUNC(PyObject*) _Py_strhex(const char* argbuf, const Py_ssize_t arglen);
+/* Returns a bytes() containing the ASCII hex representation of argbuf. */
+PyAPI_FUNC(PyObject*) _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !Py_STRHEX_H */
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 2fc5578..f92148d 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -9,7 +9,8 @@ extern "C" {
#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_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
+ CO_FUTURE_GENERATOR_STOP)
#define PyCF_MASK_OBSOLETE (CO_NESTED)
#define PyCF_SOURCE_IS_UTF8 0x0100
#define PyCF_DONT_IMPLY_DEDENT 0x0200
@@ -22,30 +23,6 @@ typedef struct {
} PyCompilerFlags;
#endif
-PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
-PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
-
-PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
-PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
-
-#ifndef Py_LIMITED_API
-/* Only used by applications that embed the interpreter and need to
- * override the standard encoding determination mechanism
- */
-PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
- const char *errors);
-#endif
-
-PyAPI_FUNC(void) Py_Initialize(void);
-PyAPI_FUNC(void) Py_InitializeEx(int);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int);
-#endif
-PyAPI_FUNC(void) Py_Finalize(void);
-PyAPI_FUNC(int) Py_IsInitialized(void);
-PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
-PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
-
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
@@ -166,26 +143,6 @@ PyAPI_FUNC(void) PyErr_Print(void);
PyAPI_FUNC(void) PyErr_PrintEx(int);
PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
-/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
- * exit functions.
- */
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
-#endif
-PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
-
-PyAPI_FUNC(void) Py_Exit(int);
-
-/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(void) _Py_RestoreSignals(void);
-
-PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
-#endif
-
-/* Bootstrap */
-PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
-
#ifndef Py_LIMITED_API
/* Use macros for a bunch of old variants */
#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
@@ -207,64 +164,6 @@ PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
#endif
-/* In getpath.c */
-PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
-PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
-PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
-PyAPI_FUNC(wchar_t *) Py_GetPath(void);
-PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
-#ifdef MS_WINDOWS
-int _Py_CheckPython3();
-#endif
-
-/* In their own files */
-PyAPI_FUNC(const char *) Py_GetVersion(void);
-PyAPI_FUNC(const char *) Py_GetPlatform(void);
-PyAPI_FUNC(const char *) Py_GetCopyright(void);
-PyAPI_FUNC(const char *) Py_GetCompiler(void);
-PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(const char *) _Py_hgidentifier(void);
-PyAPI_FUNC(const char *) _Py_hgversion(void);
-#endif
-
-/* Internal -- various one-time initializations */
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
-PyAPI_FUNC(PyObject *) _PySys_Init(void);
-PyAPI_FUNC(void) _PyImport_Init(void);
-PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
-PyAPI_FUNC(void) _PyImportHooks_Init(void);
-PyAPI_FUNC(int) _PyFrame_Init(void);
-PyAPI_FUNC(int) _PyFloat_Init(void);
-PyAPI_FUNC(int) PyByteArray_Init(void);
-PyAPI_FUNC(void) _PyRandom_Init(void);
-#endif
-
-/* Various internal finalizers */
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(void) _PyExc_Fini(void);
-PyAPI_FUNC(void) _PyImport_Fini(void);
-PyAPI_FUNC(void) PyMethod_Fini(void);
-PyAPI_FUNC(void) PyFrame_Fini(void);
-PyAPI_FUNC(void) PyCFunction_Fini(void);
-PyAPI_FUNC(void) PyDict_Fini(void);
-PyAPI_FUNC(void) PyTuple_Fini(void);
-PyAPI_FUNC(void) PyList_Fini(void);
-PyAPI_FUNC(void) PySet_Fini(void);
-PyAPI_FUNC(void) PyBytes_Fini(void);
-PyAPI_FUNC(void) PyByteArray_Fini(void);
-PyAPI_FUNC(void) PyFloat_Fini(void);
-PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
-PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
-PyAPI_FUNC(void) _PyGC_Fini(void);
-PyAPI_FUNC(void) PySlice_Fini(void);
-PyAPI_FUNC(void) _PyType_Fini(void);
-PyAPI_FUNC(void) _PyRandom_Fini(void);
-
-PyAPI_DATA(PyThreadState *) _Py_Finalizing;
-#endif
-
/* Stuff with no proper home (yet) */
#ifndef Py_LIMITED_API
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
@@ -290,14 +189,6 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
PyAPI_FUNC(int) PyOS_CheckStack(void);
#endif
-/* Signals */
-typedef void (*PyOS_sighandler_t)(int);
-PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
-PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
-
-/* Random */
-PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size);
-
#ifdef __cplusplus
}
#endif
diff --git a/Include/pytime.h b/Include/pytime.h
index b0fc6d0..027c3d8 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -13,60 +13,26 @@ functions and constants
extern "C" {
#endif
-#ifdef HAVE_GETTIMEOFDAY
-typedef struct timeval _PyTime_timeval;
+#ifdef PY_INT64_T
+/* _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 PY_INT64_T _PyTime_t;
+#define _PyTime_MIN PY_LLONG_MIN
+#define _PyTime_MAX PY_LLONG_MAX
#else
-typedef struct {
- time_t tv_sec; /* seconds since Jan. 1, 1970 */
- long tv_usec; /* and microseconds */
-} _PyTime_timeval;
+# error "_PyTime_t need signed 64-bit integer type"
#endif
-/* Structure used by time.get_clock_info() */
-typedef struct {
- const char *implementation;
- int monotonic;
- int adjustable;
- double resolution;
-} _Py_clock_info_t;
-
-/* Similar to POSIX gettimeofday but cannot fail. If system gettimeofday
- * fails or is not available, fall back to lower resolution clocks.
- */
-PyAPI_FUNC(void) _PyTime_gettimeofday(_PyTime_timeval *tp);
-
-/* Similar to _PyTime_gettimeofday() but retrieve also information on the
- * clock used to get the current time. */
-PyAPI_FUNC(void) _PyTime_gettimeofday_info(
- _PyTime_timeval *tp,
- _Py_clock_info_t *info);
-
-#define _PyTime_ADD_SECONDS(tv, interval) \
-do { \
- tv.tv_usec += (long) (((long) interval - interval) * 1000000); \
- tv.tv_sec += (time_t) interval + (time_t) (tv.tv_usec / 1000000); \
- tv.tv_usec %= 1000000; \
-} while (0)
-
-#define _PyTime_INTERVAL(tv_start, tv_end) \
- ((tv_end.tv_sec - tv_start.tv_sec) + \
- (tv_end.tv_usec - tv_start.tv_usec) * 0.000001)
-
-#ifndef Py_LIMITED_API
-
typedef enum {
- /* Round towards zero. */
- _PyTime_ROUND_DOWN=0,
- /* Round away from zero. */
- _PyTime_ROUND_UP
+ /* 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
} _PyTime_round_t;
-/* 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 time_t to a PyLong. */
PyAPI_FUNC(PyObject *) _PyLong_FromTime_t(
time_t sec);
@@ -75,6 +41,12 @@ PyAPI_FUNC(PyObject *) _PyLong_FromTime_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). */
@@ -92,10 +64,114 @@ PyAPI_FUNC(int) _PyTime_ObjectToTimespec(
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(PY_LONG_LONG ns);
+
+/* Convert a number of seconds (Python float or int) to a timetamp.
+ 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 timetamp.
+ 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);
+
+/* 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);
+
+#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE)
+/* 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
-/* Dummy to force linking. */
-PyAPI_FUNC(void) _PyTime_Init(void);
+/* Get the current time from the system clock.
+
+ The function cannot fail. _PyTime_Init() ensures that the system clock
+ works. */
+PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(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.
+
+ The function cannot fail. _PyTime_Init() ensures that a monotonic clock
+ is available and works. */
+PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void);
+
+
+/* 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.
+ * Fill clock information if info is not NULL.
+ * Raise an exception and return -1 on error, return 0 on success.
+ */
+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.
+
+ 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);
+
+
+/* Initialize time.
+ Return 0 on success, raise an exception and return -1 on error. */
+PyAPI_FUNC(int) _PyTime_Init(void);
#ifdef __cplusplus
}
diff --git a/Include/setobject.h b/Include/setobject.h
index ae3f556..f17bc1b 100644
--- a/Include/setobject.h
+++ b/Include/setobject.h
@@ -6,38 +6,43 @@
extern "C" {
#endif
+#ifndef Py_LIMITED_API
-/*
-There are three kinds of slots in the table:
+/* There are three kinds of entries in the table:
1. Unused: key == NULL
2. Active: key != NULL and key != dummy
3. Dummy: key == dummy
-Note: .pop() abuses the hash field of an Unused or Dummy slot to
-hold a search finger. The hash field of Unused or Dummy slots has
-no meaning otherwise.
+The hash field of Unused slots have no meaning.
+The hash field of Dummny slots are set to -1
+meaning that dummy entries can be detected by
+either entry->key==dummy or by entry->hash==-1.
*/
-#ifndef Py_LIMITED_API
+
#define PySet_MINSIZE 8
typedef struct {
- /* Cached hash code of the key. */
PyObject *key;
- Py_hash_t hash;
+ Py_hash_t hash; /* Cached hash code of the key */
} setentry;
+/* The SetObject data structure is shared by set and frozenset objects.
+
+Invariant for sets:
+ - hash is -1
+
+Invariants for frozensets:
+ - data is immutable.
+ - hash is the hash of the frozenset or -1 if not computed yet.
-/*
-This data structure is shared by set and frozenset objects.
*/
-typedef struct _setobject PySetObject;
-struct _setobject {
+typedef struct {
PyObject_HEAD
- Py_ssize_t fill; /* # Active + # Dummy */
- Py_ssize_t used; /* # Active */
+ Py_ssize_t fill; /* Number active and dummy entries*/
+ Py_ssize_t used; /* Number active entries */
/* The table contains mask + 1 slots, and that's a power of 2.
* We store the mask instead of the size because the mask is more
@@ -45,33 +50,42 @@ struct _setobject {
*/
Py_ssize_t mask;
- /* table points to smalltable for small tables, else to
- * additional malloc'ed memory. table is never NULL! This rule
- * saves repeated runtime null-tests.
+ /* The table points to a fixed-size smalltable for small tables
+ * or to additional malloc'ed memory for bigger tables.
+ * The table pointer is never NULL which saves us from repeated
+ * runtime null-tests.
*/
setentry *table;
- setentry *(*lookup)(PySetObject *so, PyObject *key, Py_hash_t hash);
- Py_hash_t hash; /* only used by frozenset objects */
- setentry smalltable[PySet_MINSIZE];
+ Py_hash_t hash; /* Only used by frozenset objects */
+ Py_ssize_t finger; /* Search finger for pop() */
+ setentry smalltable[PySet_MINSIZE];
PyObject *weakreflist; /* List of weak references */
-};
-#endif /* Py_LIMITED_API */
+} PySetObject;
+
+#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used)
+
+PyAPI_DATA(PyObject *) _PySet_Dummy;
+
+PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash);
+PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);
+PyAPI_FUNC(int) PySet_ClearFreeList(void);
+
+#endif /* Section excluded by Py_LIMITED_API */
PyAPI_DATA(PyTypeObject) PySet_Type;
PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
PyAPI_DATA(PyTypeObject) PySetIter_Type;
-#ifndef Py_LIMITED_API
-PyAPI_DATA(PyObject *) _PySet_Dummy;
-#endif
+PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
+PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
-/* Invariants for frozensets:
- * data is immutable.
- * hash is the hash of the frozenset or -1 if not computed yet.
- * Invariants for sets:
- * hash is -1
- */
+PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key);
+PyAPI_FUNC(int) PySet_Clear(PyObject *set);
+PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key);
+PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
+PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
+PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type)
#define PyAnySet_CheckExact(ob) \
@@ -87,26 +101,6 @@ PyAPI_DATA(PyObject *) _PySet_Dummy;
(Py_TYPE(ob) == &PyFrozenSet_Type || \
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
-PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
-PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
-PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
-#ifndef Py_LIMITED_API
-#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used)
-#endif
-PyAPI_FUNC(int) PySet_Clear(PyObject *set);
-PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key);
-PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
-PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash);
-#endif
-PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);
-
-PyAPI_FUNC(int) PySet_ClearFreeList(void);
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/Include/sliceobject.h b/Include/sliceobject.h
index f7ee90c..26370e0 100644
--- a/Include/sliceobject.h
+++ b/Include/sliceobject.h
@@ -41,7 +41,7 @@ PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
- Py_ssize_t *start, Py_ssize_t *stop,
+ Py_ssize_t *start, Py_ssize_t *stop,
Py_ssize_t *step, Py_ssize_t *slicelength);
#ifdef __cplusplus
diff --git a/Include/symtable.h b/Include/symtable.h
index 1cfd884..1409cd9 100644
--- a/Include/symtable.h
+++ b/Include/symtable.h
@@ -43,7 +43,6 @@ typedef struct _symtable_entry {
PyObject *ste_children; /* list of child blocks */
PyObject *ste_directives;/* locations of global and nonlocal statements */
_Py_block_ty ste_type; /* module, class, or function */
- int ste_unoptimized; /* false if namespace is optimized */
int ste_nested; /* true if block is nested */
unsigned ste_free : 1; /* true if block has free variables */
unsigned ste_child_free : 1; /* true if a child block has free vars,
@@ -108,10 +107,6 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
#define FREE 4
#define CELL 5
-/* The following two names are used for the ste_unoptimized bit field */
-#define OPT_IMPORT_STAR 1
-#define OPT_TOPLEVEL 2 /* top-level names, including eval and exec */
-
#define GENERATOR 1
#define GENERATOR_EXPRESSION 2
diff --git a/Include/token.h b/Include/token.h
index 905022b..595afa0 100644
--- a/Include/token.h
+++ b/Include/token.h
@@ -58,13 +58,16 @@ extern "C" {
#define DOUBLESTAREQUAL 46
#define DOUBLESLASH 47
#define DOUBLESLASHEQUAL 48
-#define AT 49
-#define RARROW 50
-#define ELLIPSIS 51
+#define AT 49
+#define ATEQUAL 50
+#define RARROW 51
+#define ELLIPSIS 52
/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
-#define OP 52
-#define ERRORTOKEN 53
-#define N_TOKENS 54
+#define OP 53
+#define AWAIT 54
+#define ASYNC 55
+#define ERRORTOKEN 56
+#define N_TOKENS 57
/* Special definitions for cooperation with parser */
diff --git a/Include/typeslots.h b/Include/typeslots.h
index ad3cdfb..0ce6a37 100644
--- a/Include/typeslots.h
+++ b/Include/typeslots.h
@@ -74,3 +74,12 @@
#define Py_tp_members 72
#define Py_tp_getset 73
#define Py_tp_free 74
+#define Py_nb_matrix_multiply 75
+#define Py_nb_inplace_matrix_multiply 76
+#define Py_am_await 77
+#define Py_am_aiter 78
+#define Py_am_anext 79
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
+/* New in 3.5 */
+#define Py_tp_finalize 80
+#endif
diff --git a/Include/ucnhash.h b/Include/ucnhash.h
index 8de9ba0..45362e9 100644
--- a/Include/ucnhash.h
+++ b/Include/ucnhash.h
@@ -16,7 +16,7 @@ typedef struct {
int size;
/* Get name for a given character code. Returns non-zero if
- success, zero if not. Does not set Python exceptions.
+ success, zero if not. Does not set Python exceptions.
If self is NULL, data come from the default version of the database.
If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */
int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen,
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index d7b2ace..4ba6328 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -2060,12 +2060,6 @@ PyAPI_FUNC(int) PyUnicode_Contains(
PyObject *element /* Element string */
);
-/* Checks whether the string contains any NUL characters. */
-
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(int) _PyUnicode_HasNULChars(PyObject *);
-#endif
-
/* Checks whether argument is a valid identifier. */
PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s);
@@ -2245,6 +2239,8 @@ PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
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). */