Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- evalkit_llava/bin/sqlite3 +3 -0
- evalkit_llava/include/python3.10/Python.h +148 -0
- evalkit_llava/include/python3.10/abstract.h +873 -0
- evalkit_llava/include/python3.10/bltinmodule.h +14 -0
- evalkit_llava/include/python3.10/bytearrayobject.h +46 -0
- evalkit_llava/include/python3.10/bytesobject.h +69 -0
- evalkit_llava/include/python3.10/classobject.h +57 -0
- evalkit_llava/include/python3.10/code.h +20 -0
- evalkit_llava/include/python3.10/codecs.h +248 -0
- evalkit_llava/include/python3.10/compile.h +25 -0
- evalkit_llava/include/python3.10/complexobject.h +69 -0
- evalkit_llava/include/python3.10/context.h +81 -0
- evalkit_llava/include/python3.10/cpython/abstract.h +373 -0
- evalkit_llava/include/python3.10/cpython/bytearrayobject.h +20 -0
- evalkit_llava/include/python3.10/cpython/bytesobject.h +118 -0
- evalkit_llava/include/python3.10/cpython/ceval.h +30 -0
- evalkit_llava/include/python3.10/cpython/dictobject.h +84 -0
- evalkit_llava/include/python3.10/cpython/fileobject.h +18 -0
- evalkit_llava/include/python3.10/cpython/fileutils.h +172 -0
- evalkit_llava/include/python3.10/cpython/frameobject.h +94 -0
- evalkit_llava/include/python3.10/cpython/import.h +46 -0
- evalkit_llava/include/python3.10/cpython/interpreteridobject.h +11 -0
- evalkit_llava/include/python3.10/cpython/listobject.h +34 -0
- evalkit_llava/include/python3.10/cpython/methodobject.h +35 -0
- evalkit_llava/include/python3.10/cpython/odictobject.h +43 -0
- evalkit_llava/include/python3.10/cpython/picklebufobject.h +31 -0
- evalkit_llava/include/python3.10/cpython/pyctype.h +39 -0
- evalkit_llava/include/python3.10/cpython/pydebug.h +38 -0
- evalkit_llava/include/python3.10/cpython/pyfpe.h +15 -0
- evalkit_llava/include/python3.10/cpython/pylifecycle.h +64 -0
- evalkit_llava/include/python3.10/cpython/pymem.h +98 -0
- evalkit_llava/include/python3.10/cpython/pythonrun.h +121 -0
- evalkit_llava/include/python3.10/cpython/sysmodule.h +16 -0
- evalkit_llava/include/python3.10/cpython/traceback.h +14 -0
- evalkit_llava/include/python3.10/cpython/unicodeobject.h +1169 -0
- evalkit_llava/include/python3.10/datetime.h +267 -0
- evalkit_llava/include/python3.10/descrobject.h +108 -0
- evalkit_llava/include/python3.10/errcode.h +38 -0
- evalkit_llava/include/python3.10/eval.h +27 -0
- evalkit_llava/include/python3.10/fileobject.h +49 -0
- evalkit_llava/include/python3.10/floatobject.h +118 -0
- evalkit_llava/include/python3.10/genericaliasobject.h +14 -0
- evalkit_llava/include/python3.10/genobject.h +100 -0
- evalkit_llava/include/python3.10/intrcheck.h +30 -0
- evalkit_llava/include/python3.10/iterobject.h +27 -0
- evalkit_llava/include/python3.10/marshal.h +28 -0
- evalkit_llava/include/python3.10/memoryobject.h +72 -0
- evalkit_llava/include/python3.10/modsupport.h +263 -0
- evalkit_llava/include/python3.10/moduleobject.h +96 -0
.gitattributes
CHANGED
|
@@ -187,3 +187,5 @@ evalkit_llava/lib/liblsan.so.0 filter=lfs diff=lfs merge=lfs -text
|
|
| 187 |
evalkit_llava/lib/libitm.so filter=lfs diff=lfs merge=lfs -text
|
| 188 |
evalkit_llava/lib/liblsan.so.0.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 189 |
evalkit_llava/lib/libitm.so.1 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 187 |
evalkit_llava/lib/libitm.so filter=lfs diff=lfs merge=lfs -text
|
| 188 |
evalkit_llava/lib/liblsan.so.0.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 189 |
evalkit_llava/lib/libitm.so.1 filter=lfs diff=lfs merge=lfs -text
|
| 190 |
+
evalkit_llava/lib/libgomp.so.1 filter=lfs diff=lfs merge=lfs -text
|
| 191 |
+
evalkit_llava/bin/sqlite3 filter=lfs diff=lfs merge=lfs -text
|
evalkit_llava/bin/sqlite3
ADDED
|
@@ -0,0 +1,3 @@
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_PYTHON_H
|
| 2 |
+
#define Py_PYTHON_H
|
| 3 |
+
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
|
| 4 |
+
|
| 5 |
+
/* Include nearly all Python header files */
|
| 6 |
+
|
| 7 |
+
#include "patchlevel.h"
|
| 8 |
+
#include "pyconfig.h"
|
| 9 |
+
#include "pymacconfig.h"
|
| 10 |
+
|
| 11 |
+
#include <limits.h>
|
| 12 |
+
|
| 13 |
+
#ifndef UCHAR_MAX
|
| 14 |
+
#error "Something's broken. UCHAR_MAX should be defined in limits.h."
|
| 15 |
+
#endif
|
| 16 |
+
|
| 17 |
+
#if UCHAR_MAX != 255
|
| 18 |
+
#error "Python's source code assumes C's unsigned char is an 8-bit type."
|
| 19 |
+
#endif
|
| 20 |
+
|
| 21 |
+
#if defined(__sgi) && !defined(_SGI_MP_SOURCE)
|
| 22 |
+
#define _SGI_MP_SOURCE
|
| 23 |
+
#endif
|
| 24 |
+
|
| 25 |
+
#include <stdio.h>
|
| 26 |
+
#ifndef NULL
|
| 27 |
+
# error "Python.h requires that stdio.h define NULL."
|
| 28 |
+
#endif
|
| 29 |
+
|
| 30 |
+
#include <string.h>
|
| 31 |
+
#ifdef HAVE_ERRNO_H
|
| 32 |
+
#include <errno.h>
|
| 33 |
+
#endif
|
| 34 |
+
#include <stdlib.h>
|
| 35 |
+
#ifndef MS_WINDOWS
|
| 36 |
+
#include <unistd.h>
|
| 37 |
+
#endif
|
| 38 |
+
|
| 39 |
+
/* For size_t? */
|
| 40 |
+
#ifdef HAVE_STDDEF_H
|
| 41 |
+
#include <stddef.h>
|
| 42 |
+
#endif
|
| 43 |
+
|
| 44 |
+
/* CAUTION: Build setups should ensure that NDEBUG is defined on the
|
| 45 |
+
* compiler command line when building Python in release mode; else
|
| 46 |
+
* assert() calls won't be removed.
|
| 47 |
+
*/
|
| 48 |
+
#include <assert.h>
|
| 49 |
+
|
| 50 |
+
#include "pyport.h"
|
| 51 |
+
#include "pymacro.h"
|
| 52 |
+
|
| 53 |
+
/* A convenient way for code to know if sanitizers are enabled. */
|
| 54 |
+
#if defined(__has_feature)
|
| 55 |
+
# if __has_feature(memory_sanitizer)
|
| 56 |
+
# if !defined(_Py_MEMORY_SANITIZER)
|
| 57 |
+
# define _Py_MEMORY_SANITIZER
|
| 58 |
+
# endif
|
| 59 |
+
# endif
|
| 60 |
+
# if __has_feature(address_sanitizer)
|
| 61 |
+
# if !defined(_Py_ADDRESS_SANITIZER)
|
| 62 |
+
# define _Py_ADDRESS_SANITIZER
|
| 63 |
+
# endif
|
| 64 |
+
# endif
|
| 65 |
+
#elif defined(__GNUC__)
|
| 66 |
+
# if defined(__SANITIZE_ADDRESS__)
|
| 67 |
+
# define _Py_ADDRESS_SANITIZER
|
| 68 |
+
# endif
|
| 69 |
+
#endif
|
| 70 |
+
|
| 71 |
+
#include "pymath.h"
|
| 72 |
+
#include "pymem.h"
|
| 73 |
+
|
| 74 |
+
#include "object.h"
|
| 75 |
+
#include "objimpl.h"
|
| 76 |
+
#include "typeslots.h"
|
| 77 |
+
#include "pyhash.h"
|
| 78 |
+
|
| 79 |
+
#include "cpython/pydebug.h"
|
| 80 |
+
|
| 81 |
+
#include "bytearrayobject.h"
|
| 82 |
+
#include "bytesobject.h"
|
| 83 |
+
#include "unicodeobject.h"
|
| 84 |
+
#include "longobject.h"
|
| 85 |
+
#include "longintrepr.h"
|
| 86 |
+
#include "boolobject.h"
|
| 87 |
+
#include "floatobject.h"
|
| 88 |
+
#include "complexobject.h"
|
| 89 |
+
#include "rangeobject.h"
|
| 90 |
+
#include "memoryobject.h"
|
| 91 |
+
#include "tupleobject.h"
|
| 92 |
+
#include "listobject.h"
|
| 93 |
+
#include "dictobject.h"
|
| 94 |
+
#include "cpython/odictobject.h"
|
| 95 |
+
#include "enumobject.h"
|
| 96 |
+
#include "setobject.h"
|
| 97 |
+
#include "methodobject.h"
|
| 98 |
+
#include "moduleobject.h"
|
| 99 |
+
#include "funcobject.h"
|
| 100 |
+
#include "classobject.h"
|
| 101 |
+
#include "fileobject.h"
|
| 102 |
+
#include "pycapsule.h"
|
| 103 |
+
#include "code.h"
|
| 104 |
+
#include "pyframe.h"
|
| 105 |
+
#include "traceback.h"
|
| 106 |
+
#include "sliceobject.h"
|
| 107 |
+
#include "cellobject.h"
|
| 108 |
+
#include "iterobject.h"
|
| 109 |
+
#include "cpython/initconfig.h"
|
| 110 |
+
#include "genobject.h"
|
| 111 |
+
#include "descrobject.h"
|
| 112 |
+
#include "genericaliasobject.h"
|
| 113 |
+
#include "warnings.h"
|
| 114 |
+
#include "weakrefobject.h"
|
| 115 |
+
#include "structseq.h"
|
| 116 |
+
#include "namespaceobject.h"
|
| 117 |
+
#include "cpython/picklebufobject.h"
|
| 118 |
+
#include "cpython/pytime.h"
|
| 119 |
+
|
| 120 |
+
#include "codecs.h"
|
| 121 |
+
#include "pyerrors.h"
|
| 122 |
+
#include "pythread.h"
|
| 123 |
+
#include "pystate.h"
|
| 124 |
+
#include "context.h"
|
| 125 |
+
|
| 126 |
+
#include "modsupport.h"
|
| 127 |
+
#include "compile.h"
|
| 128 |
+
#include "pythonrun.h"
|
| 129 |
+
#include "pylifecycle.h"
|
| 130 |
+
#include "ceval.h"
|
| 131 |
+
#include "sysmodule.h"
|
| 132 |
+
#include "osmodule.h"
|
| 133 |
+
#include "intrcheck.h"
|
| 134 |
+
#include "import.h"
|
| 135 |
+
|
| 136 |
+
#include "abstract.h"
|
| 137 |
+
#include "bltinmodule.h"
|
| 138 |
+
|
| 139 |
+
#include "eval.h"
|
| 140 |
+
|
| 141 |
+
#include "cpython/pyctype.h"
|
| 142 |
+
#include "pystrtod.h"
|
| 143 |
+
#include "pystrcmp.h"
|
| 144 |
+
#include "fileutils.h"
|
| 145 |
+
#include "cpython/pyfpe.h"
|
| 146 |
+
#include "tracemalloc.h"
|
| 147 |
+
|
| 148 |
+
#endif /* !Py_P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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Abstract Object Interface (many thanks to Jim Fulton) */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_ABSTRACTOBJECT_H
|
| 4 |
+
#define Py_ABSTRACTOBJECT_H
|
| 5 |
+
#ifdef __cplusplus
|
| 6 |
+
extern "C" {
|
| 7 |
+
#endif
|
| 8 |
+
|
| 9 |
+
/* === Object Protocol ================================================== */
|
| 10 |
+
|
| 11 |
+
/* Implemented elsewhere:
|
| 12 |
+
|
| 13 |
+
int PyObject_Print(PyObject *o, FILE *fp, int flags);
|
| 14 |
+
|
| 15 |
+
Print an object 'o' on file 'fp'. Returns -1 on error. The flags argument
|
| 16 |
+
is used to enable certain printing options. The only option currently
|
| 17 |
+
supported is Py_Print_RAW.
|
| 18 |
+
|
| 19 |
+
(What should be said about Py_Print_RAW?). */
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
/* Implemented elsewhere:
|
| 23 |
+
|
| 24 |
+
int PyObject_HasAttrString(PyObject *o, const char *attr_name);
|
| 25 |
+
|
| 26 |
+
Returns 1 if object 'o' has the attribute attr_name, and 0 otherwise.
|
| 27 |
+
|
| 28 |
+
This is equivalent to the Python expression: hasattr(o,attr_name).
|
| 29 |
+
|
| 30 |
+
This function always succeeds. */
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
/* Implemented elsewhere:
|
| 34 |
+
|
| 35 |
+
PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name);
|
| 36 |
+
|
| 37 |
+
Retrieve an attributed named attr_name form object o.
|
| 38 |
+
Returns the attribute value on success, or NULL on failure.
|
| 39 |
+
|
| 40 |
+
This is the equivalent of the Python expression: o.attr_name. */
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
/* Implemented elsewhere:
|
| 44 |
+
|
| 45 |
+
int PyObject_HasAttr(PyObject *o, PyObject *attr_name);
|
| 46 |
+
|
| 47 |
+
Returns 1 if o has the attribute attr_name, and 0 otherwise.
|
| 48 |
+
|
| 49 |
+
This is equivalent to the Python expression: hasattr(o,attr_name).
|
| 50 |
+
|
| 51 |
+
This function always succeeds. */
|
| 52 |
+
|
| 53 |
+
/* Implemented elsewhere:
|
| 54 |
+
|
| 55 |
+
PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name);
|
| 56 |
+
|
| 57 |
+
Retrieve an attributed named 'attr_name' form object 'o'.
|
| 58 |
+
Returns the attribute value on success, or NULL on failure.
|
| 59 |
+
|
| 60 |
+
This is the equivalent of the Python expression: o.attr_name. */
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
/* Implemented elsewhere:
|
| 64 |
+
|
| 65 |
+
int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v);
|
| 66 |
+
|
| 67 |
+
Set the value of the attribute named attr_name, for object 'o',
|
| 68 |
+
to the value 'v'. Raise an exception and return -1 on failure; return 0 on
|
| 69 |
+
success.
|
| 70 |
+
|
| 71 |
+
This is the equivalent of the Python statement o.attr_name=v. */
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
/* Implemented elsewhere:
|
| 75 |
+
|
| 76 |
+
int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v);
|
| 77 |
+
|
| 78 |
+
Set the value of the attribute named attr_name, for object 'o', to the value
|
| 79 |
+
'v'. an exception and return -1 on failure; return 0 on success.
|
| 80 |
+
|
| 81 |
+
This is the equivalent of the Python statement o.attr_name=v. */
|
| 82 |
+
|
| 83 |
+
/* Implemented as a macro:
|
| 84 |
+
|
| 85 |
+
int PyObject_DelAttrString(PyObject *o, const char *attr_name);
|
| 86 |
+
|
| 87 |
+
Delete attribute named attr_name, for object o. Returns
|
| 88 |
+
-1 on failure.
|
| 89 |
+
|
| 90 |
+
This is the equivalent of the Python statement: del o.attr_name. */
|
| 91 |
+
#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A), NULL)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
/* Implemented as a macro:
|
| 95 |
+
|
| 96 |
+
int PyObject_DelAttr(PyObject *o, PyObject *attr_name);
|
| 97 |
+
|
| 98 |
+
Delete attribute named attr_name, for object o. Returns -1
|
| 99 |
+
on failure. This is the equivalent of the Python
|
| 100 |
+
statement: del o.attr_name. */
|
| 101 |
+
#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A), NULL)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
/* Implemented elsewhere:
|
| 105 |
+
|
| 106 |
+
PyObject *PyObject_Repr(PyObject *o);
|
| 107 |
+
|
| 108 |
+
Compute the string representation of object 'o'. Returns the
|
| 109 |
+
string representation on success, NULL on failure.
|
| 110 |
+
|
| 111 |
+
This is the equivalent of the Python expression: repr(o).
|
| 112 |
+
|
| 113 |
+
Called by the repr() built-in function. */
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
/* Implemented elsewhere:
|
| 117 |
+
|
| 118 |
+
PyObject *PyObject_Str(PyObject *o);
|
| 119 |
+
|
| 120 |
+
Compute the string representation of object, o. Returns the
|
| 121 |
+
string representation on success, NULL on failure.
|
| 122 |
+
|
| 123 |
+
This is the equivalent of the Python expression: str(o).
|
| 124 |
+
|
| 125 |
+
Called by the str() and print() built-in functions. */
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
/* Declared elsewhere
|
| 129 |
+
|
| 130 |
+
PyAPI_FUNC(int) PyCallable_Check(PyObject *o);
|
| 131 |
+
|
| 132 |
+
Determine if the object, o, is callable. Return 1 if the object is callable
|
| 133 |
+
and 0 otherwise.
|
| 134 |
+
|
| 135 |
+
This function always succeeds. */
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
#ifdef PY_SSIZE_T_CLEAN
|
| 139 |
+
# define PyObject_CallFunction _PyObject_CallFunction_SizeT
|
| 140 |
+
# define PyObject_CallMethod _PyObject_CallMethod_SizeT
|
| 141 |
+
#endif
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
|
| 145 |
+
/* Call a callable Python object without any arguments */
|
| 146 |
+
PyAPI_FUNC(PyObject *) PyObject_CallNoArgs(PyObject *func);
|
| 147 |
+
#endif
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
/* Call a callable Python object 'callable' with arguments given by the
|
| 151 |
+
tuple 'args' and keywords arguments given by the dictionary 'kwargs'.
|
| 152 |
+
|
| 153 |
+
'args' must not be NULL, use an empty tuple if no arguments are
|
| 154 |
+
needed. If no named arguments are needed, 'kwargs' can be NULL.
|
| 155 |
+
|
| 156 |
+
This is the equivalent of the Python expression:
|
| 157 |
+
callable(*args, **kwargs). */
|
| 158 |
+
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable,
|
| 159 |
+
PyObject *args, PyObject *kwargs);
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
/* Call a callable Python object 'callable', with arguments given by the
|
| 163 |
+
tuple 'args'. If no arguments are needed, then 'args' can be NULL.
|
| 164 |
+
|
| 165 |
+
Returns the result of the call on success, or NULL on failure.
|
| 166 |
+
|
| 167 |
+
This is the equivalent of the Python expression:
|
| 168 |
+
callable(*args). */
|
| 169 |
+
PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable,
|
| 170 |
+
PyObject *args);
|
| 171 |
+
|
| 172 |
+
/* Call a callable Python object, callable, with a variable number of C
|
| 173 |
+
arguments. The C arguments are described using a mkvalue-style format
|
| 174 |
+
string.
|
| 175 |
+
|
| 176 |
+
The format may be NULL, indicating that no arguments are provided.
|
| 177 |
+
|
| 178 |
+
Returns the result of the call on success, or NULL on failure.
|
| 179 |
+
|
| 180 |
+
This is the equivalent of the Python expression:
|
| 181 |
+
callable(arg1, arg2, ...). */
|
| 182 |
+
PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable,
|
| 183 |
+
const char *format, ...);
|
| 184 |
+
|
| 185 |
+
/* Call the method named 'name' of object 'obj' with a variable number of
|
| 186 |
+
C arguments. The C arguments are described by a mkvalue format string.
|
| 187 |
+
|
| 188 |
+
The format can be NULL, indicating that no arguments are provided.
|
| 189 |
+
|
| 190 |
+
Returns the result of the call on success, or NULL on failure.
|
| 191 |
+
|
| 192 |
+
This is the equivalent of the Python expression:
|
| 193 |
+
obj.name(arg1, arg2, ...). */
|
| 194 |
+
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj,
|
| 195 |
+
const char *name,
|
| 196 |
+
const char *format, ...);
|
| 197 |
+
|
| 198 |
+
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
|
| 199 |
+
const char *format,
|
| 200 |
+
...);
|
| 201 |
+
|
| 202 |
+
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj,
|
| 203 |
+
const char *name,
|
| 204 |
+
const char *format,
|
| 205 |
+
...);
|
| 206 |
+
|
| 207 |
+
/* Call a callable Python object 'callable' with a variable number of C
|
| 208 |
+
arguments. The C arguments are provided as PyObject* values, terminated
|
| 209 |
+
by a NULL.
|
| 210 |
+
|
| 211 |
+
Returns the result of the call on success, or NULL on failure.
|
| 212 |
+
|
| 213 |
+
This is the equivalent of the Python expression:
|
| 214 |
+
callable(arg1, arg2, ...). */
|
| 215 |
+
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
|
| 216 |
+
...);
|
| 217 |
+
|
| 218 |
+
/* Call the method named 'name' of object 'obj' with a variable number of
|
| 219 |
+
C arguments. The C arguments are provided as PyObject* values, terminated
|
| 220 |
+
by NULL.
|
| 221 |
+
|
| 222 |
+
Returns the result of the call on success, or NULL on failure.
|
| 223 |
+
|
| 224 |
+
This is the equivalent of the Python expression: obj.name(*args). */
|
| 225 |
+
|
| 226 |
+
PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(
|
| 227 |
+
PyObject *obj,
|
| 228 |
+
PyObject *name,
|
| 229 |
+
...);
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
/* Implemented elsewhere:
|
| 233 |
+
|
| 234 |
+
Py_hash_t PyObject_Hash(PyObject *o);
|
| 235 |
+
|
| 236 |
+
Compute and return the hash, hash_value, of an object, o. On
|
| 237 |
+
failure, return -1.
|
| 238 |
+
|
| 239 |
+
This is the equivalent of the Python expression: hash(o). */
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
/* Implemented elsewhere:
|
| 243 |
+
|
| 244 |
+
int PyObject_IsTrue(PyObject *o);
|
| 245 |
+
|
| 246 |
+
Returns 1 if the object, o, is considered to be true, 0 if o is
|
| 247 |
+
considered to be false and -1 on failure.
|
| 248 |
+
|
| 249 |
+
This is equivalent to the Python expression: not not o. */
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
/* Implemented elsewhere:
|
| 253 |
+
|
| 254 |
+
int PyObject_Not(PyObject *o);
|
| 255 |
+
|
| 256 |
+
Returns 0 if the object, o, is considered to be true, 1 if o is
|
| 257 |
+
considered to be false and -1 on failure.
|
| 258 |
+
|
| 259 |
+
This is equivalent to the Python expression: not o. */
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
/* Get the type of an object.
|
| 263 |
+
|
| 264 |
+
On success, returns a type object corresponding to the object type of object
|
| 265 |
+
'o'. On failure, returns NULL.
|
| 266 |
+
|
| 267 |
+
This is equivalent to the Python expression: type(o) */
|
| 268 |
+
PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o);
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
/* Return the size of object 'o'. If the object 'o' provides both sequence and
|
| 272 |
+
mapping protocols, the sequence size is returned.
|
| 273 |
+
|
| 274 |
+
On error, -1 is returned.
|
| 275 |
+
|
| 276 |
+
This is the equivalent to the Python expression: len(o) */
|
| 277 |
+
PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o);
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
/* For DLL compatibility */
|
| 281 |
+
#undef PyObject_Length
|
| 282 |
+
PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o);
|
| 283 |
+
#define PyObject_Length PyObject_Size
|
| 284 |
+
|
| 285 |
+
/* Return element of 'o' corresponding to the object 'key'. Return NULL
|
| 286 |
+
on failure.
|
| 287 |
+
|
| 288 |
+
This is the equivalent of the Python expression: o[key] */
|
| 289 |
+
PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key);
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
/* Map the object 'key' to the value 'v' into 'o'.
|
| 293 |
+
|
| 294 |
+
Raise an exception and return -1 on failure; return 0 on success.
|
| 295 |
+
|
| 296 |
+
This is the equivalent of the Python statement: o[key]=v. */
|
| 297 |
+
PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v);
|
| 298 |
+
|
| 299 |
+
/* Remove the mapping for the string 'key' from the object 'o'.
|
| 300 |
+
Returns -1 on failure.
|
| 301 |
+
|
| 302 |
+
This is equivalent to the Python statement: del o[key]. */
|
| 303 |
+
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key);
|
| 304 |
+
|
| 305 |
+
/* Delete the mapping for the object 'key' from the object 'o'.
|
| 306 |
+
Returns -1 on failure.
|
| 307 |
+
|
| 308 |
+
This is the equivalent of the Python statement: del o[key]. */
|
| 309 |
+
PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key);
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
/* === Old Buffer API ============================================ */
|
| 313 |
+
|
| 314 |
+
/* FIXME: usage of these should all be replaced in Python itself
|
| 315 |
+
but for backwards compatibility we will implement them.
|
| 316 |
+
Their usage without a corresponding "unlock" mechanism
|
| 317 |
+
may create issues (but they would already be there). */
|
| 318 |
+
|
| 319 |
+
/* Takes an arbitrary object which must support the (character, single segment)
|
| 320 |
+
buffer interface and returns a pointer to a read-only memory location
|
| 321 |
+
usable as character based input for subsequent processing.
|
| 322 |
+
|
| 323 |
+
Return 0 on success. buffer and buffer_len are only set in case no error
|
| 324 |
+
occurs. Otherwise, -1 is returned and an exception set. */
|
| 325 |
+
Py_DEPRECATED(3.0)
|
| 326 |
+
PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
|
| 327 |
+
const char **buffer,
|
| 328 |
+
Py_ssize_t *buffer_len);
|
| 329 |
+
|
| 330 |
+
/* Checks whether an arbitrary object supports the (character, single segment)
|
| 331 |
+
buffer interface.
|
| 332 |
+
|
| 333 |
+
Returns 1 on success, 0 on failure. */
|
| 334 |
+
Py_DEPRECATED(3.0) PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
|
| 335 |
+
|
| 336 |
+
/* Same as PyObject_AsCharBuffer() except that this API expects (readable,
|
| 337 |
+
single segment) buffer interface and returns a pointer to a read-only memory
|
| 338 |
+
location which can contain arbitrary data.
|
| 339 |
+
|
| 340 |
+
0 is returned on success. buffer and buffer_len are only set in case no
|
| 341 |
+
error occurs. Otherwise, -1 is returned and an exception set. */
|
| 342 |
+
Py_DEPRECATED(3.0)
|
| 343 |
+
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
|
| 344 |
+
const void **buffer,
|
| 345 |
+
Py_ssize_t *buffer_len);
|
| 346 |
+
|
| 347 |
+
/* Takes an arbitrary object which must support the (writable, single segment)
|
| 348 |
+
buffer interface and returns a pointer to a writable memory location in
|
| 349 |
+
buffer of size 'buffer_len'.
|
| 350 |
+
|
| 351 |
+
Return 0 on success. buffer and buffer_len are only set in case no error
|
| 352 |
+
occurs. Otherwise, -1 is returned and an exception set. */
|
| 353 |
+
Py_DEPRECATED(3.0)
|
| 354 |
+
PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
|
| 355 |
+
void **buffer,
|
| 356 |
+
Py_ssize_t *buffer_len);
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
/* === New Buffer API ============================================ */
|
| 360 |
+
|
| 361 |
+
/* Takes an arbitrary object and returns the result of calling
|
| 362 |
+
obj.__format__(format_spec). */
|
| 363 |
+
PyAPI_FUNC(PyObject *) PyObject_Format(PyObject *obj,
|
| 364 |
+
PyObject *format_spec);
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
/* ==== Iterators ================================================ */
|
| 368 |
+
|
| 369 |
+
/* Takes an object and returns an iterator for it.
|
| 370 |
+
This is typically a new iterator but if the argument is an iterator, this
|
| 371 |
+
returns itself. */
|
| 372 |
+
PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
|
| 373 |
+
|
| 374 |
+
/* Takes an AsyncIterable object and returns an AsyncIterator for it.
|
| 375 |
+
This is typically a new iterator but if the argument is an AsyncIterator,
|
| 376 |
+
this returns itself. */
|
| 377 |
+
PyAPI_FUNC(PyObject *) PyObject_GetAIter(PyObject *);
|
| 378 |
+
|
| 379 |
+
/* Returns non-zero if the object 'obj' provides iterator protocols, and 0 otherwise.
|
| 380 |
+
|
| 381 |
+
This function always succeeds. */
|
| 382 |
+
PyAPI_FUNC(int) PyIter_Check(PyObject *);
|
| 383 |
+
|
| 384 |
+
/* Returns non-zero if the object 'obj' provides AsyncIterator protocols, and 0 otherwise.
|
| 385 |
+
|
| 386 |
+
This function always succeeds. */
|
| 387 |
+
PyAPI_FUNC(int) PyAIter_Check(PyObject *);
|
| 388 |
+
|
| 389 |
+
/* Takes an iterator object and calls its tp_iternext slot,
|
| 390 |
+
returning the next value.
|
| 391 |
+
|
| 392 |
+
If the iterator is exhausted, this returns NULL without setting an
|
| 393 |
+
exception.
|
| 394 |
+
|
| 395 |
+
NULL with an exception means an error occurred. */
|
| 396 |
+
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
|
| 397 |
+
|
| 398 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
|
| 399 |
+
|
| 400 |
+
/* Takes generator, coroutine or iterator object and sends the value into it.
|
| 401 |
+
Returns:
|
| 402 |
+
- PYGEN_RETURN (0) if generator has returned.
|
| 403 |
+
'result' parameter is filled with return value
|
| 404 |
+
- PYGEN_ERROR (-1) if exception was raised.
|
| 405 |
+
'result' parameter is NULL
|
| 406 |
+
- PYGEN_NEXT (1) if generator has yielded.
|
| 407 |
+
'result' parameter is filled with yielded value. */
|
| 408 |
+
PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **);
|
| 409 |
+
#endif
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
/* === Number Protocol ================================================== */
|
| 413 |
+
|
| 414 |
+
/* Returns 1 if the object 'o' provides numeric protocols, and 0 otherwise.
|
| 415 |
+
|
| 416 |
+
This function always succeeds. */
|
| 417 |
+
PyAPI_FUNC(int) PyNumber_Check(PyObject *o);
|
| 418 |
+
|
| 419 |
+
/* Returns the result of adding o1 and o2, or NULL on failure.
|
| 420 |
+
|
| 421 |
+
This is the equivalent of the Python expression: o1 + o2. */
|
| 422 |
+
PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2);
|
| 423 |
+
|
| 424 |
+
/* Returns the result of subtracting o2 from o1, or NULL on failure.
|
| 425 |
+
|
| 426 |
+
This is the equivalent of the Python expression: o1 - o2. */
|
| 427 |
+
PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2);
|
| 428 |
+
|
| 429 |
+
/* Returns the result of multiplying o1 and o2, or NULL on failure.
|
| 430 |
+
|
| 431 |
+
This is the equivalent of the Python expression: o1 * o2. */
|
| 432 |
+
PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2);
|
| 433 |
+
|
| 434 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
| 435 |
+
/* This is the equivalent of the Python expression: o1 @ o2. */
|
| 436 |
+
PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2);
|
| 437 |
+
#endif
|
| 438 |
+
|
| 439 |
+
/* Returns the result of dividing o1 by o2 giving an integral result,
|
| 440 |
+
or NULL on failure.
|
| 441 |
+
|
| 442 |
+
This is the equivalent of the Python expression: o1 // o2. */
|
| 443 |
+
PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2);
|
| 444 |
+
|
| 445 |
+
/* Returns the result of dividing o1 by o2 giving a float result, or NULL on
|
| 446 |
+
failure.
|
| 447 |
+
|
| 448 |
+
This is the equivalent of the Python expression: o1 / o2. */
|
| 449 |
+
PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2);
|
| 450 |
+
|
| 451 |
+
/* Returns the remainder of dividing o1 by o2, or NULL on failure.
|
| 452 |
+
|
| 453 |
+
This is the equivalent of the Python expression: o1 % o2. */
|
| 454 |
+
PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2);
|
| 455 |
+
|
| 456 |
+
/* See the built-in function divmod.
|
| 457 |
+
|
| 458 |
+
Returns NULL on failure.
|
| 459 |
+
|
| 460 |
+
This is the equivalent of the Python expression: divmod(o1, o2). */
|
| 461 |
+
PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2);
|
| 462 |
+
|
| 463 |
+
/* See the built-in function pow. Returns NULL on failure.
|
| 464 |
+
|
| 465 |
+
This is the equivalent of the Python expression: pow(o1, o2, o3),
|
| 466 |
+
where o3 is optional. */
|
| 467 |
+
PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2,
|
| 468 |
+
PyObject *o3);
|
| 469 |
+
|
| 470 |
+
/* Returns the negation of o on success, or NULL on failure.
|
| 471 |
+
|
| 472 |
+
This is the equivalent of the Python expression: -o. */
|
| 473 |
+
PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o);
|
| 474 |
+
|
| 475 |
+
/* Returns the positive of o on success, or NULL on failure.
|
| 476 |
+
|
| 477 |
+
This is the equivalent of the Python expression: +o. */
|
| 478 |
+
PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o);
|
| 479 |
+
|
| 480 |
+
/* Returns the absolute value of 'o', or NULL on failure.
|
| 481 |
+
|
| 482 |
+
This is the equivalent of the Python expression: abs(o). */
|
| 483 |
+
PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o);
|
| 484 |
+
|
| 485 |
+
/* Returns the bitwise negation of 'o' on success, or NULL on failure.
|
| 486 |
+
|
| 487 |
+
This is the equivalent of the Python expression: ~o. */
|
| 488 |
+
PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o);
|
| 489 |
+
|
| 490 |
+
/* Returns the result of left shifting o1 by o2 on success, or NULL on failure.
|
| 491 |
+
|
| 492 |
+
This is the equivalent of the Python expression: o1 << o2. */
|
| 493 |
+
PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2);
|
| 494 |
+
|
| 495 |
+
/* Returns the result of right shifting o1 by o2 on success, or NULL on
|
| 496 |
+
failure.
|
| 497 |
+
|
| 498 |
+
This is the equivalent of the Python expression: o1 >> o2. */
|
| 499 |
+
PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2);
|
| 500 |
+
|
| 501 |
+
/* Returns the result of bitwise and of o1 and o2 on success, or NULL on
|
| 502 |
+
failure.
|
| 503 |
+
|
| 504 |
+
This is the equivalent of the Python expression: o1 & o2. */
|
| 505 |
+
PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2);
|
| 506 |
+
|
| 507 |
+
/* Returns the bitwise exclusive or of o1 by o2 on success, or NULL on failure.
|
| 508 |
+
|
| 509 |
+
This is the equivalent of the Python expression: o1 ^ o2. */
|
| 510 |
+
PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2);
|
| 511 |
+
|
| 512 |
+
/* Returns the result of bitwise or on o1 and o2 on success, or NULL on
|
| 513 |
+
failure.
|
| 514 |
+
|
| 515 |
+
This is the equivalent of the Python expression: o1 | o2. */
|
| 516 |
+
PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2);
|
| 517 |
+
|
| 518 |
+
/* Returns 1 if obj is an index integer (has the nb_index slot of the
|
| 519 |
+
tp_as_number structure filled in), and 0 otherwise. */
|
| 520 |
+
PyAPI_FUNC(int) PyIndex_Check(PyObject *);
|
| 521 |
+
|
| 522 |
+
/* Returns the object 'o' converted to a Python int, or NULL with an exception
|
| 523 |
+
raised on failure. */
|
| 524 |
+
PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o);
|
| 525 |
+
|
| 526 |
+
/* Returns the object 'o' converted to Py_ssize_t by going through
|
| 527 |
+
PyNumber_Index() first.
|
| 528 |
+
|
| 529 |
+
If an overflow error occurs while converting the int to Py_ssize_t, then the
|
| 530 |
+
second argument 'exc' is the error-type to return. If it is NULL, then the
|
| 531 |
+
overflow error is cleared and the value is clipped. */
|
| 532 |
+
PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc);
|
| 533 |
+
|
| 534 |
+
/* Returns the object 'o' converted to an integer object on success, or NULL
|
| 535 |
+
on failure.
|
| 536 |
+
|
| 537 |
+
This is the equivalent of the Python expression: int(o). */
|
| 538 |
+
PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o);
|
| 539 |
+
|
| 540 |
+
/* Returns the object 'o' converted to a float object on success, or NULL
|
| 541 |
+
on failure.
|
| 542 |
+
|
| 543 |
+
This is the equivalent of the Python expression: float(o). */
|
| 544 |
+
PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o);
|
| 545 |
+
|
| 546 |
+
|
| 547 |
+
/* --- In-place variants of (some of) the above number protocol functions -- */
|
| 548 |
+
|
| 549 |
+
/* Returns the result of adding o2 to o1, possibly in-place, or NULL
|
| 550 |
+
on failure.
|
| 551 |
+
|
| 552 |
+
This is the equivalent of the Python expression: o1 += o2. */
|
| 553 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2);
|
| 554 |
+
|
| 555 |
+
/* Returns the result of subtracting o2 from o1, possibly in-place or
|
| 556 |
+
NULL on failure.
|
| 557 |
+
|
| 558 |
+
This is the equivalent of the Python expression: o1 -= o2. */
|
| 559 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2);
|
| 560 |
+
|
| 561 |
+
/* Returns the result of multiplying o1 by o2, possibly in-place, or NULL on
|
| 562 |
+
failure.
|
| 563 |
+
|
| 564 |
+
This is the equivalent of the Python expression: o1 *= o2. */
|
| 565 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2);
|
| 566 |
+
|
| 567 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
| 568 |
+
/* This is the equivalent of the Python expression: o1 @= o2. */
|
| 569 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2);
|
| 570 |
+
#endif
|
| 571 |
+
|
| 572 |
+
/* Returns the result of dividing o1 by o2 giving an integral result, possibly
|
| 573 |
+
in-place, or NULL on failure.
|
| 574 |
+
|
| 575 |
+
This is the equivalent of the Python expression: o1 /= o2. */
|
| 576 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
|
| 577 |
+
PyObject *o2);
|
| 578 |
+
|
| 579 |
+
/* Returns the result of dividing o1 by o2 giving a float result, possibly
|
| 580 |
+
in-place, or null on failure.
|
| 581 |
+
|
| 582 |
+
This is the equivalent of the Python expression: o1 /= o2. */
|
| 583 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
|
| 584 |
+
PyObject *o2);
|
| 585 |
+
|
| 586 |
+
/* Returns the remainder of dividing o1 by o2, possibly in-place, or NULL on
|
| 587 |
+
failure.
|
| 588 |
+
|
| 589 |
+
This is the equivalent of the Python expression: o1 %= o2. */
|
| 590 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2);
|
| 591 |
+
|
| 592 |
+
/* Returns the result of raising o1 to the power of o2, possibly in-place,
|
| 593 |
+
or NULL on failure.
|
| 594 |
+
|
| 595 |
+
This is the equivalent of the Python expression: o1 **= o2,
|
| 596 |
+
or o1 = pow(o1, o2, o3) if o3 is present. */
|
| 597 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
|
| 598 |
+
PyObject *o3);
|
| 599 |
+
|
| 600 |
+
/* Returns the result of left shifting o1 by o2, possibly in-place, or NULL
|
| 601 |
+
on failure.
|
| 602 |
+
|
| 603 |
+
This is the equivalent of the Python expression: o1 <<= o2. */
|
| 604 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2);
|
| 605 |
+
|
| 606 |
+
/* Returns the result of right shifting o1 by o2, possibly in-place or NULL
|
| 607 |
+
on failure.
|
| 608 |
+
|
| 609 |
+
This is the equivalent of the Python expression: o1 >>= o2. */
|
| 610 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2);
|
| 611 |
+
|
| 612 |
+
/* Returns the result of bitwise and of o1 and o2, possibly in-place, or NULL
|
| 613 |
+
on failure.
|
| 614 |
+
|
| 615 |
+
This is the equivalent of the Python expression: o1 &= o2. */
|
| 616 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2);
|
| 617 |
+
|
| 618 |
+
/* Returns the bitwise exclusive or of o1 by o2, possibly in-place, or NULL
|
| 619 |
+
on failure.
|
| 620 |
+
|
| 621 |
+
This is the equivalent of the Python expression: o1 ^= o2. */
|
| 622 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2);
|
| 623 |
+
|
| 624 |
+
/* Returns the result of bitwise or of o1 and o2, possibly in-place,
|
| 625 |
+
or NULL on failure.
|
| 626 |
+
|
| 627 |
+
This is the equivalent of the Python expression: o1 |= o2. */
|
| 628 |
+
PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2);
|
| 629 |
+
|
| 630 |
+
/* Returns the integer n converted to a string with a base, with a base
|
| 631 |
+
marker of 0b, 0o or 0x prefixed if applicable.
|
| 632 |
+
|
| 633 |
+
If n is not an int object, it is converted with PyNumber_Index first. */
|
| 634 |
+
PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base);
|
| 635 |
+
|
| 636 |
+
|
| 637 |
+
/* === Sequence protocol ================================================ */
|
| 638 |
+
|
| 639 |
+
/* Return 1 if the object provides sequence protocol, and zero
|
| 640 |
+
otherwise.
|
| 641 |
+
|
| 642 |
+
This function always succeeds. */
|
| 643 |
+
PyAPI_FUNC(int) PySequence_Check(PyObject *o);
|
| 644 |
+
|
| 645 |
+
/* Return the size of sequence object o, or -1 on failure. */
|
| 646 |
+
PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o);
|
| 647 |
+
|
| 648 |
+
/* For DLL compatibility */
|
| 649 |
+
#undef PySequence_Length
|
| 650 |
+
PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o);
|
| 651 |
+
#define PySequence_Length PySequence_Size
|
| 652 |
+
|
| 653 |
+
|
| 654 |
+
/* Return the concatenation of o1 and o2 on success, and NULL on failure.
|
| 655 |
+
|
| 656 |
+
This is the equivalent of the Python expression: o1 + o2. */
|
| 657 |
+
PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2);
|
| 658 |
+
|
| 659 |
+
/* Return the result of repeating sequence object 'o' 'count' times,
|
| 660 |
+
or NULL on failure.
|
| 661 |
+
|
| 662 |
+
This is the equivalent of the Python expression: o * count. */
|
| 663 |
+
PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count);
|
| 664 |
+
|
| 665 |
+
/* Return the ith element of o, or NULL on failure.
|
| 666 |
+
|
| 667 |
+
This is the equivalent of the Python expression: o[i]. */
|
| 668 |
+
PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i);
|
| 669 |
+
|
| 670 |
+
/* Return the slice of sequence object o between i1 and i2, or NULL on failure.
|
| 671 |
+
|
| 672 |
+
This is the equivalent of the Python expression: o[i1:i2]. */
|
| 673 |
+
PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2);
|
| 674 |
+
|
| 675 |
+
/* Assign object 'v' to the ith element of the sequence 'o'. Raise an exception
|
| 676 |
+
and return -1 on failure; return 0 on success.
|
| 677 |
+
|
| 678 |
+
This is the equivalent of the Python statement o[i] = v. */
|
| 679 |
+
PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v);
|
| 680 |
+
|
| 681 |
+
/* Delete the 'i'-th element of the sequence 'v'. Returns -1 on failure.
|
| 682 |
+
|
| 683 |
+
This is the equivalent of the Python statement: del o[i]. */
|
| 684 |
+
PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i);
|
| 685 |
+
|
| 686 |
+
/* Assign the sequence object 'v' to the slice in sequence object 'o',
|
| 687 |
+
from 'i1' to 'i2'. Returns -1 on failure.
|
| 688 |
+
|
| 689 |
+
This is the equivalent of the Python statement: o[i1:i2] = v. */
|
| 690 |
+
PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2,
|
| 691 |
+
PyObject *v);
|
| 692 |
+
|
| 693 |
+
/* Delete the slice in sequence object 'o' from 'i1' to 'i2'.
|
| 694 |
+
Returns -1 on failure.
|
| 695 |
+
|
| 696 |
+
This is the equivalent of the Python statement: del o[i1:i2]. */
|
| 697 |
+
PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2);
|
| 698 |
+
|
| 699 |
+
/* Returns the sequence 'o' as a tuple on success, and NULL on failure.
|
| 700 |
+
|
| 701 |
+
This is equivalent to the Python expression: tuple(o). */
|
| 702 |
+
PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o);
|
| 703 |
+
|
| 704 |
+
/* Returns the sequence 'o' as a list on success, and NULL on failure.
|
| 705 |
+
This is equivalent to the Python expression: list(o) */
|
| 706 |
+
PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o);
|
| 707 |
+
|
| 708 |
+
/* Return the sequence 'o' as a list, unless it's already a tuple or list.
|
| 709 |
+
|
| 710 |
+
Use PySequence_Fast_GET_ITEM to access the members of this list, and
|
| 711 |
+
PySequence_Fast_GET_SIZE to get its length.
|
| 712 |
+
|
| 713 |
+
Returns NULL on failure. If the object does not support iteration, raises a
|
| 714 |
+
TypeError exception with 'm' as the message text. */
|
| 715 |
+
PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
|
| 716 |
+
|
| 717 |
+
/* Return the size of the sequence 'o', assuming that 'o' was returned by
|
| 718 |
+
PySequence_Fast and is not NULL. */
|
| 719 |
+
#define PySequence_Fast_GET_SIZE(o) \
|
| 720 |
+
(PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o))
|
| 721 |
+
|
| 722 |
+
/* Return the 'i'-th element of the sequence 'o', assuming that o was returned
|
| 723 |
+
by PySequence_Fast, and that i is within bounds. */
|
| 724 |
+
#define PySequence_Fast_GET_ITEM(o, i)\
|
| 725 |
+
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
|
| 726 |
+
|
| 727 |
+
/* Return a pointer to the underlying item array for
|
| 728 |
+
an object returned by PySequence_Fast */
|
| 729 |
+
#define PySequence_Fast_ITEMS(sf) \
|
| 730 |
+
(PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \
|
| 731 |
+
: ((PyTupleObject *)(sf))->ob_item)
|
| 732 |
+
|
| 733 |
+
/* Return the number of occurrences on value on 'o', that is, return
|
| 734 |
+
the number of keys for which o[key] == value.
|
| 735 |
+
|
| 736 |
+
On failure, return -1. This is equivalent to the Python expression:
|
| 737 |
+
o.count(value). */
|
| 738 |
+
PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value);
|
| 739 |
+
|
| 740 |
+
/* Return 1 if 'ob' is in the sequence 'seq'; 0 if 'ob' is not in the sequence
|
| 741 |
+
'seq'; -1 on error.
|
| 742 |
+
|
| 743 |
+
Use __contains__ if possible, else _PySequence_IterSearch(). */
|
| 744 |
+
PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob);
|
| 745 |
+
|
| 746 |
+
/* For DLL-level backwards compatibility */
|
| 747 |
+
#undef PySequence_In
|
| 748 |
+
/* Determine if the sequence 'o' contains 'value'. If an item in 'o' is equal
|
| 749 |
+
to 'value', return 1, otherwise return 0. On error, return -1.
|
| 750 |
+
|
| 751 |
+
This is equivalent to the Python expression: value in o. */
|
| 752 |
+
PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value);
|
| 753 |
+
|
| 754 |
+
/* For source-level backwards compatibility */
|
| 755 |
+
#define PySequence_In PySequence_Contains
|
| 756 |
+
|
| 757 |
+
|
| 758 |
+
/* Return the first index for which o[i] == value.
|
| 759 |
+
On error, return -1.
|
| 760 |
+
|
| 761 |
+
This is equivalent to the Python expression: o.index(value). */
|
| 762 |
+
PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value);
|
| 763 |
+
|
| 764 |
+
|
| 765 |
+
/* --- In-place versions of some of the above Sequence functions --- */
|
| 766 |
+
|
| 767 |
+
/* Append sequence 'o2' to sequence 'o1', in-place when possible. Return the
|
| 768 |
+
resulting object, which could be 'o1', or NULL on failure.
|
| 769 |
+
|
| 770 |
+
This is the equivalent of the Python expression: o1 += o2. */
|
| 771 |
+
PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2);
|
| 772 |
+
|
| 773 |
+
/* Repeat sequence 'o' by 'count', in-place when possible. Return the resulting
|
| 774 |
+
object, which could be 'o', or NULL on failure.
|
| 775 |
+
|
| 776 |
+
This is the equivalent of the Python expression: o1 *= count. */
|
| 777 |
+
PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count);
|
| 778 |
+
|
| 779 |
+
|
| 780 |
+
/* === Mapping protocol ================================================= */
|
| 781 |
+
|
| 782 |
+
/* Return 1 if the object provides mapping protocol, and 0 otherwise.
|
| 783 |
+
|
| 784 |
+
This function always succeeds. */
|
| 785 |
+
PyAPI_FUNC(int) PyMapping_Check(PyObject *o);
|
| 786 |
+
|
| 787 |
+
/* Returns the number of keys in mapping object 'o' on success, and -1 on
|
| 788 |
+
failure. This is equivalent to the Python expression: len(o). */
|
| 789 |
+
PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o);
|
| 790 |
+
|
| 791 |
+
/* For DLL compatibility */
|
| 792 |
+
#undef PyMapping_Length
|
| 793 |
+
PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
|
| 794 |
+
#define PyMapping_Length PyMapping_Size
|
| 795 |
+
|
| 796 |
+
|
| 797 |
+
/* Implemented as a macro:
|
| 798 |
+
|
| 799 |
+
int PyMapping_DelItemString(PyObject *o, const char *key);
|
| 800 |
+
|
| 801 |
+
Remove the mapping for the string 'key' from the mapping 'o'. Returns -1 on
|
| 802 |
+
failure.
|
| 803 |
+
|
| 804 |
+
This is equivalent to the Python statement: del o[key]. */
|
| 805 |
+
#define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K))
|
| 806 |
+
|
| 807 |
+
/* Implemented as a macro:
|
| 808 |
+
|
| 809 |
+
int PyMapping_DelItem(PyObject *o, PyObject *key);
|
| 810 |
+
|
| 811 |
+
Remove the mapping for the object 'key' from the mapping object 'o'.
|
| 812 |
+
Returns -1 on failure.
|
| 813 |
+
|
| 814 |
+
This is equivalent to the Python statement: del o[key]. */
|
| 815 |
+
#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
|
| 816 |
+
|
| 817 |
+
/* On success, return 1 if the mapping object 'o' has the key 'key',
|
| 818 |
+
and 0 otherwise.
|
| 819 |
+
|
| 820 |
+
This is equivalent to the Python expression: key in o.
|
| 821 |
+
|
| 822 |
+
This function always succeeds. */
|
| 823 |
+
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key);
|
| 824 |
+
|
| 825 |
+
/* Return 1 if the mapping object has the key 'key', and 0 otherwise.
|
| 826 |
+
|
| 827 |
+
This is equivalent to the Python expression: key in o.
|
| 828 |
+
|
| 829 |
+
This function always succeeds. */
|
| 830 |
+
PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key);
|
| 831 |
+
|
| 832 |
+
/* On success, return a list or tuple of the keys in mapping object 'o'.
|
| 833 |
+
On failure, return NULL. */
|
| 834 |
+
PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o);
|
| 835 |
+
|
| 836 |
+
/* On success, return a list or tuple of the values in mapping object 'o'.
|
| 837 |
+
On failure, return NULL. */
|
| 838 |
+
PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o);
|
| 839 |
+
|
| 840 |
+
/* On success, return a list or tuple of the items in mapping object 'o',
|
| 841 |
+
where each item is a tuple containing a key-value pair. On failure, return
|
| 842 |
+
NULL. */
|
| 843 |
+
PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o);
|
| 844 |
+
|
| 845 |
+
/* Return element of 'o' corresponding to the string 'key' or NULL on failure.
|
| 846 |
+
|
| 847 |
+
This is the equivalent of the Python expression: o[key]. */
|
| 848 |
+
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o,
|
| 849 |
+
const char *key);
|
| 850 |
+
|
| 851 |
+
/* Map the string 'key' to the value 'v' in the mapping 'o'.
|
| 852 |
+
Returns -1 on failure.
|
| 853 |
+
|
| 854 |
+
This is the equivalent of the Python statement: o[key]=v. */
|
| 855 |
+
PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key,
|
| 856 |
+
PyObject *value);
|
| 857 |
+
|
| 858 |
+
/* isinstance(object, typeorclass) */
|
| 859 |
+
PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass);
|
| 860 |
+
|
| 861 |
+
/* issubclass(object, typeorclass) */
|
| 862 |
+
PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass);
|
| 863 |
+
|
| 864 |
+
#ifndef Py_LIMITED_API
|
| 865 |
+
# define Py_CPYTHON_ABSTRACTOBJECT_H
|
| 866 |
+
# include "cpython/abstract.h"
|
| 867 |
+
# undef Py_CPYTHON_ABSTRACTOBJECT_H
|
| 868 |
+
#endif
|
| 869 |
+
|
| 870 |
+
#ifdef __cplusplus
|
| 871 |
+
}
|
| 872 |
+
#endif
|
| 873 |
+
#endif /* Py_ABSTRACTOBJECT_H */
|
evalkit_llava/include/python3.10/bltinmodule.h
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_BLTINMODULE_H
|
| 2 |
+
#define Py_BLTINMODULE_H
|
| 3 |
+
#ifdef __cplusplus
|
| 4 |
+
extern "C" {
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
PyAPI_DATA(PyTypeObject) PyFilter_Type;
|
| 8 |
+
PyAPI_DATA(PyTypeObject) PyMap_Type;
|
| 9 |
+
PyAPI_DATA(PyTypeObject) PyZip_Type;
|
| 10 |
+
|
| 11 |
+
#ifdef __cplusplus
|
| 12 |
+
}
|
| 13 |
+
#endif
|
| 14 |
+
#endif /* !Py_BLTINMODULE_H */
|
evalkit_llava/include/python3.10/bytearrayobject.h
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ByteArray object interface */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_BYTEARRAYOBJECT_H
|
| 4 |
+
#define Py_BYTEARRAYOBJECT_H
|
| 5 |
+
#ifdef __cplusplus
|
| 6 |
+
extern "C" {
|
| 7 |
+
#endif
|
| 8 |
+
|
| 9 |
+
#include <stdarg.h>
|
| 10 |
+
|
| 11 |
+
/* Type PyByteArrayObject represents a mutable array of bytes.
|
| 12 |
+
* The Python API is that of a sequence;
|
| 13 |
+
* the bytes are mapped to ints in [0, 256).
|
| 14 |
+
* Bytes are not characters; they may be used to encode characters.
|
| 15 |
+
* The only way to go between bytes and str/unicode is via encoding
|
| 16 |
+
* and decoding.
|
| 17 |
+
* For the convenience of C programmers, the bytes type is considered
|
| 18 |
+
* to contain a char pointer, not an unsigned char pointer.
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
/* Type object */
|
| 22 |
+
PyAPI_DATA(PyTypeObject) PyByteArray_Type;
|
| 23 |
+
PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
|
| 24 |
+
|
| 25 |
+
/* Type check macros */
|
| 26 |
+
#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
|
| 27 |
+
#define PyByteArray_CheckExact(self) Py_IS_TYPE(self, &PyByteArray_Type)
|
| 28 |
+
|
| 29 |
+
/* Direct API functions */
|
| 30 |
+
PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);
|
| 31 |
+
PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *);
|
| 32 |
+
PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t);
|
| 33 |
+
PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *);
|
| 34 |
+
PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *);
|
| 35 |
+
PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
|
| 36 |
+
|
| 37 |
+
#ifndef Py_LIMITED_API
|
| 38 |
+
# define Py_CPYTHON_BYTEARRAYOBJECT_H
|
| 39 |
+
# include "cpython/bytearrayobject.h"
|
| 40 |
+
# undef Py_CPYTHON_BYTEARRAYOBJECT_H
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
#ifdef __cplusplus
|
| 44 |
+
}
|
| 45 |
+
#endif
|
| 46 |
+
#endif /* !Py_BYTEARRAYOBJECT_H */
|
evalkit_llava/include/python3.10/bytesobject.h
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* Bytes object interface */
|
| 3 |
+
|
| 4 |
+
#ifndef Py_BYTESOBJECT_H
|
| 5 |
+
#define Py_BYTESOBJECT_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <stdarg.h>
|
| 11 |
+
|
| 12 |
+
/*
|
| 13 |
+
Type PyBytesObject represents a byte string. An extra zero byte is
|
| 14 |
+
reserved at the end to ensure it is zero-terminated, but a size is
|
| 15 |
+
present so strings with null bytes in them can be represented. This
|
| 16 |
+
is an immutable object type.
|
| 17 |
+
|
| 18 |
+
There are functions to create new bytes objects, to test
|
| 19 |
+
an object for bytes-ness, and to get the
|
| 20 |
+
byte string value. The latter function returns a null pointer
|
| 21 |
+
if the object is not of the proper type.
|
| 22 |
+
There is a variant that takes an explicit size as well as a
|
| 23 |
+
variant that assumes a zero-terminated string. Note that none of the
|
| 24 |
+
functions should be applied to NULL pointer.
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
PyAPI_DATA(PyTypeObject) PyBytes_Type;
|
| 28 |
+
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
|
| 29 |
+
|
| 30 |
+
#define PyBytes_Check(op) \
|
| 31 |
+
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
|
| 32 |
+
#define PyBytes_CheckExact(op) Py_IS_TYPE(op, &PyBytes_Type)
|
| 33 |
+
|
| 34 |
+
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
|
| 35 |
+
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
|
| 36 |
+
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
|
| 37 |
+
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
|
| 38 |
+
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
|
| 39 |
+
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
|
| 40 |
+
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
| 41 |
+
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
|
| 42 |
+
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
|
| 43 |
+
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
|
| 44 |
+
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
|
| 45 |
+
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
|
| 46 |
+
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
|
| 47 |
+
const char *, Py_ssize_t,
|
| 48 |
+
const char *);
|
| 49 |
+
|
| 50 |
+
/* Provides access to the internal data buffer and size of a bytes object.
|
| 51 |
+
Passing NULL as len parameter will force the string buffer to be
|
| 52 |
+
0-terminated (passing a string with embedded NUL characters will
|
| 53 |
+
cause an exception). */
|
| 54 |
+
PyAPI_FUNC(int) PyBytes_AsStringAndSize(
|
| 55 |
+
PyObject *obj, /* bytes object */
|
| 56 |
+
char **s, /* pointer to buffer variable */
|
| 57 |
+
Py_ssize_t *len /* pointer to length variable or NULL */
|
| 58 |
+
);
|
| 59 |
+
|
| 60 |
+
#ifndef Py_LIMITED_API
|
| 61 |
+
# define Py_CPYTHON_BYTESOBJECT_H
|
| 62 |
+
# include "cpython/bytesobject.h"
|
| 63 |
+
# undef Py_CPYTHON_BYTESOBJECT_H
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#ifdef __cplusplus
|
| 67 |
+
}
|
| 68 |
+
#endif
|
| 69 |
+
#endif /* !Py_BYTESOBJECT_H */
|
evalkit_llava/include/python3.10/classobject.h
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Former class object interface -- now only bound methods are here */
|
| 2 |
+
|
| 3 |
+
/* Revealing some structures (not for general use) */
|
| 4 |
+
|
| 5 |
+
#ifndef Py_LIMITED_API
|
| 6 |
+
#ifndef Py_CLASSOBJECT_H
|
| 7 |
+
#define Py_CLASSOBJECT_H
|
| 8 |
+
#ifdef __cplusplus
|
| 9 |
+
extern "C" {
|
| 10 |
+
#endif
|
| 11 |
+
|
| 12 |
+
typedef struct {
|
| 13 |
+
PyObject_HEAD
|
| 14 |
+
PyObject *im_func; /* The callable object implementing the method */
|
| 15 |
+
PyObject *im_self; /* The instance it is bound to */
|
| 16 |
+
PyObject *im_weakreflist; /* List of weak references */
|
| 17 |
+
vectorcallfunc vectorcall;
|
| 18 |
+
} PyMethodObject;
|
| 19 |
+
|
| 20 |
+
PyAPI_DATA(PyTypeObject) PyMethod_Type;
|
| 21 |
+
|
| 22 |
+
#define PyMethod_Check(op) Py_IS_TYPE(op, &PyMethod_Type)
|
| 23 |
+
|
| 24 |
+
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
|
| 25 |
+
|
| 26 |
+
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
| 27 |
+
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
| 28 |
+
|
| 29 |
+
/* Macros for direct access to these values. Type checks are *not*
|
| 30 |
+
done, so use with care. */
|
| 31 |
+
#define PyMethod_GET_FUNCTION(meth) \
|
| 32 |
+
(((PyMethodObject *)meth) -> im_func)
|
| 33 |
+
#define PyMethod_GET_SELF(meth) \
|
| 34 |
+
(((PyMethodObject *)meth) -> im_self)
|
| 35 |
+
|
| 36 |
+
typedef struct {
|
| 37 |
+
PyObject_HEAD
|
| 38 |
+
PyObject *func;
|
| 39 |
+
} PyInstanceMethodObject;
|
| 40 |
+
|
| 41 |
+
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
|
| 42 |
+
|
| 43 |
+
#define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type)
|
| 44 |
+
|
| 45 |
+
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
|
| 46 |
+
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
|
| 47 |
+
|
| 48 |
+
/* Macros for direct access to these values. Type checks are *not*
|
| 49 |
+
done, so use with care. */
|
| 50 |
+
#define PyInstanceMethod_GET_FUNCTION(meth) \
|
| 51 |
+
(((PyInstanceMethodObject *)meth) -> func)
|
| 52 |
+
|
| 53 |
+
#ifdef __cplusplus
|
| 54 |
+
}
|
| 55 |
+
#endif
|
| 56 |
+
#endif /* !Py_CLASSOBJECT_H */
|
| 57 |
+
#endif /* Py_LIMITED_API */
|
evalkit_llava/include/python3.10/code.h
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Definitions for bytecode */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_CODE_H
|
| 4 |
+
#define Py_CODE_H
|
| 5 |
+
#ifdef __cplusplus
|
| 6 |
+
extern "C" {
|
| 7 |
+
#endif
|
| 8 |
+
|
| 9 |
+
typedef struct PyCodeObject PyCodeObject;
|
| 10 |
+
|
| 11 |
+
#ifndef Py_LIMITED_API
|
| 12 |
+
# define Py_CPYTHON_CODE_H
|
| 13 |
+
# include "cpython/code.h"
|
| 14 |
+
# undef Py_CPYTHON_CODE_H
|
| 15 |
+
#endif
|
| 16 |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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CODECREGISTRY_H
|
| 2 |
+
#define Py_CODECREGISTRY_H
|
| 3 |
+
#ifdef __cplusplus
|
| 4 |
+
extern "C" {
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
/* ------------------------------------------------------------------------
|
| 8 |
+
|
| 9 |
+
Python Codec Registry and support functions
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
Written by Marc-Andre Lemburg ([email protected]).
|
| 13 |
+
|
| 14 |
+
Copyright (c) Corporation for National Research Initiatives.
|
| 15 |
+
|
| 16 |
+
------------------------------------------------------------------------ */
|
| 17 |
+
|
| 18 |
+
/* Register a new codec search function.
|
| 19 |
+
|
| 20 |
+
As side effect, this tries to load the encodings package, if not
|
| 21 |
+
yet done, to make sure that it is always first in the list of
|
| 22 |
+
search functions.
|
| 23 |
+
|
| 24 |
+
The search_function's refcount is incremented by this function. */
|
| 25 |
+
|
| 26 |
+
PyAPI_FUNC(int) PyCodec_Register(
|
| 27 |
+
PyObject *search_function
|
| 28 |
+
);
|
| 29 |
+
|
| 30 |
+
/* Unregister a codec search function and clear the registry's cache.
|
| 31 |
+
If the search function is not registered, do nothing.
|
| 32 |
+
Return 0 on success. Raise an exception and return -1 on error. */
|
| 33 |
+
|
| 34 |
+
PyAPI_FUNC(int) PyCodec_Unregister(
|
| 35 |
+
PyObject *search_function
|
| 36 |
+
);
|
| 37 |
+
|
| 38 |
+
/* Codec registry lookup API.
|
| 39 |
+
|
| 40 |
+
Looks up the given encoding and returns a CodecInfo object with
|
| 41 |
+
function attributes which implement the different aspects of
|
| 42 |
+
processing the encoding.
|
| 43 |
+
|
| 44 |
+
The encoding string is looked up converted to all lower-case
|
| 45 |
+
characters. This makes encodings looked up through this mechanism
|
| 46 |
+
effectively case-insensitive.
|
| 47 |
+
|
| 48 |
+
If no codec is found, a KeyError is set and NULL returned.
|
| 49 |
+
|
| 50 |
+
As side effect, this tries to load the encodings package, if not
|
| 51 |
+
yet done. This is part of the lazy load strategy for the encodings
|
| 52 |
+
package.
|
| 53 |
+
|
| 54 |
+
*/
|
| 55 |
+
|
| 56 |
+
#ifndef Py_LIMITED_API
|
| 57 |
+
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
|
| 58 |
+
const char *encoding
|
| 59 |
+
);
|
| 60 |
+
|
| 61 |
+
PyAPI_FUNC(int) _PyCodec_Forget(
|
| 62 |
+
const char *encoding
|
| 63 |
+
);
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
/* Codec registry encoding check API.
|
| 67 |
+
|
| 68 |
+
Returns 1/0 depending on whether there is a registered codec for
|
| 69 |
+
the given encoding.
|
| 70 |
+
|
| 71 |
+
*/
|
| 72 |
+
|
| 73 |
+
PyAPI_FUNC(int) PyCodec_KnownEncoding(
|
| 74 |
+
const char *encoding
|
| 75 |
+
);
|
| 76 |
+
|
| 77 |
+
/* Generic codec based encoding API.
|
| 78 |
+
|
| 79 |
+
object is passed through the encoder function found for the given
|
| 80 |
+
encoding using the error handling method defined by errors. errors
|
| 81 |
+
may be NULL to use the default method defined for the codec.
|
| 82 |
+
|
| 83 |
+
Raises a LookupError in case no encoder can be found.
|
| 84 |
+
|
| 85 |
+
*/
|
| 86 |
+
|
| 87 |
+
PyAPI_FUNC(PyObject *) PyCodec_Encode(
|
| 88 |
+
PyObject *object,
|
| 89 |
+
const char *encoding,
|
| 90 |
+
const char *errors
|
| 91 |
+
);
|
| 92 |
+
|
| 93 |
+
/* Generic codec based decoding API.
|
| 94 |
+
|
| 95 |
+
object is passed through the decoder function found for the given
|
| 96 |
+
encoding using the error handling method defined by errors. errors
|
| 97 |
+
may be NULL to use the default method defined for the codec.
|
| 98 |
+
|
| 99 |
+
Raises a LookupError in case no encoder can be found.
|
| 100 |
+
|
| 101 |
+
*/
|
| 102 |
+
|
| 103 |
+
PyAPI_FUNC(PyObject *) PyCodec_Decode(
|
| 104 |
+
PyObject *object,
|
| 105 |
+
const char *encoding,
|
| 106 |
+
const char *errors
|
| 107 |
+
);
|
| 108 |
+
|
| 109 |
+
#ifndef Py_LIMITED_API
|
| 110 |
+
/* Text codec specific encoding and decoding API.
|
| 111 |
+
|
| 112 |
+
Checks the encoding against a list of codecs which do not
|
| 113 |
+
implement a str<->bytes encoding before attempting the
|
| 114 |
+
operation.
|
| 115 |
+
|
| 116 |
+
Please note that these APIs are internal and should not
|
| 117 |
+
be used in Python C extensions.
|
| 118 |
+
|
| 119 |
+
XXX (ncoghlan): should we make these, or something like them, public
|
| 120 |
+
in Python 3.5+?
|
| 121 |
+
|
| 122 |
+
*/
|
| 123 |
+
PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
|
| 124 |
+
const char *encoding,
|
| 125 |
+
const char *alternate_command
|
| 126 |
+
);
|
| 127 |
+
|
| 128 |
+
PyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
|
| 129 |
+
PyObject *object,
|
| 130 |
+
const char *encoding,
|
| 131 |
+
const char *errors
|
| 132 |
+
);
|
| 133 |
+
|
| 134 |
+
PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
|
| 135 |
+
PyObject *object,
|
| 136 |
+
const char *encoding,
|
| 137 |
+
const char *errors
|
| 138 |
+
);
|
| 139 |
+
|
| 140 |
+
/* These two aren't actually text encoding specific, but _io.TextIOWrapper
|
| 141 |
+
* is the only current API consumer.
|
| 142 |
+
*/
|
| 143 |
+
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
|
| 144 |
+
PyObject *codec_info,
|
| 145 |
+
const char *errors
|
| 146 |
+
);
|
| 147 |
+
|
| 148 |
+
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
|
| 149 |
+
PyObject *codec_info,
|
| 150 |
+
const char *errors
|
| 151 |
+
);
|
| 152 |
+
#endif
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
/* --- Codec Lookup APIs --------------------------------------------------
|
| 157 |
+
|
| 158 |
+
All APIs return a codec object with incremented refcount and are
|
| 159 |
+
based on _PyCodec_Lookup(). The same comments w/r to the encoding
|
| 160 |
+
name also apply to these APIs.
|
| 161 |
+
|
| 162 |
+
*/
|
| 163 |
+
|
| 164 |
+
/* Get an encoder function for the given encoding. */
|
| 165 |
+
|
| 166 |
+
PyAPI_FUNC(PyObject *) PyCodec_Encoder(
|
| 167 |
+
const char *encoding
|
| 168 |
+
);
|
| 169 |
+
|
| 170 |
+
/* Get a decoder function for the given encoding. */
|
| 171 |
+
|
| 172 |
+
PyAPI_FUNC(PyObject *) PyCodec_Decoder(
|
| 173 |
+
const char *encoding
|
| 174 |
+
);
|
| 175 |
+
|
| 176 |
+
/* Get an IncrementalEncoder object for the given encoding. */
|
| 177 |
+
|
| 178 |
+
PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
|
| 179 |
+
const char *encoding,
|
| 180 |
+
const char *errors
|
| 181 |
+
);
|
| 182 |
+
|
| 183 |
+
/* Get an IncrementalDecoder object function for the given encoding. */
|
| 184 |
+
|
| 185 |
+
PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
|
| 186 |
+
const char *encoding,
|
| 187 |
+
const char *errors
|
| 188 |
+
);
|
| 189 |
+
|
| 190 |
+
/* Get a StreamReader factory function for the given encoding. */
|
| 191 |
+
|
| 192 |
+
PyAPI_FUNC(PyObject *) PyCodec_StreamReader(
|
| 193 |
+
const char *encoding,
|
| 194 |
+
PyObject *stream,
|
| 195 |
+
const char *errors
|
| 196 |
+
);
|
| 197 |
+
|
| 198 |
+
/* Get a StreamWriter factory function for the given encoding. */
|
| 199 |
+
|
| 200 |
+
PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
|
| 201 |
+
const char *encoding,
|
| 202 |
+
PyObject *stream,
|
| 203 |
+
const char *errors
|
| 204 |
+
);
|
| 205 |
+
|
| 206 |
+
/* Unicode encoding error handling callback registry API */
|
| 207 |
+
|
| 208 |
+
/* Register the error handling callback function error under the given
|
| 209 |
+
name. This function will be called by the codec when it encounters
|
| 210 |
+
unencodable characters/undecodable bytes and doesn't know the
|
| 211 |
+
callback name, when name is specified as the error parameter
|
| 212 |
+
in the call to the encode/decode function.
|
| 213 |
+
Return 0 on success, -1 on error */
|
| 214 |
+
PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);
|
| 215 |
+
|
| 216 |
+
/* Lookup the error handling callback function registered under the given
|
| 217 |
+
name. As a special case NULL can be passed, in which case
|
| 218 |
+
the error handling callback for "strict" will be returned. */
|
| 219 |
+
PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);
|
| 220 |
+
|
| 221 |
+
/* raise exc as an exception */
|
| 222 |
+
PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);
|
| 223 |
+
|
| 224 |
+
/* ignore the unicode error, skipping the faulty input */
|
| 225 |
+
PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
|
| 226 |
+
|
| 227 |
+
/* replace the unicode encode error with ? or U+FFFD */
|
| 228 |
+
PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
|
| 229 |
+
|
| 230 |
+
/* replace the unicode encode error with XML character references */
|
| 231 |
+
PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
|
| 232 |
+
|
| 233 |
+
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
|
| 234 |
+
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
|
| 235 |
+
|
| 236 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
| 237 |
+
/* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */
|
| 238 |
+
PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc);
|
| 239 |
+
#endif
|
| 240 |
+
|
| 241 |
+
#ifndef Py_LIMITED_API
|
| 242 |
+
PyAPI_DATA(const char *) Py_hexdigits;
|
| 243 |
+
#endif
|
| 244 |
+
|
| 245 |
+
#ifdef __cplusplus
|
| 246 |
+
}
|
| 247 |
+
#endif
|
| 248 |
+
#endif /* !Py_CODECREGISTRY_H */
|
evalkit_llava/include/python3.10/compile.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_COMPILE_H
|
| 2 |
+
#define Py_COMPILE_H
|
| 3 |
+
#ifdef __cplusplus
|
| 4 |
+
extern "C" {
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
/* These definitions must match corresponding definitions in graminit.h. */
|
| 8 |
+
#define Py_single_input 256
|
| 9 |
+
#define Py_file_input 257
|
| 10 |
+
#define Py_eval_input 258
|
| 11 |
+
#define Py_func_type_input 345
|
| 12 |
+
|
| 13 |
+
/* This doesn't need to match anything */
|
| 14 |
+
#define Py_fstring_input 800
|
| 15 |
+
|
| 16 |
+
#ifndef Py_LIMITED_API
|
| 17 |
+
# define Py_CPYTHON_COMPILE_H
|
| 18 |
+
# include "cpython/compile.h"
|
| 19 |
+
# undef Py_CPYTHON_COMPILE_H
|
| 20 |
+
#endif
|
| 21 |
+
|
| 22 |
+
#ifdef __cplusplus
|
| 23 |
+
}
|
| 24 |
+
#endif
|
| 25 |
+
#endif /* !Py_COMPILE_H */
|
evalkit_llava/include/python3.10/complexobject.h
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Complex number structure */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_COMPLEXOBJECT_H
|
| 4 |
+
#define Py_COMPLEXOBJECT_H
|
| 5 |
+
#ifdef __cplusplus
|
| 6 |
+
extern "C" {
|
| 7 |
+
#endif
|
| 8 |
+
|
| 9 |
+
#ifndef Py_LIMITED_API
|
| 10 |
+
typedef struct {
|
| 11 |
+
double real;
|
| 12 |
+
double imag;
|
| 13 |
+
} Py_complex;
|
| 14 |
+
|
| 15 |
+
/* Operations on complex numbers from complexmodule.c */
|
| 16 |
+
|
| 17 |
+
PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
|
| 18 |
+
PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
|
| 19 |
+
PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
|
| 20 |
+
PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex);
|
| 21 |
+
PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex);
|
| 22 |
+
PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex);
|
| 23 |
+
PyAPI_FUNC(double) _Py_c_abs(Py_complex);
|
| 24 |
+
#endif
|
| 25 |
+
|
| 26 |
+
/* Complex object interface */
|
| 27 |
+
|
| 28 |
+
/*
|
| 29 |
+
PyComplexObject represents a complex number with double-precision
|
| 30 |
+
real and imaginary parts.
|
| 31 |
+
*/
|
| 32 |
+
#ifndef Py_LIMITED_API
|
| 33 |
+
typedef struct {
|
| 34 |
+
PyObject_HEAD
|
| 35 |
+
Py_complex cval;
|
| 36 |
+
} PyComplexObject;
|
| 37 |
+
#endif
|
| 38 |
+
|
| 39 |
+
PyAPI_DATA(PyTypeObject) PyComplex_Type;
|
| 40 |
+
|
| 41 |
+
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
|
| 42 |
+
#define PyComplex_CheckExact(op) Py_IS_TYPE(op, &PyComplex_Type)
|
| 43 |
+
|
| 44 |
+
#ifndef Py_LIMITED_API
|
| 45 |
+
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
|
| 46 |
+
#endif
|
| 47 |
+
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
|
| 48 |
+
|
| 49 |
+
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
|
| 50 |
+
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
|
| 51 |
+
#ifndef Py_LIMITED_API
|
| 52 |
+
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
|
| 53 |
+
#endif
|
| 54 |
+
|
| 55 |
+
/* Format the object based on the format_spec, as defined in PEP 3101
|
| 56 |
+
(Advanced String Formatting). */
|
| 57 |
+
#ifndef Py_LIMITED_API
|
| 58 |
+
PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter(
|
| 59 |
+
_PyUnicodeWriter *writer,
|
| 60 |
+
PyObject *obj,
|
| 61 |
+
PyObject *format_spec,
|
| 62 |
+
Py_ssize_t start,
|
| 63 |
+
Py_ssize_t end);
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#ifdef __cplusplus
|
| 67 |
+
}
|
| 68 |
+
#endif
|
| 69 |
+
#endif /* !Py_COMPLEXOBJECT_H */
|
evalkit_llava/include/python3.10/context.h
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CONTEXT_H
|
| 2 |
+
#define Py_CONTEXT_H
|
| 3 |
+
#ifdef __cplusplus
|
| 4 |
+
extern "C" {
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
#ifndef Py_LIMITED_API
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
PyAPI_DATA(PyTypeObject) PyContext_Type;
|
| 11 |
+
typedef struct _pycontextobject PyContext;
|
| 12 |
+
|
| 13 |
+
PyAPI_DATA(PyTypeObject) PyContextVar_Type;
|
| 14 |
+
typedef struct _pycontextvarobject PyContextVar;
|
| 15 |
+
|
| 16 |
+
PyAPI_DATA(PyTypeObject) PyContextToken_Type;
|
| 17 |
+
typedef struct _pycontexttokenobject PyContextToken;
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#define PyContext_CheckExact(o) Py_IS_TYPE(o, &PyContext_Type)
|
| 21 |
+
#define PyContextVar_CheckExact(o) Py_IS_TYPE(o, &PyContextVar_Type)
|
| 22 |
+
#define PyContextToken_CheckExact(o) Py_IS_TYPE(o, &PyContextToken_Type)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
PyAPI_FUNC(PyObject *) PyContext_New(void);
|
| 26 |
+
PyAPI_FUNC(PyObject *) PyContext_Copy(PyObject *);
|
| 27 |
+
PyAPI_FUNC(PyObject *) PyContext_CopyCurrent(void);
|
| 28 |
+
|
| 29 |
+
PyAPI_FUNC(int) PyContext_Enter(PyObject *);
|
| 30 |
+
PyAPI_FUNC(int) PyContext_Exit(PyObject *);
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
/* Create a new context variable.
|
| 34 |
+
|
| 35 |
+
default_value can be NULL.
|
| 36 |
+
*/
|
| 37 |
+
PyAPI_FUNC(PyObject *) PyContextVar_New(
|
| 38 |
+
const char *name, PyObject *default_value);
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
/* Get a value for the variable.
|
| 42 |
+
|
| 43 |
+
Returns -1 if an error occurred during lookup.
|
| 44 |
+
|
| 45 |
+
Returns 0 if value either was or was not found.
|
| 46 |
+
|
| 47 |
+
If value was found, *value will point to it.
|
| 48 |
+
If not, it will point to:
|
| 49 |
+
|
| 50 |
+
- default_value, if not NULL;
|
| 51 |
+
- the default value of "var", if not NULL;
|
| 52 |
+
- NULL.
|
| 53 |
+
|
| 54 |
+
'*value' will be a new ref, if not NULL.
|
| 55 |
+
*/
|
| 56 |
+
PyAPI_FUNC(int) PyContextVar_Get(
|
| 57 |
+
PyObject *var, PyObject *default_value, PyObject **value);
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
/* Set a new value for the variable.
|
| 61 |
+
Returns NULL if an error occurs.
|
| 62 |
+
*/
|
| 63 |
+
PyAPI_FUNC(PyObject *) PyContextVar_Set(PyObject *var, PyObject *value);
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
/* Reset a variable to its previous value.
|
| 67 |
+
Returns 0 on success, -1 on error.
|
| 68 |
+
*/
|
| 69 |
+
PyAPI_FUNC(int) PyContextVar_Reset(PyObject *var, PyObject *token);
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
/* This method is exposed only for CPython tests. Don not use it. */
|
| 73 |
+
PyAPI_FUNC(PyObject *) _PyContext_NewHamtForTests(void);
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
#endif /* !Py_LIMITED_API */
|
| 77 |
+
|
| 78 |
+
#ifdef __cplusplus
|
| 79 |
+
}
|
| 80 |
+
#endif
|
| 81 |
+
#endif /* !Py_CONTEXT_H */
|
evalkit_llava/include/python3.10/cpython/abstract.h
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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py_CPYTHON_ABSTRACTOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* === Object Protocol ================================================== */
|
| 6 |
+
|
| 7 |
+
#ifdef PY_SSIZE_T_CLEAN
|
| 8 |
+
# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT
|
| 9 |
+
#endif
|
| 10 |
+
|
| 11 |
+
/* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple)
|
| 12 |
+
format to a Python dictionary ("kwargs" dict).
|
| 13 |
+
|
| 14 |
+
The type of kwnames keys is not checked. The final function getting
|
| 15 |
+
arguments is responsible to check if all keys are strings, for example using
|
| 16 |
+
PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments().
|
| 17 |
+
|
| 18 |
+
Duplicate keys are merged using the last value. If duplicate keys must raise
|
| 19 |
+
an exception, the caller is responsible to implement an explicit keys on
|
| 20 |
+
kwnames. */
|
| 21 |
+
PyAPI_FUNC(PyObject *) _PyStack_AsDict(
|
| 22 |
+
PyObject *const *values,
|
| 23 |
+
PyObject *kwnames);
|
| 24 |
+
|
| 25 |
+
/* Suggested size (number of positional arguments) for arrays of PyObject*
|
| 26 |
+
allocated on a C stack to avoid allocating memory on the heap memory. Such
|
| 27 |
+
array is used to pass positional arguments to call functions of the
|
| 28 |
+
PyObject_Vectorcall() family.
|
| 29 |
+
|
| 30 |
+
The size is chosen to not abuse the C stack and so limit the risk of stack
|
| 31 |
+
overflow. The size is also chosen to allow using the small stack for most
|
| 32 |
+
function calls of the Python standard library. On 64-bit CPU, it allocates
|
| 33 |
+
40 bytes on the stack. */
|
| 34 |
+
#define _PY_FASTCALL_SMALL_STACK 5
|
| 35 |
+
|
| 36 |
+
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(
|
| 37 |
+
PyThreadState *tstate,
|
| 38 |
+
PyObject *callable,
|
| 39 |
+
PyObject *result,
|
| 40 |
+
const char *where);
|
| 41 |
+
|
| 42 |
+
/* === Vectorcall protocol (PEP 590) ============================= */
|
| 43 |
+
|
| 44 |
+
/* Call callable using tp_call. Arguments are like PyObject_Vectorcall()
|
| 45 |
+
or PyObject_FastCallDict() (both forms are supported),
|
| 46 |
+
except that nargs is plainly the number of arguments without flags. */
|
| 47 |
+
PyAPI_FUNC(PyObject *) _PyObject_MakeTpCall(
|
| 48 |
+
PyThreadState *tstate,
|
| 49 |
+
PyObject *callable,
|
| 50 |
+
PyObject *const *args, Py_ssize_t nargs,
|
| 51 |
+
PyObject *keywords);
|
| 52 |
+
|
| 53 |
+
#define PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
|
| 54 |
+
|
| 55 |
+
static inline Py_ssize_t
|
| 56 |
+
PyVectorcall_NARGS(size_t n)
|
| 57 |
+
{
|
| 58 |
+
return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
static inline vectorcallfunc
|
| 62 |
+
PyVectorcall_Function(PyObject *callable)
|
| 63 |
+
{
|
| 64 |
+
PyTypeObject *tp;
|
| 65 |
+
Py_ssize_t offset;
|
| 66 |
+
vectorcallfunc ptr;
|
| 67 |
+
|
| 68 |
+
assert(callable != NULL);
|
| 69 |
+
tp = Py_TYPE(callable);
|
| 70 |
+
if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
|
| 71 |
+
return NULL;
|
| 72 |
+
}
|
| 73 |
+
assert(PyCallable_Check(callable));
|
| 74 |
+
offset = tp->tp_vectorcall_offset;
|
| 75 |
+
assert(offset > 0);
|
| 76 |
+
memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
|
| 77 |
+
return ptr;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/* Call the callable object 'callable' with the "vectorcall" calling
|
| 81 |
+
convention.
|
| 82 |
+
|
| 83 |
+
args is a C array for positional arguments.
|
| 84 |
+
|
| 85 |
+
nargsf is the number of positional arguments plus optionally the flag
|
| 86 |
+
PY_VECTORCALL_ARGUMENTS_OFFSET which means that the caller is allowed to
|
| 87 |
+
modify args[-1].
|
| 88 |
+
|
| 89 |
+
kwnames is a tuple of keyword names. The values of the keyword arguments
|
| 90 |
+
are stored in "args" after the positional arguments (note that the number
|
| 91 |
+
of keyword arguments does not change nargsf). kwnames can also be NULL if
|
| 92 |
+
there are no keyword arguments.
|
| 93 |
+
|
| 94 |
+
keywords must only contain strings and all keys must be unique.
|
| 95 |
+
|
| 96 |
+
Return the result on success. Raise an exception and return NULL on
|
| 97 |
+
error. */
|
| 98 |
+
static inline PyObject *
|
| 99 |
+
_PyObject_VectorcallTstate(PyThreadState *tstate, PyObject *callable,
|
| 100 |
+
PyObject *const *args, size_t nargsf,
|
| 101 |
+
PyObject *kwnames)
|
| 102 |
+
{
|
| 103 |
+
vectorcallfunc func;
|
| 104 |
+
PyObject *res;
|
| 105 |
+
|
| 106 |
+
assert(kwnames == NULL || PyTuple_Check(kwnames));
|
| 107 |
+
assert(args != NULL || PyVectorcall_NARGS(nargsf) == 0);
|
| 108 |
+
|
| 109 |
+
func = PyVectorcall_Function(callable);
|
| 110 |
+
if (func == NULL) {
|
| 111 |
+
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
|
| 112 |
+
return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwnames);
|
| 113 |
+
}
|
| 114 |
+
res = func(callable, args, nargsf, kwnames);
|
| 115 |
+
return _Py_CheckFunctionResult(tstate, callable, res, NULL);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
static inline PyObject *
|
| 119 |
+
PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
|
| 120 |
+
size_t nargsf, PyObject *kwnames)
|
| 121 |
+
{
|
| 122 |
+
PyThreadState *tstate = PyThreadState_Get();
|
| 123 |
+
return _PyObject_VectorcallTstate(tstate, callable,
|
| 124 |
+
args, nargsf, kwnames);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
// Backwards compatibility aliases for API that was provisional in Python 3.8
|
| 128 |
+
#define _PyObject_Vectorcall PyObject_Vectorcall
|
| 129 |
+
#define _PyObject_VectorcallMethod PyObject_VectorcallMethod
|
| 130 |
+
#define _PyObject_FastCallDict PyObject_VectorcallDict
|
| 131 |
+
#define _PyVectorcall_Function PyVectorcall_Function
|
| 132 |
+
#define _PyObject_CallOneArg PyObject_CallOneArg
|
| 133 |
+
#define _PyObject_CallMethodNoArgs PyObject_CallMethodNoArgs
|
| 134 |
+
#define _PyObject_CallMethodOneArg PyObject_CallMethodOneArg
|
| 135 |
+
|
| 136 |
+
/* Same as PyObject_Vectorcall except that keyword arguments are passed as
|
| 137 |
+
dict, which may be NULL if there are no keyword arguments. */
|
| 138 |
+
PyAPI_FUNC(PyObject *) PyObject_VectorcallDict(
|
| 139 |
+
PyObject *callable,
|
| 140 |
+
PyObject *const *args,
|
| 141 |
+
size_t nargsf,
|
| 142 |
+
PyObject *kwargs);
|
| 143 |
+
|
| 144 |
+
/* Call "callable" (which must support vectorcall) with positional arguments
|
| 145 |
+
"tuple" and keyword arguments "dict". "dict" may also be NULL */
|
| 146 |
+
PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict);
|
| 147 |
+
|
| 148 |
+
static inline PyObject *
|
| 149 |
+
_PyObject_FastCallTstate(PyThreadState *tstate, PyObject *func, PyObject *const *args, Py_ssize_t nargs)
|
| 150 |
+
{
|
| 151 |
+
return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
/* Same as PyObject_Vectorcall except without keyword arguments */
|
| 155 |
+
static inline PyObject *
|
| 156 |
+
_PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
|
| 157 |
+
{
|
| 158 |
+
PyThreadState *tstate = PyThreadState_Get();
|
| 159 |
+
return _PyObject_FastCallTstate(tstate, func, args, nargs);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/* Call a callable without any arguments
|
| 163 |
+
Private static inline function variant of public function
|
| 164 |
+
PyObject_CallNoArgs(). */
|
| 165 |
+
static inline PyObject *
|
| 166 |
+
_PyObject_CallNoArg(PyObject *func) {
|
| 167 |
+
PyThreadState *tstate = PyThreadState_Get();
|
| 168 |
+
return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
static inline PyObject *
|
| 172 |
+
PyObject_CallOneArg(PyObject *func, PyObject *arg)
|
| 173 |
+
{
|
| 174 |
+
PyObject *_args[2];
|
| 175 |
+
PyObject **args;
|
| 176 |
+
PyThreadState *tstate;
|
| 177 |
+
size_t nargsf;
|
| 178 |
+
|
| 179 |
+
assert(arg != NULL);
|
| 180 |
+
args = _args + 1; // For PY_VECTORCALL_ARGUMENTS_OFFSET
|
| 181 |
+
args[0] = arg;
|
| 182 |
+
tstate = PyThreadState_Get();
|
| 183 |
+
nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET;
|
| 184 |
+
return _PyObject_VectorcallTstate(tstate, func, args, nargsf, NULL);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
PyAPI_FUNC(PyObject *) PyObject_VectorcallMethod(
|
| 188 |
+
PyObject *name, PyObject *const *args,
|
| 189 |
+
size_t nargsf, PyObject *kwnames);
|
| 190 |
+
|
| 191 |
+
static inline PyObject *
|
| 192 |
+
PyObject_CallMethodNoArgs(PyObject *self, PyObject *name)
|
| 193 |
+
{
|
| 194 |
+
return PyObject_VectorcallMethod(name, &self,
|
| 195 |
+
1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
static inline PyObject *
|
| 199 |
+
PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg)
|
| 200 |
+
{
|
| 201 |
+
PyObject *args[2] = {self, arg};
|
| 202 |
+
|
| 203 |
+
assert(arg != NULL);
|
| 204 |
+
return PyObject_VectorcallMethod(name, args,
|
| 205 |
+
2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
/* Like PyObject_CallMethod(), but expect a _Py_Identifier*
|
| 209 |
+
as the method name. */
|
| 210 |
+
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,
|
| 211 |
+
_Py_Identifier *name,
|
| 212 |
+
const char *format, ...);
|
| 213 |
+
|
| 214 |
+
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj,
|
| 215 |
+
_Py_Identifier *name,
|
| 216 |
+
const char *format,
|
| 217 |
+
...);
|
| 218 |
+
|
| 219 |
+
PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(
|
| 220 |
+
PyObject *obj,
|
| 221 |
+
struct _Py_Identifier *name,
|
| 222 |
+
...);
|
| 223 |
+
|
| 224 |
+
static inline PyObject *
|
| 225 |
+
_PyObject_VectorcallMethodId(
|
| 226 |
+
_Py_Identifier *name, PyObject *const *args,
|
| 227 |
+
size_t nargsf, PyObject *kwnames)
|
| 228 |
+
{
|
| 229 |
+
PyObject *oname = _PyUnicode_FromId(name); /* borrowed */
|
| 230 |
+
if (!oname) {
|
| 231 |
+
return NULL;
|
| 232 |
+
}
|
| 233 |
+
return PyObject_VectorcallMethod(oname, args, nargsf, kwnames);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
static inline PyObject *
|
| 237 |
+
_PyObject_CallMethodIdNoArgs(PyObject *self, _Py_Identifier *name)
|
| 238 |
+
{
|
| 239 |
+
return _PyObject_VectorcallMethodId(name, &self,
|
| 240 |
+
1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
static inline PyObject *
|
| 244 |
+
_PyObject_CallMethodIdOneArg(PyObject *self, _Py_Identifier *name, PyObject *arg)
|
| 245 |
+
{
|
| 246 |
+
PyObject *args[2] = {self, arg};
|
| 247 |
+
|
| 248 |
+
assert(arg != NULL);
|
| 249 |
+
return _PyObject_VectorcallMethodId(name, args,
|
| 250 |
+
2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o);
|
| 254 |
+
|
| 255 |
+
/* Guess the size of object 'o' using len(o) or o.__length_hint__().
|
| 256 |
+
If neither of those return a non-negative value, then return the default
|
| 257 |
+
value. If one of the calls fails, this function returns -1. */
|
| 258 |
+
PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
| 259 |
+
|
| 260 |
+
/* === New Buffer API ============================================ */
|
| 261 |
+
|
| 262 |
+
/* Return 1 if the getbuffer function is available, otherwise return 0. */
|
| 263 |
+
PyAPI_FUNC(int) PyObject_CheckBuffer(PyObject *obj);
|
| 264 |
+
|
| 265 |
+
/* This is a C-API version of the getbuffer function call. It checks
|
| 266 |
+
to make sure object has the required function pointer and issues the
|
| 267 |
+
call.
|
| 268 |
+
|
| 269 |
+
Returns -1 and raises an error on failure and returns 0 on success. */
|
| 270 |
+
PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view,
|
| 271 |
+
int flags);
|
| 272 |
+
|
| 273 |
+
/* Get the memory area pointed to by the indices for the buffer given.
|
| 274 |
+
Note that view->ndim is the assumed size of indices. */
|
| 275 |
+
PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices);
|
| 276 |
+
|
| 277 |
+
/* Return the implied itemsize of the data-format area from a
|
| 278 |
+
struct-style description. */
|
| 279 |
+
PyAPI_FUNC(Py_ssize_t) PyBuffer_SizeFromFormat(const char *format);
|
| 280 |
+
|
| 281 |
+
/* Implementation in memoryobject.c */
|
| 282 |
+
PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view,
|
| 283 |
+
Py_ssize_t len, char order);
|
| 284 |
+
|
| 285 |
+
PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf,
|
| 286 |
+
Py_ssize_t len, char order);
|
| 287 |
+
|
| 288 |
+
/* Copy len bytes of data from the contiguous chunk of memory
|
| 289 |
+
pointed to by buf into the buffer exported by obj. Return
|
| 290 |
+
0 on success and return -1 and raise a PyBuffer_Error on
|
| 291 |
+
error (i.e. the object does not have a buffer interface or
|
| 292 |
+
it is not working).
|
| 293 |
+
|
| 294 |
+
If fort is 'F', then if the object is multi-dimensional,
|
| 295 |
+
then the data will be copied into the array in
|
| 296 |
+
Fortran-style (first dimension varies the fastest). If
|
| 297 |
+
fort is 'C', then the data will be copied into the array
|
| 298 |
+
in C-style (last dimension varies the fastest). If fort
|
| 299 |
+
is 'A', then it does not matter and the copy will be made
|
| 300 |
+
in whatever way is more efficient. */
|
| 301 |
+
PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src);
|
| 302 |
+
|
| 303 |
+
/* Copy the data from the src buffer to the buffer of destination. */
|
| 304 |
+
PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort);
|
| 305 |
+
|
| 306 |
+
/*Fill the strides array with byte-strides of a contiguous
|
| 307 |
+
(Fortran-style if fort is 'F' or C-style otherwise)
|
| 308 |
+
array of the given shape with the given number of bytes
|
| 309 |
+
per element. */
|
| 310 |
+
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
|
| 311 |
+
Py_ssize_t *shape,
|
| 312 |
+
Py_ssize_t *strides,
|
| 313 |
+
int itemsize,
|
| 314 |
+
char fort);
|
| 315 |
+
|
| 316 |
+
/* Fills in a buffer-info structure correctly for an exporter
|
| 317 |
+
that can only share a contiguous chunk of memory of
|
| 318 |
+
"unsigned bytes" of the given length.
|
| 319 |
+
|
| 320 |
+
Returns 0 on success and -1 (with raising an error) on error. */
|
| 321 |
+
PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf,
|
| 322 |
+
Py_ssize_t len, int readonly,
|
| 323 |
+
int flags);
|
| 324 |
+
|
| 325 |
+
/* Releases a Py_buffer obtained from getbuffer ParseTuple's "s*". */
|
| 326 |
+
PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
|
| 327 |
+
|
| 328 |
+
/* === Sequence protocol ================================================ */
|
| 329 |
+
|
| 330 |
+
/* Assume tp_as_sequence and sq_item exist and that 'i' does not
|
| 331 |
+
need to be corrected for a negative index. */
|
| 332 |
+
#define PySequence_ITEM(o, i)\
|
| 333 |
+
( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
|
| 334 |
+
|
| 335 |
+
#define PY_ITERSEARCH_COUNT 1
|
| 336 |
+
#define PY_ITERSEARCH_INDEX 2
|
| 337 |
+
#define PY_ITERSEARCH_CONTAINS 3
|
| 338 |
+
|
| 339 |
+
/* Iterate over seq.
|
| 340 |
+
|
| 341 |
+
Result depends on the operation:
|
| 342 |
+
|
| 343 |
+
PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if
|
| 344 |
+
error.
|
| 345 |
+
PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of
|
| 346 |
+
obj in seq; set ValueError and return -1 if none found;
|
| 347 |
+
also return -1 on error.
|
| 348 |
+
PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on
|
| 349 |
+
error. */
|
| 350 |
+
PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq,
|
| 351 |
+
PyObject *obj, int operation);
|
| 352 |
+
|
| 353 |
+
/* === Mapping protocol ================================================= */
|
| 354 |
+
|
| 355 |
+
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
|
| 356 |
+
|
| 357 |
+
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
|
| 358 |
+
|
| 359 |
+
PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self);
|
| 360 |
+
|
| 361 |
+
PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]);
|
| 362 |
+
|
| 363 |
+
/* For internal use by buffer API functions */
|
| 364 |
+
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
|
| 365 |
+
const Py_ssize_t *shape);
|
| 366 |
+
PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
|
| 367 |
+
const Py_ssize_t *shape);
|
| 368 |
+
|
| 369 |
+
/* Convert Python int to Py_ssize_t. Do nothing if the argument is None. */
|
| 370 |
+
PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *);
|
| 371 |
+
|
| 372 |
+
/* Same as PyNumber_Index but can return an instance of a subclass of int. */
|
| 373 |
+
PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o);
|
evalkit_llava/include/python3.10/cpython/bytearrayobject.h
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_BYTEARRAYOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Object layout */
|
| 6 |
+
typedef struct {
|
| 7 |
+
PyObject_VAR_HEAD
|
| 8 |
+
Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */
|
| 9 |
+
char *ob_bytes; /* Physical backing buffer */
|
| 10 |
+
char *ob_start; /* Logical start inside ob_bytes */
|
| 11 |
+
Py_ssize_t ob_exports; /* How many buffer exports */
|
| 12 |
+
} PyByteArrayObject;
|
| 13 |
+
|
| 14 |
+
/* Macros, trading safety for speed */
|
| 15 |
+
#define PyByteArray_AS_STRING(self) \
|
| 16 |
+
(assert(PyByteArray_Check(self)), \
|
| 17 |
+
Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string)
|
| 18 |
+
#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self))
|
| 19 |
+
|
| 20 |
+
PyAPI_DATA(char) _PyByteArray_empty_string[];
|
evalkit_llava/include/python3.10/cpython/bytesobject.h
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_BYTESOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef struct {
|
| 6 |
+
PyObject_VAR_HEAD
|
| 7 |
+
Py_hash_t ob_shash;
|
| 8 |
+
char ob_sval[1];
|
| 9 |
+
|
| 10 |
+
/* Invariants:
|
| 11 |
+
* ob_sval contains space for 'ob_size+1' elements.
|
| 12 |
+
* ob_sval[ob_size] == 0.
|
| 13 |
+
* ob_shash is the hash of the byte string or -1 if not computed yet.
|
| 14 |
+
*/
|
| 15 |
+
} PyBytesObject;
|
| 16 |
+
|
| 17 |
+
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
|
| 18 |
+
PyAPI_FUNC(PyObject*) _PyBytes_FormatEx(
|
| 19 |
+
const char *format,
|
| 20 |
+
Py_ssize_t format_len,
|
| 21 |
+
PyObject *args,
|
| 22 |
+
int use_bytearray);
|
| 23 |
+
PyAPI_FUNC(PyObject*) _PyBytes_FromHex(
|
| 24 |
+
PyObject *string,
|
| 25 |
+
int use_bytearray);
|
| 26 |
+
|
| 27 |
+
/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */
|
| 28 |
+
PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
|
| 29 |
+
const char *, const char **);
|
| 30 |
+
|
| 31 |
+
/* Macro, trading safety for speed */
|
| 32 |
+
#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
|
| 33 |
+
(((PyBytesObject *)(op))->ob_sval))
|
| 34 |
+
#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
|
| 35 |
+
|
| 36 |
+
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
|
| 37 |
+
x must be an iterable object. */
|
| 38 |
+
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer".
|
| 42 |
+
A _PyBytesWriter variable must be declared at the end of variables in a
|
| 43 |
+
function to optimize the memory allocation on the stack. */
|
| 44 |
+
typedef struct {
|
| 45 |
+
/* bytes, bytearray or NULL (when the small buffer is used) */
|
| 46 |
+
PyObject *buffer;
|
| 47 |
+
|
| 48 |
+
/* Number of allocated size. */
|
| 49 |
+
Py_ssize_t allocated;
|
| 50 |
+
|
| 51 |
+
/* Minimum number of allocated bytes,
|
| 52 |
+
incremented by _PyBytesWriter_Prepare() */
|
| 53 |
+
Py_ssize_t min_size;
|
| 54 |
+
|
| 55 |
+
/* If non-zero, use a bytearray instead of a bytes object for buffer. */
|
| 56 |
+
int use_bytearray;
|
| 57 |
+
|
| 58 |
+
/* If non-zero, overallocate the buffer (default: 0).
|
| 59 |
+
This flag must be zero if use_bytearray is non-zero. */
|
| 60 |
+
int overallocate;
|
| 61 |
+
|
| 62 |
+
/* Stack buffer */
|
| 63 |
+
int use_small_buffer;
|
| 64 |
+
char small_buffer[512];
|
| 65 |
+
} _PyBytesWriter;
|
| 66 |
+
|
| 67 |
+
/* Initialize a bytes writer
|
| 68 |
+
|
| 69 |
+
By default, the overallocation is disabled. Set the overallocate attribute
|
| 70 |
+
to control the allocation of the buffer. */
|
| 71 |
+
PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer);
|
| 72 |
+
|
| 73 |
+
/* Get the buffer content and reset the writer.
|
| 74 |
+
Return a bytes object, or a bytearray object if use_bytearray is non-zero.
|
| 75 |
+
Raise an exception and return NULL on error. */
|
| 76 |
+
PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer,
|
| 77 |
+
void *str);
|
| 78 |
+
|
| 79 |
+
/* Deallocate memory of a writer (clear its internal buffer). */
|
| 80 |
+
PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer);
|
| 81 |
+
|
| 82 |
+
/* Allocate the buffer to write size bytes.
|
| 83 |
+
Return the pointer to the beginning of buffer data.
|
| 84 |
+
Raise an exception and return NULL on error. */
|
| 85 |
+
PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer,
|
| 86 |
+
Py_ssize_t size);
|
| 87 |
+
|
| 88 |
+
/* Ensure that the buffer is large enough to write *size* bytes.
|
| 89 |
+
Add size to the writer minimum size (min_size attribute).
|
| 90 |
+
|
| 91 |
+
str is the current pointer inside the buffer.
|
| 92 |
+
Return the updated current pointer inside the buffer.
|
| 93 |
+
Raise an exception and return NULL on error. */
|
| 94 |
+
PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
|
| 95 |
+
void *str,
|
| 96 |
+
Py_ssize_t size);
|
| 97 |
+
|
| 98 |
+
/* Resize the buffer to make it larger.
|
| 99 |
+
The new buffer may be larger than size bytes because of overallocation.
|
| 100 |
+
Return the updated current pointer inside the buffer.
|
| 101 |
+
Raise an exception and return NULL on error.
|
| 102 |
+
|
| 103 |
+
Note: size must be greater than the number of allocated bytes in the writer.
|
| 104 |
+
|
| 105 |
+
This function doesn't use the writer minimum size (min_size attribute).
|
| 106 |
+
|
| 107 |
+
See also _PyBytesWriter_Prepare().
|
| 108 |
+
*/
|
| 109 |
+
PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer,
|
| 110 |
+
void *str,
|
| 111 |
+
Py_ssize_t size);
|
| 112 |
+
|
| 113 |
+
/* Write bytes.
|
| 114 |
+
Raise an exception and return NULL on error. */
|
| 115 |
+
PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
|
| 116 |
+
void *str,
|
| 117 |
+
const void *bytes,
|
| 118 |
+
Py_ssize_t size);
|
evalkit_llava/include/python3.10/cpython/ceval.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_CEVAL_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
|
| 6 |
+
PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
|
| 7 |
+
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
| 8 |
+
PyAPI_FUNC(int) _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
|
| 9 |
+
PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void);
|
| 10 |
+
PyAPI_FUNC(int) _PyEval_SetAsyncGenFirstiter(PyObject *);
|
| 11 |
+
PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void);
|
| 12 |
+
PyAPI_FUNC(int) _PyEval_SetAsyncGenFinalizer(PyObject *);
|
| 13 |
+
PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFinalizer(void);
|
| 14 |
+
|
| 15 |
+
/* Helper to look up a builtin object */
|
| 16 |
+
PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *);
|
| 17 |
+
/* Look at the current frame's (if any) code's co_flags, and turn on
|
| 18 |
+
the corresponding compiler flags in cf->cf_flags. Return 1 if any
|
| 19 |
+
flag was set, else return 0. */
|
| 20 |
+
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
|
| 21 |
+
|
| 22 |
+
PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int exc);
|
| 23 |
+
|
| 24 |
+
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
|
| 25 |
+
PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void);
|
| 26 |
+
|
| 27 |
+
PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc);
|
| 28 |
+
|
| 29 |
+
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
|
| 30 |
+
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
|
evalkit_llava/include/python3.10/cpython/dictobject.h
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_DICTOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef struct _dictkeysobject PyDictKeysObject;
|
| 6 |
+
|
| 7 |
+
/* The ma_values pointer is NULL for a combined table
|
| 8 |
+
* or points to an array of PyObject* for a split table
|
| 9 |
+
*/
|
| 10 |
+
typedef struct {
|
| 11 |
+
PyObject_HEAD
|
| 12 |
+
|
| 13 |
+
/* Number of items in the dictionary */
|
| 14 |
+
Py_ssize_t ma_used;
|
| 15 |
+
|
| 16 |
+
/* Dictionary version: globally unique, value change each time
|
| 17 |
+
the dictionary is modified */
|
| 18 |
+
uint64_t ma_version_tag;
|
| 19 |
+
|
| 20 |
+
PyDictKeysObject *ma_keys;
|
| 21 |
+
|
| 22 |
+
/* If ma_values is NULL, the table is "combined": keys and values
|
| 23 |
+
are stored in ma_keys.
|
| 24 |
+
|
| 25 |
+
If ma_values is not NULL, the table is split:
|
| 26 |
+
keys are stored in ma_keys and values are stored in ma_values */
|
| 27 |
+
PyObject **ma_values;
|
| 28 |
+
} PyDictObject;
|
| 29 |
+
|
| 30 |
+
PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
|
| 31 |
+
Py_hash_t hash);
|
| 32 |
+
PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp,
|
| 33 |
+
struct _Py_Identifier *key);
|
| 34 |
+
PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *);
|
| 35 |
+
PyAPI_FUNC(PyObject *) PyDict_SetDefault(
|
| 36 |
+
PyObject *mp, PyObject *key, PyObject *defaultobj);
|
| 37 |
+
PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key,
|
| 38 |
+
PyObject *item, Py_hash_t hash);
|
| 39 |
+
PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key,
|
| 40 |
+
Py_hash_t hash);
|
| 41 |
+
PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key,
|
| 42 |
+
int (*predicate)(PyObject *value));
|
| 43 |
+
PyDictKeysObject *_PyDict_NewKeysForClass(void);
|
| 44 |
+
PyAPI_FUNC(int) _PyDict_Next(
|
| 45 |
+
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
|
| 46 |
+
|
| 47 |
+
/* Get the number of items of a dictionary. */
|
| 48 |
+
#define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used)
|
| 49 |
+
PyAPI_FUNC(int) _PyDict_Contains_KnownHash(PyObject *, PyObject *, Py_hash_t);
|
| 50 |
+
PyAPI_FUNC(int) _PyDict_ContainsId(PyObject *, struct _Py_Identifier *);
|
| 51 |
+
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
| 52 |
+
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
| 53 |
+
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
|
| 54 |
+
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
|
| 55 |
+
PyAPI_FUNC(Py_ssize_t) _PyDict_SizeOf(PyDictObject *);
|
| 56 |
+
PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *);
|
| 57 |
+
PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *);
|
| 58 |
+
PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
|
| 59 |
+
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
|
| 60 |
+
|
| 61 |
+
/* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0,
|
| 62 |
+
the first occurrence of a key wins, if override is 1, the last occurrence
|
| 63 |
+
of a key wins, if override is 2, a KeyError with conflicting key as
|
| 64 |
+
argument is raised.
|
| 65 |
+
*/
|
| 66 |
+
PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override);
|
| 67 |
+
PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item);
|
| 68 |
+
|
| 69 |
+
PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
|
| 70 |
+
PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
|
| 71 |
+
|
| 72 |
+
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
|
| 73 |
+
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
|
| 74 |
+
Py_ssize_t _PyDict_GetItemHint(PyDictObject *, PyObject *, Py_ssize_t, PyObject **);
|
| 75 |
+
|
| 76 |
+
/* _PyDictView */
|
| 77 |
+
|
| 78 |
+
typedef struct {
|
| 79 |
+
PyObject_HEAD
|
| 80 |
+
PyDictObject *dv_dict;
|
| 81 |
+
} _PyDictViewObject;
|
| 82 |
+
|
| 83 |
+
PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *);
|
| 84 |
+
PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
|
evalkit_llava/include/python3.10/cpython/fileobject.h
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_FILEOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
|
| 6 |
+
|
| 7 |
+
/* The std printer acts as a preliminary sys.stderr until the new io
|
| 8 |
+
infrastructure is in place. */
|
| 9 |
+
PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
|
| 10 |
+
PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
|
| 11 |
+
|
| 12 |
+
typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *);
|
| 13 |
+
|
| 14 |
+
PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path);
|
| 15 |
+
PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path);
|
| 16 |
+
PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenC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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_FILEUTILS_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef enum {
|
| 6 |
+
_Py_ERROR_UNKNOWN=0,
|
| 7 |
+
_Py_ERROR_STRICT,
|
| 8 |
+
_Py_ERROR_SURROGATEESCAPE,
|
| 9 |
+
_Py_ERROR_REPLACE,
|
| 10 |
+
_Py_ERROR_IGNORE,
|
| 11 |
+
_Py_ERROR_BACKSLASHREPLACE,
|
| 12 |
+
_Py_ERROR_SURROGATEPASS,
|
| 13 |
+
_Py_ERROR_XMLCHARREFREPLACE,
|
| 14 |
+
_Py_ERROR_OTHER
|
| 15 |
+
} _Py_error_handler;
|
| 16 |
+
|
| 17 |
+
PyAPI_FUNC(_Py_error_handler) _Py_GetErrorHandler(const char *errors);
|
| 18 |
+
|
| 19 |
+
PyAPI_FUNC(int) _Py_DecodeLocaleEx(
|
| 20 |
+
const char *arg,
|
| 21 |
+
wchar_t **wstr,
|
| 22 |
+
size_t *wlen,
|
| 23 |
+
const char **reason,
|
| 24 |
+
int current_locale,
|
| 25 |
+
_Py_error_handler errors);
|
| 26 |
+
|
| 27 |
+
PyAPI_FUNC(int) _Py_EncodeLocaleEx(
|
| 28 |
+
const wchar_t *text,
|
| 29 |
+
char **str,
|
| 30 |
+
size_t *error_pos,
|
| 31 |
+
const char **reason,
|
| 32 |
+
int current_locale,
|
| 33 |
+
_Py_error_handler errors);
|
| 34 |
+
|
| 35 |
+
PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
|
| 36 |
+
const wchar_t *text,
|
| 37 |
+
size_t *error_pos);
|
| 38 |
+
|
| 39 |
+
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
|
| 40 |
+
|
| 41 |
+
#if defined(MS_WINDOWS) || defined(__APPLE__)
|
| 42 |
+
/* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611).
|
| 43 |
+
On macOS 10.13, read() and write() with more than INT_MAX bytes
|
| 44 |
+
fail with EINVAL (bpo-24658). */
|
| 45 |
+
# define _PY_READ_MAX INT_MAX
|
| 46 |
+
# define _PY_WRITE_MAX INT_MAX
|
| 47 |
+
#else
|
| 48 |
+
/* write() should truncate the input to PY_SSIZE_T_MAX bytes,
|
| 49 |
+
but it's safer to do it ourself to have a portable behaviour */
|
| 50 |
+
# define _PY_READ_MAX PY_SSIZE_T_MAX
|
| 51 |
+
# define _PY_WRITE_MAX PY_SSIZE_T_MAX
|
| 52 |
+
#endif
|
| 53 |
+
|
| 54 |
+
#ifdef MS_WINDOWS
|
| 55 |
+
struct _Py_stat_struct {
|
| 56 |
+
unsigned long st_dev;
|
| 57 |
+
uint64_t st_ino;
|
| 58 |
+
unsigned short st_mode;
|
| 59 |
+
int st_nlink;
|
| 60 |
+
int st_uid;
|
| 61 |
+
int st_gid;
|
| 62 |
+
unsigned long st_rdev;
|
| 63 |
+
__int64 st_size;
|
| 64 |
+
time_t st_atime;
|
| 65 |
+
int st_atime_nsec;
|
| 66 |
+
time_t st_mtime;
|
| 67 |
+
int st_mtime_nsec;
|
| 68 |
+
time_t st_ctime;
|
| 69 |
+
int st_ctime_nsec;
|
| 70 |
+
unsigned long st_file_attributes;
|
| 71 |
+
unsigned long st_reparse_tag;
|
| 72 |
+
};
|
| 73 |
+
#else
|
| 74 |
+
# define _Py_stat_struct stat
|
| 75 |
+
#endif
|
| 76 |
+
|
| 77 |
+
PyAPI_FUNC(int) _Py_fstat(
|
| 78 |
+
int fd,
|
| 79 |
+
struct _Py_stat_struct *status);
|
| 80 |
+
|
| 81 |
+
PyAPI_FUNC(int) _Py_fstat_noraise(
|
| 82 |
+
int fd,
|
| 83 |
+
struct _Py_stat_struct *status);
|
| 84 |
+
|
| 85 |
+
PyAPI_FUNC(int) _Py_stat(
|
| 86 |
+
PyObject *path,
|
| 87 |
+
struct stat *status);
|
| 88 |
+
|
| 89 |
+
PyAPI_FUNC(int) _Py_open(
|
| 90 |
+
const char *pathname,
|
| 91 |
+
int flags);
|
| 92 |
+
|
| 93 |
+
PyAPI_FUNC(int) _Py_open_noraise(
|
| 94 |
+
const char *pathname,
|
| 95 |
+
int flags);
|
| 96 |
+
|
| 97 |
+
PyAPI_FUNC(FILE *) _Py_wfopen(
|
| 98 |
+
const wchar_t *path,
|
| 99 |
+
const wchar_t *mode);
|
| 100 |
+
|
| 101 |
+
PyAPI_FUNC(FILE*) _Py_fopen_obj(
|
| 102 |
+
PyObject *path,
|
| 103 |
+
const char *mode);
|
| 104 |
+
|
| 105 |
+
PyAPI_FUNC(Py_ssize_t) _Py_read(
|
| 106 |
+
int fd,
|
| 107 |
+
void *buf,
|
| 108 |
+
size_t count);
|
| 109 |
+
|
| 110 |
+
PyAPI_FUNC(Py_ssize_t) _Py_write(
|
| 111 |
+
int fd,
|
| 112 |
+
const void *buf,
|
| 113 |
+
size_t count);
|
| 114 |
+
|
| 115 |
+
PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
|
| 116 |
+
int fd,
|
| 117 |
+
const void *buf,
|
| 118 |
+
size_t count);
|
| 119 |
+
|
| 120 |
+
#ifdef HAVE_READLINK
|
| 121 |
+
PyAPI_FUNC(int) _Py_wreadlink(
|
| 122 |
+
const wchar_t *path,
|
| 123 |
+
wchar_t *buf,
|
| 124 |
+
/* Number of characters of 'buf' buffer
|
| 125 |
+
including the trailing NUL character */
|
| 126 |
+
size_t buflen);
|
| 127 |
+
#endif
|
| 128 |
+
|
| 129 |
+
#ifdef HAVE_REALPATH
|
| 130 |
+
PyAPI_FUNC(wchar_t*) _Py_wrealpath(
|
| 131 |
+
const wchar_t *path,
|
| 132 |
+
wchar_t *resolved_path,
|
| 133 |
+
/* Number of characters of 'resolved_path' buffer
|
| 134 |
+
including the trailing NUL character */
|
| 135 |
+
size_t resolved_path_len);
|
| 136 |
+
#endif
|
| 137 |
+
|
| 138 |
+
#ifndef MS_WINDOWS
|
| 139 |
+
PyAPI_FUNC(int) _Py_isabs(const wchar_t *path);
|
| 140 |
+
#endif
|
| 141 |
+
|
| 142 |
+
PyAPI_FUNC(int) _Py_abspath(const wchar_t *path, wchar_t **abspath_p);
|
| 143 |
+
|
| 144 |
+
PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
|
| 145 |
+
wchar_t *buf,
|
| 146 |
+
/* Number of characters of 'buf' buffer
|
| 147 |
+
including the trailing NUL character */
|
| 148 |
+
size_t buflen);
|
| 149 |
+
|
| 150 |
+
PyAPI_FUNC(int) _Py_get_inheritable(int fd);
|
| 151 |
+
|
| 152 |
+
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
|
| 153 |
+
int *atomic_flag_works);
|
| 154 |
+
|
| 155 |
+
PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable,
|
| 156 |
+
int *atomic_flag_works);
|
| 157 |
+
|
| 158 |
+
PyAPI_FUNC(int) _Py_dup(int fd);
|
| 159 |
+
|
| 160 |
+
#ifndef MS_WINDOWS
|
| 161 |
+
PyAPI_FUNC(int) _Py_get_blocking(int fd);
|
| 162 |
+
|
| 163 |
+
PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
|
| 164 |
+
#else /* MS_WINDOWS */
|
| 165 |
+
PyAPI_FUNC(void*) _Py_get_osfhandle_noraise(int fd);
|
| 166 |
+
|
| 167 |
+
PyAPI_FUNC(void*) _Py_get_osfhandle(int fd);
|
| 168 |
+
|
| 169 |
+
PyAPI_FUNC(int) _Py_open_osfhandle_noraise(void *handle, int flags);
|
| 170 |
+
|
| 171 |
+
PyAPI_FUNC(int) _Py_open_osfhandle(void *handle, int flags);
|
| 172 |
+
#endif /* MS_WINDOWS */
|
evalkit_llava/include/python3.10/cpython/frameobject.h
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Frame object interface */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_CPYTHON_FRAMEOBJECT_H
|
| 4 |
+
# error "this header file must not be included directly"
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
/* These values are chosen so that the inline functions below all
|
| 8 |
+
* compare f_state to zero.
|
| 9 |
+
*/
|
| 10 |
+
enum _framestate {
|
| 11 |
+
FRAME_CREATED = -2,
|
| 12 |
+
FRAME_SUSPENDED = -1,
|
| 13 |
+
FRAME_EXECUTING = 0,
|
| 14 |
+
FRAME_RETURNED = 1,
|
| 15 |
+
FRAME_UNWINDING = 2,
|
| 16 |
+
FRAME_RAISED = 3,
|
| 17 |
+
FRAME_CLEARED = 4
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
typedef signed char PyFrameState;
|
| 21 |
+
|
| 22 |
+
typedef struct {
|
| 23 |
+
int b_type; /* what kind of block this is */
|
| 24 |
+
int b_handler; /* where to jump to find handler */
|
| 25 |
+
int b_level; /* value stack level to pop to */
|
| 26 |
+
} PyTryBlock;
|
| 27 |
+
|
| 28 |
+
struct _frame {
|
| 29 |
+
PyObject_VAR_HEAD
|
| 30 |
+
struct _frame *f_back; /* previous frame, or NULL */
|
| 31 |
+
PyCodeObject *f_code; /* code segment */
|
| 32 |
+
PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
|
| 33 |
+
PyObject *f_globals; /* global symbol table (PyDictObject) */
|
| 34 |
+
PyObject *f_locals; /* local symbol table (any mapping) */
|
| 35 |
+
PyObject **f_valuestack; /* points after the last local */
|
| 36 |
+
PyObject *f_trace; /* Trace function */
|
| 37 |
+
int f_stackdepth; /* Depth of value stack */
|
| 38 |
+
char f_trace_lines; /* Emit per-line trace events? */
|
| 39 |
+
char f_trace_opcodes; /* Emit per-opcode trace events? */
|
| 40 |
+
|
| 41 |
+
/* Borrowed reference to a generator, or NULL */
|
| 42 |
+
PyObject *f_gen;
|
| 43 |
+
|
| 44 |
+
int f_lasti; /* Last instruction if called */
|
| 45 |
+
int f_lineno; /* Current line number. Only valid if non-zero */
|
| 46 |
+
int f_iblock; /* index in f_blockstack */
|
| 47 |
+
PyFrameState f_state; /* What state the frame is in */
|
| 48 |
+
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
|
| 49 |
+
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
static inline int _PyFrame_IsRunnable(struct _frame *f) {
|
| 53 |
+
return f->f_state < FRAME_EXECUTING;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
static inline int _PyFrame_IsExecuting(struct _frame *f) {
|
| 57 |
+
return f->f_state == FRAME_EXECUTING;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
static inline int _PyFrameHasCompleted(struct _frame *f) {
|
| 61 |
+
return f->f_state > FRAME_EXECUTING;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/* Standard object interface */
|
| 65 |
+
|
| 66 |
+
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
| 67 |
+
|
| 68 |
+
#define PyFrame_Check(op) Py_IS_TYPE(op, &PyFrame_Type)
|
| 69 |
+
|
| 70 |
+
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
| 71 |
+
PyObject *, PyObject *);
|
| 72 |
+
|
| 73 |
+
/* only internal use */
|
| 74 |
+
PyFrameObject*
|
| 75 |
+
_PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *);
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
/* The rest of the interface is specific for frame objects */
|
| 79 |
+
|
| 80 |
+
/* Block management functions */
|
| 81 |
+
|
| 82 |
+
PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
|
| 83 |
+
PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
|
| 84 |
+
|
| 85 |
+
/* Conversions between "fast locals" and locals in dictionary */
|
| 86 |
+
|
| 87 |
+
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
|
| 88 |
+
|
| 89 |
+
PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f);
|
| 90 |
+
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
|
| 91 |
+
|
| 92 |
+
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
|
| 93 |
+
|
| 94 |
+
PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
|
evalkit_llava/include/python3.10/cpython/import.h
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_IMPORT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyMODINIT_FUNC PyInit__imp(void);
|
| 6 |
+
|
| 7 |
+
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
|
| 8 |
+
|
| 9 |
+
PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name);
|
| 10 |
+
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);
|
| 11 |
+
PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module);
|
| 12 |
+
|
| 13 |
+
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
|
| 14 |
+
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
|
| 15 |
+
|
| 16 |
+
/* Obsolete since 3.5, will be removed in 3.11. */
|
| 17 |
+
Py_DEPRECATED(3.10) PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
|
| 18 |
+
|
| 19 |
+
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
|
| 20 |
+
PyObject *mod,
|
| 21 |
+
const char *name, /* UTF-8 encoded string */
|
| 22 |
+
PyObject *modules
|
| 23 |
+
);
|
| 24 |
+
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *,
|
| 25 |
+
PyObject *, PyObject *);
|
| 26 |
+
|
| 27 |
+
struct _inittab {
|
| 28 |
+
const char *name; /* ASCII encoded string */
|
| 29 |
+
PyObject* (*initfunc)(void);
|
| 30 |
+
};
|
| 31 |
+
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
| 32 |
+
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
|
| 33 |
+
|
| 34 |
+
struct _frozen {
|
| 35 |
+
const char *name; /* ASCII encoded string */
|
| 36 |
+
const unsigned char *code;
|
| 37 |
+
int size;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
/* Embedding apps may change this pointer to point to their favorite
|
| 41 |
+
collection of frozen modules: */
|
| 42 |
+
|
| 43 |
+
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
|
| 44 |
+
|
| 45 |
+
PyAPI_DATA(PyObject *) _PyImport_GetModuleAttr(PyObject *, PyObject *);
|
| 46 |
+
PyAPI_DATA(PyObject *) _PyImport_GetModuleAttrString(const char *, const char *);
|
evalkit_llava/include/python3.10/cpython/interpreteridobject.h
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_INTERPRETERIDOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Interpreter ID Object */
|
| 6 |
+
|
| 7 |
+
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
|
| 8 |
+
|
| 9 |
+
PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
|
| 10 |
+
PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
|
| 11 |
+
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
|
evalkit_llava/include/python3.10/cpython/listobject.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_LISTOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef struct {
|
| 6 |
+
PyObject_VAR_HEAD
|
| 7 |
+
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
|
| 8 |
+
PyObject **ob_item;
|
| 9 |
+
|
| 10 |
+
/* ob_item contains space for 'allocated' elements. The number
|
| 11 |
+
* currently in use is ob_size.
|
| 12 |
+
* Invariants:
|
| 13 |
+
* 0 <= ob_size <= allocated
|
| 14 |
+
* len(list) == ob_size
|
| 15 |
+
* ob_item == NULL implies ob_size == allocated == 0
|
| 16 |
+
* list.sort() temporarily sets allocated to -1 to detect mutations.
|
| 17 |
+
*
|
| 18 |
+
* Items must normally not be NULL, except during construction when
|
| 19 |
+
* the list is not yet visible outside the function that builds it.
|
| 20 |
+
*/
|
| 21 |
+
Py_ssize_t allocated;
|
| 22 |
+
} PyListObject;
|
| 23 |
+
|
| 24 |
+
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
| 25 |
+
PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
|
| 26 |
+
|
| 27 |
+
/* Macro, trading safety for speed */
|
| 28 |
+
|
| 29 |
+
/* Cast argument to PyListObject* type. */
|
| 30 |
+
#define _PyList_CAST(op) (assert(PyList_Check(op)), (PyListObject *)(op))
|
| 31 |
+
|
| 32 |
+
#define PyList_GET_ITEM(op, i) (_PyList_CAST(op)->ob_item[i])
|
| 33 |
+
#define PyList_SET_ITEM(op, i, v) ((void)(_PyList_CAST(op)->ob_item[i] = (v)))
|
| 34 |
+
#define PyList_GET_SIZE(op) Py_SIZE(_PyList_CAST(op))
|
evalkit_llava/include/python3.10/cpython/methodobject.h
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_METHODOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_DATA(PyTypeObject) PyCMethod_Type;
|
| 6 |
+
|
| 7 |
+
#define PyCMethod_CheckExact(op) Py_IS_TYPE(op, &PyCMethod_Type)
|
| 8 |
+
#define PyCMethod_Check(op) PyObject_TypeCheck(op, &PyCMethod_Type)
|
| 9 |
+
|
| 10 |
+
/* Macros for direct access to these values. Type checks are *not*
|
| 11 |
+
done, so use with care. */
|
| 12 |
+
#define PyCFunction_GET_FUNCTION(func) \
|
| 13 |
+
(((PyCFunctionObject *)func) -> m_ml -> ml_meth)
|
| 14 |
+
#define PyCFunction_GET_SELF(func) \
|
| 15 |
+
(((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \
|
| 16 |
+
NULL : ((PyCFunctionObject *)func) -> m_self)
|
| 17 |
+
#define PyCFunction_GET_FLAGS(func) \
|
| 18 |
+
(((PyCFunctionObject *)func) -> m_ml -> ml_flags)
|
| 19 |
+
#define PyCFunction_GET_CLASS(func) \
|
| 20 |
+
(((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_METHOD ? \
|
| 21 |
+
((PyCMethodObject *)func) -> mm_class : NULL)
|
| 22 |
+
|
| 23 |
+
typedef struct {
|
| 24 |
+
PyObject_HEAD
|
| 25 |
+
PyMethodDef *m_ml; /* Description of the C function to call */
|
| 26 |
+
PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
|
| 27 |
+
PyObject *m_module; /* The __module__ attribute, can be anything */
|
| 28 |
+
PyObject *m_weakreflist; /* List of weak references */
|
| 29 |
+
vectorcallfunc vectorcall;
|
| 30 |
+
} PyCFunctionObject;
|
| 31 |
+
|
| 32 |
+
typedef struct {
|
| 33 |
+
PyCFunctionObject func;
|
| 34 |
+
PyTypeObject *mm_class; /* Class that defines this method */
|
| 35 |
+
} PyCMethodObject;
|
evalkit_llava/include/python3.10/cpython/odictobject.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_ODICTOBJECT_H
|
| 2 |
+
#define Py_ODICTOBJECT_H
|
| 3 |
+
#ifdef __cplusplus
|
| 4 |
+
extern "C" {
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
/* OrderedDict */
|
| 9 |
+
/* This API is optional and mostly redundant. */
|
| 10 |
+
|
| 11 |
+
#ifndef Py_LIMITED_API
|
| 12 |
+
|
| 13 |
+
typedef struct _odictobject PyODictObject;
|
| 14 |
+
|
| 15 |
+
PyAPI_DATA(PyTypeObject) PyODict_Type;
|
| 16 |
+
PyAPI_DATA(PyTypeObject) PyODictIter_Type;
|
| 17 |
+
PyAPI_DATA(PyTypeObject) PyODictKeys_Type;
|
| 18 |
+
PyAPI_DATA(PyTypeObject) PyODictItems_Type;
|
| 19 |
+
PyAPI_DATA(PyTypeObject) PyODictValues_Type;
|
| 20 |
+
|
| 21 |
+
#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
|
| 22 |
+
#define PyODict_CheckExact(op) Py_IS_TYPE(op, &PyODict_Type)
|
| 23 |
+
#define PyODict_SIZE(op) PyDict_GET_SIZE((op))
|
| 24 |
+
|
| 25 |
+
PyAPI_FUNC(PyObject *) PyODict_New(void);
|
| 26 |
+
PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
|
| 27 |
+
PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key);
|
| 28 |
+
|
| 29 |
+
/* wrappers around PyDict* functions */
|
| 30 |
+
#define PyODict_GetItem(od, key) PyDict_GetItem(_PyObject_CAST(od), key)
|
| 31 |
+
#define PyODict_GetItemWithError(od, key) \
|
| 32 |
+
PyDict_GetItemWithError(_PyObject_CAST(od), key)
|
| 33 |
+
#define PyODict_Contains(od, key) PyDict_Contains(_PyObject_CAST(od), key)
|
| 34 |
+
#define PyODict_Size(od) PyDict_Size(_PyObject_CAST(od))
|
| 35 |
+
#define PyODict_GetItemString(od, key) \
|
| 36 |
+
PyDict_GetItemString(_PyObject_CAST(od), key)
|
| 37 |
+
|
| 38 |
+
#endif
|
| 39 |
+
|
| 40 |
+
#ifdef __cplusplus
|
| 41 |
+
}
|
| 42 |
+
#endif
|
| 43 |
+
#endif /* !Py_ODICTOBJECT_H */
|
evalkit_llava/include/python3.10/cpython/picklebufobject.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* PickleBuffer object. This is built-in for ease of use from third-party
|
| 2 |
+
* C extensions.
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
#ifndef Py_PICKLEBUFOBJECT_H
|
| 6 |
+
#define Py_PICKLEBUFOBJECT_H
|
| 7 |
+
#ifdef __cplusplus
|
| 8 |
+
extern "C" {
|
| 9 |
+
#endif
|
| 10 |
+
|
| 11 |
+
#ifndef Py_LIMITED_API
|
| 12 |
+
|
| 13 |
+
PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type;
|
| 14 |
+
|
| 15 |
+
#define PyPickleBuffer_Check(op) Py_IS_TYPE(op, &PyPickleBuffer_Type)
|
| 16 |
+
|
| 17 |
+
/* Create a PickleBuffer redirecting to the given buffer-enabled object */
|
| 18 |
+
PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *);
|
| 19 |
+
/* Get the PickleBuffer's underlying view to the original object
|
| 20 |
+
* (NULL if released)
|
| 21 |
+
*/
|
| 22 |
+
PyAPI_FUNC(const Py_buffer *) PyPickleBuffer_GetBuffer(PyObject *);
|
| 23 |
+
/* Release the PickleBuffer. Returns 0 on success, -1 on error. */
|
| 24 |
+
PyAPI_FUNC(int) PyPickleBuffer_Release(PyObject *);
|
| 25 |
+
|
| 26 |
+
#endif /* !Py_LIMITED_API */
|
| 27 |
+
|
| 28 |
+
#ifdef __cplusplus
|
| 29 |
+
}
|
| 30 |
+
#endif
|
| 31 |
+
#endif /* !Py_PICKLEBUFOBJECT_H */
|
evalkit_llava/include/python3.10/cpython/pyctype.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_LIMITED_API
|
| 2 |
+
#ifndef PYCTYPE_H
|
| 3 |
+
#define PYCTYPE_H
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
#define PY_CTF_LOWER 0x01
|
| 9 |
+
#define PY_CTF_UPPER 0x02
|
| 10 |
+
#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER)
|
| 11 |
+
#define PY_CTF_DIGIT 0x04
|
| 12 |
+
#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT)
|
| 13 |
+
#define PY_CTF_SPACE 0x08
|
| 14 |
+
#define PY_CTF_XDIGIT 0x10
|
| 15 |
+
|
| 16 |
+
PyAPI_DATA(const unsigned int) _Py_ctype_table[256];
|
| 17 |
+
|
| 18 |
+
/* Unlike their C counterparts, the following macros are not meant to
|
| 19 |
+
* handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
|
| 20 |
+
* must be a signed/unsigned char. */
|
| 21 |
+
#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
|
| 22 |
+
#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
|
| 23 |
+
#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)
|
| 24 |
+
#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT)
|
| 25 |
+
#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT)
|
| 26 |
+
#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM)
|
| 27 |
+
#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE)
|
| 28 |
+
|
| 29 |
+
PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256];
|
| 30 |
+
PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256];
|
| 31 |
+
|
| 32 |
+
#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
|
| 33 |
+
#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
|
| 34 |
+
|
| 35 |
+
#ifdef __cplusplus
|
| 36 |
+
}
|
| 37 |
+
#endif
|
| 38 |
+
#endif /* !PYCTYPE_H */
|
| 39 |
+
#endif /* !Py_LIMITED_API */
|
evalkit_llava/include/python3.10/cpython/pydebug.h
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_LIMITED_API
|
| 2 |
+
#ifndef Py_PYDEBUG_H
|
| 3 |
+
#define Py_PYDEBUG_H
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
PyAPI_DATA(int) Py_DebugFlag;
|
| 9 |
+
PyAPI_DATA(int) Py_VerboseFlag;
|
| 10 |
+
PyAPI_DATA(int) Py_QuietFlag;
|
| 11 |
+
PyAPI_DATA(int) Py_InteractiveFlag;
|
| 12 |
+
PyAPI_DATA(int) Py_InspectFlag;
|
| 13 |
+
PyAPI_DATA(int) Py_OptimizeFlag;
|
| 14 |
+
PyAPI_DATA(int) Py_NoSiteFlag;
|
| 15 |
+
PyAPI_DATA(int) Py_BytesWarningFlag;
|
| 16 |
+
PyAPI_DATA(int) Py_FrozenFlag;
|
| 17 |
+
PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
|
| 18 |
+
PyAPI_DATA(int) Py_DontWriteBytecodeFlag;
|
| 19 |
+
PyAPI_DATA(int) Py_NoUserSiteDirectory;
|
| 20 |
+
PyAPI_DATA(int) Py_UnbufferedStdioFlag;
|
| 21 |
+
PyAPI_DATA(int) Py_HashRandomizationFlag;
|
| 22 |
+
PyAPI_DATA(int) Py_IsolatedFlag;
|
| 23 |
+
|
| 24 |
+
#ifdef MS_WINDOWS
|
| 25 |
+
PyAPI_DATA(int) Py_LegacyWindowsFSEncodingFlag;
|
| 26 |
+
PyAPI_DATA(int) Py_LegacyWindowsStdioFlag;
|
| 27 |
+
#endif
|
| 28 |
+
|
| 29 |
+
/* this is a wrapper around getenv() that pays attention to
|
| 30 |
+
Py_IgnoreEnvironmentFlag. It should be used for getting variables like
|
| 31 |
+
PYTHONPATH and PYTHONHOME from the environment */
|
| 32 |
+
#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
|
| 33 |
+
|
| 34 |
+
#ifdef __cplusplus
|
| 35 |
+
}
|
| 36 |
+
#endif
|
| 37 |
+
#endif /* !Py_PYDEBUG_H */
|
| 38 |
+
#endif /* Py_LIMITED_API */
|
evalkit_llava/include/python3.10/cpython/pyfpe.h
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_PYFPE_H
|
| 2 |
+
#define Py_PYFPE_H
|
| 3 |
+
/* Header excluded from the stable API */
|
| 4 |
+
#ifndef Py_LIMITED_API
|
| 5 |
+
|
| 6 |
+
/* These macros used to do something when Python was built with --with-fpectl,
|
| 7 |
+
* but support for that was dropped in 3.7. We continue to define them though,
|
| 8 |
+
* to avoid breaking API users.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
#define PyFPE_START_PROTECT(err_string, leave_stmt)
|
| 12 |
+
#define PyFPE_END_PROTECT(v)
|
| 13 |
+
|
| 14 |
+
#endif /* !defined(Py_LIMITED_API) */
|
| 15 |
+
#endif /* !Py_PYFPE_H */
|
evalkit_llava/include/python3.10/cpython/pylifecycle.h
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PYLIFECYCLE_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Py_FrozenMain is kept out of the Limited API until documented and present
|
| 6 |
+
in all builds of Python */
|
| 7 |
+
PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv);
|
| 8 |
+
|
| 9 |
+
/* Only used by applications that embed the interpreter and need to
|
| 10 |
+
* override the standard encoding determination mechanism
|
| 11 |
+
*/
|
| 12 |
+
PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
|
| 13 |
+
const char *errors);
|
| 14 |
+
|
| 15 |
+
/* PEP 432 Multi-phase initialization API (Private while provisional!) */
|
| 16 |
+
|
| 17 |
+
PyAPI_FUNC(PyStatus) Py_PreInitialize(
|
| 18 |
+
const PyPreConfig *src_config);
|
| 19 |
+
PyAPI_FUNC(PyStatus) Py_PreInitializeFromBytesArgs(
|
| 20 |
+
const PyPreConfig *src_config,
|
| 21 |
+
Py_ssize_t argc,
|
| 22 |
+
char **argv);
|
| 23 |
+
PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs(
|
| 24 |
+
const PyPreConfig *src_config,
|
| 25 |
+
Py_ssize_t argc,
|
| 26 |
+
wchar_t **argv);
|
| 27 |
+
|
| 28 |
+
PyAPI_FUNC(int) _Py_IsCoreInitialized(void);
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
/* Initialization and finalization */
|
| 32 |
+
|
| 33 |
+
PyAPI_FUNC(PyStatus) Py_InitializeFromConfig(
|
| 34 |
+
const PyConfig *config);
|
| 35 |
+
PyAPI_FUNC(PyStatus) _Py_InitializeMain(void);
|
| 36 |
+
|
| 37 |
+
PyAPI_FUNC(int) Py_RunMain(void);
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
|
| 41 |
+
|
| 42 |
+
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
|
| 43 |
+
PyAPI_FUNC(void) _Py_RestoreSignals(void);
|
| 44 |
+
|
| 45 |
+
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
|
| 46 |
+
PyAPI_FUNC(int) _Py_FdIsInteractive(FILE *fp, PyObject *filename);
|
| 47 |
+
|
| 48 |
+
PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *);
|
| 49 |
+
|
| 50 |
+
PyAPI_FUNC(const char *) _Py_gitidentifier(void);
|
| 51 |
+
PyAPI_FUNC(const char *) _Py_gitversion(void);
|
| 52 |
+
|
| 53 |
+
PyAPI_FUNC(int) _Py_IsFinalizing(void);
|
| 54 |
+
|
| 55 |
+
/* Random */
|
| 56 |
+
PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size);
|
| 57 |
+
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
|
| 58 |
+
|
| 59 |
+
/* Legacy locale support */
|
| 60 |
+
PyAPI_FUNC(int) _Py_CoerceLegacyLocale(int warn);
|
| 61 |
+
PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn);
|
| 62 |
+
PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category);
|
| 63 |
+
|
| 64 |
+
PyAPI_FUNC(PyThreadState *) _Py_NewInterpreter(int isolated_subinterpreter);
|
evalkit_llava/include/python3.10/cpython/pymem.h
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PYMEM_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size);
|
| 6 |
+
PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize);
|
| 7 |
+
PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size);
|
| 8 |
+
PyAPI_FUNC(void) PyMem_RawFree(void *ptr);
|
| 9 |
+
|
| 10 |
+
/* Try to get the allocators name set by _PyMem_SetupAllocators(). */
|
| 11 |
+
PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void);
|
| 12 |
+
|
| 13 |
+
/* strdup() using PyMem_RawMalloc() */
|
| 14 |
+
PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str);
|
| 15 |
+
|
| 16 |
+
/* strdup() using PyMem_Malloc() */
|
| 17 |
+
PyAPI_FUNC(char *) _PyMem_Strdup(const char *str);
|
| 18 |
+
|
| 19 |
+
/* wcsdup() using PyMem_RawMalloc() */
|
| 20 |
+
PyAPI_FUNC(wchar_t*) _PyMem_RawWcsdup(const wchar_t *str);
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
typedef enum {
|
| 24 |
+
/* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */
|
| 25 |
+
PYMEM_DOMAIN_RAW,
|
| 26 |
+
|
| 27 |
+
/* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */
|
| 28 |
+
PYMEM_DOMAIN_MEM,
|
| 29 |
+
|
| 30 |
+
/* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */
|
| 31 |
+
PYMEM_DOMAIN_OBJ
|
| 32 |
+
} PyMemAllocatorDomain;
|
| 33 |
+
|
| 34 |
+
typedef enum {
|
| 35 |
+
PYMEM_ALLOCATOR_NOT_SET = 0,
|
| 36 |
+
PYMEM_ALLOCATOR_DEFAULT = 1,
|
| 37 |
+
PYMEM_ALLOCATOR_DEBUG = 2,
|
| 38 |
+
PYMEM_ALLOCATOR_MALLOC = 3,
|
| 39 |
+
PYMEM_ALLOCATOR_MALLOC_DEBUG = 4,
|
| 40 |
+
#ifdef WITH_PYMALLOC
|
| 41 |
+
PYMEM_ALLOCATOR_PYMALLOC = 5,
|
| 42 |
+
PYMEM_ALLOCATOR_PYMALLOC_DEBUG = 6,
|
| 43 |
+
#endif
|
| 44 |
+
} PyMemAllocatorName;
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
typedef struct {
|
| 48 |
+
/* user context passed as the first argument to the 4 functions */
|
| 49 |
+
void *ctx;
|
| 50 |
+
|
| 51 |
+
/* allocate a memory block */
|
| 52 |
+
void* (*malloc) (void *ctx, size_t size);
|
| 53 |
+
|
| 54 |
+
/* allocate a memory block initialized by zeros */
|
| 55 |
+
void* (*calloc) (void *ctx, size_t nelem, size_t elsize);
|
| 56 |
+
|
| 57 |
+
/* allocate or resize a memory block */
|
| 58 |
+
void* (*realloc) (void *ctx, void *ptr, size_t new_size);
|
| 59 |
+
|
| 60 |
+
/* release a memory block */
|
| 61 |
+
void (*free) (void *ctx, void *ptr);
|
| 62 |
+
} PyMemAllocatorEx;
|
| 63 |
+
|
| 64 |
+
/* Get the memory block allocator of the specified domain. */
|
| 65 |
+
PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain,
|
| 66 |
+
PyMemAllocatorEx *allocator);
|
| 67 |
+
|
| 68 |
+
/* Set the memory block allocator of the specified domain.
|
| 69 |
+
|
| 70 |
+
The new allocator must return a distinct non-NULL pointer when requesting
|
| 71 |
+
zero bytes.
|
| 72 |
+
|
| 73 |
+
For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL
|
| 74 |
+
is not held when the allocator is called.
|
| 75 |
+
|
| 76 |
+
If the new allocator is not a hook (don't call the previous allocator), the
|
| 77 |
+
PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks
|
| 78 |
+
on top on the new allocator. */
|
| 79 |
+
PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain,
|
| 80 |
+
PyMemAllocatorEx *allocator);
|
| 81 |
+
|
| 82 |
+
/* Setup hooks to detect bugs in the following Python memory allocator
|
| 83 |
+
functions:
|
| 84 |
+
|
| 85 |
+
- PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
|
| 86 |
+
- PyMem_Malloc(), PyMem_Realloc(), PyMem_Free()
|
| 87 |
+
- PyObject_Malloc(), PyObject_Realloc() and PyObject_Free()
|
| 88 |
+
|
| 89 |
+
Newly allocated memory is filled with the byte 0xCB, freed memory is filled
|
| 90 |
+
with the byte 0xDB. Additional checks:
|
| 91 |
+
|
| 92 |
+
- detect API violations, ex: PyObject_Free() called on a buffer allocated
|
| 93 |
+
by PyMem_Malloc()
|
| 94 |
+
- detect write before the start of the buffer (buffer underflow)
|
| 95 |
+
- detect write after the end of the buffer (buffer overflow)
|
| 96 |
+
|
| 97 |
+
The function does nothing if Python is not compiled is debug mode. */
|
| 98 |
+
PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
|
evalkit_llava/include/python3.10/cpython/pythonrun.h
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PYTHONRUN_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
|
| 6 |
+
PyAPI_FUNC(int) _PyRun_SimpleFileObject(
|
| 7 |
+
FILE *fp,
|
| 8 |
+
PyObject *filename,
|
| 9 |
+
int closeit,
|
| 10 |
+
PyCompilerFlags *flags);
|
| 11 |
+
PyAPI_FUNC(int) PyRun_AnyFileExFlags(
|
| 12 |
+
FILE *fp,
|
| 13 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 14 |
+
int closeit,
|
| 15 |
+
PyCompilerFlags *flags);
|
| 16 |
+
PyAPI_FUNC(int) _PyRun_AnyFileObject(
|
| 17 |
+
FILE *fp,
|
| 18 |
+
PyObject *filename,
|
| 19 |
+
int closeit,
|
| 20 |
+
PyCompilerFlags *flags);
|
| 21 |
+
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
|
| 22 |
+
FILE *fp,
|
| 23 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 24 |
+
int closeit,
|
| 25 |
+
PyCompilerFlags *flags);
|
| 26 |
+
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
|
| 27 |
+
FILE *fp,
|
| 28 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 29 |
+
PyCompilerFlags *flags);
|
| 30 |
+
PyAPI_FUNC(int) PyRun_InteractiveOneObject(
|
| 31 |
+
FILE *fp,
|
| 32 |
+
PyObject *filename,
|
| 33 |
+
PyCompilerFlags *flags);
|
| 34 |
+
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
|
| 35 |
+
FILE *fp,
|
| 36 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 37 |
+
PyCompilerFlags *flags);
|
| 38 |
+
PyAPI_FUNC(int) _PyRun_InteractiveLoopObject(
|
| 39 |
+
FILE *fp,
|
| 40 |
+
PyObject *filename,
|
| 41 |
+
PyCompilerFlags *flags);
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
|
| 45 |
+
PyObject *, PyCompilerFlags *);
|
| 46 |
+
|
| 47 |
+
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
|
| 48 |
+
FILE *fp,
|
| 49 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 50 |
+
int start,
|
| 51 |
+
PyObject *globals,
|
| 52 |
+
PyObject *locals,
|
| 53 |
+
int closeit,
|
| 54 |
+
PyCompilerFlags *flags);
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
|
| 58 |
+
const char *str,
|
| 59 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 60 |
+
int start,
|
| 61 |
+
PyCompilerFlags *flags,
|
| 62 |
+
int optimize);
|
| 63 |
+
PyAPI_FUNC(PyObject *) Py_CompileStringObject(
|
| 64 |
+
const char *str,
|
| 65 |
+
PyObject *filename, int start,
|
| 66 |
+
PyCompilerFlags *flags,
|
| 67 |
+
int optimize);
|
| 68 |
+
|
| 69 |
+
#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
|
| 70 |
+
#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
PyAPI_FUNC(const char *) _Py_SourceAsString(
|
| 74 |
+
PyObject *cmd,
|
| 75 |
+
const char *funcname,
|
| 76 |
+
const char *what,
|
| 77 |
+
PyCompilerFlags *cf,
|
| 78 |
+
PyObject **cmd_copy);
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
/* A function flavor is also exported by libpython. It is required when
|
| 82 |
+
libpython is accessed directly rather than using header files which defines
|
| 83 |
+
macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
|
| 84 |
+
export functions in pythonXX.dll. */
|
| 85 |
+
PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
|
| 86 |
+
PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
|
| 87 |
+
PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
|
| 88 |
+
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
|
| 89 |
+
PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
|
| 90 |
+
PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
|
| 91 |
+
PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
|
| 92 |
+
PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
|
| 93 |
+
PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
|
| 94 |
+
PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
|
| 95 |
+
PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
|
| 96 |
+
PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
|
| 97 |
+
|
| 98 |
+
/* Use macros for a bunch of old variants */
|
| 99 |
+
#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
|
| 100 |
+
#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
|
| 101 |
+
#define PyRun_AnyFileEx(fp, name, closeit) \
|
| 102 |
+
PyRun_AnyFileExFlags(fp, name, closeit, NULL)
|
| 103 |
+
#define PyRun_AnyFileFlags(fp, name, flags) \
|
| 104 |
+
PyRun_AnyFileExFlags(fp, name, 0, flags)
|
| 105 |
+
#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
|
| 106 |
+
#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
|
| 107 |
+
#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
|
| 108 |
+
#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
|
| 109 |
+
#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
|
| 110 |
+
#define PyRun_File(fp, p, s, g, l) \
|
| 111 |
+
PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
|
| 112 |
+
#define PyRun_FileEx(fp, p, s, g, l, c) \
|
| 113 |
+
PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
|
| 114 |
+
#define PyRun_FileFlags(fp, p, s, g, l, flags) \
|
| 115 |
+
PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
/* Stuff with no proper home (yet) */
|
| 119 |
+
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
|
| 120 |
+
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
|
| 121 |
+
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
|
evalkit_llava/include/python3.10/cpython/sysmodule.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_SYSMODULE_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key);
|
| 6 |
+
PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *);
|
| 7 |
+
|
| 8 |
+
PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *);
|
| 9 |
+
|
| 10 |
+
typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *);
|
| 11 |
+
|
| 12 |
+
PyAPI_FUNC(int) PySys_Audit(
|
| 13 |
+
const char *event,
|
| 14 |
+
const char *argFormat,
|
| 15 |
+
...);
|
| 16 |
+
PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
|
evalkit_llava/include/python3.10/cpython/traceback.h
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_TRACEBACK_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef struct _traceback {
|
| 6 |
+
PyObject_HEAD
|
| 7 |
+
struct _traceback *tb_next;
|
| 8 |
+
PyFrameObject *tb_frame;
|
| 9 |
+
int tb_lasti;
|
| 10 |
+
int tb_lineno;
|
| 11 |
+
} PyTracebackObject;
|
| 12 |
+
|
| 13 |
+
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int);
|
| 14 |
+
PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
|
evalkit_llava/include/python3.10/cpython/unicodeobject.h
ADDED
|
@@ -0,0 +1,1169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_UNICODEOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Py_UNICODE was the native Unicode storage format (code unit) used by
|
| 6 |
+
Python and represents a single Unicode element in the Unicode type.
|
| 7 |
+
With PEP 393, Py_UNICODE is deprecated and replaced with a
|
| 8 |
+
typedef to wchar_t. */
|
| 9 |
+
#define PY_UNICODE_TYPE wchar_t
|
| 10 |
+
/* Py_DEPRECATED(3.3) */ typedef wchar_t Py_UNICODE;
|
| 11 |
+
|
| 12 |
+
/* --- Internal Unicode Operations ---------------------------------------- */
|
| 13 |
+
|
| 14 |
+
#ifndef USE_UNICODE_WCHAR_CACHE
|
| 15 |
+
# define USE_UNICODE_WCHAR_CACHE 1
|
| 16 |
+
#endif /* USE_UNICODE_WCHAR_CACHE */
|
| 17 |
+
|
| 18 |
+
/* Since splitting on whitespace is an important use case, and
|
| 19 |
+
whitespace in most situations is solely ASCII whitespace, we
|
| 20 |
+
optimize for the common case by using a quick look-up table
|
| 21 |
+
_Py_ascii_whitespace (see below) with an inlined check.
|
| 22 |
+
|
| 23 |
+
*/
|
| 24 |
+
#define Py_UNICODE_ISSPACE(ch) \
|
| 25 |
+
((Py_UCS4)(ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
|
| 26 |
+
|
| 27 |
+
#define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch)
|
| 28 |
+
#define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch)
|
| 29 |
+
#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch)
|
| 30 |
+
#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch)
|
| 31 |
+
|
| 32 |
+
#define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch)
|
| 33 |
+
#define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch)
|
| 34 |
+
#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch)
|
| 35 |
+
|
| 36 |
+
#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
|
| 37 |
+
#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
|
| 38 |
+
#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
|
| 39 |
+
#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
|
| 40 |
+
|
| 41 |
+
#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
|
| 42 |
+
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
|
| 43 |
+
#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch)
|
| 44 |
+
|
| 45 |
+
#define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch)
|
| 46 |
+
|
| 47 |
+
#define Py_UNICODE_ISALNUM(ch) \
|
| 48 |
+
(Py_UNICODE_ISALPHA(ch) || \
|
| 49 |
+
Py_UNICODE_ISDECIMAL(ch) || \
|
| 50 |
+
Py_UNICODE_ISDIGIT(ch) || \
|
| 51 |
+
Py_UNICODE_ISNUMERIC(ch))
|
| 52 |
+
|
| 53 |
+
Py_DEPRECATED(3.3) static inline void
|
| 54 |
+
Py_UNICODE_COPY(Py_UNICODE *target, const Py_UNICODE *source, Py_ssize_t length) {
|
| 55 |
+
memcpy(target, source, (size_t)(length) * sizeof(Py_UNICODE));
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
Py_DEPRECATED(3.3) static inline void
|
| 59 |
+
Py_UNICODE_FILL(Py_UNICODE *target, Py_UNICODE value, Py_ssize_t length) {
|
| 60 |
+
Py_ssize_t i;
|
| 61 |
+
for (i = 0; i < length; i++) {
|
| 62 |
+
target[i] = value;
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/* macros to work with surrogates */
|
| 67 |
+
#define Py_UNICODE_IS_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDFFF)
|
| 68 |
+
#define Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDBFF)
|
| 69 |
+
#define Py_UNICODE_IS_LOW_SURROGATE(ch) (0xDC00 <= (ch) && (ch) <= 0xDFFF)
|
| 70 |
+
/* Join two surrogate characters and return a single Py_UCS4 value. */
|
| 71 |
+
#define Py_UNICODE_JOIN_SURROGATES(high, low) \
|
| 72 |
+
(((((Py_UCS4)(high) & 0x03FF) << 10) | \
|
| 73 |
+
((Py_UCS4)(low) & 0x03FF)) + 0x10000)
|
| 74 |
+
/* high surrogate = top 10 bits added to D800 */
|
| 75 |
+
#define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 - (0x10000 >> 10) + ((ch) >> 10))
|
| 76 |
+
/* low surrogate = bottom 10 bits added to DC00 */
|
| 77 |
+
#define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 + ((ch) & 0x3FF))
|
| 78 |
+
|
| 79 |
+
/* --- Unicode Type ------------------------------------------------------- */
|
| 80 |
+
|
| 81 |
+
/* ASCII-only strings created through PyUnicode_New use the PyASCIIObject
|
| 82 |
+
structure. state.ascii and state.compact are set, and the data
|
| 83 |
+
immediately follow the structure. utf8_length and wstr_length can be found
|
| 84 |
+
in the length field; the utf8 pointer is equal to the data pointer. */
|
| 85 |
+
typedef struct {
|
| 86 |
+
/* There are 4 forms of Unicode strings:
|
| 87 |
+
|
| 88 |
+
- compact ascii:
|
| 89 |
+
|
| 90 |
+
* structure = PyASCIIObject
|
| 91 |
+
* test: PyUnicode_IS_COMPACT_ASCII(op)
|
| 92 |
+
* kind = PyUnicode_1BYTE_KIND
|
| 93 |
+
* compact = 1
|
| 94 |
+
* ascii = 1
|
| 95 |
+
* ready = 1
|
| 96 |
+
* (length is the length of the utf8 and wstr strings)
|
| 97 |
+
* (data starts just after the structure)
|
| 98 |
+
* (since ASCII is decoded from UTF-8, the utf8 string are the data)
|
| 99 |
+
|
| 100 |
+
- compact:
|
| 101 |
+
|
| 102 |
+
* structure = PyCompactUnicodeObject
|
| 103 |
+
* test: PyUnicode_IS_COMPACT(op) && !PyUnicode_IS_ASCII(op)
|
| 104 |
+
* kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or
|
| 105 |
+
PyUnicode_4BYTE_KIND
|
| 106 |
+
* compact = 1
|
| 107 |
+
* ready = 1
|
| 108 |
+
* ascii = 0
|
| 109 |
+
* utf8 is not shared with data
|
| 110 |
+
* utf8_length = 0 if utf8 is NULL
|
| 111 |
+
* wstr is shared with data and wstr_length=length
|
| 112 |
+
if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2
|
| 113 |
+
or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_t)=4
|
| 114 |
+
* wstr_length = 0 if wstr is NULL
|
| 115 |
+
* (data starts just after the structure)
|
| 116 |
+
|
| 117 |
+
- legacy string, not ready:
|
| 118 |
+
|
| 119 |
+
* structure = PyUnicodeObject
|
| 120 |
+
* test: kind == PyUnicode_WCHAR_KIND
|
| 121 |
+
* length = 0 (use wstr_length)
|
| 122 |
+
* hash = -1
|
| 123 |
+
* kind = PyUnicode_WCHAR_KIND
|
| 124 |
+
* compact = 0
|
| 125 |
+
* ascii = 0
|
| 126 |
+
* ready = 0
|
| 127 |
+
* interned = SSTATE_NOT_INTERNED
|
| 128 |
+
* wstr is not NULL
|
| 129 |
+
* data.any is NULL
|
| 130 |
+
* utf8 is NULL
|
| 131 |
+
* utf8_length = 0
|
| 132 |
+
|
| 133 |
+
- legacy string, ready:
|
| 134 |
+
|
| 135 |
+
* structure = PyUnicodeObject structure
|
| 136 |
+
* test: !PyUnicode_IS_COMPACT(op) && kind != PyUnicode_WCHAR_KIND
|
| 137 |
+
* kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or
|
| 138 |
+
PyUnicode_4BYTE_KIND
|
| 139 |
+
* compact = 0
|
| 140 |
+
* ready = 1
|
| 141 |
+
* data.any is not NULL
|
| 142 |
+
* utf8 is shared and utf8_length = length with data.any if ascii = 1
|
| 143 |
+
* utf8_length = 0 if utf8 is NULL
|
| 144 |
+
* wstr is shared with data.any and wstr_length = length
|
| 145 |
+
if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2
|
| 146 |
+
or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_4)=4
|
| 147 |
+
* wstr_length = 0 if wstr is NULL
|
| 148 |
+
|
| 149 |
+
Compact strings use only one memory block (structure + characters),
|
| 150 |
+
whereas legacy strings use one block for the structure and one block
|
| 151 |
+
for characters.
|
| 152 |
+
|
| 153 |
+
Legacy strings are created by PyUnicode_FromUnicode() and
|
| 154 |
+
PyUnicode_FromStringAndSize(NULL, size) functions. They become ready
|
| 155 |
+
when PyUnicode_READY() is called.
|
| 156 |
+
|
| 157 |
+
See also _PyUnicode_CheckConsistency().
|
| 158 |
+
*/
|
| 159 |
+
PyObject_HEAD
|
| 160 |
+
Py_ssize_t length; /* Number of code points in the string */
|
| 161 |
+
Py_hash_t hash; /* Hash value; -1 if not set */
|
| 162 |
+
struct {
|
| 163 |
+
/*
|
| 164 |
+
SSTATE_NOT_INTERNED (0)
|
| 165 |
+
SSTATE_INTERNED_MORTAL (1)
|
| 166 |
+
SSTATE_INTERNED_IMMORTAL (2)
|
| 167 |
+
|
| 168 |
+
If interned != SSTATE_NOT_INTERNED, the two references from the
|
| 169 |
+
dictionary to this object are *not* counted in ob_refcnt.
|
| 170 |
+
*/
|
| 171 |
+
unsigned int interned:2;
|
| 172 |
+
/* Character size:
|
| 173 |
+
|
| 174 |
+
- PyUnicode_WCHAR_KIND (0):
|
| 175 |
+
|
| 176 |
+
* character type = wchar_t (16 or 32 bits, depending on the
|
| 177 |
+
platform)
|
| 178 |
+
|
| 179 |
+
- PyUnicode_1BYTE_KIND (1):
|
| 180 |
+
|
| 181 |
+
* character type = Py_UCS1 (8 bits, unsigned)
|
| 182 |
+
* all characters are in the range U+0000-U+00FF (latin1)
|
| 183 |
+
* if ascii is set, all characters are in the range U+0000-U+007F
|
| 184 |
+
(ASCII), otherwise at least one character is in the range
|
| 185 |
+
U+0080-U+00FF
|
| 186 |
+
|
| 187 |
+
- PyUnicode_2BYTE_KIND (2):
|
| 188 |
+
|
| 189 |
+
* character type = Py_UCS2 (16 bits, unsigned)
|
| 190 |
+
* all characters are in the range U+0000-U+FFFF (BMP)
|
| 191 |
+
* at least one character is in the range U+0100-U+FFFF
|
| 192 |
+
|
| 193 |
+
- PyUnicode_4BYTE_KIND (4):
|
| 194 |
+
|
| 195 |
+
* character type = Py_UCS4 (32 bits, unsigned)
|
| 196 |
+
* all characters are in the range U+0000-U+10FFFF
|
| 197 |
+
* at least one character is in the range U+10000-U+10FFFF
|
| 198 |
+
*/
|
| 199 |
+
unsigned int kind:3;
|
| 200 |
+
/* Compact is with respect to the allocation scheme. Compact unicode
|
| 201 |
+
objects only require one memory block while non-compact objects use
|
| 202 |
+
one block for the PyUnicodeObject struct and another for its data
|
| 203 |
+
buffer. */
|
| 204 |
+
unsigned int compact:1;
|
| 205 |
+
/* The string only contains characters in the range U+0000-U+007F (ASCII)
|
| 206 |
+
and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is
|
| 207 |
+
set, use the PyASCIIObject structure. */
|
| 208 |
+
unsigned int ascii:1;
|
| 209 |
+
/* The ready flag indicates whether the object layout is initialized
|
| 210 |
+
completely. This means that this is either a compact object, or
|
| 211 |
+
the data pointer is filled out. The bit is redundant, and helps
|
| 212 |
+
to minimize the test in PyUnicode_IS_READY(). */
|
| 213 |
+
unsigned int ready:1;
|
| 214 |
+
/* Padding to ensure that PyUnicode_DATA() is always aligned to
|
| 215 |
+
4 bytes (see issue #19537 on m68k). */
|
| 216 |
+
unsigned int :24;
|
| 217 |
+
} state;
|
| 218 |
+
wchar_t *wstr; /* wchar_t representation (null-terminated) */
|
| 219 |
+
} PyASCIIObject;
|
| 220 |
+
|
| 221 |
+
/* Non-ASCII strings allocated through PyUnicode_New use the
|
| 222 |
+
PyCompactUnicodeObject structure. state.compact is set, and the data
|
| 223 |
+
immediately follow the structure. */
|
| 224 |
+
typedef struct {
|
| 225 |
+
PyASCIIObject _base;
|
| 226 |
+
Py_ssize_t utf8_length; /* Number of bytes in utf8, excluding the
|
| 227 |
+
* terminating \0. */
|
| 228 |
+
char *utf8; /* UTF-8 representation (null-terminated) */
|
| 229 |
+
Py_ssize_t wstr_length; /* Number of code points in wstr, possible
|
| 230 |
+
* surrogates count as two code points. */
|
| 231 |
+
} PyCompactUnicodeObject;
|
| 232 |
+
|
| 233 |
+
/* Strings allocated through PyUnicode_FromUnicode(NULL, len) use the
|
| 234 |
+
PyUnicodeObject structure. The actual string data is initially in the wstr
|
| 235 |
+
block, and copied into the data block using _PyUnicode_Ready. */
|
| 236 |
+
typedef struct {
|
| 237 |
+
PyCompactUnicodeObject _base;
|
| 238 |
+
union {
|
| 239 |
+
void *any;
|
| 240 |
+
Py_UCS1 *latin1;
|
| 241 |
+
Py_UCS2 *ucs2;
|
| 242 |
+
Py_UCS4 *ucs4;
|
| 243 |
+
} data; /* Canonical, smallest-form Unicode buffer */
|
| 244 |
+
} PyUnicodeObject;
|
| 245 |
+
|
| 246 |
+
PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
|
| 247 |
+
PyObject *op,
|
| 248 |
+
int check_content);
|
| 249 |
+
|
| 250 |
+
/* Fast access macros */
|
| 251 |
+
|
| 252 |
+
/* Returns the deprecated Py_UNICODE representation's size in code units
|
| 253 |
+
(this includes surrogate pairs as 2 units).
|
| 254 |
+
If the Py_UNICODE representation is not available, it will be computed
|
| 255 |
+
on request. Use PyUnicode_GET_LENGTH() for the length in code points. */
|
| 256 |
+
|
| 257 |
+
/* Py_DEPRECATED(3.3) */
|
| 258 |
+
#define PyUnicode_GET_SIZE(op) \
|
| 259 |
+
(assert(PyUnicode_Check(op)), \
|
| 260 |
+
(((PyASCIIObject *)(op))->wstr) ? \
|
| 261 |
+
PyUnicode_WSTR_LENGTH(op) : \
|
| 262 |
+
((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
|
| 263 |
+
assert(((PyASCIIObject *)(op))->wstr), \
|
| 264 |
+
PyUnicode_WSTR_LENGTH(op)))
|
| 265 |
+
|
| 266 |
+
/* Py_DEPRECATED(3.3) */
|
| 267 |
+
#define PyUnicode_GET_DATA_SIZE(op) \
|
| 268 |
+
(PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
|
| 269 |
+
|
| 270 |
+
/* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE
|
| 271 |
+
representation on demand. Using this macro is very inefficient now,
|
| 272 |
+
try to port your code to use the new PyUnicode_*BYTE_DATA() macros or
|
| 273 |
+
use PyUnicode_WRITE() and PyUnicode_READ(). */
|
| 274 |
+
|
| 275 |
+
/* Py_DEPRECATED(3.3) */
|
| 276 |
+
#define PyUnicode_AS_UNICODE(op) \
|
| 277 |
+
(assert(PyUnicode_Check(op)), \
|
| 278 |
+
(((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \
|
| 279 |
+
PyUnicode_AsUnicode(_PyObject_CAST(op)))
|
| 280 |
+
|
| 281 |
+
/* Py_DEPRECATED(3.3) */
|
| 282 |
+
#define PyUnicode_AS_DATA(op) \
|
| 283 |
+
((const char *)(PyUnicode_AS_UNICODE(op)))
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */
|
| 287 |
+
|
| 288 |
+
/* Values for PyASCIIObject.state: */
|
| 289 |
+
|
| 290 |
+
/* Interning state. */
|
| 291 |
+
#define SSTATE_NOT_INTERNED 0
|
| 292 |
+
#define SSTATE_INTERNED_MORTAL 1
|
| 293 |
+
#define SSTATE_INTERNED_IMMORTAL 2
|
| 294 |
+
|
| 295 |
+
/* Return true if the string contains only ASCII characters, or 0 if not. The
|
| 296 |
+
string may be compact (PyUnicode_IS_COMPACT_ASCII) or not, but must be
|
| 297 |
+
ready. */
|
| 298 |
+
#define PyUnicode_IS_ASCII(op) \
|
| 299 |
+
(assert(PyUnicode_Check(op)), \
|
| 300 |
+
assert(PyUnicode_IS_READY(op)), \
|
| 301 |
+
((PyASCIIObject*)op)->state.ascii)
|
| 302 |
+
|
| 303 |
+
/* Return true if the string is compact or 0 if not.
|
| 304 |
+
No type checks or Ready calls are performed. */
|
| 305 |
+
#define PyUnicode_IS_COMPACT(op) \
|
| 306 |
+
(((PyASCIIObject*)(op))->state.compact)
|
| 307 |
+
|
| 308 |
+
/* Return true if the string is a compact ASCII string (use PyASCIIObject
|
| 309 |
+
structure), or 0 if not. No type checks or Ready calls are performed. */
|
| 310 |
+
#define PyUnicode_IS_COMPACT_ASCII(op) \
|
| 311 |
+
(((PyASCIIObject*)op)->state.ascii && PyUnicode_IS_COMPACT(op))
|
| 312 |
+
|
| 313 |
+
enum PyUnicode_Kind {
|
| 314 |
+
/* String contains only wstr byte characters. This is only possible
|
| 315 |
+
when the string was created with a legacy API and _PyUnicode_Ready()
|
| 316 |
+
has not been called yet. */
|
| 317 |
+
PyUnicode_WCHAR_KIND = 0,
|
| 318 |
+
/* Return values of the PyUnicode_KIND() macro: */
|
| 319 |
+
PyUnicode_1BYTE_KIND = 1,
|
| 320 |
+
PyUnicode_2BYTE_KIND = 2,
|
| 321 |
+
PyUnicode_4BYTE_KIND = 4
|
| 322 |
+
};
|
| 323 |
+
|
| 324 |
+
/* Return pointers to the canonical representation cast to unsigned char,
|
| 325 |
+
Py_UCS2, or Py_UCS4 for direct character access.
|
| 326 |
+
No checks are performed, use PyUnicode_KIND() before to ensure
|
| 327 |
+
these will work correctly. */
|
| 328 |
+
|
| 329 |
+
#define PyUnicode_1BYTE_DATA(op) ((Py_UCS1*)PyUnicode_DATA(op))
|
| 330 |
+
#define PyUnicode_2BYTE_DATA(op) ((Py_UCS2*)PyUnicode_DATA(op))
|
| 331 |
+
#define PyUnicode_4BYTE_DATA(op) ((Py_UCS4*)PyUnicode_DATA(op))
|
| 332 |
+
|
| 333 |
+
/* Return one of the PyUnicode_*_KIND values defined above. */
|
| 334 |
+
#define PyUnicode_KIND(op) \
|
| 335 |
+
(assert(PyUnicode_Check(op)), \
|
| 336 |
+
assert(PyUnicode_IS_READY(op)), \
|
| 337 |
+
((PyASCIIObject *)(op))->state.kind)
|
| 338 |
+
|
| 339 |
+
/* Return a void pointer to the raw unicode buffer. */
|
| 340 |
+
#define _PyUnicode_COMPACT_DATA(op) \
|
| 341 |
+
(PyUnicode_IS_ASCII(op) ? \
|
| 342 |
+
((void*)((PyASCIIObject*)(op) + 1)) : \
|
| 343 |
+
((void*)((PyCompactUnicodeObject*)(op) + 1)))
|
| 344 |
+
|
| 345 |
+
#define _PyUnicode_NONCOMPACT_DATA(op) \
|
| 346 |
+
(assert(((PyUnicodeObject*)(op))->data.any), \
|
| 347 |
+
((((PyUnicodeObject *)(op))->data.any)))
|
| 348 |
+
|
| 349 |
+
#define PyUnicode_DATA(op) \
|
| 350 |
+
(assert(PyUnicode_Check(op)), \
|
| 351 |
+
PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) : \
|
| 352 |
+
_PyUnicode_NONCOMPACT_DATA(op))
|
| 353 |
+
|
| 354 |
+
/* In the access macros below, "kind" may be evaluated more than once.
|
| 355 |
+
All other macro parameters are evaluated exactly once, so it is safe
|
| 356 |
+
to put side effects into them (such as increasing the index). */
|
| 357 |
+
|
| 358 |
+
/* Write into the canonical representation, this macro does not do any sanity
|
| 359 |
+
checks and is intended for usage in loops. The caller should cache the
|
| 360 |
+
kind and data pointers obtained from other macro calls.
|
| 361 |
+
index is the index in the string (starts at 0) and value is the new
|
| 362 |
+
code point value which should be written to that location. */
|
| 363 |
+
#define PyUnicode_WRITE(kind, data, index, value) \
|
| 364 |
+
do { \
|
| 365 |
+
switch ((kind)) { \
|
| 366 |
+
case PyUnicode_1BYTE_KIND: { \
|
| 367 |
+
((Py_UCS1 *)(data))[(index)] = (Py_UCS1)(value); \
|
| 368 |
+
break; \
|
| 369 |
+
} \
|
| 370 |
+
case PyUnicode_2BYTE_KIND: { \
|
| 371 |
+
((Py_UCS2 *)(data))[(index)] = (Py_UCS2)(value); \
|
| 372 |
+
break; \
|
| 373 |
+
} \
|
| 374 |
+
default: { \
|
| 375 |
+
assert((kind) == PyUnicode_4BYTE_KIND); \
|
| 376 |
+
((Py_UCS4 *)(data))[(index)] = (Py_UCS4)(value); \
|
| 377 |
+
} \
|
| 378 |
+
} \
|
| 379 |
+
} while (0)
|
| 380 |
+
|
| 381 |
+
/* Read a code point from the string's canonical representation. No checks
|
| 382 |
+
or ready calls are performed. */
|
| 383 |
+
#define PyUnicode_READ(kind, data, index) \
|
| 384 |
+
((Py_UCS4) \
|
| 385 |
+
((kind) == PyUnicode_1BYTE_KIND ? \
|
| 386 |
+
((const Py_UCS1 *)(data))[(index)] : \
|
| 387 |
+
((kind) == PyUnicode_2BYTE_KIND ? \
|
| 388 |
+
((const Py_UCS2 *)(data))[(index)] : \
|
| 389 |
+
((const Py_UCS4 *)(data))[(index)] \
|
| 390 |
+
) \
|
| 391 |
+
))
|
| 392 |
+
|
| 393 |
+
/* PyUnicode_READ_CHAR() is less efficient than PyUnicode_READ() because it
|
| 394 |
+
calls PyUnicode_KIND() and might call it twice. For single reads, use
|
| 395 |
+
PyUnicode_READ_CHAR, for multiple consecutive reads callers should
|
| 396 |
+
cache kind and use PyUnicode_READ instead. */
|
| 397 |
+
#define PyUnicode_READ_CHAR(unicode, index) \
|
| 398 |
+
(assert(PyUnicode_Check(unicode)), \
|
| 399 |
+
assert(PyUnicode_IS_READY(unicode)), \
|
| 400 |
+
(Py_UCS4) \
|
| 401 |
+
(PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND ? \
|
| 402 |
+
((const Py_UCS1 *)(PyUnicode_DATA((unicode))))[(index)] : \
|
| 403 |
+
(PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND ? \
|
| 404 |
+
((const Py_UCS2 *)(PyUnicode_DATA((unicode))))[(index)] : \
|
| 405 |
+
((const Py_UCS4 *)(PyUnicode_DATA((unicode))))[(index)] \
|
| 406 |
+
) \
|
| 407 |
+
))
|
| 408 |
+
|
| 409 |
+
/* Returns the length of the unicode string. The caller has to make sure that
|
| 410 |
+
the string has it's canonical representation set before calling
|
| 411 |
+
this macro. Call PyUnicode_(FAST_)Ready to ensure that. */
|
| 412 |
+
#define PyUnicode_GET_LENGTH(op) \
|
| 413 |
+
(assert(PyUnicode_Check(op)), \
|
| 414 |
+
assert(PyUnicode_IS_READY(op)), \
|
| 415 |
+
((PyASCIIObject *)(op))->length)
|
| 416 |
+
|
| 417 |
+
|
| 418 |
+
/* Fast check to determine whether an object is ready. Equivalent to
|
| 419 |
+
PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any */
|
| 420 |
+
|
| 421 |
+
#define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready)
|
| 422 |
+
|
| 423 |
+
/* PyUnicode_READY() does less work than _PyUnicode_Ready() in the best
|
| 424 |
+
case. If the canonical representation is not yet set, it will still call
|
| 425 |
+
_PyUnicode_Ready().
|
| 426 |
+
Returns 0 on success and -1 on errors. */
|
| 427 |
+
#define PyUnicode_READY(op) \
|
| 428 |
+
(assert(PyUnicode_Check(op)), \
|
| 429 |
+
(PyUnicode_IS_READY(op) ? \
|
| 430 |
+
0 : _PyUnicode_Ready(_PyObject_CAST(op))))
|
| 431 |
+
|
| 432 |
+
/* Return a maximum character value which is suitable for creating another
|
| 433 |
+
string based on op. This is always an approximation but more efficient
|
| 434 |
+
than iterating over the string. */
|
| 435 |
+
#define PyUnicode_MAX_CHAR_VALUE(op) \
|
| 436 |
+
(assert(PyUnicode_IS_READY(op)), \
|
| 437 |
+
(PyUnicode_IS_ASCII(op) ? \
|
| 438 |
+
(0x7f) : \
|
| 439 |
+
(PyUnicode_KIND(op) == PyUnicode_1BYTE_KIND ? \
|
| 440 |
+
(0xffU) : \
|
| 441 |
+
(PyUnicode_KIND(op) == PyUnicode_2BYTE_KIND ? \
|
| 442 |
+
(0xffffU) : \
|
| 443 |
+
(0x10ffffU)))))
|
| 444 |
+
|
| 445 |
+
Py_DEPRECATED(3.3)
|
| 446 |
+
static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
|
| 447 |
+
return PyUnicode_IS_COMPACT_ASCII(op) ?
|
| 448 |
+
((PyASCIIObject*)op)->length :
|
| 449 |
+
((PyCompactUnicodeObject*)op)->wstr_length;
|
| 450 |
+
}
|
| 451 |
+
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
|
| 452 |
+
|
| 453 |
+
/* === Public API ========================================================= */
|
| 454 |
+
|
| 455 |
+
/* --- Plain Py_UNICODE --------------------------------------------------- */
|
| 456 |
+
|
| 457 |
+
/* With PEP 393, this is the recommended way to allocate a new unicode object.
|
| 458 |
+
This function will allocate the object and its buffer in a single memory
|
| 459 |
+
block. Objects created using this function are not resizable. */
|
| 460 |
+
PyAPI_FUNC(PyObject*) PyUnicode_New(
|
| 461 |
+
Py_ssize_t size, /* Number of code points in the new string */
|
| 462 |
+
Py_UCS4 maxchar /* maximum code point value in the string */
|
| 463 |
+
);
|
| 464 |
+
|
| 465 |
+
/* Initializes the canonical string representation from the deprecated
|
| 466 |
+
wstr/Py_UNICODE representation. This function is used to convert Unicode
|
| 467 |
+
objects which were created using the old API to the new flexible format
|
| 468 |
+
introduced with PEP 393.
|
| 469 |
+
|
| 470 |
+
Don't call this function directly, use the public PyUnicode_READY() macro
|
| 471 |
+
instead. */
|
| 472 |
+
PyAPI_FUNC(int) _PyUnicode_Ready(
|
| 473 |
+
PyObject *unicode /* Unicode object */
|
| 474 |
+
);
|
| 475 |
+
|
| 476 |
+
/* Get a copy of a Unicode string. */
|
| 477 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_Copy(
|
| 478 |
+
PyObject *unicode
|
| 479 |
+
);
|
| 480 |
+
|
| 481 |
+
/* Copy character from one unicode object into another, this function performs
|
| 482 |
+
character conversion when necessary and falls back to memcpy() if possible.
|
| 483 |
+
|
| 484 |
+
Fail if to is too small (smaller than *how_many* or smaller than
|
| 485 |
+
len(from)-from_start), or if kind(from[from_start:from_start+how_many]) >
|
| 486 |
+
kind(to), or if *to* has more than 1 reference.
|
| 487 |
+
|
| 488 |
+
Return the number of written character, or return -1 and raise an exception
|
| 489 |
+
on error.
|
| 490 |
+
|
| 491 |
+
Pseudo-code:
|
| 492 |
+
|
| 493 |
+
how_many = min(how_many, len(from) - from_start)
|
| 494 |
+
to[to_start:to_start+how_many] = from[from_start:from_start+how_many]
|
| 495 |
+
return how_many
|
| 496 |
+
|
| 497 |
+
Note: The function doesn't write a terminating null character.
|
| 498 |
+
*/
|
| 499 |
+
PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(
|
| 500 |
+
PyObject *to,
|
| 501 |
+
Py_ssize_t to_start,
|
| 502 |
+
PyObject *from,
|
| 503 |
+
Py_ssize_t from_start,
|
| 504 |
+
Py_ssize_t how_many
|
| 505 |
+
);
|
| 506 |
+
|
| 507 |
+
/* Unsafe version of PyUnicode_CopyCharacters(): don't check arguments and so
|
| 508 |
+
may crash if parameters are invalid (e.g. if the output string
|
| 509 |
+
is too short). */
|
| 510 |
+
PyAPI_FUNC(void) _PyUnicode_FastCopyCharacters(
|
| 511 |
+
PyObject *to,
|
| 512 |
+
Py_ssize_t to_start,
|
| 513 |
+
PyObject *from,
|
| 514 |
+
Py_ssize_t from_start,
|
| 515 |
+
Py_ssize_t how_many
|
| 516 |
+
);
|
| 517 |
+
|
| 518 |
+
/* Fill a string with a character: write fill_char into
|
| 519 |
+
unicode[start:start+length].
|
| 520 |
+
|
| 521 |
+
Fail if fill_char is bigger than the string maximum character, or if the
|
| 522 |
+
string has more than 1 reference.
|
| 523 |
+
|
| 524 |
+
Return the number of written character, or return -1 and raise an exception
|
| 525 |
+
on error. */
|
| 526 |
+
PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill(
|
| 527 |
+
PyObject *unicode,
|
| 528 |
+
Py_ssize_t start,
|
| 529 |
+
Py_ssize_t length,
|
| 530 |
+
Py_UCS4 fill_char
|
| 531 |
+
);
|
| 532 |
+
|
| 533 |
+
/* Unsafe version of PyUnicode_Fill(): don't check arguments and so may crash
|
| 534 |
+
if parameters are invalid (e.g. if length is longer than the string). */
|
| 535 |
+
PyAPI_FUNC(void) _PyUnicode_FastFill(
|
| 536 |
+
PyObject *unicode,
|
| 537 |
+
Py_ssize_t start,
|
| 538 |
+
Py_ssize_t length,
|
| 539 |
+
Py_UCS4 fill_char
|
| 540 |
+
);
|
| 541 |
+
|
| 542 |
+
/* Create a Unicode Object from the Py_UNICODE buffer u of the given
|
| 543 |
+
size.
|
| 544 |
+
|
| 545 |
+
u may be NULL which causes the contents to be undefined. It is the
|
| 546 |
+
user's responsibility to fill in the needed data afterwards. Note
|
| 547 |
+
that modifying the Unicode object contents after construction is
|
| 548 |
+
only allowed if u was set to NULL.
|
| 549 |
+
|
| 550 |
+
The buffer is copied into the new object. */
|
| 551 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
|
| 552 |
+
const Py_UNICODE *u, /* Unicode buffer */
|
| 553 |
+
Py_ssize_t size /* size of buffer */
|
| 554 |
+
);
|
| 555 |
+
|
| 556 |
+
/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters.
|
| 557 |
+
Scan the string to find the maximum character. */
|
| 558 |
+
PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData(
|
| 559 |
+
int kind,
|
| 560 |
+
const void *buffer,
|
| 561 |
+
Py_ssize_t size);
|
| 562 |
+
|
| 563 |
+
/* Create a new string from a buffer of ASCII characters.
|
| 564 |
+
WARNING: Don't check if the string contains any non-ASCII character. */
|
| 565 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII(
|
| 566 |
+
const char *buffer,
|
| 567 |
+
Py_ssize_t size);
|
| 568 |
+
|
| 569 |
+
/* Compute the maximum character of the substring unicode[start:end].
|
| 570 |
+
Return 127 for an empty string. */
|
| 571 |
+
PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar (
|
| 572 |
+
PyObject *unicode,
|
| 573 |
+
Py_ssize_t start,
|
| 574 |
+
Py_ssize_t end);
|
| 575 |
+
|
| 576 |
+
/* Return a read-only pointer to the Unicode object's internal
|
| 577 |
+
Py_UNICODE buffer.
|
| 578 |
+
If the wchar_t/Py_UNICODE representation is not yet available, this
|
| 579 |
+
function will calculate it. */
|
| 580 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
|
| 581 |
+
PyObject *unicode /* Unicode object */
|
| 582 |
+
);
|
| 583 |
+
|
| 584 |
+
/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string
|
| 585 |
+
contains null characters. */
|
| 586 |
+
PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
|
| 587 |
+
PyObject *unicode /* Unicode object */
|
| 588 |
+
);
|
| 589 |
+
|
| 590 |
+
/* Return a read-only pointer to the Unicode object's internal
|
| 591 |
+
Py_UNICODE buffer and save the length at size.
|
| 592 |
+
If the wchar_t/Py_UNICODE representation is not yet available, this
|
| 593 |
+
function will calculate it. */
|
| 594 |
+
|
| 595 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize(
|
| 596 |
+
PyObject *unicode, /* Unicode object */
|
| 597 |
+
Py_ssize_t *size /* location where to save the length */
|
| 598 |
+
);
|
| 599 |
+
|
| 600 |
+
|
| 601 |
+
/* --- _PyUnicodeWriter API ----------------------------------------------- */
|
| 602 |
+
|
| 603 |
+
typedef struct {
|
| 604 |
+
PyObject *buffer;
|
| 605 |
+
void *data;
|
| 606 |
+
enum PyUnicode_Kind kind;
|
| 607 |
+
Py_UCS4 maxchar;
|
| 608 |
+
Py_ssize_t size;
|
| 609 |
+
Py_ssize_t pos;
|
| 610 |
+
|
| 611 |
+
/* minimum number of allocated characters (default: 0) */
|
| 612 |
+
Py_ssize_t min_length;
|
| 613 |
+
|
| 614 |
+
/* minimum character (default: 127, ASCII) */
|
| 615 |
+
Py_UCS4 min_char;
|
| 616 |
+
|
| 617 |
+
/* If non-zero, overallocate the buffer (default: 0). */
|
| 618 |
+
unsigned char overallocate;
|
| 619 |
+
|
| 620 |
+
/* If readonly is 1, buffer is a shared string (cannot be modified)
|
| 621 |
+
and size is set to 0. */
|
| 622 |
+
unsigned char readonly;
|
| 623 |
+
} _PyUnicodeWriter ;
|
| 624 |
+
|
| 625 |
+
/* Initialize a Unicode writer.
|
| 626 |
+
*
|
| 627 |
+
* By default, the minimum buffer size is 0 character and overallocation is
|
| 628 |
+
* disabled. Set min_length, min_char and overallocate attributes to control
|
| 629 |
+
* the allocation of the buffer. */
|
| 630 |
+
PyAPI_FUNC(void)
|
| 631 |
+
_PyUnicodeWriter_Init(_PyUnicodeWriter *writer);
|
| 632 |
+
|
| 633 |
+
/* Prepare the buffer to write 'length' characters
|
| 634 |
+
with the specified maximum character.
|
| 635 |
+
|
| 636 |
+
Return 0 on success, raise an exception and return -1 on error. */
|
| 637 |
+
#define _PyUnicodeWriter_Prepare(WRITER, LENGTH, MAXCHAR) \
|
| 638 |
+
(((MAXCHAR) <= (WRITER)->maxchar \
|
| 639 |
+
&& (LENGTH) <= (WRITER)->size - (WRITER)->pos) \
|
| 640 |
+
? 0 \
|
| 641 |
+
: (((LENGTH) == 0) \
|
| 642 |
+
? 0 \
|
| 643 |
+
: _PyUnicodeWriter_PrepareInternal((WRITER), (LENGTH), (MAXCHAR))))
|
| 644 |
+
|
| 645 |
+
/* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro
|
| 646 |
+
instead. */
|
| 647 |
+
PyAPI_FUNC(int)
|
| 648 |
+
_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
|
| 649 |
+
Py_ssize_t length, Py_UCS4 maxchar);
|
| 650 |
+
|
| 651 |
+
/* Prepare the buffer to have at least the kind KIND.
|
| 652 |
+
For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will
|
| 653 |
+
support characters in range U+000-U+FFFF.
|
| 654 |
+
|
| 655 |
+
Return 0 on success, raise an exception and return -1 on error. */
|
| 656 |
+
#define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \
|
| 657 |
+
(assert((KIND) != PyUnicode_WCHAR_KIND), \
|
| 658 |
+
(KIND) <= (WRITER)->kind \
|
| 659 |
+
? 0 \
|
| 660 |
+
: _PyUnicodeWriter_PrepareKindInternal((WRITER), (KIND)))
|
| 661 |
+
|
| 662 |
+
/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind()
|
| 663 |
+
macro instead. */
|
| 664 |
+
PyAPI_FUNC(int)
|
| 665 |
+
_PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer,
|
| 666 |
+
enum PyUnicode_Kind kind);
|
| 667 |
+
|
| 668 |
+
/* Append a Unicode character.
|
| 669 |
+
Return 0 on success, raise an exception and return -1 on error. */
|
| 670 |
+
PyAPI_FUNC(int)
|
| 671 |
+
_PyUnicodeWriter_WriteChar(_PyUnicodeWriter *writer,
|
| 672 |
+
Py_UCS4 ch
|
| 673 |
+
);
|
| 674 |
+
|
| 675 |
+
/* Append a Unicode string.
|
| 676 |
+
Return 0 on success, raise an exception and return -1 on error. */
|
| 677 |
+
PyAPI_FUNC(int)
|
| 678 |
+
_PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer,
|
| 679 |
+
PyObject *str /* Unicode string */
|
| 680 |
+
);
|
| 681 |
+
|
| 682 |
+
/* Append a substring of a Unicode string.
|
| 683 |
+
Return 0 on success, raise an exception and return -1 on error. */
|
| 684 |
+
PyAPI_FUNC(int)
|
| 685 |
+
_PyUnicodeWriter_WriteSubstring(_PyUnicodeWriter *writer,
|
| 686 |
+
PyObject *str, /* Unicode string */
|
| 687 |
+
Py_ssize_t start,
|
| 688 |
+
Py_ssize_t end
|
| 689 |
+
);
|
| 690 |
+
|
| 691 |
+
/* Append an ASCII-encoded byte string.
|
| 692 |
+
Return 0 on success, raise an exception and return -1 on error. */
|
| 693 |
+
PyAPI_FUNC(int)
|
| 694 |
+
_PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer,
|
| 695 |
+
const char *str, /* ASCII-encoded byte string */
|
| 696 |
+
Py_ssize_t len /* number of bytes, or -1 if unknown */
|
| 697 |
+
);
|
| 698 |
+
|
| 699 |
+
/* Append a latin1-encoded byte string.
|
| 700 |
+
Return 0 on success, raise an exception and return -1 on error. */
|
| 701 |
+
PyAPI_FUNC(int)
|
| 702 |
+
_PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer,
|
| 703 |
+
const char *str, /* latin1-encoded byte string */
|
| 704 |
+
Py_ssize_t len /* length in bytes */
|
| 705 |
+
);
|
| 706 |
+
|
| 707 |
+
/* Get the value of the writer as a Unicode string. Clear the
|
| 708 |
+
buffer of the writer. Raise an exception and return NULL
|
| 709 |
+
on error. */
|
| 710 |
+
PyAPI_FUNC(PyObject *)
|
| 711 |
+
_PyUnicodeWriter_Finish(_PyUnicodeWriter *writer);
|
| 712 |
+
|
| 713 |
+
/* Deallocate memory of a writer (clear its internal buffer). */
|
| 714 |
+
PyAPI_FUNC(void)
|
| 715 |
+
_PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer);
|
| 716 |
+
|
| 717 |
+
|
| 718 |
+
/* Format the object based on the format_spec, as defined in PEP 3101
|
| 719 |
+
(Advanced String Formatting). */
|
| 720 |
+
PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter(
|
| 721 |
+
_PyUnicodeWriter *writer,
|
| 722 |
+
PyObject *obj,
|
| 723 |
+
PyObject *format_spec,
|
| 724 |
+
Py_ssize_t start,
|
| 725 |
+
Py_ssize_t end);
|
| 726 |
+
|
| 727 |
+
/* --- Manage the default encoding ---------------------------------------- */
|
| 728 |
+
|
| 729 |
+
/* Returns a pointer to the default encoding (UTF-8) of the
|
| 730 |
+
Unicode object unicode.
|
| 731 |
+
|
| 732 |
+
Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation
|
| 733 |
+
in the unicodeobject.
|
| 734 |
+
|
| 735 |
+
_PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to
|
| 736 |
+
support the previous internal function with the same behaviour.
|
| 737 |
+
|
| 738 |
+
Use of this API is DEPRECATED since no size information can be
|
| 739 |
+
extracted from the returned data.
|
| 740 |
+
*/
|
| 741 |
+
|
| 742 |
+
PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);
|
| 743 |
+
|
| 744 |
+
#define _PyUnicode_AsString PyUnicode_AsUTF8
|
| 745 |
+
|
| 746 |
+
/* --- Generic Codecs ----------------------------------------------------- */
|
| 747 |
+
|
| 748 |
+
/* Encodes a Py_UNICODE buffer of the given size and returns a
|
| 749 |
+
Python string object. */
|
| 750 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_Encode(
|
| 751 |
+
const Py_UNICODE *s, /* Unicode char buffer */
|
| 752 |
+
Py_ssize_t size, /* number of Py_UNICODE chars to encode */
|
| 753 |
+
const char *encoding, /* encoding */
|
| 754 |
+
const char *errors /* error handling */
|
| 755 |
+
);
|
| 756 |
+
|
| 757 |
+
/* --- UTF-7 Codecs ------------------------------------------------------- */
|
| 758 |
+
|
| 759 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
|
| 760 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 761 |
+
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
|
| 762 |
+
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
|
| 763 |
+
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
|
| 764 |
+
const char *errors /* error handling */
|
| 765 |
+
);
|
| 766 |
+
|
| 767 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7(
|
| 768 |
+
PyObject *unicode, /* Unicode object */
|
| 769 |
+
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
|
| 770 |
+
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
|
| 771 |
+
const char *errors /* error handling */
|
| 772 |
+
);
|
| 773 |
+
|
| 774 |
+
/* --- UTF-8 Codecs ------------------------------------------------------- */
|
| 775 |
+
|
| 776 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String(
|
| 777 |
+
PyObject *unicode,
|
| 778 |
+
const char *errors);
|
| 779 |
+
|
| 780 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
|
| 781 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 782 |
+
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
|
| 783 |
+
const char *errors /* error handling */
|
| 784 |
+
);
|
| 785 |
+
|
| 786 |
+
/* --- UTF-32 Codecs ------------------------------------------------------ */
|
| 787 |
+
|
| 788 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
|
| 789 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 790 |
+
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
|
| 791 |
+
const char *errors, /* error handling */
|
| 792 |
+
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
|
| 793 |
+
);
|
| 794 |
+
|
| 795 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32(
|
| 796 |
+
PyObject *object, /* Unicode object */
|
| 797 |
+
const char *errors, /* error handling */
|
| 798 |
+
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
|
| 799 |
+
);
|
| 800 |
+
|
| 801 |
+
/* --- UTF-16 Codecs ------------------------------------------------------ */
|
| 802 |
+
|
| 803 |
+
/* Returns a Python string object holding the UTF-16 encoded value of
|
| 804 |
+
the Unicode data.
|
| 805 |
+
|
| 806 |
+
If byteorder is not 0, output is written according to the following
|
| 807 |
+
byte order:
|
| 808 |
+
|
| 809 |
+
byteorder == -1: little endian
|
| 810 |
+
byteorder == 0: native byte order (writes a BOM mark)
|
| 811 |
+
byteorder == 1: big endian
|
| 812 |
+
|
| 813 |
+
If byteorder is 0, the output string will always start with the
|
| 814 |
+
Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is
|
| 815 |
+
prepended.
|
| 816 |
+
|
| 817 |
+
Note that Py_UNICODE data is being interpreted as UTF-16 reduced to
|
| 818 |
+
UCS-2. This trick makes it possible to add full UTF-16 capabilities
|
| 819 |
+
at a later point without compromising the APIs.
|
| 820 |
+
|
| 821 |
+
*/
|
| 822 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
|
| 823 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 824 |
+
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
|
| 825 |
+
const char *errors, /* error handling */
|
| 826 |
+
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
|
| 827 |
+
);
|
| 828 |
+
|
| 829 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16(
|
| 830 |
+
PyObject* unicode, /* Unicode object */
|
| 831 |
+
const char *errors, /* error handling */
|
| 832 |
+
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
|
| 833 |
+
);
|
| 834 |
+
|
| 835 |
+
/* --- Unicode-Escape Codecs ---------------------------------------------- */
|
| 836 |
+
|
| 837 |
+
/* Variant of PyUnicode_DecodeUnicodeEscape that supports partial decoding. */
|
| 838 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeStateful(
|
| 839 |
+
const char *string, /* Unicode-Escape encoded string */
|
| 840 |
+
Py_ssize_t length, /* size of string */
|
| 841 |
+
const char *errors, /* error handling */
|
| 842 |
+
Py_ssize_t *consumed /* bytes consumed */
|
| 843 |
+
);
|
| 844 |
+
|
| 845 |
+
/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape
|
| 846 |
+
chars. */
|
| 847 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal(
|
| 848 |
+
const char *string, /* Unicode-Escape encoded string */
|
| 849 |
+
Py_ssize_t length, /* size of string */
|
| 850 |
+
const char *errors, /* error handling */
|
| 851 |
+
Py_ssize_t *consumed, /* bytes consumed */
|
| 852 |
+
const char **first_invalid_escape /* on return, points to first
|
| 853 |
+
invalid escaped char in
|
| 854 |
+
string. */
|
| 855 |
+
);
|
| 856 |
+
|
| 857 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape(
|
| 858 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 859 |
+
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
|
| 860 |
+
);
|
| 861 |
+
|
| 862 |
+
/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */
|
| 863 |
+
|
| 864 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape(
|
| 865 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 866 |
+
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
|
| 867 |
+
);
|
| 868 |
+
|
| 869 |
+
/* Variant of PyUnicode_DecodeRawUnicodeEscape that supports partial decoding. */
|
| 870 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeRawUnicodeEscapeStateful(
|
| 871 |
+
const char *string, /* Unicode-Escape encoded string */
|
| 872 |
+
Py_ssize_t length, /* size of string */
|
| 873 |
+
const char *errors, /* error handling */
|
| 874 |
+
Py_ssize_t *consumed /* bytes consumed */
|
| 875 |
+
);
|
| 876 |
+
|
| 877 |
+
/* --- Latin-1 Codecs ----------------------------------------------------- */
|
| 878 |
+
|
| 879 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_AsLatin1String(
|
| 880 |
+
PyObject* unicode,
|
| 881 |
+
const char* errors);
|
| 882 |
+
|
| 883 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1(
|
| 884 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 885 |
+
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
|
| 886 |
+
const char *errors /* error handling */
|
| 887 |
+
);
|
| 888 |
+
|
| 889 |
+
/* --- ASCII Codecs ------------------------------------------------------- */
|
| 890 |
+
|
| 891 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_AsASCIIString(
|
| 892 |
+
PyObject* unicode,
|
| 893 |
+
const char* errors);
|
| 894 |
+
|
| 895 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII(
|
| 896 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 897 |
+
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
|
| 898 |
+
const char *errors /* error handling */
|
| 899 |
+
);
|
| 900 |
+
|
| 901 |
+
/* --- Character Map Codecs ----------------------------------------------- */
|
| 902 |
+
|
| 903 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
|
| 904 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 905 |
+
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
|
| 906 |
+
PyObject *mapping, /* encoding mapping */
|
| 907 |
+
const char *errors /* error handling */
|
| 908 |
+
);
|
| 909 |
+
|
| 910 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
|
| 911 |
+
PyObject *unicode, /* Unicode object */
|
| 912 |
+
PyObject *mapping, /* encoding mapping */
|
| 913 |
+
const char *errors /* error handling */
|
| 914 |
+
);
|
| 915 |
+
|
| 916 |
+
/* Translate a Py_UNICODE buffer of the given length by applying a
|
| 917 |
+
character mapping table to it and return the resulting Unicode
|
| 918 |
+
object.
|
| 919 |
+
|
| 920 |
+
The mapping table must map Unicode ordinal integers to Unicode strings,
|
| 921 |
+
Unicode ordinal integers or None (causing deletion of the character).
|
| 922 |
+
|
| 923 |
+
Mapping tables may be dictionaries or sequences. Unmapped character
|
| 924 |
+
ordinals (ones which cause a LookupError) are left untouched and
|
| 925 |
+
are copied as-is.
|
| 926 |
+
|
| 927 |
+
*/
|
| 928 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
|
| 929 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 930 |
+
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
|
| 931 |
+
PyObject *table, /* Translate table */
|
| 932 |
+
const char *errors /* error handling */
|
| 933 |
+
);
|
| 934 |
+
|
| 935 |
+
/* --- MBCS codecs for Windows -------------------------------------------- */
|
| 936 |
+
|
| 937 |
+
#ifdef MS_WINDOWS
|
| 938 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
|
| 939 |
+
const Py_UNICODE *data, /* Unicode char buffer */
|
| 940 |
+
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
|
| 941 |
+
const char *errors /* error handling */
|
| 942 |
+
);
|
| 943 |
+
#endif
|
| 944 |
+
|
| 945 |
+
/* --- Decimal Encoder ---------------------------------------------------- */
|
| 946 |
+
|
| 947 |
+
/* Takes a Unicode string holding a decimal value and writes it into
|
| 948 |
+
an output buffer using standard ASCII digit codes.
|
| 949 |
+
|
| 950 |
+
The output buffer has to provide at least length+1 bytes of storage
|
| 951 |
+
area. The output string is 0-terminated.
|
| 952 |
+
|
| 953 |
+
The encoder converts whitespace to ' ', decimal characters to their
|
| 954 |
+
corresponding ASCII digit and all other Latin-1 characters except
|
| 955 |
+
\0 as-is. Characters outside this range (Unicode ordinals 1-256)
|
| 956 |
+
are treated as errors. This includes embedded NULL bytes.
|
| 957 |
+
|
| 958 |
+
Error handling is defined by the errors argument:
|
| 959 |
+
|
| 960 |
+
NULL or "strict": raise a ValueError
|
| 961 |
+
"ignore": ignore the wrong characters (these are not copied to the
|
| 962 |
+
output buffer)
|
| 963 |
+
"replace": replaces illegal characters with '?'
|
| 964 |
+
|
| 965 |
+
Returns 0 on success, -1 on failure.
|
| 966 |
+
|
| 967 |
+
*/
|
| 968 |
+
|
| 969 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
|
| 970 |
+
Py_UNICODE *s, /* Unicode buffer */
|
| 971 |
+
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
|
| 972 |
+
char *output, /* Output buffer; must have size >= length */
|
| 973 |
+
const char *errors /* error handling */
|
| 974 |
+
);
|
| 975 |
+
|
| 976 |
+
/* Transforms code points that have decimal digit property to the
|
| 977 |
+
corresponding ASCII digit code points.
|
| 978 |
+
|
| 979 |
+
Returns a new Unicode string on success, NULL on failure.
|
| 980 |
+
*/
|
| 981 |
+
|
| 982 |
+
Py_DEPRECATED(3.3)
|
| 983 |
+
PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII(
|
| 984 |
+
Py_UNICODE *s, /* Unicode buffer */
|
| 985 |
+
Py_ssize_t length /* Number of Py_UNICODE chars to transform */
|
| 986 |
+
);
|
| 987 |
+
|
| 988 |
+
/* Coverts a Unicode object holding a decimal value to an ASCII string
|
| 989 |
+
for using in int, float and complex parsers.
|
| 990 |
+
Transforms code points that have decimal digit property to the
|
| 991 |
+
corresponding ASCII digit code points. Transforms spaces to ASCII.
|
| 992 |
+
Transforms code points starting from the first non-ASCII code point that
|
| 993 |
+
is neither a decimal digit nor a space to the end into '?'. */
|
| 994 |
+
|
| 995 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII(
|
| 996 |
+
PyObject *unicode /* Unicode object */
|
| 997 |
+
);
|
| 998 |
+
|
| 999 |
+
/* --- Methods & Slots ---------------------------------------------------- */
|
| 1000 |
+
|
| 1001 |
+
PyAPI_FUNC(PyObject *) _PyUnicode_JoinArray(
|
| 1002 |
+
PyObject *separator,
|
| 1003 |
+
PyObject *const *items,
|
| 1004 |
+
Py_ssize_t seqlen
|
| 1005 |
+
);
|
| 1006 |
+
|
| 1007 |
+
/* Test whether a unicode is equal to ASCII identifier. Return 1 if true,
|
| 1008 |
+
0 otherwise. The right argument must be ASCII identifier.
|
| 1009 |
+
Any error occurs inside will be cleared before return. */
|
| 1010 |
+
PyAPI_FUNC(int) _PyUnicode_EqualToASCIIId(
|
| 1011 |
+
PyObject *left, /* Left string */
|
| 1012 |
+
_Py_Identifier *right /* Right identifier */
|
| 1013 |
+
);
|
| 1014 |
+
|
| 1015 |
+
/* Test whether a unicode is equal to ASCII string. Return 1 if true,
|
| 1016 |
+
0 otherwise. The right argument must be ASCII-encoded string.
|
| 1017 |
+
Any error occurs inside will be cleared before return. */
|
| 1018 |
+
PyAPI_FUNC(int) _PyUnicode_EqualToASCIIString(
|
| 1019 |
+
PyObject *left,
|
| 1020 |
+
const char *right /* ASCII-encoded string */
|
| 1021 |
+
);
|
| 1022 |
+
|
| 1023 |
+
/* Externally visible for str.strip(unicode) */
|
| 1024 |
+
PyAPI_FUNC(PyObject *) _PyUnicode_XStrip(
|
| 1025 |
+
PyObject *self,
|
| 1026 |
+
int striptype,
|
| 1027 |
+
PyObject *sepobj
|
| 1028 |
+
);
|
| 1029 |
+
|
| 1030 |
+
/* Using explicit passed-in values, insert the thousands grouping
|
| 1031 |
+
into the string pointed to by buffer. For the argument descriptions,
|
| 1032 |
+
see Objects/stringlib/localeutil.h */
|
| 1033 |
+
PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping(
|
| 1034 |
+
_PyUnicodeWriter *writer,
|
| 1035 |
+
Py_ssize_t n_buffer,
|
| 1036 |
+
PyObject *digits,
|
| 1037 |
+
Py_ssize_t d_pos,
|
| 1038 |
+
Py_ssize_t n_digits,
|
| 1039 |
+
Py_ssize_t min_width,
|
| 1040 |
+
const char *grouping,
|
| 1041 |
+
PyObject *thousands_sep,
|
| 1042 |
+
Py_UCS4 *maxchar);
|
| 1043 |
+
|
| 1044 |
+
/* === Characters Type APIs =============================================== */
|
| 1045 |
+
|
| 1046 |
+
/* Helper array used by Py_UNICODE_ISSPACE(). */
|
| 1047 |
+
|
| 1048 |
+
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
|
| 1049 |
+
|
| 1050 |
+
/* These should not be used directly. Use the Py_UNICODE_IS* and
|
| 1051 |
+
Py_UNICODE_TO* macros instead.
|
| 1052 |
+
|
| 1053 |
+
These APIs are implemented in Objects/unicodectype.c.
|
| 1054 |
+
|
| 1055 |
+
*/
|
| 1056 |
+
|
| 1057 |
+
PyAPI_FUNC(int) _PyUnicode_IsLowercase(
|
| 1058 |
+
Py_UCS4 ch /* Unicode character */
|
| 1059 |
+
);
|
| 1060 |
+
|
| 1061 |
+
PyAPI_FUNC(int) _PyUnicode_IsUppercase(
|
| 1062 |
+
Py_UCS4 ch /* Unicode character */
|
| 1063 |
+
);
|
| 1064 |
+
|
| 1065 |
+
PyAPI_FUNC(int) _PyUnicode_IsTitlecase(
|
| 1066 |
+
Py_UCS4 ch /* Unicode character */
|
| 1067 |
+
);
|
| 1068 |
+
|
| 1069 |
+
PyAPI_FUNC(int) _PyUnicode_IsXidStart(
|
| 1070 |
+
Py_UCS4 ch /* Unicode character */
|
| 1071 |
+
);
|
| 1072 |
+
|
| 1073 |
+
PyAPI_FUNC(int) _PyUnicode_IsXidContinue(
|
| 1074 |
+
Py_UCS4 ch /* Unicode character */
|
| 1075 |
+
);
|
| 1076 |
+
|
| 1077 |
+
PyAPI_FUNC(int) _PyUnicode_IsWhitespace(
|
| 1078 |
+
const Py_UCS4 ch /* Unicode character */
|
| 1079 |
+
);
|
| 1080 |
+
|
| 1081 |
+
PyAPI_FUNC(int) _PyUnicode_IsLinebreak(
|
| 1082 |
+
const Py_UCS4 ch /* Unicode character */
|
| 1083 |
+
);
|
| 1084 |
+
|
| 1085 |
+
/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase(
|
| 1086 |
+
Py_UCS4 ch /* Unicode character */
|
| 1087 |
+
);
|
| 1088 |
+
|
| 1089 |
+
/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase(
|
| 1090 |
+
Py_UCS4 ch /* Unicode character */
|
| 1091 |
+
);
|
| 1092 |
+
|
| 1093 |
+
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase(
|
| 1094 |
+
Py_UCS4 ch /* Unicode character */
|
| 1095 |
+
);
|
| 1096 |
+
|
| 1097 |
+
PyAPI_FUNC(int) _PyUnicode_ToLowerFull(
|
| 1098 |
+
Py_UCS4 ch, /* Unicode character */
|
| 1099 |
+
Py_UCS4 *res
|
| 1100 |
+
);
|
| 1101 |
+
|
| 1102 |
+
PyAPI_FUNC(int) _PyUnicode_ToTitleFull(
|
| 1103 |
+
Py_UCS4 ch, /* Unicode character */
|
| 1104 |
+
Py_UCS4 *res
|
| 1105 |
+
);
|
| 1106 |
+
|
| 1107 |
+
PyAPI_FUNC(int) _PyUnicode_ToUpperFull(
|
| 1108 |
+
Py_UCS4 ch, /* Unicode character */
|
| 1109 |
+
Py_UCS4 *res
|
| 1110 |
+
);
|
| 1111 |
+
|
| 1112 |
+
PyAPI_FUNC(int) _PyUnicode_ToFoldedFull(
|
| 1113 |
+
Py_UCS4 ch, /* Unicode character */
|
| 1114 |
+
Py_UCS4 *res
|
| 1115 |
+
);
|
| 1116 |
+
|
| 1117 |
+
PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable(
|
| 1118 |
+
Py_UCS4 ch /* Unicode character */
|
| 1119 |
+
);
|
| 1120 |
+
|
| 1121 |
+
PyAPI_FUNC(int) _PyUnicode_IsCased(
|
| 1122 |
+
Py_UCS4 ch /* Unicode character */
|
| 1123 |
+
);
|
| 1124 |
+
|
| 1125 |
+
PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit(
|
| 1126 |
+
Py_UCS4 ch /* Unicode character */
|
| 1127 |
+
);
|
| 1128 |
+
|
| 1129 |
+
PyAPI_FUNC(int) _PyUnicode_ToDigit(
|
| 1130 |
+
Py_UCS4 ch /* Unicode character */
|
| 1131 |
+
);
|
| 1132 |
+
|
| 1133 |
+
PyAPI_FUNC(double) _PyUnicode_ToNumeric(
|
| 1134 |
+
Py_UCS4 ch /* Unicode character */
|
| 1135 |
+
);
|
| 1136 |
+
|
| 1137 |
+
PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit(
|
| 1138 |
+
Py_UCS4 ch /* Unicode character */
|
| 1139 |
+
);
|
| 1140 |
+
|
| 1141 |
+
PyAPI_FUNC(int) _PyUnicode_IsDigit(
|
| 1142 |
+
Py_UCS4 ch /* Unicode character */
|
| 1143 |
+
);
|
| 1144 |
+
|
| 1145 |
+
PyAPI_FUNC(int) _PyUnicode_IsNumeric(
|
| 1146 |
+
Py_UCS4 ch /* Unicode character */
|
| 1147 |
+
);
|
| 1148 |
+
|
| 1149 |
+
PyAPI_FUNC(int) _PyUnicode_IsPrintable(
|
| 1150 |
+
Py_UCS4 ch /* Unicode character */
|
| 1151 |
+
);
|
| 1152 |
+
|
| 1153 |
+
PyAPI_FUNC(int) _PyUnicode_IsAlpha(
|
| 1154 |
+
Py_UCS4 ch /* Unicode character */
|
| 1155 |
+
);
|
| 1156 |
+
|
| 1157 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
|
| 1158 |
+
|
| 1159 |
+
/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
|
| 1160 |
+
PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
|
| 1161 |
+
|
| 1162 |
+
/* Fast equality check when the inputs are known to be exact unicode types
|
| 1163 |
+
and where the hash values are equal (i.e. a very probable match) */
|
| 1164 |
+
PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
|
| 1165 |
+
|
| 1166 |
+
PyAPI_FUNC(int) _PyUnicode_WideCharString_Converter(PyObject *, void *);
|
| 1167 |
+
PyAPI_FUNC(int) _PyUnicode_WideCharString_Opt_Converter(PyObject *, void *);
|
| 1168 |
+
|
| 1169 |
+
PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);
|
evalkit_llava/include/python3.10/datetime.h
ADDED
|
@@ -0,0 +1,267 @@
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* datetime.h
|
| 2 |
+
*/
|
| 3 |
+
#ifndef Py_LIMITED_API
|
| 4 |
+
#ifndef DATETIME_H
|
| 5 |
+
#define DATETIME_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
/* Fields are packed into successive bytes, each viewed as unsigned and
|
| 11 |
+
* big-endian, unless otherwise noted:
|
| 12 |
+
*
|
| 13 |
+
* byte offset
|
| 14 |
+
* 0 year 2 bytes, 1-9999
|
| 15 |
+
* 2 month 1 byte, 1-12
|
| 16 |
+
* 3 day 1 byte, 1-31
|
| 17 |
+
* 4 hour 1 byte, 0-23
|
| 18 |
+
* 5 minute 1 byte, 0-59
|
| 19 |
+
* 6 second 1 byte, 0-59
|
| 20 |
+
* 7 usecond 3 bytes, 0-999999
|
| 21 |
+
* 10
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
/* # of bytes for year, month, and day. */
|
| 25 |
+
#define _PyDateTime_DATE_DATASIZE 4
|
| 26 |
+
|
| 27 |
+
/* # of bytes for hour, minute, second, and usecond. */
|
| 28 |
+
#define _PyDateTime_TIME_DATASIZE 6
|
| 29 |
+
|
| 30 |
+
/* # of bytes for year, month, day, hour, minute, second, and usecond. */
|
| 31 |
+
#define _PyDateTime_DATETIME_DATASIZE 10
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
typedef struct
|
| 35 |
+
{
|
| 36 |
+
PyObject_HEAD
|
| 37 |
+
Py_hash_t hashcode; /* -1 when unknown */
|
| 38 |
+
int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
|
| 39 |
+
int seconds; /* 0 <= seconds < 24*3600 is invariant */
|
| 40 |
+
int microseconds; /* 0 <= microseconds < 1000000 is invariant */
|
| 41 |
+
} PyDateTime_Delta;
|
| 42 |
+
|
| 43 |
+
typedef struct
|
| 44 |
+
{
|
| 45 |
+
PyObject_HEAD /* a pure abstract base class */
|
| 46 |
+
} PyDateTime_TZInfo;
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
/* The datetime and time types have hashcodes, and an optional tzinfo member,
|
| 50 |
+
* present if and only if hastzinfo is true.
|
| 51 |
+
*/
|
| 52 |
+
#define _PyTZINFO_HEAD \
|
| 53 |
+
PyObject_HEAD \
|
| 54 |
+
Py_hash_t hashcode; \
|
| 55 |
+
char hastzinfo; /* boolean flag */
|
| 56 |
+
|
| 57 |
+
/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
|
| 58 |
+
* convenient to cast to, when getting at the hastzinfo member of objects
|
| 59 |
+
* starting with _PyTZINFO_HEAD.
|
| 60 |
+
*/
|
| 61 |
+
typedef struct
|
| 62 |
+
{
|
| 63 |
+
_PyTZINFO_HEAD
|
| 64 |
+
} _PyDateTime_BaseTZInfo;
|
| 65 |
+
|
| 66 |
+
/* All time objects are of PyDateTime_TimeType, but that can be allocated
|
| 67 |
+
* in two ways, with or without a tzinfo member. Without is the same as
|
| 68 |
+
* tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an
|
| 69 |
+
* internal struct used to allocate the right amount of space for the
|
| 70 |
+
* "without" case.
|
| 71 |
+
*/
|
| 72 |
+
#define _PyDateTime_TIMEHEAD \
|
| 73 |
+
_PyTZINFO_HEAD \
|
| 74 |
+
unsigned char data[_PyDateTime_TIME_DATASIZE];
|
| 75 |
+
|
| 76 |
+
typedef struct
|
| 77 |
+
{
|
| 78 |
+
_PyDateTime_TIMEHEAD
|
| 79 |
+
} _PyDateTime_BaseTime; /* hastzinfo false */
|
| 80 |
+
|
| 81 |
+
typedef struct
|
| 82 |
+
{
|
| 83 |
+
_PyDateTime_TIMEHEAD
|
| 84 |
+
unsigned char fold;
|
| 85 |
+
PyObject *tzinfo;
|
| 86 |
+
} PyDateTime_Time; /* hastzinfo true */
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
/* All datetime objects are of PyDateTime_DateTimeType, but that can be
|
| 90 |
+
* allocated in two ways too, just like for time objects above. In addition,
|
| 91 |
+
* the plain date type is a base class for datetime, so it must also have
|
| 92 |
+
* a hastzinfo member (although it's unused there).
|
| 93 |
+
*/
|
| 94 |
+
typedef struct
|
| 95 |
+
{
|
| 96 |
+
_PyTZINFO_HEAD
|
| 97 |
+
unsigned char data[_PyDateTime_DATE_DATASIZE];
|
| 98 |
+
} PyDateTime_Date;
|
| 99 |
+
|
| 100 |
+
#define _PyDateTime_DATETIMEHEAD \
|
| 101 |
+
_PyTZINFO_HEAD \
|
| 102 |
+
unsigned char data[_PyDateTime_DATETIME_DATASIZE];
|
| 103 |
+
|
| 104 |
+
typedef struct
|
| 105 |
+
{
|
| 106 |
+
_PyDateTime_DATETIMEHEAD
|
| 107 |
+
} _PyDateTime_BaseDateTime; /* hastzinfo false */
|
| 108 |
+
|
| 109 |
+
typedef struct
|
| 110 |
+
{
|
| 111 |
+
_PyDateTime_DATETIMEHEAD
|
| 112 |
+
unsigned char fold;
|
| 113 |
+
PyObject *tzinfo;
|
| 114 |
+
} PyDateTime_DateTime; /* hastzinfo true */
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
/* Apply for date and datetime instances. */
|
| 118 |
+
|
| 119 |
+
// o is a pointer to a time or a datetime object.
|
| 120 |
+
#define _PyDateTime_HAS_TZINFO(o) (((_PyDateTime_BaseTZInfo *)(o))->hastzinfo)
|
| 121 |
+
|
| 122 |
+
#define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
|
| 123 |
+
((PyDateTime_Date*)o)->data[1])
|
| 124 |
+
#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2])
|
| 125 |
+
#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3])
|
| 126 |
+
|
| 127 |
+
#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4])
|
| 128 |
+
#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5])
|
| 129 |
+
#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6])
|
| 130 |
+
#define PyDateTime_DATE_GET_MICROSECOND(o) \
|
| 131 |
+
((((PyDateTime_DateTime*)o)->data[7] << 16) | \
|
| 132 |
+
(((PyDateTime_DateTime*)o)->data[8] << 8) | \
|
| 133 |
+
((PyDateTime_DateTime*)o)->data[9])
|
| 134 |
+
#define PyDateTime_DATE_GET_FOLD(o) (((PyDateTime_DateTime*)o)->fold)
|
| 135 |
+
#define PyDateTime_DATE_GET_TZINFO(o) (_PyDateTime_HAS_TZINFO(o) ? \
|
| 136 |
+
((PyDateTime_DateTime *)(o))->tzinfo : Py_None)
|
| 137 |
+
|
| 138 |
+
/* Apply for time instances. */
|
| 139 |
+
#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
|
| 140 |
+
#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
|
| 141 |
+
#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2])
|
| 142 |
+
#define PyDateTime_TIME_GET_MICROSECOND(o) \
|
| 143 |
+
((((PyDateTime_Time*)o)->data[3] << 16) | \
|
| 144 |
+
(((PyDateTime_Time*)o)->data[4] << 8) | \
|
| 145 |
+
((PyDateTime_Time*)o)->data[5])
|
| 146 |
+
#define PyDateTime_TIME_GET_FOLD(o) (((PyDateTime_Time*)o)->fold)
|
| 147 |
+
#define PyDateTime_TIME_GET_TZINFO(o) (_PyDateTime_HAS_TZINFO(o) ? \
|
| 148 |
+
((PyDateTime_Time *)(o))->tzinfo : Py_None)
|
| 149 |
+
|
| 150 |
+
/* Apply for time delta instances */
|
| 151 |
+
#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days)
|
| 152 |
+
#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds)
|
| 153 |
+
#define PyDateTime_DELTA_GET_MICROSECONDS(o) \
|
| 154 |
+
(((PyDateTime_Delta*)o)->microseconds)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
/* Define structure for C API. */
|
| 158 |
+
typedef struct {
|
| 159 |
+
/* type objects */
|
| 160 |
+
PyTypeObject *DateType;
|
| 161 |
+
PyTypeObject *DateTimeType;
|
| 162 |
+
PyTypeObject *TimeType;
|
| 163 |
+
PyTypeObject *DeltaType;
|
| 164 |
+
PyTypeObject *TZInfoType;
|
| 165 |
+
|
| 166 |
+
/* singletons */
|
| 167 |
+
PyObject *TimeZone_UTC;
|
| 168 |
+
|
| 169 |
+
/* constructors */
|
| 170 |
+
PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*);
|
| 171 |
+
PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int,
|
| 172 |
+
PyObject*, PyTypeObject*);
|
| 173 |
+
PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*);
|
| 174 |
+
PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*);
|
| 175 |
+
PyObject *(*TimeZone_FromTimeZone)(PyObject *offset, PyObject *name);
|
| 176 |
+
|
| 177 |
+
/* constructors for the DB API */
|
| 178 |
+
PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*);
|
| 179 |
+
PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*);
|
| 180 |
+
|
| 181 |
+
/* PEP 495 constructors */
|
| 182 |
+
PyObject *(*DateTime_FromDateAndTimeAndFold)(int, int, int, int, int, int, int,
|
| 183 |
+
PyObject*, int, PyTypeObject*);
|
| 184 |
+
PyObject *(*Time_FromTimeAndFold)(int, int, int, int, PyObject*, int, PyTypeObject*);
|
| 185 |
+
|
| 186 |
+
} PyDateTime_CAPI;
|
| 187 |
+
|
| 188 |
+
#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
/* This block is only used as part of the public API and should not be
|
| 192 |
+
* included in _datetimemodule.c, which does not use the C API capsule.
|
| 193 |
+
* See bpo-35081 for more details.
|
| 194 |
+
* */
|
| 195 |
+
#ifndef _PY_DATETIME_IMPL
|
| 196 |
+
/* Define global variable for the C API and a macro for setting it. */
|
| 197 |
+
static PyDateTime_CAPI *PyDateTimeAPI = NULL;
|
| 198 |
+
|
| 199 |
+
#define PyDateTime_IMPORT \
|
| 200 |
+
PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
|
| 201 |
+
|
| 202 |
+
/* Macro for access to the UTC singleton */
|
| 203 |
+
#define PyDateTime_TimeZone_UTC PyDateTimeAPI->TimeZone_UTC
|
| 204 |
+
|
| 205 |
+
/* Macros for type checking when not building the Python core. */
|
| 206 |
+
#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
|
| 207 |
+
#define PyDate_CheckExact(op) Py_IS_TYPE(op, PyDateTimeAPI->DateType)
|
| 208 |
+
|
| 209 |
+
#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
|
| 210 |
+
#define PyDateTime_CheckExact(op) Py_IS_TYPE(op, PyDateTimeAPI->DateTimeType)
|
| 211 |
+
|
| 212 |
+
#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
|
| 213 |
+
#define PyTime_CheckExact(op) Py_IS_TYPE(op, PyDateTimeAPI->TimeType)
|
| 214 |
+
|
| 215 |
+
#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
|
| 216 |
+
#define PyDelta_CheckExact(op) Py_IS_TYPE(op, PyDateTimeAPI->DeltaType)
|
| 217 |
+
|
| 218 |
+
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
|
| 219 |
+
#define PyTZInfo_CheckExact(op) Py_IS_TYPE(op, PyDateTimeAPI->TZInfoType)
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
/* Macros for accessing constructors in a simplified fashion. */
|
| 223 |
+
#define PyDate_FromDate(year, month, day) \
|
| 224 |
+
PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
|
| 225 |
+
|
| 226 |
+
#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \
|
| 227 |
+
PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
|
| 228 |
+
min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
|
| 229 |
+
|
| 230 |
+
#define PyDateTime_FromDateAndTimeAndFold(year, month, day, hour, min, sec, usec, fold) \
|
| 231 |
+
PyDateTimeAPI->DateTime_FromDateAndTimeAndFold(year, month, day, hour, \
|
| 232 |
+
min, sec, usec, Py_None, fold, PyDateTimeAPI->DateTimeType)
|
| 233 |
+
|
| 234 |
+
#define PyTime_FromTime(hour, minute, second, usecond) \
|
| 235 |
+
PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
|
| 236 |
+
Py_None, PyDateTimeAPI->TimeType)
|
| 237 |
+
|
| 238 |
+
#define PyTime_FromTimeAndFold(hour, minute, second, usecond, fold) \
|
| 239 |
+
PyDateTimeAPI->Time_FromTimeAndFold(hour, minute, second, usecond, \
|
| 240 |
+
Py_None, fold, PyDateTimeAPI->TimeType)
|
| 241 |
+
|
| 242 |
+
#define PyDelta_FromDSU(days, seconds, useconds) \
|
| 243 |
+
PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
|
| 244 |
+
PyDateTimeAPI->DeltaType)
|
| 245 |
+
|
| 246 |
+
#define PyTimeZone_FromOffset(offset) \
|
| 247 |
+
PyDateTimeAPI->TimeZone_FromTimeZone(offset, NULL)
|
| 248 |
+
|
| 249 |
+
#define PyTimeZone_FromOffsetAndName(offset, name) \
|
| 250 |
+
PyDateTimeAPI->TimeZone_FromTimeZone(offset, name)
|
| 251 |
+
|
| 252 |
+
/* Macros supporting the DB API. */
|
| 253 |
+
#define PyDateTime_FromTimestamp(args) \
|
| 254 |
+
PyDateTimeAPI->DateTime_FromTimestamp( \
|
| 255 |
+
(PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
|
| 256 |
+
|
| 257 |
+
#define PyDate_FromTimestamp(args) \
|
| 258 |
+
PyDateTimeAPI->Date_FromTimestamp( \
|
| 259 |
+
(PyObject*) (PyDateTimeAPI->DateType), args)
|
| 260 |
+
|
| 261 |
+
#endif /* !defined(_PY_DATETIME_IMPL) */
|
| 262 |
+
|
| 263 |
+
#ifdef __cplusplus
|
| 264 |
+
}
|
| 265 |
+
#endif
|
| 266 |
+
#endif
|
| 267 |
+
#endif /* !Py_LIMITED_API */
|
evalkit_llava/include/python3.10/descrobject.h
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Descriptors */
|
| 2 |
+
#ifndef Py_DESCROBJECT_H
|
| 3 |
+
#define Py_DESCROBJECT_H
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
typedef PyObject *(*getter)(PyObject *, void *);
|
| 9 |
+
typedef int (*setter)(PyObject *, PyObject *, void *);
|
| 10 |
+
|
| 11 |
+
typedef struct PyGetSetDef {
|
| 12 |
+
const char *name;
|
| 13 |
+
getter get;
|
| 14 |
+
setter set;
|
| 15 |
+
const char *doc;
|
| 16 |
+
void *closure;
|
| 17 |
+
} PyGetSetDef;
|
| 18 |
+
|
| 19 |
+
#ifndef Py_LIMITED_API
|
| 20 |
+
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
|
| 21 |
+
void *wrapped);
|
| 22 |
+
|
| 23 |
+
typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
|
| 24 |
+
void *wrapped, PyObject *kwds);
|
| 25 |
+
|
| 26 |
+
struct wrapperbase {
|
| 27 |
+
const char *name;
|
| 28 |
+
int offset;
|
| 29 |
+
void *function;
|
| 30 |
+
wrapperfunc wrapper;
|
| 31 |
+
const char *doc;
|
| 32 |
+
int flags;
|
| 33 |
+
PyObject *name_strobj;
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
/* Flags for above struct */
|
| 37 |
+
#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
|
| 38 |
+
|
| 39 |
+
/* Various kinds of descriptor objects */
|
| 40 |
+
|
| 41 |
+
typedef struct {
|
| 42 |
+
PyObject_HEAD
|
| 43 |
+
PyTypeObject *d_type;
|
| 44 |
+
PyObject *d_name;
|
| 45 |
+
PyObject *d_qualname;
|
| 46 |
+
} PyDescrObject;
|
| 47 |
+
|
| 48 |
+
#define PyDescr_COMMON PyDescrObject d_common
|
| 49 |
+
|
| 50 |
+
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
| 51 |
+
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
| 52 |
+
|
| 53 |
+
typedef struct {
|
| 54 |
+
PyDescr_COMMON;
|
| 55 |
+
PyMethodDef *d_method;
|
| 56 |
+
vectorcallfunc vectorcall;
|
| 57 |
+
} PyMethodDescrObject;
|
| 58 |
+
|
| 59 |
+
typedef struct {
|
| 60 |
+
PyDescr_COMMON;
|
| 61 |
+
struct PyMemberDef *d_member;
|
| 62 |
+
} PyMemberDescrObject;
|
| 63 |
+
|
| 64 |
+
typedef struct {
|
| 65 |
+
PyDescr_COMMON;
|
| 66 |
+
PyGetSetDef *d_getset;
|
| 67 |
+
} PyGetSetDescrObject;
|
| 68 |
+
|
| 69 |
+
typedef struct {
|
| 70 |
+
PyDescr_COMMON;
|
| 71 |
+
struct wrapperbase *d_base;
|
| 72 |
+
void *d_wrapped; /* This can be any function pointer */
|
| 73 |
+
} PyWrapperDescrObject;
|
| 74 |
+
#endif /* Py_LIMITED_API */
|
| 75 |
+
|
| 76 |
+
PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type;
|
| 77 |
+
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
|
| 78 |
+
PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
|
| 79 |
+
PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;
|
| 80 |
+
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
|
| 81 |
+
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
|
| 82 |
+
#ifndef Py_LIMITED_API
|
| 83 |
+
PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type;
|
| 84 |
+
#endif /* Py_LIMITED_API */
|
| 85 |
+
|
| 86 |
+
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
|
| 87 |
+
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
|
| 88 |
+
struct PyMemberDef; /* forward declaration for following prototype */
|
| 89 |
+
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
|
| 90 |
+
struct PyMemberDef *);
|
| 91 |
+
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
|
| 92 |
+
struct PyGetSetDef *);
|
| 93 |
+
#ifndef Py_LIMITED_API
|
| 94 |
+
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
| 95 |
+
struct wrapperbase *, void *);
|
| 96 |
+
PyAPI_FUNC(int) PyDescr_IsData(PyObject *);
|
| 97 |
+
#endif
|
| 98 |
+
|
| 99 |
+
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
| 100 |
+
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
PyAPI_DATA(PyTypeObject) PyProperty_Type;
|
| 104 |
+
#ifdef __cplusplus
|
| 105 |
+
}
|
| 106 |
+
#endif
|
| 107 |
+
#endif /* !Py_DESCROBJECT_H */
|
| 108 |
+
|
evalkit_llava/include/python3.10/errcode.h
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_ERRCODE_H
|
| 2 |
+
#define Py_ERRCODE_H
|
| 3 |
+
#ifdef __cplusplus
|
| 4 |
+
extern "C" {
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
/* Error codes passed around between file input, tokenizer, parser and
|
| 9 |
+
interpreter. This is necessary so we can turn them into Python
|
| 10 |
+
exceptions at a higher level. Note that some errors have a
|
| 11 |
+
slightly different meaning when passed from the tokenizer to the
|
| 12 |
+
parser than when passed from the parser to the interpreter; e.g.
|
| 13 |
+
the parser only returns E_EOF when it hits EOF immediately, and it
|
| 14 |
+
never returns E_OK. */
|
| 15 |
+
|
| 16 |
+
#define E_OK 10 /* No error */
|
| 17 |
+
#define E_EOF 11 /* End Of File */
|
| 18 |
+
#define E_INTR 12 /* Interrupted */
|
| 19 |
+
#define E_TOKEN 13 /* Bad token */
|
| 20 |
+
#define E_SYNTAX 14 /* Syntax error */
|
| 21 |
+
#define E_NOMEM 15 /* Ran out of memory */
|
| 22 |
+
#define E_DONE 16 /* Parsing complete */
|
| 23 |
+
#define E_ERROR 17 /* Execution error */
|
| 24 |
+
#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */
|
| 25 |
+
#define E_OVERFLOW 19 /* Node had too many children */
|
| 26 |
+
#define E_TOODEEP 20 /* Too many indentation levels */
|
| 27 |
+
#define E_DEDENT 21 /* No matching outer block for dedent */
|
| 28 |
+
#define E_DECODE 22 /* Error in decoding into Unicode */
|
| 29 |
+
#define E_EOFS 23 /* EOF in triple-quoted string */
|
| 30 |
+
#define E_EOLS 24 /* EOL in single-quoted string */
|
| 31 |
+
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
|
| 32 |
+
#define E_BADSINGLE 27 /* Ill-formed single statement input */
|
| 33 |
+
#define E_INTERACT_STOP 28 /* Interactive mode stopped tokenization */
|
| 34 |
+
|
| 35 |
+
#ifdef __cplusplus
|
| 36 |
+
}
|
| 37 |
+
#endif
|
| 38 |
+
#endif /* !Py_ERRCODE_H */
|
evalkit_llava/include/python3.10/eval.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* Interface to execute compiled code */
|
| 3 |
+
|
| 4 |
+
#ifndef Py_EVAL_H
|
| 5 |
+
#define Py_EVAL_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *);
|
| 11 |
+
|
| 12 |
+
PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
|
| 13 |
+
PyObject *globals,
|
| 14 |
+
PyObject *locals,
|
| 15 |
+
PyObject *const *args, int argc,
|
| 16 |
+
PyObject *const *kwds, int kwdc,
|
| 17 |
+
PyObject *const *defs, int defc,
|
| 18 |
+
PyObject *kwdefs, PyObject *closure);
|
| 19 |
+
|
| 20 |
+
#ifndef Py_LIMITED_API
|
| 21 |
+
PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
|
| 22 |
+
#endif
|
| 23 |
+
|
| 24 |
+
#ifdef __cplusplus
|
| 25 |
+
}
|
| 26 |
+
#endif
|
| 27 |
+
#endif /* !Py_EVAL_H */
|
evalkit_llava/include/python3.10/fileobject.h
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* File object interface (what's left of it -- see io.py) */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_FILEOBJECT_H
|
| 4 |
+
#define Py_FILEOBJECT_H
|
| 5 |
+
#ifdef __cplusplus
|
| 6 |
+
extern "C" {
|
| 7 |
+
#endif
|
| 8 |
+
|
| 9 |
+
#define PY_STDIOTEXTMODE "b"
|
| 10 |
+
|
| 11 |
+
PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
|
| 12 |
+
const char *, const char *,
|
| 13 |
+
const char *, int);
|
| 14 |
+
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
| 15 |
+
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
| 16 |
+
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
| 17 |
+
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
|
| 18 |
+
|
| 19 |
+
/* The default encoding used by the platform file system APIs
|
| 20 |
+
If non-NULL, this is different than the default encoding for strings
|
| 21 |
+
*/
|
| 22 |
+
PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
|
| 23 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
|
| 24 |
+
PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors;
|
| 25 |
+
#endif
|
| 26 |
+
PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
|
| 27 |
+
|
| 28 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
|
| 29 |
+
PyAPI_DATA(int) Py_UTF8Mode;
|
| 30 |
+
#endif
|
| 31 |
+
|
| 32 |
+
/* A routine to check if a file descriptor can be select()-ed. */
|
| 33 |
+
#ifdef _MSC_VER
|
| 34 |
+
/* On Windows, any socket fd can be select()-ed, no matter how high */
|
| 35 |
+
#define _PyIsSelectable_fd(FD) (1)
|
| 36 |
+
#else
|
| 37 |
+
#define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
|
| 38 |
+
#endif
|
| 39 |
+
|
| 40 |
+
#ifndef Py_LIMITED_API
|
| 41 |
+
# define Py_CPYTHON_FILEOBJECT_H
|
| 42 |
+
# include "cpython/fileobject.h"
|
| 43 |
+
# undef Py_CPYTHON_FILEOBJECT_H
|
| 44 |
+
#endif
|
| 45 |
+
|
| 46 |
+
#ifdef __cplusplus
|
| 47 |
+
}
|
| 48 |
+
#endif
|
| 49 |
+
#endif /* !Py_FILEOBJECT_H */
|
evalkit_llava/include/python3.10/floatobject.h
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* Float object interface */
|
| 3 |
+
|
| 4 |
+
/*
|
| 5 |
+
PyFloatObject represents a (double precision) floating point number.
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
#ifndef Py_FLOATOBJECT_H
|
| 9 |
+
#define Py_FLOATOBJECT_H
|
| 10 |
+
#ifdef __cplusplus
|
| 11 |
+
extern "C" {
|
| 12 |
+
#endif
|
| 13 |
+
|
| 14 |
+
#ifndef Py_LIMITED_API
|
| 15 |
+
typedef struct {
|
| 16 |
+
PyObject_HEAD
|
| 17 |
+
double ob_fval;
|
| 18 |
+
} PyFloatObject;
|
| 19 |
+
#endif
|
| 20 |
+
|
| 21 |
+
PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
| 22 |
+
|
| 23 |
+
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
|
| 24 |
+
#define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type)
|
| 25 |
+
|
| 26 |
+
#ifdef Py_NAN
|
| 27 |
+
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
|
| 28 |
+
#endif
|
| 29 |
+
|
| 30 |
+
#define Py_RETURN_INF(sign) do \
|
| 31 |
+
if (copysign(1., sign) == 1.) { \
|
| 32 |
+
return PyFloat_FromDouble(Py_HUGE_VAL); \
|
| 33 |
+
} else { \
|
| 34 |
+
return PyFloat_FromDouble(-Py_HUGE_VAL); \
|
| 35 |
+
} while(0)
|
| 36 |
+
|
| 37 |
+
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
| 38 |
+
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
| 39 |
+
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void);
|
| 40 |
+
|
| 41 |
+
/* Return Python float from string PyObject. */
|
| 42 |
+
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*);
|
| 43 |
+
|
| 44 |
+
/* Return Python float from C double. */
|
| 45 |
+
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
|
| 46 |
+
|
| 47 |
+
/* Extract C double from Python float. The macro version trades safety for
|
| 48 |
+
speed. */
|
| 49 |
+
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
|
| 50 |
+
#ifndef Py_LIMITED_API
|
| 51 |
+
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
|
| 52 |
+
#endif
|
| 53 |
+
|
| 54 |
+
#ifndef Py_LIMITED_API
|
| 55 |
+
/* _PyFloat_{Pack,Unpack}{4,8}
|
| 56 |
+
*
|
| 57 |
+
* The struct and pickle (at least) modules need an efficient platform-
|
| 58 |
+
* independent way to store floating-point values as byte strings.
|
| 59 |
+
* The Pack routines produce a string from a C double, and the Unpack
|
| 60 |
+
* routines produce a C double from such a string. The suffix (4 or 8)
|
| 61 |
+
* specifies the number of bytes in the string.
|
| 62 |
+
*
|
| 63 |
+
* On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats
|
| 64 |
+
* these functions work by copying bits. On other platforms, the formats the
|
| 65 |
+
* 4- byte format is identical to the IEEE-754 single precision format, and
|
| 66 |
+
* the 8-byte format to the IEEE-754 double precision format, although the
|
| 67 |
+
* packing of INFs and NaNs (if such things exist on the platform) isn't
|
| 68 |
+
* handled correctly, and attempting to unpack a string containing an IEEE
|
| 69 |
+
* INF or NaN will raise an exception.
|
| 70 |
+
*
|
| 71 |
+
* On non-IEEE platforms with more precision, or larger dynamic range, than
|
| 72 |
+
* 754 supports, not all values can be packed; on non-IEEE platforms with less
|
| 73 |
+
* precision, or smaller dynamic range, not all values can be unpacked. What
|
| 74 |
+
* happens in such cases is partly accidental (alas).
|
| 75 |
+
*/
|
| 76 |
+
|
| 77 |
+
/* The pack routines write 2, 4 or 8 bytes, starting at p. le is a bool
|
| 78 |
+
* argument, true if you want the string in little-endian format (exponent
|
| 79 |
+
* last, at p+1, p+3 or p+7), false if you want big-endian format (exponent
|
| 80 |
+
* first, at p).
|
| 81 |
+
* Return value: 0 if all is OK, -1 if error (and an exception is
|
| 82 |
+
* set, most likely OverflowError).
|
| 83 |
+
* There are two problems on non-IEEE platforms:
|
| 84 |
+
* 1): What this does is undefined if x is a NaN or infinity.
|
| 85 |
+
* 2): -0.0 and +0.0 produce the same string.
|
| 86 |
+
*/
|
| 87 |
+
PyAPI_FUNC(int) _PyFloat_Pack2(double x, unsigned char *p, int le);
|
| 88 |
+
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
|
| 89 |
+
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
|
| 90 |
+
|
| 91 |
+
/* The unpack routines read 2, 4 or 8 bytes, starting at p. le is a bool
|
| 92 |
+
* argument, true if the string is in little-endian format (exponent
|
| 93 |
+
* last, at p+1, p+3 or p+7), false if big-endian (exponent first, at p).
|
| 94 |
+
* Return value: The unpacked double. On error, this is -1.0 and
|
| 95 |
+
* PyErr_Occurred() is true (and an exception is set, most likely
|
| 96 |
+
* OverflowError). Note that on a non-IEEE platform this will refuse
|
| 97 |
+
* to unpack a string that represents a NaN or infinity.
|
| 98 |
+
*/
|
| 99 |
+
PyAPI_FUNC(double) _PyFloat_Unpack2(const unsigned char *p, int le);
|
| 100 |
+
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
|
| 101 |
+
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
|
| 102 |
+
|
| 103 |
+
PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
|
| 104 |
+
|
| 105 |
+
/* Format the object based on the format_spec, as defined in PEP 3101
|
| 106 |
+
(Advanced String Formatting). */
|
| 107 |
+
PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(
|
| 108 |
+
_PyUnicodeWriter *writer,
|
| 109 |
+
PyObject *obj,
|
| 110 |
+
PyObject *format_spec,
|
| 111 |
+
Py_ssize_t start,
|
| 112 |
+
Py_ssize_t end);
|
| 113 |
+
#endif /* Py_LIMITED_API */
|
| 114 |
+
|
| 115 |
+
#ifdef __cplusplus
|
| 116 |
+
}
|
| 117 |
+
#endif
|
| 118 |
+
#endif /* !Py_FLOATOBJECT_H */
|
evalkit_llava/include/python3.10/genericaliasobject.h
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Implementation of PEP 585: support list[int] etc.
|
| 2 |
+
#ifndef Py_GENERICALIASOBJECT_H
|
| 3 |
+
#define Py_GENERICALIASOBJECT_H
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
PyAPI_FUNC(PyObject *) Py_GenericAlias(PyObject *, PyObject *);
|
| 9 |
+
PyAPI_DATA(PyTypeObject) Py_GenericAliasType;
|
| 10 |
+
|
| 11 |
+
#ifdef __cplusplus
|
| 12 |
+
}
|
| 13 |
+
#endif
|
| 14 |
+
#endif /* !Py_GENERICALIASOBJECT_H */
|
evalkit_llava/include/python3.10/genobject.h
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* Generator object interface */
|
| 3 |
+
|
| 4 |
+
#ifndef Py_LIMITED_API
|
| 5 |
+
#ifndef Py_GENOBJECT_H
|
| 6 |
+
#define Py_GENOBJECT_H
|
| 7 |
+
#ifdef __cplusplus
|
| 8 |
+
extern "C" {
|
| 9 |
+
#endif
|
| 10 |
+
|
| 11 |
+
#include "pystate.h" /* _PyErr_StackItem */
|
| 12 |
+
#include "abstract.h" /* PySendResult */
|
| 13 |
+
|
| 14 |
+
/* _PyGenObject_HEAD defines the initial segment of generator
|
| 15 |
+
and coroutine objects. */
|
| 16 |
+
#define _PyGenObject_HEAD(prefix) \
|
| 17 |
+
PyObject_HEAD \
|
| 18 |
+
/* Note: gi_frame can be NULL if the generator is "finished" */ \
|
| 19 |
+
PyFrameObject *prefix##_frame; \
|
| 20 |
+
/* The code object backing the generator */ \
|
| 21 |
+
PyObject *prefix##_code; \
|
| 22 |
+
/* List of weak reference. */ \
|
| 23 |
+
PyObject *prefix##_weakreflist; \
|
| 24 |
+
/* Name of the generator. */ \
|
| 25 |
+
PyObject *prefix##_name; \
|
| 26 |
+
/* Qualified name of the generator. */ \
|
| 27 |
+
PyObject *prefix##_qualname; \
|
| 28 |
+
_PyErr_StackItem prefix##_exc_state;
|
| 29 |
+
|
| 30 |
+
typedef struct {
|
| 31 |
+
/* The gi_ prefix is intended to remind of generator-iterator. */
|
| 32 |
+
_PyGenObject_HEAD(gi)
|
| 33 |
+
} PyGenObject;
|
| 34 |
+
|
| 35 |
+
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
| 36 |
+
|
| 37 |
+
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
|
| 38 |
+
#define PyGen_CheckExact(op) Py_IS_TYPE(op, &PyGen_Type)
|
| 39 |
+
|
| 40 |
+
PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *);
|
| 41 |
+
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
|
| 42 |
+
PyObject *name, PyObject *qualname);
|
| 43 |
+
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
|
| 44 |
+
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
|
| 45 |
+
PyObject *_PyGen_yf(PyGenObject *);
|
| 46 |
+
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
|
| 47 |
+
|
| 48 |
+
#ifndef Py_LIMITED_API
|
| 49 |
+
typedef struct {
|
| 50 |
+
_PyGenObject_HEAD(cr)
|
| 51 |
+
PyObject *cr_origin;
|
| 52 |
+
} PyCoroObject;
|
| 53 |
+
|
| 54 |
+
PyAPI_DATA(PyTypeObject) PyCoro_Type;
|
| 55 |
+
PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
|
| 56 |
+
|
| 57 |
+
#define PyCoro_CheckExact(op) Py_IS_TYPE(op, &PyCoro_Type)
|
| 58 |
+
PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
|
| 59 |
+
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
|
| 60 |
+
PyObject *name, PyObject *qualname);
|
| 61 |
+
|
| 62 |
+
/* Asynchronous Generators */
|
| 63 |
+
|
| 64 |
+
typedef struct {
|
| 65 |
+
_PyGenObject_HEAD(ag)
|
| 66 |
+
PyObject *ag_finalizer;
|
| 67 |
+
|
| 68 |
+
/* Flag is set to 1 when hooks set up by sys.set_asyncgen_hooks
|
| 69 |
+
were called on the generator, to avoid calling them more
|
| 70 |
+
than once. */
|
| 71 |
+
int ag_hooks_inited;
|
| 72 |
+
|
| 73 |
+
/* Flag is set to 1 when aclose() is called for the first time, or
|
| 74 |
+
when a StopAsyncIteration exception is raised. */
|
| 75 |
+
int ag_closed;
|
| 76 |
+
|
| 77 |
+
int ag_running_async;
|
| 78 |
+
} PyAsyncGenObject;
|
| 79 |
+
|
| 80 |
+
PyAPI_DATA(PyTypeObject) PyAsyncGen_Type;
|
| 81 |
+
PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type;
|
| 82 |
+
PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type;
|
| 83 |
+
PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type;
|
| 84 |
+
|
| 85 |
+
PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,
|
| 86 |
+
PyObject *name, PyObject *qualname);
|
| 87 |
+
|
| 88 |
+
#define PyAsyncGen_CheckExact(op) Py_IS_TYPE(op, &PyAsyncGen_Type)
|
| 89 |
+
|
| 90 |
+
PyObject *_PyAsyncGenValueWrapperNew(PyObject *);
|
| 91 |
+
|
| 92 |
+
#endif
|
| 93 |
+
|
| 94 |
+
#undef _PyGenObject_HEAD
|
| 95 |
+
|
| 96 |
+
#ifdef __cplusplus
|
| 97 |
+
}
|
| 98 |
+
#endif
|
| 99 |
+
#endif /* !Py_GENOBJECT_H */
|
| 100 |
+
#endif /* Py_LIMITED_API */
|
evalkit_llava/include/python3.10/intrcheck.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_INTRCHECK_H
|
| 2 |
+
#define Py_INTRCHECK_H
|
| 3 |
+
#ifdef __cplusplus
|
| 4 |
+
extern "C" {
|
| 5 |
+
#endif
|
| 6 |
+
|
| 7 |
+
PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
|
| 8 |
+
#ifdef HAVE_FORK
|
| 9 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
|
| 10 |
+
PyAPI_FUNC(void) PyOS_BeforeFork(void);
|
| 11 |
+
PyAPI_FUNC(void) PyOS_AfterFork_Parent(void);
|
| 12 |
+
PyAPI_FUNC(void) PyOS_AfterFork_Child(void);
|
| 13 |
+
#endif
|
| 14 |
+
#endif
|
| 15 |
+
/* Deprecated, please use PyOS_AfterFork_Child() instead */
|
| 16 |
+
Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyOS_AfterFork(void);
|
| 17 |
+
|
| 18 |
+
#ifndef Py_LIMITED_API
|
| 19 |
+
PyAPI_FUNC(int) _PyOS_IsMainThread(void);
|
| 20 |
+
|
| 21 |
+
#ifdef MS_WINDOWS
|
| 22 |
+
/* windows.h is not included by Python.h so use void* instead of HANDLE */
|
| 23 |
+
PyAPI_FUNC(void*) _PyOS_SigintEvent(void);
|
| 24 |
+
#endif
|
| 25 |
+
#endif /* !Py_LIMITED_API */
|
| 26 |
+
|
| 27 |
+
#ifdef __cplusplus
|
| 28 |
+
}
|
| 29 |
+
#endif
|
| 30 |
+
#endif /* !Py_INTRCHECK_H */
|
evalkit_llava/include/python3.10/iterobject.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_ITEROBJECT_H
|
| 2 |
+
#define Py_ITEROBJECT_H
|
| 3 |
+
/* Iterators (the basic kind, over a sequence) */
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
PyAPI_DATA(PyTypeObject) PySeqIter_Type;
|
| 9 |
+
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
|
| 10 |
+
#ifdef Py_BUILD_CORE
|
| 11 |
+
extern PyTypeObject _PyAnextAwaitable_Type;
|
| 12 |
+
#endif
|
| 13 |
+
|
| 14 |
+
#define PySeqIter_Check(op) Py_IS_TYPE(op, &PySeqIter_Type)
|
| 15 |
+
|
| 16 |
+
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
#define PyCallIter_Check(op) Py_IS_TYPE(op, &PyCallIter_Type)
|
| 20 |
+
|
| 21 |
+
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
|
| 22 |
+
|
| 23 |
+
#ifdef __cplusplus
|
| 24 |
+
}
|
| 25 |
+
#endif
|
| 26 |
+
#endif /* !Py_ITEROBJECT_H */
|
| 27 |
+
|
evalkit_llava/include/python3.10/marshal.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* Interface for marshal.c */
|
| 3 |
+
|
| 4 |
+
#ifndef Py_MARSHAL_H
|
| 5 |
+
#define Py_MARSHAL_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#define Py_MARSHAL_VERSION 4
|
| 11 |
+
|
| 12 |
+
PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
|
| 13 |
+
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
|
| 14 |
+
PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int);
|
| 15 |
+
|
| 16 |
+
#ifndef Py_LIMITED_API
|
| 17 |
+
PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *);
|
| 18 |
+
PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
|
| 19 |
+
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
|
| 20 |
+
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
|
| 21 |
+
#endif
|
| 22 |
+
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *,
|
| 23 |
+
Py_ssize_t);
|
| 24 |
+
|
| 25 |
+
#ifdef __cplusplus
|
| 26 |
+
}
|
| 27 |
+
#endif
|
| 28 |
+
#endif /* !Py_MARSHAL_H */
|
evalkit_llava/include/python3.10/memoryobject.h
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Memory view object. In Python this is available as "memoryview". */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_MEMORYOBJECT_H
|
| 4 |
+
#define Py_MEMORYOBJECT_H
|
| 5 |
+
#ifdef __cplusplus
|
| 6 |
+
extern "C" {
|
| 7 |
+
#endif
|
| 8 |
+
|
| 9 |
+
#ifndef Py_LIMITED_API
|
| 10 |
+
PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type;
|
| 11 |
+
#endif
|
| 12 |
+
PyAPI_DATA(PyTypeObject) PyMemoryView_Type;
|
| 13 |
+
|
| 14 |
+
#define PyMemoryView_Check(op) Py_IS_TYPE(op, &PyMemoryView_Type)
|
| 15 |
+
|
| 16 |
+
#ifndef Py_LIMITED_API
|
| 17 |
+
/* Get a pointer to the memoryview's private copy of the exporter's buffer. */
|
| 18 |
+
#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)
|
| 19 |
+
/* Get a pointer to the exporting object (this may be NULL!). */
|
| 20 |
+
#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)
|
| 21 |
+
#endif
|
| 22 |
+
|
| 23 |
+
PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
|
| 24 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
| 25 |
+
PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size,
|
| 26 |
+
int flags);
|
| 27 |
+
#endif
|
| 28 |
+
#ifndef Py_LIMITED_API
|
| 29 |
+
PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);
|
| 30 |
+
#endif
|
| 31 |
+
PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
|
| 32 |
+
int buffertype,
|
| 33 |
+
char order);
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
/* The structs are declared here so that macros can work, but they shouldn't
|
| 37 |
+
be considered public. Don't access their fields directly, use the macros
|
| 38 |
+
and functions instead! */
|
| 39 |
+
#ifndef Py_LIMITED_API
|
| 40 |
+
#define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */
|
| 41 |
+
#define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */
|
| 42 |
+
typedef struct {
|
| 43 |
+
PyObject_HEAD
|
| 44 |
+
int flags; /* state flags */
|
| 45 |
+
Py_ssize_t exports; /* number of direct memoryview exports */
|
| 46 |
+
Py_buffer master; /* snapshot buffer obtained from the original exporter */
|
| 47 |
+
} _PyManagedBufferObject;
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
/* memoryview state flags */
|
| 51 |
+
#define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */
|
| 52 |
+
#define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */
|
| 53 |
+
#define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */
|
| 54 |
+
#define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */
|
| 55 |
+
#define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */
|
| 56 |
+
|
| 57 |
+
typedef struct {
|
| 58 |
+
PyObject_VAR_HEAD
|
| 59 |
+
_PyManagedBufferObject *mbuf; /* managed buffer */
|
| 60 |
+
Py_hash_t hash; /* hash value for read-only views */
|
| 61 |
+
int flags; /* state flags */
|
| 62 |
+
Py_ssize_t exports; /* number of buffer re-exports */
|
| 63 |
+
Py_buffer view; /* private copy of the exporter's view */
|
| 64 |
+
PyObject *weakreflist;
|
| 65 |
+
Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */
|
| 66 |
+
} PyMemoryViewObject;
|
| 67 |
+
#endif
|
| 68 |
+
|
| 69 |
+
#ifdef __cplusplus
|
| 70 |
+
}
|
| 71 |
+
#endif
|
| 72 |
+
#endif /* !Py_MEMORYOBJECT_H */
|
evalkit_llava/include/python3.10/modsupport.h
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
#ifndef Py_MODSUPPORT_H
|
| 3 |
+
#define Py_MODSUPPORT_H
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
/* Module support interface */
|
| 9 |
+
|
| 10 |
+
#include <stdarg.h>
|
| 11 |
+
|
| 12 |
+
/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
|
| 13 |
+
to mean Py_ssize_t */
|
| 14 |
+
#ifdef PY_SSIZE_T_CLEAN
|
| 15 |
+
#define PyArg_Parse _PyArg_Parse_SizeT
|
| 16 |
+
#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
|
| 17 |
+
#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
|
| 18 |
+
#define PyArg_VaParse _PyArg_VaParse_SizeT
|
| 19 |
+
#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
|
| 20 |
+
#define Py_BuildValue _Py_BuildValue_SizeT
|
| 21 |
+
#define Py_VaBuildValue _Py_VaBuildValue_SizeT
|
| 22 |
+
#ifndef Py_LIMITED_API
|
| 23 |
+
#define _Py_VaBuildStack _Py_VaBuildStack_SizeT
|
| 24 |
+
#endif
|
| 25 |
+
#else
|
| 26 |
+
#ifndef Py_LIMITED_API
|
| 27 |
+
PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
|
| 28 |
+
PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT(
|
| 29 |
+
PyObject **small_stack,
|
| 30 |
+
Py_ssize_t small_stack_len,
|
| 31 |
+
const char *format,
|
| 32 |
+
va_list va,
|
| 33 |
+
Py_ssize_t *p_nargs);
|
| 34 |
+
#endif /* !Py_LIMITED_API */
|
| 35 |
+
#endif
|
| 36 |
+
|
| 37 |
+
/* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */
|
| 38 |
+
#if !defined(PY_SSIZE_T_CLEAN) || !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
| 39 |
+
PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
|
| 40 |
+
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...);
|
| 41 |
+
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
| 42 |
+
const char *, char **, ...);
|
| 43 |
+
PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
|
| 44 |
+
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
|
| 45 |
+
const char *, char **, va_list);
|
| 46 |
+
#endif
|
| 47 |
+
PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *);
|
| 48 |
+
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
|
| 49 |
+
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
|
| 50 |
+
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
#ifndef Py_LIMITED_API
|
| 54 |
+
PyAPI_FUNC(int) _PyArg_UnpackStack(
|
| 55 |
+
PyObject *const *args,
|
| 56 |
+
Py_ssize_t nargs,
|
| 57 |
+
const char *name,
|
| 58 |
+
Py_ssize_t min,
|
| 59 |
+
Py_ssize_t max,
|
| 60 |
+
...);
|
| 61 |
+
|
| 62 |
+
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
|
| 63 |
+
PyAPI_FUNC(int) _PyArg_NoKwnames(const char *funcname, PyObject *kwnames);
|
| 64 |
+
PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
|
| 65 |
+
#define _PyArg_NoKeywords(funcname, kwargs) \
|
| 66 |
+
((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
|
| 67 |
+
#define _PyArg_NoKwnames(funcname, kwnames) \
|
| 68 |
+
((kwnames) == NULL || _PyArg_NoKwnames((funcname), (kwnames)))
|
| 69 |
+
#define _PyArg_NoPositional(funcname, args) \
|
| 70 |
+
((args) == NULL || _PyArg_NoPositional((funcname), (args)))
|
| 71 |
+
|
| 72 |
+
PyAPI_FUNC(void) _PyArg_BadArgument(const char *, const char *, const char *, PyObject *);
|
| 73 |
+
PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
|
| 74 |
+
Py_ssize_t, Py_ssize_t);
|
| 75 |
+
#define _PyArg_CheckPositional(funcname, nargs, min, max) \
|
| 76 |
+
(((min) <= (nargs) && (nargs) <= (max)) \
|
| 77 |
+
|| _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
|
| 78 |
+
|
| 79 |
+
#endif
|
| 80 |
+
|
| 81 |
+
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
|
| 82 |
+
#ifndef Py_LIMITED_API
|
| 83 |
+
PyAPI_FUNC(PyObject **) _Py_VaBuildStack(
|
| 84 |
+
PyObject **small_stack,
|
| 85 |
+
Py_ssize_t small_stack_len,
|
| 86 |
+
const char *format,
|
| 87 |
+
va_list va,
|
| 88 |
+
Py_ssize_t *p_nargs);
|
| 89 |
+
#endif
|
| 90 |
+
|
| 91 |
+
#ifndef Py_LIMITED_API
|
| 92 |
+
typedef struct _PyArg_Parser {
|
| 93 |
+
const char *format;
|
| 94 |
+
const char * const *keywords;
|
| 95 |
+
const char *fname;
|
| 96 |
+
const char *custom_msg;
|
| 97 |
+
int pos; /* number of positional-only arguments */
|
| 98 |
+
int min; /* minimal number of arguments */
|
| 99 |
+
int max; /* maximal number of positional arguments */
|
| 100 |
+
PyObject *kwtuple; /* tuple of keyword parameter names */
|
| 101 |
+
struct _PyArg_Parser *next;
|
| 102 |
+
} _PyArg_Parser;
|
| 103 |
+
#ifdef PY_SSIZE_T_CLEAN
|
| 104 |
+
#define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT
|
| 105 |
+
#define _PyArg_ParseStack _PyArg_ParseStack_SizeT
|
| 106 |
+
#define _PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT
|
| 107 |
+
#define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT
|
| 108 |
+
#endif
|
| 109 |
+
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
| 110 |
+
struct _PyArg_Parser *, ...);
|
| 111 |
+
PyAPI_FUNC(int) _PyArg_ParseStack(
|
| 112 |
+
PyObject *const *args,
|
| 113 |
+
Py_ssize_t nargs,
|
| 114 |
+
const char *format,
|
| 115 |
+
...);
|
| 116 |
+
PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
|
| 117 |
+
PyObject *const *args,
|
| 118 |
+
Py_ssize_t nargs,
|
| 119 |
+
PyObject *kwnames,
|
| 120 |
+
struct _PyArg_Parser *,
|
| 121 |
+
...);
|
| 122 |
+
PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
| 123 |
+
struct _PyArg_Parser *, va_list);
|
| 124 |
+
PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
|
| 125 |
+
PyObject *const *args, Py_ssize_t nargs,
|
| 126 |
+
PyObject *kwargs, PyObject *kwnames,
|
| 127 |
+
struct _PyArg_Parser *parser,
|
| 128 |
+
int minpos, int maxpos, int minkw,
|
| 129 |
+
PyObject **buf);
|
| 130 |
+
#define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
|
| 131 |
+
(((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
|
| 132 |
+
(minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \
|
| 133 |
+
_PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
|
| 134 |
+
(minpos), (maxpos), (minkw), (buf)))
|
| 135 |
+
|
| 136 |
+
void _PyArg_Fini(void);
|
| 137 |
+
#endif /* Py_LIMITED_API */
|
| 138 |
+
|
| 139 |
+
// Add an attribute with name 'name' and value 'obj' to the module 'mod.
|
| 140 |
+
// On success, return 0 on success.
|
| 141 |
+
// On error, raise an exception and return -1.
|
| 142 |
+
PyAPI_FUNC(int) PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value);
|
| 143 |
+
|
| 144 |
+
// Similar to PyModule_AddObjectRef() but steal a reference to 'obj'
|
| 145 |
+
// (Py_DECREF(obj)) on success (if it returns 0).
|
| 146 |
+
PyAPI_FUNC(int) PyModule_AddObject(PyObject *mod, const char *, PyObject *value);
|
| 147 |
+
|
| 148 |
+
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
|
| 149 |
+
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
|
| 150 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
|
| 151 |
+
/* New in 3.9 */
|
| 152 |
+
PyAPI_FUNC(int) PyModule_AddType(PyObject *module, PyTypeObject *type);
|
| 153 |
+
#endif /* Py_LIMITED_API */
|
| 154 |
+
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
|
| 155 |
+
#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
|
| 156 |
+
|
| 157 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
| 158 |
+
/* New in 3.5 */
|
| 159 |
+
PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *);
|
| 160 |
+
PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *);
|
| 161 |
+
PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def);
|
| 162 |
+
#endif
|
| 163 |
+
|
| 164 |
+
#define Py_CLEANUP_SUPPORTED 0x20000
|
| 165 |
+
|
| 166 |
+
#define PYTHON_API_VERSION 1013
|
| 167 |
+
#define PYTHON_API_STRING "1013"
|
| 168 |
+
/* The API version is maintained (independently from the Python version)
|
| 169 |
+
so we can detect mismatches between the interpreter and dynamically
|
| 170 |
+
loaded modules. These are diagnosed by an error message but
|
| 171 |
+
the module is still loaded (because the mismatch can only be tested
|
| 172 |
+
after loading the module). The error message is intended to
|
| 173 |
+
explain the core dump a few seconds later.
|
| 174 |
+
|
| 175 |
+
The symbol PYTHON_API_STRING defines the same value as a string
|
| 176 |
+
literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
|
| 177 |
+
|
| 178 |
+
Please add a line or two to the top of this log for each API
|
| 179 |
+
version change:
|
| 180 |
+
|
| 181 |
+
22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
|
| 182 |
+
|
| 183 |
+
19-Aug-2002 GvR 1012 Changes to string object struct for
|
| 184 |
+
interning changes, saving 3 bytes.
|
| 185 |
+
|
| 186 |
+
17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
|
| 187 |
+
|
| 188 |
+
25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
|
| 189 |
+
PyFrame_New(); Python 2.1a2
|
| 190 |
+
|
| 191 |
+
14-Mar-2000 GvR 1009 Unicode API added
|
| 192 |
+
|
| 193 |
+
3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
|
| 194 |
+
|
| 195 |
+
3-Dec-1998 GvR 1008 Python 1.5.2b1
|
| 196 |
+
|
| 197 |
+
18-Jan-1997 GvR 1007 string interning and other speedups
|
| 198 |
+
|
| 199 |
+
11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
|
| 200 |
+
|
| 201 |
+
30-Jul-1996 GvR Slice and ellipses syntax added
|
| 202 |
+
|
| 203 |
+
23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
|
| 204 |
+
|
| 205 |
+
7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
|
| 206 |
+
|
| 207 |
+
10-Jan-1995 GvR Renamed globals to new naming scheme
|
| 208 |
+
|
| 209 |
+
9-Jan-1995 GvR Initial version (incompatible with older API)
|
| 210 |
+
*/
|
| 211 |
+
|
| 212 |
+
/* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
|
| 213 |
+
Python 3, it will stay at the value of 3; changes to the limited API
|
| 214 |
+
must be performed in a strictly backwards-compatible manner. */
|
| 215 |
+
#define PYTHON_ABI_VERSION 3
|
| 216 |
+
#define PYTHON_ABI_STRING "3"
|
| 217 |
+
|
| 218 |
+
#ifdef Py_TRACE_REFS
|
| 219 |
+
/* When we are tracing reference counts, rename module creation functions so
|
| 220 |
+
modules compiled with incompatible settings will generate a
|
| 221 |
+
link-time error. */
|
| 222 |
+
#define PyModule_Create2 PyModule_Create2TraceRefs
|
| 223 |
+
#define PyModule_FromDefAndSpec2 PyModule_FromDefAndSpec2TraceRefs
|
| 224 |
+
#endif
|
| 225 |
+
|
| 226 |
+
PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
|
| 227 |
+
int apiver);
|
| 228 |
+
#ifndef Py_LIMITED_API
|
| 229 |
+
PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(struct PyModuleDef*,
|
| 230 |
+
int apiver);
|
| 231 |
+
#endif
|
| 232 |
+
|
| 233 |
+
#ifdef Py_LIMITED_API
|
| 234 |
+
#define PyModule_Create(module) \
|
| 235 |
+
PyModule_Create2(module, PYTHON_ABI_VERSION)
|
| 236 |
+
#else
|
| 237 |
+
#define PyModule_Create(module) \
|
| 238 |
+
PyModule_Create2(module, PYTHON_API_VERSION)
|
| 239 |
+
#endif
|
| 240 |
+
|
| 241 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
| 242 |
+
/* New in 3.5 */
|
| 243 |
+
PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
|
| 244 |
+
PyObject *spec,
|
| 245 |
+
int module_api_version);
|
| 246 |
+
|
| 247 |
+
#ifdef Py_LIMITED_API
|
| 248 |
+
#define PyModule_FromDefAndSpec(module, spec) \
|
| 249 |
+
PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION)
|
| 250 |
+
#else
|
| 251 |
+
#define PyModule_FromDefAndSpec(module, spec) \
|
| 252 |
+
PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION)
|
| 253 |
+
#endif /* Py_LIMITED_API */
|
| 254 |
+
#endif /* New in 3.5 */
|
| 255 |
+
|
| 256 |
+
#ifndef Py_LIMITED_API
|
| 257 |
+
PyAPI_DATA(const char *) _Py_PackageContext;
|
| 258 |
+
#endif
|
| 259 |
+
|
| 260 |
+
#ifdef __cplusplus
|
| 261 |
+
}
|
| 262 |
+
#endif
|
| 263 |
+
#endif /* !Py_MODSUPPORT_H */
|
evalkit_llava/include/python3.10/moduleobject.h
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* Module object interface */
|
| 3 |
+
|
| 4 |
+
#ifndef Py_MODULEOBJECT_H
|
| 5 |
+
#define Py_MODULEOBJECT_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
PyAPI_DATA(PyTypeObject) PyModule_Type;
|
| 11 |
+
|
| 12 |
+
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
| 13 |
+
#define PyModule_CheckExact(op) Py_IS_TYPE(op, &PyModule_Type)
|
| 14 |
+
|
| 15 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
| 16 |
+
PyAPI_FUNC(PyObject *) PyModule_NewObject(
|
| 17 |
+
PyObject *name
|
| 18 |
+
);
|
| 19 |
+
#endif
|
| 20 |
+
PyAPI_FUNC(PyObject *) PyModule_New(
|
| 21 |
+
const char *name /* UTF-8 encoded string */
|
| 22 |
+
);
|
| 23 |
+
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
|
| 24 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
| 25 |
+
PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
|
| 26 |
+
#endif
|
| 27 |
+
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
|
| 28 |
+
Py_DEPRECATED(3.2) PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
|
| 29 |
+
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
|
| 30 |
+
#ifndef Py_LIMITED_API
|
| 31 |
+
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
|
| 32 |
+
PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *);
|
| 33 |
+
PyAPI_FUNC(int) _PyModuleSpec_IsInitializing(PyObject *);
|
| 34 |
+
#endif
|
| 35 |
+
PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
|
| 36 |
+
PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
|
| 37 |
+
|
| 38 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
| 39 |
+
/* New in 3.5 */
|
| 40 |
+
PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*);
|
| 41 |
+
PyAPI_DATA(PyTypeObject) PyModuleDef_Type;
|
| 42 |
+
#endif
|
| 43 |
+
|
| 44 |
+
typedef struct PyModuleDef_Base {
|
| 45 |
+
PyObject_HEAD
|
| 46 |
+
PyObject* (*m_init)(void);
|
| 47 |
+
Py_ssize_t m_index;
|
| 48 |
+
PyObject* m_copy;
|
| 49 |
+
} PyModuleDef_Base;
|
| 50 |
+
|
| 51 |
+
#define PyModuleDef_HEAD_INIT { \
|
| 52 |
+
PyObject_HEAD_INIT(NULL) \
|
| 53 |
+
NULL, /* m_init */ \
|
| 54 |
+
0, /* m_index */ \
|
| 55 |
+
NULL, /* m_copy */ \
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
struct PyModuleDef_Slot;
|
| 59 |
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
| 60 |
+
/* New in 3.5 */
|
| 61 |
+
typedef struct PyModuleDef_Slot{
|
| 62 |
+
int slot;
|
| 63 |
+
void *value;
|
| 64 |
+
} PyModuleDef_Slot;
|
| 65 |
+
|
| 66 |
+
#define Py_mod_create 1
|
| 67 |
+
#define Py_mod_exec 2
|
| 68 |
+
|
| 69 |
+
#ifndef Py_LIMITED_API
|
| 70 |
+
#define _Py_mod_LAST_SLOT 2
|
| 71 |
+
#endif
|
| 72 |
+
|
| 73 |
+
#endif /* New in 3.5 */
|
| 74 |
+
|
| 75 |
+
typedef struct PyModuleDef{
|
| 76 |
+
PyModuleDef_Base m_base;
|
| 77 |
+
const char* m_name;
|
| 78 |
+
const char* m_doc;
|
| 79 |
+
Py_ssize_t m_size;
|
| 80 |
+
PyMethodDef *m_methods;
|
| 81 |
+
struct PyModuleDef_Slot* m_slots;
|
| 82 |
+
traverseproc m_traverse;
|
| 83 |
+
inquiry m_clear;
|
| 84 |
+
freefunc m_free;
|
| 85 |
+
} PyModuleDef;
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
// Internal C API
|
| 89 |
+
#ifdef Py_BUILD_CORE
|
| 90 |
+
extern int _PyModule_IsExtension(PyObject *obj);
|
| 91 |
+
#endif
|
| 92 |
+
|
| 93 |
+
#ifdef __cplusplus
|
| 94 |
+
}
|
| 95 |
+
#endif
|
| 96 |
+
#endif /* !Py_MODULEOBJECT_H */
|