Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- data/miniconda3/include/python3.13/cpython/abstract.h +87 -0
- data/miniconda3/include/python3.13/cpython/bytearrayobject.h +34 -0
- data/miniconda3/include/python3.13/cpython/bytesobject.h +37 -0
- data/miniconda3/include/python3.13/cpython/cellobject.h +44 -0
- data/miniconda3/include/python3.13/cpython/ceval.h +25 -0
- data/miniconda3/include/python3.13/cpython/classobject.h +71 -0
- data/miniconda3/include/python3.13/cpython/code.h +358 -0
- data/miniconda3/include/python3.13/cpython/compile.h +50 -0
- data/miniconda3/include/python3.13/cpython/complexobject.h +33 -0
- data/miniconda3/include/python3.13/cpython/context.h +74 -0
- data/miniconda3/include/python3.13/cpython/critical_section.h +134 -0
- data/miniconda3/include/python3.13/cpython/descrobject.h +62 -0
- data/miniconda3/include/python3.13/cpython/dictobject.h +102 -0
- data/miniconda3/include/python3.13/cpython/fileobject.h +16 -0
- data/miniconda3/include/python3.13/cpython/fileutils.h +8 -0
- data/miniconda3/include/python3.13/cpython/floatobject.h +27 -0
- data/miniconda3/include/python3.13/cpython/frameobject.h +35 -0
- data/miniconda3/include/python3.13/cpython/funcobject.h +184 -0
- data/miniconda3/include/python3.13/cpython/genobject.h +83 -0
- data/miniconda3/include/python3.13/cpython/import.h +25 -0
- data/miniconda3/include/python3.13/cpython/initconfig.h +274 -0
- data/miniconda3/include/python3.13/cpython/listobject.h +53 -0
- data/miniconda3/include/python3.13/cpython/lock.h +63 -0
- data/miniconda3/include/python3.13/cpython/longintrepr.h +146 -0
- data/miniconda3/include/python3.13/cpython/longobject.h +116 -0
- data/miniconda3/include/python3.13/cpython/memoryobject.h +50 -0
- data/miniconda3/include/python3.13/cpython/methodobject.h +66 -0
- data/miniconda3/include/python3.13/cpython/modsupport.h +26 -0
- data/miniconda3/include/python3.13/cpython/monitoring.h +250 -0
- data/miniconda3/include/python3.13/cpython/object.h +525 -0
- data/miniconda3/include/python3.13/cpython/objimpl.h +104 -0
- data/miniconda3/include/python3.13/cpython/odictobject.h +43 -0
- data/miniconda3/include/python3.13/cpython/picklebufobject.h +31 -0
- data/miniconda3/include/python3.13/cpython/pthread_stubs.h +105 -0
- data/miniconda3/include/python3.13/cpython/pyatomic.h +569 -0
- data/miniconda3/include/python3.13/cpython/pyatomic_gcc.h +551 -0
- data/miniconda3/include/python3.13/cpython/pyatomic_msc.h +1095 -0
- data/miniconda3/include/python3.13/cpython/pyatomic_std.h +976 -0
- data/miniconda3/include/python3.13/cpython/pyctype.h +39 -0
- data/miniconda3/include/python3.13/cpython/pydebug.h +38 -0
- data/miniconda3/include/python3.13/cpython/pyerrors.h +131 -0
- data/miniconda3/include/python3.13/cpython/pyfpe.h +15 -0
- data/miniconda3/include/python3.13/cpython/pyframe.h +45 -0
- data/miniconda3/include/python3.13/cpython/pyhash.h +47 -0
- data/miniconda3/include/python3.13/cpython/pylifecycle.h +92 -0
- data/miniconda3/include/python3.13/cpython/pymem.h +84 -0
- data/miniconda3/include/python3.13/cpython/pystate.h +277 -0
- data/miniconda3/include/python3.13/cpython/pystats.h +175 -0
- data/miniconda3/include/python3.13/cpython/pythonrun.h +96 -0
- data/miniconda3/include/python3.13/cpython/pythread.h +43 -0
data/miniconda3/include/python3.13/cpython/abstract.h
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_ABSTRACTOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* === Object Protocol ================================================== */
|
| 6 |
+
|
| 7 |
+
/* Like PyObject_CallMethod(), but expect a _Py_Identifier*
|
| 8 |
+
as the method name. */
|
| 9 |
+
PyAPI_FUNC(PyObject*) _PyObject_CallMethodId(
|
| 10 |
+
PyObject *obj,
|
| 11 |
+
_Py_Identifier *name,
|
| 12 |
+
const char *format, ...);
|
| 13 |
+
|
| 14 |
+
/* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple)
|
| 15 |
+
format to a Python dictionary ("kwargs" dict).
|
| 16 |
+
|
| 17 |
+
The type of kwnames keys is not checked. The final function getting
|
| 18 |
+
arguments is responsible to check if all keys are strings, for example using
|
| 19 |
+
PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments().
|
| 20 |
+
|
| 21 |
+
Duplicate keys are merged using the last value. If duplicate keys must raise
|
| 22 |
+
an exception, the caller is responsible to implement an explicit keys on
|
| 23 |
+
kwnames. */
|
| 24 |
+
PyAPI_FUNC(PyObject*) _PyStack_AsDict(PyObject *const *values, PyObject *kwnames);
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
/* === Vectorcall protocol (PEP 590) ============================= */
|
| 28 |
+
|
| 29 |
+
// PyVectorcall_NARGS() is exported as a function for the stable ABI.
|
| 30 |
+
// Here (when we are not using the stable ABI), the name is overridden to
|
| 31 |
+
// call a static inline function for best performance.
|
| 32 |
+
static inline Py_ssize_t
|
| 33 |
+
_PyVectorcall_NARGS(size_t n)
|
| 34 |
+
{
|
| 35 |
+
return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET;
|
| 36 |
+
}
|
| 37 |
+
#define PyVectorcall_NARGS(n) _PyVectorcall_NARGS(n)
|
| 38 |
+
|
| 39 |
+
PyAPI_FUNC(vectorcallfunc) PyVectorcall_Function(PyObject *callable);
|
| 40 |
+
|
| 41 |
+
// Backwards compatibility aliases (PEP 590) for API that was provisional
|
| 42 |
+
// in Python 3.8
|
| 43 |
+
#define _PyObject_Vectorcall PyObject_Vectorcall
|
| 44 |
+
#define _PyObject_VectorcallMethod PyObject_VectorcallMethod
|
| 45 |
+
#define _PyObject_FastCallDict PyObject_VectorcallDict
|
| 46 |
+
#define _PyVectorcall_Function PyVectorcall_Function
|
| 47 |
+
#define _PyObject_CallOneArg PyObject_CallOneArg
|
| 48 |
+
#define _PyObject_CallMethodNoArgs PyObject_CallMethodNoArgs
|
| 49 |
+
#define _PyObject_CallMethodOneArg PyObject_CallMethodOneArg
|
| 50 |
+
|
| 51 |
+
/* Same as PyObject_Vectorcall except that keyword arguments are passed as
|
| 52 |
+
dict, which may be NULL if there are no keyword arguments. */
|
| 53 |
+
PyAPI_FUNC(PyObject *) PyObject_VectorcallDict(
|
| 54 |
+
PyObject *callable,
|
| 55 |
+
PyObject *const *args,
|
| 56 |
+
size_t nargsf,
|
| 57 |
+
PyObject *kwargs);
|
| 58 |
+
|
| 59 |
+
PyAPI_FUNC(PyObject *) PyObject_CallOneArg(PyObject *func, PyObject *arg);
|
| 60 |
+
|
| 61 |
+
static inline PyObject *
|
| 62 |
+
PyObject_CallMethodNoArgs(PyObject *self, PyObject *name)
|
| 63 |
+
{
|
| 64 |
+
size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET;
|
| 65 |
+
return PyObject_VectorcallMethod(name, &self, nargsf, _Py_NULL);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
static inline PyObject *
|
| 69 |
+
PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg)
|
| 70 |
+
{
|
| 71 |
+
PyObject *args[2] = {self, arg};
|
| 72 |
+
size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET;
|
| 73 |
+
assert(arg != NULL);
|
| 74 |
+
return PyObject_VectorcallMethod(name, args, nargsf, _Py_NULL);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/* Guess the size of object 'o' using len(o) or o.__length_hint__().
|
| 78 |
+
If neither of those return a non-negative value, then return the default
|
| 79 |
+
value. If one of the calls fails, this function returns -1. */
|
| 80 |
+
PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
| 81 |
+
|
| 82 |
+
/* === Sequence protocol ================================================ */
|
| 83 |
+
|
| 84 |
+
/* Assume tp_as_sequence and sq_item exist and that 'i' does not
|
| 85 |
+
need to be corrected for a negative index. */
|
| 86 |
+
#define PySequence_ITEM(o, i)\
|
| 87 |
+
( Py_TYPE(o)->tp_as_sequence->sq_item((o), (i)) )
|
data/miniconda3/include/python3.13/cpython/bytearrayobject.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
PyAPI_DATA(char) _PyByteArray_empty_string[];
|
| 15 |
+
|
| 16 |
+
/* Macros and static inline functions, trading safety for speed */
|
| 17 |
+
#define _PyByteArray_CAST(op) \
|
| 18 |
+
(assert(PyByteArray_Check(op)), _Py_CAST(PyByteArrayObject*, op))
|
| 19 |
+
|
| 20 |
+
static inline char* PyByteArray_AS_STRING(PyObject *op)
|
| 21 |
+
{
|
| 22 |
+
PyByteArrayObject *self = _PyByteArray_CAST(op);
|
| 23 |
+
if (Py_SIZE(self)) {
|
| 24 |
+
return self->ob_start;
|
| 25 |
+
}
|
| 26 |
+
return _PyByteArray_empty_string;
|
| 27 |
+
}
|
| 28 |
+
#define PyByteArray_AS_STRING(self) PyByteArray_AS_STRING(_PyObject_CAST(self))
|
| 29 |
+
|
| 30 |
+
static inline Py_ssize_t PyByteArray_GET_SIZE(PyObject *op) {
|
| 31 |
+
PyByteArrayObject *self = _PyByteArray_CAST(op);
|
| 32 |
+
return Py_SIZE(self);
|
| 33 |
+
}
|
| 34 |
+
#define PyByteArray_GET_SIZE(self) PyByteArray_GET_SIZE(_PyObject_CAST(self))
|
data/miniconda3/include/python3.13/cpython/bytesobject.h
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_DEPRECATED(3.11) 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 |
+
|
| 19 |
+
/* Macros and static inline functions, trading safety for speed */
|
| 20 |
+
#define _PyBytes_CAST(op) \
|
| 21 |
+
(assert(PyBytes_Check(op)), _Py_CAST(PyBytesObject*, op))
|
| 22 |
+
|
| 23 |
+
static inline char* PyBytes_AS_STRING(PyObject *op)
|
| 24 |
+
{
|
| 25 |
+
return _PyBytes_CAST(op)->ob_sval;
|
| 26 |
+
}
|
| 27 |
+
#define PyBytes_AS_STRING(op) PyBytes_AS_STRING(_PyObject_CAST(op))
|
| 28 |
+
|
| 29 |
+
static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) {
|
| 30 |
+
PyBytesObject *self = _PyBytes_CAST(op);
|
| 31 |
+
return Py_SIZE(self);
|
| 32 |
+
}
|
| 33 |
+
#define PyBytes_GET_SIZE(self) PyBytes_GET_SIZE(_PyObject_CAST(self))
|
| 34 |
+
|
| 35 |
+
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
|
| 36 |
+
x must be an iterable object. */
|
| 37 |
+
PyAPI_FUNC(PyObject*) _PyBytes_Join(PyObject *sep, PyObject *x);
|
data/miniconda3/include/python3.13/cpython/cellobject.h
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Cell object interface */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_LIMITED_API
|
| 4 |
+
#ifndef Py_CELLOBJECT_H
|
| 5 |
+
#define Py_CELLOBJECT_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
typedef struct {
|
| 11 |
+
PyObject_HEAD
|
| 12 |
+
/* Content of the cell or NULL when empty */
|
| 13 |
+
PyObject *ob_ref;
|
| 14 |
+
} PyCellObject;
|
| 15 |
+
|
| 16 |
+
PyAPI_DATA(PyTypeObject) PyCell_Type;
|
| 17 |
+
|
| 18 |
+
#define PyCell_Check(op) Py_IS_TYPE((op), &PyCell_Type)
|
| 19 |
+
|
| 20 |
+
PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
|
| 21 |
+
PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
|
| 22 |
+
PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
|
| 23 |
+
|
| 24 |
+
static inline PyObject* PyCell_GET(PyObject *op) {
|
| 25 |
+
PyCellObject *cell;
|
| 26 |
+
assert(PyCell_Check(op));
|
| 27 |
+
cell = _Py_CAST(PyCellObject*, op);
|
| 28 |
+
return cell->ob_ref;
|
| 29 |
+
}
|
| 30 |
+
#define PyCell_GET(op) PyCell_GET(_PyObject_CAST(op))
|
| 31 |
+
|
| 32 |
+
static inline void PyCell_SET(PyObject *op, PyObject *value) {
|
| 33 |
+
PyCellObject *cell;
|
| 34 |
+
assert(PyCell_Check(op));
|
| 35 |
+
cell = _Py_CAST(PyCellObject*, op);
|
| 36 |
+
cell->ob_ref = value;
|
| 37 |
+
}
|
| 38 |
+
#define PyCell_SET(op, value) PyCell_SET(_PyObject_CAST(op), (value))
|
| 39 |
+
|
| 40 |
+
#ifdef __cplusplus
|
| 41 |
+
}
|
| 42 |
+
#endif
|
| 43 |
+
#endif /* !Py_TUPLEOBJECT_H */
|
| 44 |
+
#endif /* Py_LIMITED_API */
|
data/miniconda3/include/python3.13/cpython/ceval.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_FUNC(void) PyEval_SetProfileAllThreads(Py_tracefunc, PyObject *);
|
| 7 |
+
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
| 8 |
+
PyAPI_FUNC(void) PyEval_SetTraceAllThreads(Py_tracefunc, PyObject *);
|
| 9 |
+
|
| 10 |
+
/* Look at the current frame's (if any) code's co_flags, and turn on
|
| 11 |
+
the corresponding compiler flags in cf->cf_flags. Return 1 if any
|
| 12 |
+
flag was set, else return 0. */
|
| 13 |
+
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
|
| 14 |
+
|
| 15 |
+
PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc);
|
| 16 |
+
|
| 17 |
+
PyAPI_FUNC(Py_ssize_t) PyUnstable_Eval_RequestCodeExtraIndex(freefunc);
|
| 18 |
+
// Old name -- remove when this API changes:
|
| 19 |
+
_Py_DEPRECATED_EXTERNALLY(3.12) static inline Py_ssize_t
|
| 20 |
+
_PyEval_RequestCodeExtraIndex(freefunc f) {
|
| 21 |
+
return PyUnstable_Eval_RequestCodeExtraIndex(f);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
|
| 25 |
+
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
|
data/miniconda3/include/python3.13/cpython/classobject.h
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
#define _PyMethod_CAST(meth) \
|
| 30 |
+
(assert(PyMethod_Check(meth)), _Py_CAST(PyMethodObject*, meth))
|
| 31 |
+
|
| 32 |
+
/* Static inline functions for direct access to these values.
|
| 33 |
+
Type checks are *not* done, so use with care. */
|
| 34 |
+
static inline PyObject* PyMethod_GET_FUNCTION(PyObject *meth) {
|
| 35 |
+
return _PyMethod_CAST(meth)->im_func;
|
| 36 |
+
}
|
| 37 |
+
#define PyMethod_GET_FUNCTION(meth) PyMethod_GET_FUNCTION(_PyObject_CAST(meth))
|
| 38 |
+
|
| 39 |
+
static inline PyObject* PyMethod_GET_SELF(PyObject *meth) {
|
| 40 |
+
return _PyMethod_CAST(meth)->im_self;
|
| 41 |
+
}
|
| 42 |
+
#define PyMethod_GET_SELF(meth) PyMethod_GET_SELF(_PyObject_CAST(meth))
|
| 43 |
+
|
| 44 |
+
typedef struct {
|
| 45 |
+
PyObject_HEAD
|
| 46 |
+
PyObject *func;
|
| 47 |
+
} PyInstanceMethodObject;
|
| 48 |
+
|
| 49 |
+
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
|
| 50 |
+
|
| 51 |
+
#define PyInstanceMethod_Check(op) Py_IS_TYPE((op), &PyInstanceMethod_Type)
|
| 52 |
+
|
| 53 |
+
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
|
| 54 |
+
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
|
| 55 |
+
|
| 56 |
+
#define _PyInstanceMethod_CAST(meth) \
|
| 57 |
+
(assert(PyInstanceMethod_Check(meth)), \
|
| 58 |
+
_Py_CAST(PyInstanceMethodObject*, meth))
|
| 59 |
+
|
| 60 |
+
/* Static inline function for direct access to these values.
|
| 61 |
+
Type checks are *not* done, so use with care. */
|
| 62 |
+
static inline PyObject* PyInstanceMethod_GET_FUNCTION(PyObject *meth) {
|
| 63 |
+
return _PyInstanceMethod_CAST(meth)->func;
|
| 64 |
+
}
|
| 65 |
+
#define PyInstanceMethod_GET_FUNCTION(meth) PyInstanceMethod_GET_FUNCTION(_PyObject_CAST(meth))
|
| 66 |
+
|
| 67 |
+
#ifdef __cplusplus
|
| 68 |
+
}
|
| 69 |
+
#endif
|
| 70 |
+
#endif // !Py_CLASSOBJECT_H
|
| 71 |
+
#endif // !Py_LIMITED_API
|
data/miniconda3/include/python3.13/cpython/code.h
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Definitions for bytecode */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_LIMITED_API
|
| 4 |
+
#ifndef Py_CODE_H
|
| 5 |
+
#define Py_CODE_H
|
| 6 |
+
|
| 7 |
+
#ifdef __cplusplus
|
| 8 |
+
extern "C" {
|
| 9 |
+
#endif
|
| 10 |
+
|
| 11 |
+
/* Count of all local monitoring events */
|
| 12 |
+
#define _PY_MONITORING_LOCAL_EVENTS 10
|
| 13 |
+
/* Count of all "real" monitoring events (not derived from other events) */
|
| 14 |
+
#define _PY_MONITORING_UNGROUPED_EVENTS 15
|
| 15 |
+
/* Count of all monitoring events */
|
| 16 |
+
#define _PY_MONITORING_EVENTS 17
|
| 17 |
+
|
| 18 |
+
/* Tables of which tools are active for each monitored event. */
|
| 19 |
+
typedef struct _Py_LocalMonitors {
|
| 20 |
+
uint8_t tools[_PY_MONITORING_LOCAL_EVENTS];
|
| 21 |
+
} _Py_LocalMonitors;
|
| 22 |
+
|
| 23 |
+
typedef struct _Py_GlobalMonitors {
|
| 24 |
+
uint8_t tools[_PY_MONITORING_UNGROUPED_EVENTS];
|
| 25 |
+
} _Py_GlobalMonitors;
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
typedef struct {
|
| 29 |
+
PyObject *_co_code;
|
| 30 |
+
PyObject *_co_varnames;
|
| 31 |
+
PyObject *_co_cellvars;
|
| 32 |
+
PyObject *_co_freevars;
|
| 33 |
+
} _PyCoCached;
|
| 34 |
+
|
| 35 |
+
/* Ancillary data structure used for instrumentation.
|
| 36 |
+
Line instrumentation creates this with sufficient
|
| 37 |
+
space for one entry per code unit. The total size
|
| 38 |
+
of the data will be `bytes_per_entry * Py_SIZE(code)` */
|
| 39 |
+
typedef struct {
|
| 40 |
+
uint8_t bytes_per_entry;
|
| 41 |
+
uint8_t data[1];
|
| 42 |
+
} _PyCoLineInstrumentationData;
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
typedef struct {
|
| 46 |
+
int size;
|
| 47 |
+
int capacity;
|
| 48 |
+
struct _PyExecutorObject *executors[1];
|
| 49 |
+
} _PyExecutorArray;
|
| 50 |
+
|
| 51 |
+
/* Main data structure used for instrumentation.
|
| 52 |
+
* This is allocated when needed for instrumentation
|
| 53 |
+
*/
|
| 54 |
+
typedef struct {
|
| 55 |
+
/* Monitoring specific to this code object */
|
| 56 |
+
_Py_LocalMonitors local_monitors;
|
| 57 |
+
/* Monitoring that is active on this code object */
|
| 58 |
+
_Py_LocalMonitors active_monitors;
|
| 59 |
+
/* The tools that are to be notified for events for the matching code unit */
|
| 60 |
+
uint8_t *tools;
|
| 61 |
+
/* Information to support line events */
|
| 62 |
+
_PyCoLineInstrumentationData *lines;
|
| 63 |
+
/* The tools that are to be notified for line events for the matching code unit */
|
| 64 |
+
uint8_t *line_tools;
|
| 65 |
+
/* Information to support instruction events */
|
| 66 |
+
/* The underlying instructions, which can themselves be instrumented */
|
| 67 |
+
uint8_t *per_instruction_opcodes;
|
| 68 |
+
/* The tools that are to be notified for instruction events for the matching code unit */
|
| 69 |
+
uint8_t *per_instruction_tools;
|
| 70 |
+
} _PyCoMonitoringData;
|
| 71 |
+
|
| 72 |
+
// To avoid repeating ourselves in deepfreeze.py, all PyCodeObject members are
|
| 73 |
+
// defined in this macro:
|
| 74 |
+
#define _PyCode_DEF(SIZE) { \
|
| 75 |
+
PyObject_VAR_HEAD \
|
| 76 |
+
\
|
| 77 |
+
/* Note only the following fields are used in hash and/or comparisons \
|
| 78 |
+
* \
|
| 79 |
+
* - co_name \
|
| 80 |
+
* - co_argcount \
|
| 81 |
+
* - co_posonlyargcount \
|
| 82 |
+
* - co_kwonlyargcount \
|
| 83 |
+
* - co_nlocals \
|
| 84 |
+
* - co_stacksize \
|
| 85 |
+
* - co_flags \
|
| 86 |
+
* - co_firstlineno \
|
| 87 |
+
* - co_consts \
|
| 88 |
+
* - co_names \
|
| 89 |
+
* - co_localsplusnames \
|
| 90 |
+
* This is done to preserve the name and line number for tracebacks \
|
| 91 |
+
* and debuggers; otherwise, constant de-duplication would collapse \
|
| 92 |
+
* identical functions/lambdas defined on different lines. \
|
| 93 |
+
*/ \
|
| 94 |
+
\
|
| 95 |
+
/* These fields are set with provided values on new code objects. */ \
|
| 96 |
+
\
|
| 97 |
+
/* The hottest fields (in the eval loop) are grouped here at the top. */ \
|
| 98 |
+
PyObject *co_consts; /* list (constants used) */ \
|
| 99 |
+
PyObject *co_names; /* list of strings (names used) */ \
|
| 100 |
+
PyObject *co_exceptiontable; /* Byte string encoding exception handling \
|
| 101 |
+
table */ \
|
| 102 |
+
int co_flags; /* CO_..., see below */ \
|
| 103 |
+
\
|
| 104 |
+
/* The rest are not so impactful on performance. */ \
|
| 105 |
+
int co_argcount; /* #arguments, except *args */ \
|
| 106 |
+
int co_posonlyargcount; /* #positional only arguments */ \
|
| 107 |
+
int co_kwonlyargcount; /* #keyword only arguments */ \
|
| 108 |
+
int co_stacksize; /* #entries needed for evaluation stack */ \
|
| 109 |
+
int co_firstlineno; /* first source line number */ \
|
| 110 |
+
\
|
| 111 |
+
/* redundant values (derived from co_localsplusnames and \
|
| 112 |
+
co_localspluskinds) */ \
|
| 113 |
+
int co_nlocalsplus; /* number of local + cell + free variables */ \
|
| 114 |
+
int co_framesize; /* Size of frame in words */ \
|
| 115 |
+
int co_nlocals; /* number of local variables */ \
|
| 116 |
+
int co_ncellvars; /* total number of cell variables */ \
|
| 117 |
+
int co_nfreevars; /* number of free variables */ \
|
| 118 |
+
uint32_t co_version; /* version number */ \
|
| 119 |
+
\
|
| 120 |
+
PyObject *co_localsplusnames; /* tuple mapping offsets to names */ \
|
| 121 |
+
PyObject *co_localspluskinds; /* Bytes mapping to local kinds (one byte \
|
| 122 |
+
per variable) */ \
|
| 123 |
+
PyObject *co_filename; /* unicode (where it was loaded from) */ \
|
| 124 |
+
PyObject *co_name; /* unicode (name, for reference) */ \
|
| 125 |
+
PyObject *co_qualname; /* unicode (qualname, for reference) */ \
|
| 126 |
+
PyObject *co_linetable; /* bytes object that holds location info */ \
|
| 127 |
+
PyObject *co_weakreflist; /* to support weakrefs to code objects */ \
|
| 128 |
+
_PyExecutorArray *co_executors; /* executors from optimizer */ \
|
| 129 |
+
_PyCoCached *_co_cached; /* cached co_* attributes */ \
|
| 130 |
+
uintptr_t _co_instrumentation_version; /* current instrumentation version */ \
|
| 131 |
+
_PyCoMonitoringData *_co_monitoring; /* Monitoring data */ \
|
| 132 |
+
int _co_firsttraceable; /* index of first traceable instruction */ \
|
| 133 |
+
/* Scratch space for extra data relating to the code object. \
|
| 134 |
+
Type is a void* to keep the format private in codeobject.c to force \
|
| 135 |
+
people to go through the proper APIs. */ \
|
| 136 |
+
void *co_extra; \
|
| 137 |
+
char co_code_adaptive[(SIZE)]; \
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/* Bytecode object */
|
| 141 |
+
struct PyCodeObject _PyCode_DEF(1);
|
| 142 |
+
|
| 143 |
+
/* Masks for co_flags above */
|
| 144 |
+
#define CO_OPTIMIZED 0x0001
|
| 145 |
+
#define CO_NEWLOCALS 0x0002
|
| 146 |
+
#define CO_VARARGS 0x0004
|
| 147 |
+
#define CO_VARKEYWORDS 0x0008
|
| 148 |
+
#define CO_NESTED 0x0010
|
| 149 |
+
#define CO_GENERATOR 0x0020
|
| 150 |
+
|
| 151 |
+
/* The CO_COROUTINE flag is set for coroutine functions (defined with
|
| 152 |
+
``async def`` keywords) */
|
| 153 |
+
#define CO_COROUTINE 0x0080
|
| 154 |
+
#define CO_ITERABLE_COROUTINE 0x0100
|
| 155 |
+
#define CO_ASYNC_GENERATOR 0x0200
|
| 156 |
+
|
| 157 |
+
/* bpo-39562: These constant values are changed in Python 3.9
|
| 158 |
+
to prevent collision with compiler flags. CO_FUTURE_ and PyCF_
|
| 159 |
+
constants must be kept unique. PyCF_ constants can use bits from
|
| 160 |
+
0x0100 to 0x10000. CO_FUTURE_ constants use bits starting at 0x20000. */
|
| 161 |
+
#define CO_FUTURE_DIVISION 0x20000
|
| 162 |
+
#define CO_FUTURE_ABSOLUTE_IMPORT 0x40000 /* do absolute imports by default */
|
| 163 |
+
#define CO_FUTURE_WITH_STATEMENT 0x80000
|
| 164 |
+
#define CO_FUTURE_PRINT_FUNCTION 0x100000
|
| 165 |
+
#define CO_FUTURE_UNICODE_LITERALS 0x200000
|
| 166 |
+
|
| 167 |
+
#define CO_FUTURE_BARRY_AS_BDFL 0x400000
|
| 168 |
+
#define CO_FUTURE_GENERATOR_STOP 0x800000
|
| 169 |
+
#define CO_FUTURE_ANNOTATIONS 0x1000000
|
| 170 |
+
|
| 171 |
+
#define CO_NO_MONITORING_EVENTS 0x2000000
|
| 172 |
+
|
| 173 |
+
/* This should be defined if a future statement modifies the syntax.
|
| 174 |
+
For example, when a keyword is added.
|
| 175 |
+
*/
|
| 176 |
+
#define PY_PARSER_REQUIRES_FUTURE_KEYWORD
|
| 177 |
+
|
| 178 |
+
#define CO_MAXBLOCKS 21 /* Max static block nesting within a function */
|
| 179 |
+
|
| 180 |
+
PyAPI_DATA(PyTypeObject) PyCode_Type;
|
| 181 |
+
|
| 182 |
+
#define PyCode_Check(op) Py_IS_TYPE((op), &PyCode_Type)
|
| 183 |
+
|
| 184 |
+
static inline Py_ssize_t PyCode_GetNumFree(PyCodeObject *op) {
|
| 185 |
+
assert(PyCode_Check(op));
|
| 186 |
+
return op->co_nfreevars;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
static inline int PyUnstable_Code_GetFirstFree(PyCodeObject *op) {
|
| 190 |
+
assert(PyCode_Check(op));
|
| 191 |
+
return op->co_nlocalsplus - op->co_nfreevars;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
Py_DEPRECATED(3.13) static inline int PyCode_GetFirstFree(PyCodeObject *op) {
|
| 195 |
+
return PyUnstable_Code_GetFirstFree(op);
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
/* Unstable public interface */
|
| 199 |
+
PyAPI_FUNC(PyCodeObject *) PyUnstable_Code_New(
|
| 200 |
+
int, int, int, int, int, PyObject *, PyObject *,
|
| 201 |
+
PyObject *, PyObject *, PyObject *, PyObject *,
|
| 202 |
+
PyObject *, PyObject *, PyObject *, int, PyObject *,
|
| 203 |
+
PyObject *);
|
| 204 |
+
|
| 205 |
+
PyAPI_FUNC(PyCodeObject *) PyUnstable_Code_NewWithPosOnlyArgs(
|
| 206 |
+
int, int, int, int, int, int, PyObject *, PyObject *,
|
| 207 |
+
PyObject *, PyObject *, PyObject *, PyObject *,
|
| 208 |
+
PyObject *, PyObject *, PyObject *, int, PyObject *,
|
| 209 |
+
PyObject *);
|
| 210 |
+
/* same as struct above */
|
| 211 |
+
// Old names -- remove when this API changes:
|
| 212 |
+
_Py_DEPRECATED_EXTERNALLY(3.12) static inline PyCodeObject *
|
| 213 |
+
PyCode_New(
|
| 214 |
+
int a, int b, int c, int d, int e, PyObject *f, PyObject *g,
|
| 215 |
+
PyObject *h, PyObject *i, PyObject *j, PyObject *k,
|
| 216 |
+
PyObject *l, PyObject *m, PyObject *n, int o, PyObject *p,
|
| 217 |
+
PyObject *q)
|
| 218 |
+
{
|
| 219 |
+
return PyUnstable_Code_New(
|
| 220 |
+
a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q);
|
| 221 |
+
}
|
| 222 |
+
_Py_DEPRECATED_EXTERNALLY(3.12) static inline PyCodeObject *
|
| 223 |
+
PyCode_NewWithPosOnlyArgs(
|
| 224 |
+
int a, int poac, int b, int c, int d, int e, PyObject *f, PyObject *g,
|
| 225 |
+
PyObject *h, PyObject *i, PyObject *j, PyObject *k,
|
| 226 |
+
PyObject *l, PyObject *m, PyObject *n, int o, PyObject *p,
|
| 227 |
+
PyObject *q)
|
| 228 |
+
{
|
| 229 |
+
return PyUnstable_Code_NewWithPosOnlyArgs(
|
| 230 |
+
a, poac, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/* Creates a new empty code object with the specified source location. */
|
| 234 |
+
PyAPI_FUNC(PyCodeObject *)
|
| 235 |
+
PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
|
| 236 |
+
|
| 237 |
+
/* Return the line number associated with the specified bytecode index
|
| 238 |
+
in this code object. If you just need the line number of a frame,
|
| 239 |
+
use PyFrame_GetLineNumber() instead. */
|
| 240 |
+
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
|
| 241 |
+
|
| 242 |
+
PyAPI_FUNC(int) PyCode_Addr2Location(PyCodeObject *, int, int *, int *, int *, int *);
|
| 243 |
+
|
| 244 |
+
#define PY_FOREACH_CODE_EVENT(V) \
|
| 245 |
+
V(CREATE) \
|
| 246 |
+
V(DESTROY)
|
| 247 |
+
|
| 248 |
+
typedef enum {
|
| 249 |
+
#define PY_DEF_EVENT(op) PY_CODE_EVENT_##op,
|
| 250 |
+
PY_FOREACH_CODE_EVENT(PY_DEF_EVENT)
|
| 251 |
+
#undef PY_DEF_EVENT
|
| 252 |
+
} PyCodeEvent;
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
/*
|
| 256 |
+
* A callback that is invoked for different events in a code object's lifecycle.
|
| 257 |
+
*
|
| 258 |
+
* The callback is invoked with a borrowed reference to co, after it is
|
| 259 |
+
* created and before it is destroyed.
|
| 260 |
+
*
|
| 261 |
+
* If the callback sets an exception, it must return -1. Otherwise
|
| 262 |
+
* it should return 0.
|
| 263 |
+
*/
|
| 264 |
+
typedef int (*PyCode_WatchCallback)(
|
| 265 |
+
PyCodeEvent event,
|
| 266 |
+
PyCodeObject* co);
|
| 267 |
+
|
| 268 |
+
/*
|
| 269 |
+
* Register a per-interpreter callback that will be invoked for code object
|
| 270 |
+
* lifecycle events.
|
| 271 |
+
*
|
| 272 |
+
* Returns a handle that may be passed to PyCode_ClearWatcher on success,
|
| 273 |
+
* or -1 and sets an error if no more handles are available.
|
| 274 |
+
*/
|
| 275 |
+
PyAPI_FUNC(int) PyCode_AddWatcher(PyCode_WatchCallback callback);
|
| 276 |
+
|
| 277 |
+
/*
|
| 278 |
+
* Clear the watcher associated with the watcher_id handle.
|
| 279 |
+
*
|
| 280 |
+
* Returns 0 on success or -1 if no watcher exists for the provided id.
|
| 281 |
+
*/
|
| 282 |
+
PyAPI_FUNC(int) PyCode_ClearWatcher(int watcher_id);
|
| 283 |
+
|
| 284 |
+
/* for internal use only */
|
| 285 |
+
struct _opaque {
|
| 286 |
+
int computed_line;
|
| 287 |
+
const uint8_t *lo_next;
|
| 288 |
+
const uint8_t *limit;
|
| 289 |
+
};
|
| 290 |
+
|
| 291 |
+
typedef struct _line_offsets {
|
| 292 |
+
int ar_start;
|
| 293 |
+
int ar_end;
|
| 294 |
+
int ar_line;
|
| 295 |
+
struct _opaque opaque;
|
| 296 |
+
} PyCodeAddressRange;
|
| 297 |
+
|
| 298 |
+
/* Update *bounds to describe the first and one-past-the-last instructions in the
|
| 299 |
+
same line as lasti. Return the number of that line.
|
| 300 |
+
*/
|
| 301 |
+
PyAPI_FUNC(int) _PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds);
|
| 302 |
+
|
| 303 |
+
/* Create a comparable key used to compare constants taking in account the
|
| 304 |
+
* object type. It is used to make sure types are not coerced (e.g., float and
|
| 305 |
+
* complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms
|
| 306 |
+
*
|
| 307 |
+
* Return (type(obj), obj, ...): a tuple with variable size (at least 2 items)
|
| 308 |
+
* depending on the type and the value. The type is the first item to not
|
| 309 |
+
* compare bytes and str which can raise a BytesWarning exception. */
|
| 310 |
+
PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj);
|
| 311 |
+
|
| 312 |
+
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
|
| 313 |
+
PyObject *names, PyObject *lnotab);
|
| 314 |
+
|
| 315 |
+
PyAPI_FUNC(int) PyUnstable_Code_GetExtra(
|
| 316 |
+
PyObject *code, Py_ssize_t index, void **extra);
|
| 317 |
+
PyAPI_FUNC(int) PyUnstable_Code_SetExtra(
|
| 318 |
+
PyObject *code, Py_ssize_t index, void *extra);
|
| 319 |
+
// Old names -- remove when this API changes:
|
| 320 |
+
_Py_DEPRECATED_EXTERNALLY(3.12) static inline int
|
| 321 |
+
_PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra)
|
| 322 |
+
{
|
| 323 |
+
return PyUnstable_Code_GetExtra(code, index, extra);
|
| 324 |
+
}
|
| 325 |
+
_Py_DEPRECATED_EXTERNALLY(3.12) static inline int
|
| 326 |
+
_PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra)
|
| 327 |
+
{
|
| 328 |
+
return PyUnstable_Code_SetExtra(code, index, extra);
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
/* Equivalent to getattr(code, 'co_code') in Python.
|
| 332 |
+
Returns a strong reference to a bytes object. */
|
| 333 |
+
PyAPI_FUNC(PyObject *) PyCode_GetCode(PyCodeObject *code);
|
| 334 |
+
/* Equivalent to getattr(code, 'co_varnames') in Python. */
|
| 335 |
+
PyAPI_FUNC(PyObject *) PyCode_GetVarnames(PyCodeObject *code);
|
| 336 |
+
/* Equivalent to getattr(code, 'co_cellvars') in Python. */
|
| 337 |
+
PyAPI_FUNC(PyObject *) PyCode_GetCellvars(PyCodeObject *code);
|
| 338 |
+
/* Equivalent to getattr(code, 'co_freevars') in Python. */
|
| 339 |
+
PyAPI_FUNC(PyObject *) PyCode_GetFreevars(PyCodeObject *code);
|
| 340 |
+
|
| 341 |
+
typedef enum _PyCodeLocationInfoKind {
|
| 342 |
+
/* short forms are 0 to 9 */
|
| 343 |
+
PY_CODE_LOCATION_INFO_SHORT0 = 0,
|
| 344 |
+
/* one lineforms are 10 to 12 */
|
| 345 |
+
PY_CODE_LOCATION_INFO_ONE_LINE0 = 10,
|
| 346 |
+
PY_CODE_LOCATION_INFO_ONE_LINE1 = 11,
|
| 347 |
+
PY_CODE_LOCATION_INFO_ONE_LINE2 = 12,
|
| 348 |
+
|
| 349 |
+
PY_CODE_LOCATION_INFO_NO_COLUMNS = 13,
|
| 350 |
+
PY_CODE_LOCATION_INFO_LONG = 14,
|
| 351 |
+
PY_CODE_LOCATION_INFO_NONE = 15
|
| 352 |
+
} _PyCodeLocationInfoKind;
|
| 353 |
+
|
| 354 |
+
#ifdef __cplusplus
|
| 355 |
+
}
|
| 356 |
+
#endif
|
| 357 |
+
#endif // !Py_CODE_H
|
| 358 |
+
#endif // !Py_LIMITED_API
|
data/miniconda3/include/python3.13/cpython/compile.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_COMPILE_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Public interface */
|
| 6 |
+
#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
|
| 7 |
+
CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
|
| 8 |
+
CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
|
| 9 |
+
CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
|
| 10 |
+
#define PyCF_MASK_OBSOLETE (CO_NESTED)
|
| 11 |
+
|
| 12 |
+
/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique.
|
| 13 |
+
PyCF_ constants can use bits from 0x0100 to 0x10000.
|
| 14 |
+
CO_FUTURE_ constants use bits starting at 0x20000. */
|
| 15 |
+
#define PyCF_SOURCE_IS_UTF8 0x0100
|
| 16 |
+
#define PyCF_DONT_IMPLY_DEDENT 0x0200
|
| 17 |
+
#define PyCF_ONLY_AST 0x0400
|
| 18 |
+
#define PyCF_IGNORE_COOKIE 0x0800
|
| 19 |
+
#define PyCF_TYPE_COMMENTS 0x1000
|
| 20 |
+
#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
|
| 21 |
+
#define PyCF_ALLOW_INCOMPLETE_INPUT 0x4000
|
| 22 |
+
#define PyCF_OPTIMIZED_AST (0x8000 | PyCF_ONLY_AST)
|
| 23 |
+
#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
|
| 24 |
+
PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT | \
|
| 25 |
+
PyCF_ALLOW_INCOMPLETE_INPUT | PyCF_OPTIMIZED_AST)
|
| 26 |
+
|
| 27 |
+
typedef struct {
|
| 28 |
+
int cf_flags; /* bitmask of CO_xxx flags relevant to future */
|
| 29 |
+
int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */
|
| 30 |
+
} PyCompilerFlags;
|
| 31 |
+
|
| 32 |
+
#define _PyCompilerFlags_INIT \
|
| 33 |
+
(PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
|
| 34 |
+
|
| 35 |
+
/* Future feature support */
|
| 36 |
+
|
| 37 |
+
#define FUTURE_NESTED_SCOPES "nested_scopes"
|
| 38 |
+
#define FUTURE_GENERATORS "generators"
|
| 39 |
+
#define FUTURE_DIVISION "division"
|
| 40 |
+
#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
|
| 41 |
+
#define FUTURE_WITH_STATEMENT "with_statement"
|
| 42 |
+
#define FUTURE_PRINT_FUNCTION "print_function"
|
| 43 |
+
#define FUTURE_UNICODE_LITERALS "unicode_literals"
|
| 44 |
+
#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
|
| 45 |
+
#define FUTURE_GENERATOR_STOP "generator_stop"
|
| 46 |
+
#define FUTURE_ANNOTATIONS "annotations"
|
| 47 |
+
|
| 48 |
+
#define PY_INVALID_STACK_EFFECT INT_MAX
|
| 49 |
+
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
|
| 50 |
+
PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
|
data/miniconda3/include/python3.13/cpython/complexobject.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_COMPLEXOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef struct {
|
| 6 |
+
double real;
|
| 7 |
+
double imag;
|
| 8 |
+
} Py_complex;
|
| 9 |
+
|
| 10 |
+
// Operations on complex numbers.
|
| 11 |
+
PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
|
| 12 |
+
PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
|
| 13 |
+
PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
|
| 14 |
+
PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex);
|
| 15 |
+
PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex);
|
| 16 |
+
PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex);
|
| 17 |
+
PyAPI_FUNC(double) _Py_c_abs(Py_complex);
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
/* Complex object interface */
|
| 21 |
+
|
| 22 |
+
/*
|
| 23 |
+
PyComplexObject represents a complex number with double-precision
|
| 24 |
+
real and imaginary parts.
|
| 25 |
+
*/
|
| 26 |
+
typedef struct {
|
| 27 |
+
PyObject_HEAD
|
| 28 |
+
Py_complex cval;
|
| 29 |
+
} PyComplexObject;
|
| 30 |
+
|
| 31 |
+
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
|
| 32 |
+
|
| 33 |
+
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
|
data/miniconda3/include/python3.13/cpython/context.h
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_LIMITED_API
|
| 2 |
+
#ifndef Py_CONTEXT_H
|
| 3 |
+
#define Py_CONTEXT_H
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
PyAPI_DATA(PyTypeObject) PyContext_Type;
|
| 9 |
+
typedef struct _pycontextobject PyContext;
|
| 10 |
+
|
| 11 |
+
PyAPI_DATA(PyTypeObject) PyContextVar_Type;
|
| 12 |
+
typedef struct _pycontextvarobject PyContextVar;
|
| 13 |
+
|
| 14 |
+
PyAPI_DATA(PyTypeObject) PyContextToken_Type;
|
| 15 |
+
typedef struct _pycontexttokenobject PyContextToken;
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
#define PyContext_CheckExact(o) Py_IS_TYPE((o), &PyContext_Type)
|
| 19 |
+
#define PyContextVar_CheckExact(o) Py_IS_TYPE((o), &PyContextVar_Type)
|
| 20 |
+
#define PyContextToken_CheckExact(o) Py_IS_TYPE((o), &PyContextToken_Type)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
PyAPI_FUNC(PyObject *) PyContext_New(void);
|
| 24 |
+
PyAPI_FUNC(PyObject *) PyContext_Copy(PyObject *);
|
| 25 |
+
PyAPI_FUNC(PyObject *) PyContext_CopyCurrent(void);
|
| 26 |
+
|
| 27 |
+
PyAPI_FUNC(int) PyContext_Enter(PyObject *);
|
| 28 |
+
PyAPI_FUNC(int) PyContext_Exit(PyObject *);
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
/* Create a new context variable.
|
| 32 |
+
|
| 33 |
+
default_value can be NULL.
|
| 34 |
+
*/
|
| 35 |
+
PyAPI_FUNC(PyObject *) PyContextVar_New(
|
| 36 |
+
const char *name, PyObject *default_value);
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
/* Get a value for the variable.
|
| 40 |
+
|
| 41 |
+
Returns -1 if an error occurred during lookup.
|
| 42 |
+
|
| 43 |
+
Returns 0 if value either was or was not found.
|
| 44 |
+
|
| 45 |
+
If value was found, *value will point to it.
|
| 46 |
+
If not, it will point to:
|
| 47 |
+
|
| 48 |
+
- default_value, if not NULL;
|
| 49 |
+
- the default value of "var", if not NULL;
|
| 50 |
+
- NULL.
|
| 51 |
+
|
| 52 |
+
'*value' will be a new ref, if not NULL.
|
| 53 |
+
*/
|
| 54 |
+
PyAPI_FUNC(int) PyContextVar_Get(
|
| 55 |
+
PyObject *var, PyObject *default_value, PyObject **value);
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
/* Set a new value for the variable.
|
| 59 |
+
Returns NULL if an error occurs.
|
| 60 |
+
*/
|
| 61 |
+
PyAPI_FUNC(PyObject *) PyContextVar_Set(PyObject *var, PyObject *value);
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
/* Reset a variable to its previous value.
|
| 65 |
+
Returns 0 on success, -1 on error.
|
| 66 |
+
*/
|
| 67 |
+
PyAPI_FUNC(int) PyContextVar_Reset(PyObject *var, PyObject *token);
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
#ifdef __cplusplus
|
| 71 |
+
}
|
| 72 |
+
#endif
|
| 73 |
+
#endif /* !Py_CONTEXT_H */
|
| 74 |
+
#endif /* !Py_LIMITED_API */
|
data/miniconda3/include/python3.13/cpython/critical_section.h
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_CRITICAL_SECTION_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
// Python critical sections
|
| 6 |
+
//
|
| 7 |
+
// Conceptually, critical sections are a deadlock avoidance layer on top of
|
| 8 |
+
// per-object locks. These helpers, in combination with those locks, replace
|
| 9 |
+
// our usage of the global interpreter lock to provide thread-safety for
|
| 10 |
+
// otherwise thread-unsafe objects, such as dict.
|
| 11 |
+
//
|
| 12 |
+
// NOTE: These APIs are no-ops in non-free-threaded builds.
|
| 13 |
+
//
|
| 14 |
+
// Straightforward per-object locking could introduce deadlocks that were not
|
| 15 |
+
// present when running with the GIL. Threads may hold locks for multiple
|
| 16 |
+
// objects simultaneously because Python operations can nest. If threads were
|
| 17 |
+
// to acquire the same locks in different orders, they would deadlock.
|
| 18 |
+
//
|
| 19 |
+
// One way to avoid deadlocks is to allow threads to hold only the lock (or
|
| 20 |
+
// locks) for a single operation at a time (typically a single lock, but some
|
| 21 |
+
// operations involve two locks). When a thread begins a nested operation it
|
| 22 |
+
// could suspend the locks for any outer operation: before beginning the nested
|
| 23 |
+
// operation, the locks for the outer operation are released and when the
|
| 24 |
+
// nested operation completes, the locks for the outer operation are
|
| 25 |
+
// reacquired.
|
| 26 |
+
//
|
| 27 |
+
// To improve performance, this API uses a variation of the above scheme.
|
| 28 |
+
// Instead of immediately suspending locks any time a nested operation begins,
|
| 29 |
+
// locks are only suspended if the thread would block. This reduces the number
|
| 30 |
+
// of lock acquisitions and releases for nested operations, while still
|
| 31 |
+
// avoiding deadlocks.
|
| 32 |
+
//
|
| 33 |
+
// Additionally, the locks for any active operation are suspended around
|
| 34 |
+
// other potentially blocking operations, such as I/O. This is because the
|
| 35 |
+
// interaction between locks and blocking operations can lead to deadlocks in
|
| 36 |
+
// the same way as the interaction between multiple locks.
|
| 37 |
+
//
|
| 38 |
+
// Each thread's critical sections and their corresponding locks are tracked in
|
| 39 |
+
// a stack in `PyThreadState.critical_section`. When a thread calls
|
| 40 |
+
// `_PyThreadState_Detach()`, such as before a blocking I/O operation or when
|
| 41 |
+
// waiting to acquire a lock, the thread suspends all of its active critical
|
| 42 |
+
// sections, temporarily releasing the associated locks. When the thread calls
|
| 43 |
+
// `_PyThreadState_Attach()`, it resumes the top-most (i.e., most recent)
|
| 44 |
+
// critical section by reacquiring the associated lock or locks. See
|
| 45 |
+
// `_PyCriticalSection_Resume()`.
|
| 46 |
+
//
|
| 47 |
+
// NOTE: Only the top-most critical section is guaranteed to be active.
|
| 48 |
+
// Operations that need to lock two objects at once must use
|
| 49 |
+
// `Py_BEGIN_CRITICAL_SECTION2()`. You *CANNOT* use nested critical sections
|
| 50 |
+
// to lock more than one object at once, because the inner critical section
|
| 51 |
+
// may suspend the outer critical sections. This API does not provide a way
|
| 52 |
+
// to lock more than two objects at once (though it could be added later
|
| 53 |
+
// if actually needed).
|
| 54 |
+
//
|
| 55 |
+
// NOTE: Critical sections implicitly behave like reentrant locks because
|
| 56 |
+
// attempting to acquire the same lock will suspend any outer (earlier)
|
| 57 |
+
// critical sections. However, they are less efficient for this use case than
|
| 58 |
+
// purposefully designed reentrant locks.
|
| 59 |
+
//
|
| 60 |
+
// Example usage:
|
| 61 |
+
// Py_BEGIN_CRITICAL_SECTION(op);
|
| 62 |
+
// ...
|
| 63 |
+
// Py_END_CRITICAL_SECTION();
|
| 64 |
+
//
|
| 65 |
+
// To lock two objects at once:
|
| 66 |
+
// Py_BEGIN_CRITICAL_SECTION2(op1, op2);
|
| 67 |
+
// ...
|
| 68 |
+
// Py_END_CRITICAL_SECTION2();
|
| 69 |
+
|
| 70 |
+
typedef struct PyCriticalSection PyCriticalSection;
|
| 71 |
+
typedef struct PyCriticalSection2 PyCriticalSection2;
|
| 72 |
+
|
| 73 |
+
PyAPI_FUNC(void)
|
| 74 |
+
PyCriticalSection_Begin(PyCriticalSection *c, PyObject *op);
|
| 75 |
+
|
| 76 |
+
PyAPI_FUNC(void)
|
| 77 |
+
PyCriticalSection_End(PyCriticalSection *c);
|
| 78 |
+
|
| 79 |
+
PyAPI_FUNC(void)
|
| 80 |
+
PyCriticalSection2_Begin(PyCriticalSection2 *c, PyObject *a, PyObject *b);
|
| 81 |
+
|
| 82 |
+
PyAPI_FUNC(void)
|
| 83 |
+
PyCriticalSection2_End(PyCriticalSection2 *c);
|
| 84 |
+
|
| 85 |
+
#ifndef Py_GIL_DISABLED
|
| 86 |
+
# define Py_BEGIN_CRITICAL_SECTION(op) \
|
| 87 |
+
{
|
| 88 |
+
# define Py_END_CRITICAL_SECTION() \
|
| 89 |
+
}
|
| 90 |
+
# define Py_BEGIN_CRITICAL_SECTION2(a, b) \
|
| 91 |
+
{
|
| 92 |
+
# define Py_END_CRITICAL_SECTION2() \
|
| 93 |
+
}
|
| 94 |
+
#else /* !Py_GIL_DISABLED */
|
| 95 |
+
|
| 96 |
+
// NOTE: the contents of this struct are private and may change betweeen
|
| 97 |
+
// Python releases without a deprecation period.
|
| 98 |
+
struct PyCriticalSection {
|
| 99 |
+
// Tagged pointer to an outer active critical section (or 0).
|
| 100 |
+
uintptr_t _cs_prev;
|
| 101 |
+
|
| 102 |
+
// Mutex used to protect critical section
|
| 103 |
+
PyMutex *_cs_mutex;
|
| 104 |
+
};
|
| 105 |
+
|
| 106 |
+
// A critical section protected by two mutexes. Use
|
| 107 |
+
// Py_BEGIN_CRITICAL_SECTION2 and Py_END_CRITICAL_SECTION2.
|
| 108 |
+
// NOTE: the contents of this struct are private and may change betweeen
|
| 109 |
+
// Python releases without a deprecation period.
|
| 110 |
+
struct PyCriticalSection2 {
|
| 111 |
+
PyCriticalSection _cs_base;
|
| 112 |
+
|
| 113 |
+
PyMutex *_cs_mutex2;
|
| 114 |
+
};
|
| 115 |
+
|
| 116 |
+
# define Py_BEGIN_CRITICAL_SECTION(op) \
|
| 117 |
+
{ \
|
| 118 |
+
PyCriticalSection _py_cs; \
|
| 119 |
+
PyCriticalSection_Begin(&_py_cs, _PyObject_CAST(op))
|
| 120 |
+
|
| 121 |
+
# define Py_END_CRITICAL_SECTION() \
|
| 122 |
+
PyCriticalSection_End(&_py_cs); \
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
# define Py_BEGIN_CRITICAL_SECTION2(a, b) \
|
| 126 |
+
{ \
|
| 127 |
+
PyCriticalSection2 _py_cs2; \
|
| 128 |
+
PyCriticalSection2_Begin(&_py_cs2, _PyObject_CAST(a), _PyObject_CAST(b))
|
| 129 |
+
|
| 130 |
+
# define Py_END_CRITICAL_SECTION2() \
|
| 131 |
+
PyCriticalSection2_End(&_py_cs2); \
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
#endif
|
data/miniconda3/include/python3.13/cpython/descrobject.h
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_DESCROBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
|
| 6 |
+
void *wrapped);
|
| 7 |
+
|
| 8 |
+
typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
|
| 9 |
+
void *wrapped, PyObject *kwds);
|
| 10 |
+
|
| 11 |
+
struct wrapperbase {
|
| 12 |
+
const char *name;
|
| 13 |
+
int offset;
|
| 14 |
+
void *function;
|
| 15 |
+
wrapperfunc wrapper;
|
| 16 |
+
const char *doc;
|
| 17 |
+
int flags;
|
| 18 |
+
PyObject *name_strobj;
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
+
/* Flags for above struct */
|
| 22 |
+
#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
|
| 23 |
+
|
| 24 |
+
/* Various kinds of descriptor objects */
|
| 25 |
+
|
| 26 |
+
typedef struct {
|
| 27 |
+
PyObject_HEAD
|
| 28 |
+
PyTypeObject *d_type;
|
| 29 |
+
PyObject *d_name;
|
| 30 |
+
PyObject *d_qualname;
|
| 31 |
+
} PyDescrObject;
|
| 32 |
+
|
| 33 |
+
#define PyDescr_COMMON PyDescrObject d_common
|
| 34 |
+
|
| 35 |
+
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
| 36 |
+
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
| 37 |
+
|
| 38 |
+
typedef struct {
|
| 39 |
+
PyDescr_COMMON;
|
| 40 |
+
PyMethodDef *d_method;
|
| 41 |
+
vectorcallfunc vectorcall;
|
| 42 |
+
} PyMethodDescrObject;
|
| 43 |
+
|
| 44 |
+
typedef struct {
|
| 45 |
+
PyDescr_COMMON;
|
| 46 |
+
PyMemberDef *d_member;
|
| 47 |
+
} PyMemberDescrObject;
|
| 48 |
+
|
| 49 |
+
typedef struct {
|
| 50 |
+
PyDescr_COMMON;
|
| 51 |
+
PyGetSetDef *d_getset;
|
| 52 |
+
} PyGetSetDescrObject;
|
| 53 |
+
|
| 54 |
+
typedef struct {
|
| 55 |
+
PyDescr_COMMON;
|
| 56 |
+
struct wrapperbase *d_base;
|
| 57 |
+
void *d_wrapped; /* This can be any function pointer */
|
| 58 |
+
} PyWrapperDescrObject;
|
| 59 |
+
|
| 60 |
+
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
| 61 |
+
struct wrapperbase *, void *);
|
| 62 |
+
PyAPI_FUNC(int) PyDescr_IsData(PyObject *);
|
data/miniconda3/include/python3.13/cpython/dictobject.h
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
typedef struct _dictvalues PyDictValues;
|
| 7 |
+
|
| 8 |
+
/* The ma_values pointer is NULL for a combined table
|
| 9 |
+
* or points to an array of PyObject* for a split table
|
| 10 |
+
*/
|
| 11 |
+
typedef struct {
|
| 12 |
+
PyObject_HEAD
|
| 13 |
+
|
| 14 |
+
/* Number of items in the dictionary */
|
| 15 |
+
Py_ssize_t ma_used;
|
| 16 |
+
|
| 17 |
+
/* Dictionary version: globally unique, value change each time
|
| 18 |
+
the dictionary is modified */
|
| 19 |
+
#ifdef Py_BUILD_CORE
|
| 20 |
+
/* Bits 0-7 are for dict watchers.
|
| 21 |
+
* Bits 8-11 are for the watched mutation counter (used by tier2 optimization)
|
| 22 |
+
* The remaining bits (12-63) are the actual version tag. */
|
| 23 |
+
uint64_t ma_version_tag;
|
| 24 |
+
#else
|
| 25 |
+
Py_DEPRECATED(3.12) uint64_t ma_version_tag;
|
| 26 |
+
#endif
|
| 27 |
+
|
| 28 |
+
PyDictKeysObject *ma_keys;
|
| 29 |
+
|
| 30 |
+
/* If ma_values is NULL, the table is "combined": keys and values
|
| 31 |
+
are stored in ma_keys.
|
| 32 |
+
|
| 33 |
+
If ma_values is not NULL, the table is split:
|
| 34 |
+
keys are stored in ma_keys and values are stored in ma_values */
|
| 35 |
+
PyDictValues *ma_values;
|
| 36 |
+
} PyDictObject;
|
| 37 |
+
|
| 38 |
+
PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
|
| 39 |
+
Py_hash_t hash);
|
| 40 |
+
PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *);
|
| 41 |
+
PyAPI_FUNC(PyObject *) PyDict_SetDefault(
|
| 42 |
+
PyObject *mp, PyObject *key, PyObject *defaultobj);
|
| 43 |
+
|
| 44 |
+
// Inserts `key` with a value `default_value`, if `key` is not already present
|
| 45 |
+
// in the dictionary. If `result` is not NULL, then the value associated
|
| 46 |
+
// with `key` is returned in `*result` (either the existing value, or the now
|
| 47 |
+
// inserted `default_value`).
|
| 48 |
+
// Returns:
|
| 49 |
+
// -1 on error
|
| 50 |
+
// 0 if `key` was not present and `default_value` was inserted
|
| 51 |
+
// 1 if `key` was present and `default_value` was not inserted
|
| 52 |
+
PyAPI_FUNC(int) PyDict_SetDefaultRef(PyObject *mp, PyObject *key, PyObject *default_value, PyObject **result);
|
| 53 |
+
|
| 54 |
+
/* Get the number of items of a dictionary. */
|
| 55 |
+
static inline Py_ssize_t PyDict_GET_SIZE(PyObject *op) {
|
| 56 |
+
PyDictObject *mp;
|
| 57 |
+
assert(PyDict_Check(op));
|
| 58 |
+
mp = _Py_CAST(PyDictObject*, op);
|
| 59 |
+
#ifdef Py_GIL_DISABLED
|
| 60 |
+
return _Py_atomic_load_ssize_relaxed(&mp->ma_used);
|
| 61 |
+
#else
|
| 62 |
+
return mp->ma_used;
|
| 63 |
+
#endif
|
| 64 |
+
}
|
| 65 |
+
#define PyDict_GET_SIZE(op) PyDict_GET_SIZE(_PyObject_CAST(op))
|
| 66 |
+
|
| 67 |
+
PyAPI_FUNC(int) PyDict_ContainsString(PyObject *mp, const char *key);
|
| 68 |
+
|
| 69 |
+
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
| 70 |
+
|
| 71 |
+
PyAPI_FUNC(int) PyDict_Pop(PyObject *dict, PyObject *key, PyObject **result);
|
| 72 |
+
PyAPI_FUNC(int) PyDict_PopString(PyObject *dict, const char *key, PyObject **result);
|
| 73 |
+
PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *dict, PyObject *key, PyObject *default_value);
|
| 74 |
+
|
| 75 |
+
/* Dictionary watchers */
|
| 76 |
+
|
| 77 |
+
#define PY_FOREACH_DICT_EVENT(V) \
|
| 78 |
+
V(ADDED) \
|
| 79 |
+
V(MODIFIED) \
|
| 80 |
+
V(DELETED) \
|
| 81 |
+
V(CLONED) \
|
| 82 |
+
V(CLEARED) \
|
| 83 |
+
V(DEALLOCATED)
|
| 84 |
+
|
| 85 |
+
typedef enum {
|
| 86 |
+
#define PY_DEF_EVENT(EVENT) PyDict_EVENT_##EVENT,
|
| 87 |
+
PY_FOREACH_DICT_EVENT(PY_DEF_EVENT)
|
| 88 |
+
#undef PY_DEF_EVENT
|
| 89 |
+
} PyDict_WatchEvent;
|
| 90 |
+
|
| 91 |
+
// Callback to be invoked when a watched dict is cleared, dealloced, or modified.
|
| 92 |
+
// In clear/dealloc case, key and new_value will be NULL. Otherwise, new_value will be the
|
| 93 |
+
// new value for key, NULL if key is being deleted.
|
| 94 |
+
typedef int(*PyDict_WatchCallback)(PyDict_WatchEvent event, PyObject* dict, PyObject* key, PyObject* new_value);
|
| 95 |
+
|
| 96 |
+
// Register/unregister a dict-watcher callback
|
| 97 |
+
PyAPI_FUNC(int) PyDict_AddWatcher(PyDict_WatchCallback callback);
|
| 98 |
+
PyAPI_FUNC(int) PyDict_ClearWatcher(int watcher_id);
|
| 99 |
+
|
| 100 |
+
// Mark given dictionary as "watched" (callback will be called if it is modified)
|
| 101 |
+
PyAPI_FUNC(int) PyDict_Watch(int watcher_id, PyObject* dict);
|
| 102 |
+
PyAPI_FUNC(int) PyDict_Unwatch(int watcher_id, PyObject* dict);
|
data/miniconda3/include/python3.13/cpython/fileobject.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_OpenCodeHookFunction hook, void *userData);
|
data/miniconda3/include/python3.13/cpython/fileutils.h
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_FILEUTILS_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
// Used by _testcapi which must not use the internal C API
|
| 6 |
+
PyAPI_FUNC(FILE*) _Py_fopen_obj(
|
| 7 |
+
PyObject *path,
|
| 8 |
+
const char *mode);
|
data/miniconda3/include/python3.13/cpython/floatobject.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_FLOATOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef struct {
|
| 6 |
+
PyObject_HEAD
|
| 7 |
+
double ob_fval;
|
| 8 |
+
} PyFloatObject;
|
| 9 |
+
|
| 10 |
+
#define _PyFloat_CAST(op) \
|
| 11 |
+
(assert(PyFloat_Check(op)), _Py_CAST(PyFloatObject*, op))
|
| 12 |
+
|
| 13 |
+
// Static inline version of PyFloat_AsDouble() trading safety for speed.
|
| 14 |
+
// It doesn't check if op is a double object.
|
| 15 |
+
static inline double PyFloat_AS_DOUBLE(PyObject *op) {
|
| 16 |
+
return _PyFloat_CAST(op)->ob_fval;
|
| 17 |
+
}
|
| 18 |
+
#define PyFloat_AS_DOUBLE(op) PyFloat_AS_DOUBLE(_PyObject_CAST(op))
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
PyAPI_FUNC(int) PyFloat_Pack2(double x, char *p, int le);
|
| 22 |
+
PyAPI_FUNC(int) PyFloat_Pack4(double x, char *p, int le);
|
| 23 |
+
PyAPI_FUNC(int) PyFloat_Pack8(double x, char *p, int le);
|
| 24 |
+
|
| 25 |
+
PyAPI_FUNC(double) PyFloat_Unpack2(const char *p, int le);
|
| 26 |
+
PyAPI_FUNC(double) PyFloat_Unpack4(const char *p, int le);
|
| 27 |
+
PyAPI_FUNC(double) PyFloat_Unpack8(const char *p, int le);
|
data/miniconda3/include/python3.13/cpython/frameobject.h
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
/* Standard object interface */
|
| 8 |
+
|
| 9 |
+
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
| 10 |
+
PyObject *, PyObject *);
|
| 11 |
+
|
| 12 |
+
/* The rest of the interface is specific for frame objects */
|
| 13 |
+
|
| 14 |
+
/* Conversions between "fast locals" and locals in dictionary */
|
| 15 |
+
|
| 16 |
+
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
|
| 17 |
+
|
| 18 |
+
/* -- Caveat emptor --
|
| 19 |
+
* The concept of entry frames is an implementation detail of the CPython
|
| 20 |
+
* interpreter. This API is considered unstable and is provided for the
|
| 21 |
+
* convenience of debuggers, profilers and state-inspecting tools. Notice that
|
| 22 |
+
* this API can be changed in future minor versions if the underlying frame
|
| 23 |
+
* mechanism change or the concept of an 'entry frame' or its semantics becomes
|
| 24 |
+
* obsolete or outdated. */
|
| 25 |
+
|
| 26 |
+
PyAPI_FUNC(int) _PyFrame_IsEntryFrame(PyFrameObject *frame);
|
| 27 |
+
|
| 28 |
+
PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f);
|
| 29 |
+
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
typedef struct {
|
| 33 |
+
PyObject_HEAD
|
| 34 |
+
PyFrameObject* frame;
|
| 35 |
+
} PyFrameLocalsProxyObject;
|
data/miniconda3/include/python3.13/cpython/funcobject.h
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Function object interface */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_LIMITED_API
|
| 4 |
+
#ifndef Py_FUNCOBJECT_H
|
| 5 |
+
#define Py_FUNCOBJECT_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
#define _Py_COMMON_FIELDS(PREFIX) \
|
| 12 |
+
PyObject *PREFIX ## globals; \
|
| 13 |
+
PyObject *PREFIX ## builtins; \
|
| 14 |
+
PyObject *PREFIX ## name; \
|
| 15 |
+
PyObject *PREFIX ## qualname; \
|
| 16 |
+
PyObject *PREFIX ## code; /* A code object, the __code__ attribute */ \
|
| 17 |
+
PyObject *PREFIX ## defaults; /* NULL or a tuple */ \
|
| 18 |
+
PyObject *PREFIX ## kwdefaults; /* NULL or a dict */ \
|
| 19 |
+
PyObject *PREFIX ## closure; /* NULL or a tuple of cell objects */
|
| 20 |
+
|
| 21 |
+
typedef struct {
|
| 22 |
+
_Py_COMMON_FIELDS(fc_)
|
| 23 |
+
} PyFrameConstructor;
|
| 24 |
+
|
| 25 |
+
/* Function objects and code objects should not be confused with each other:
|
| 26 |
+
*
|
| 27 |
+
* Function objects are created by the execution of the 'def' statement.
|
| 28 |
+
* They reference a code object in their __code__ attribute, which is a
|
| 29 |
+
* purely syntactic object, i.e. nothing more than a compiled version of some
|
| 30 |
+
* source code lines. There is one code object per source code "fragment",
|
| 31 |
+
* but each code object can be referenced by zero or many function objects
|
| 32 |
+
* depending only on how many times the 'def' statement in the source was
|
| 33 |
+
* executed so far.
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
typedef struct {
|
| 37 |
+
PyObject_HEAD
|
| 38 |
+
_Py_COMMON_FIELDS(func_)
|
| 39 |
+
PyObject *func_doc; /* The __doc__ attribute, can be anything */
|
| 40 |
+
PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */
|
| 41 |
+
PyObject *func_weakreflist; /* List of weak references */
|
| 42 |
+
PyObject *func_module; /* The __module__ attribute, can be anything */
|
| 43 |
+
PyObject *func_annotations; /* Annotations, a dict or NULL */
|
| 44 |
+
PyObject *func_typeparams; /* Tuple of active type variables or NULL */
|
| 45 |
+
vectorcallfunc vectorcall;
|
| 46 |
+
/* Version number for use by specializer.
|
| 47 |
+
* Can set to non-zero when we want to specialize.
|
| 48 |
+
* Will be set to zero if any of these change:
|
| 49 |
+
* defaults
|
| 50 |
+
* kwdefaults (only if the object changes, not the contents of the dict)
|
| 51 |
+
* code
|
| 52 |
+
* annotations
|
| 53 |
+
* vectorcall function pointer */
|
| 54 |
+
uint32_t func_version;
|
| 55 |
+
|
| 56 |
+
/* Invariant:
|
| 57 |
+
* func_closure contains the bindings for func_code->co_freevars, so
|
| 58 |
+
* PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code)
|
| 59 |
+
* (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0).
|
| 60 |
+
*/
|
| 61 |
+
} PyFunctionObject;
|
| 62 |
+
|
| 63 |
+
#undef _Py_COMMON_FIELDS
|
| 64 |
+
|
| 65 |
+
PyAPI_DATA(PyTypeObject) PyFunction_Type;
|
| 66 |
+
|
| 67 |
+
#define PyFunction_Check(op) Py_IS_TYPE((op), &PyFunction_Type)
|
| 68 |
+
|
| 69 |
+
PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
|
| 70 |
+
PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *);
|
| 71 |
+
PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);
|
| 72 |
+
PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *);
|
| 73 |
+
PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *);
|
| 74 |
+
PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *);
|
| 75 |
+
PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *);
|
| 76 |
+
PyAPI_FUNC(void) PyFunction_SetVectorcall(PyFunctionObject *, vectorcallfunc);
|
| 77 |
+
PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *);
|
| 78 |
+
PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *);
|
| 79 |
+
PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *);
|
| 80 |
+
PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
|
| 81 |
+
PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *);
|
| 82 |
+
PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *);
|
| 83 |
+
|
| 84 |
+
#define _PyFunction_CAST(func) \
|
| 85 |
+
(assert(PyFunction_Check(func)), _Py_CAST(PyFunctionObject*, func))
|
| 86 |
+
|
| 87 |
+
/* Static inline functions for direct access to these values.
|
| 88 |
+
Type checks are *not* done, so use with care. */
|
| 89 |
+
static inline PyObject* PyFunction_GET_CODE(PyObject *func) {
|
| 90 |
+
return _PyFunction_CAST(func)->func_code;
|
| 91 |
+
}
|
| 92 |
+
#define PyFunction_GET_CODE(func) PyFunction_GET_CODE(_PyObject_CAST(func))
|
| 93 |
+
|
| 94 |
+
static inline PyObject* PyFunction_GET_GLOBALS(PyObject *func) {
|
| 95 |
+
return _PyFunction_CAST(func)->func_globals;
|
| 96 |
+
}
|
| 97 |
+
#define PyFunction_GET_GLOBALS(func) PyFunction_GET_GLOBALS(_PyObject_CAST(func))
|
| 98 |
+
|
| 99 |
+
static inline PyObject* PyFunction_GET_MODULE(PyObject *func) {
|
| 100 |
+
return _PyFunction_CAST(func)->func_module;
|
| 101 |
+
}
|
| 102 |
+
#define PyFunction_GET_MODULE(func) PyFunction_GET_MODULE(_PyObject_CAST(func))
|
| 103 |
+
|
| 104 |
+
static inline PyObject* PyFunction_GET_DEFAULTS(PyObject *func) {
|
| 105 |
+
return _PyFunction_CAST(func)->func_defaults;
|
| 106 |
+
}
|
| 107 |
+
#define PyFunction_GET_DEFAULTS(func) PyFunction_GET_DEFAULTS(_PyObject_CAST(func))
|
| 108 |
+
|
| 109 |
+
static inline PyObject* PyFunction_GET_KW_DEFAULTS(PyObject *func) {
|
| 110 |
+
return _PyFunction_CAST(func)->func_kwdefaults;
|
| 111 |
+
}
|
| 112 |
+
#define PyFunction_GET_KW_DEFAULTS(func) PyFunction_GET_KW_DEFAULTS(_PyObject_CAST(func))
|
| 113 |
+
|
| 114 |
+
static inline PyObject* PyFunction_GET_CLOSURE(PyObject *func) {
|
| 115 |
+
return _PyFunction_CAST(func)->func_closure;
|
| 116 |
+
}
|
| 117 |
+
#define PyFunction_GET_CLOSURE(func) PyFunction_GET_CLOSURE(_PyObject_CAST(func))
|
| 118 |
+
|
| 119 |
+
static inline PyObject* PyFunction_GET_ANNOTATIONS(PyObject *func) {
|
| 120 |
+
return _PyFunction_CAST(func)->func_annotations;
|
| 121 |
+
}
|
| 122 |
+
#define PyFunction_GET_ANNOTATIONS(func) PyFunction_GET_ANNOTATIONS(_PyObject_CAST(func))
|
| 123 |
+
|
| 124 |
+
/* The classmethod and staticmethod types lives here, too */
|
| 125 |
+
PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
|
| 126 |
+
PyAPI_DATA(PyTypeObject) PyStaticMethod_Type;
|
| 127 |
+
|
| 128 |
+
PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *);
|
| 129 |
+
PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *);
|
| 130 |
+
|
| 131 |
+
#define PY_FOREACH_FUNC_EVENT(V) \
|
| 132 |
+
V(CREATE) \
|
| 133 |
+
V(DESTROY) \
|
| 134 |
+
V(MODIFY_CODE) \
|
| 135 |
+
V(MODIFY_DEFAULTS) \
|
| 136 |
+
V(MODIFY_KWDEFAULTS)
|
| 137 |
+
|
| 138 |
+
typedef enum {
|
| 139 |
+
#define PY_DEF_EVENT(EVENT) PyFunction_EVENT_##EVENT,
|
| 140 |
+
PY_FOREACH_FUNC_EVENT(PY_DEF_EVENT)
|
| 141 |
+
#undef PY_DEF_EVENT
|
| 142 |
+
} PyFunction_WatchEvent;
|
| 143 |
+
|
| 144 |
+
/*
|
| 145 |
+
* A callback that is invoked for different events in a function's lifecycle.
|
| 146 |
+
*
|
| 147 |
+
* The callback is invoked with a borrowed reference to func, after it is
|
| 148 |
+
* created and before it is modified or destroyed. The callback should not
|
| 149 |
+
* modify func.
|
| 150 |
+
*
|
| 151 |
+
* When a function's code object, defaults, or kwdefaults are modified the
|
| 152 |
+
* callback will be invoked with the respective event and new_value will
|
| 153 |
+
* contain a borrowed reference to the new value that is about to be stored in
|
| 154 |
+
* the function. Otherwise the third argument is NULL.
|
| 155 |
+
*
|
| 156 |
+
* If the callback returns with an exception set, it must return -1. Otherwise
|
| 157 |
+
* it should return 0.
|
| 158 |
+
*/
|
| 159 |
+
typedef int (*PyFunction_WatchCallback)(
|
| 160 |
+
PyFunction_WatchEvent event,
|
| 161 |
+
PyFunctionObject *func,
|
| 162 |
+
PyObject *new_value);
|
| 163 |
+
|
| 164 |
+
/*
|
| 165 |
+
* Register a per-interpreter callback that will be invoked for function lifecycle
|
| 166 |
+
* events.
|
| 167 |
+
*
|
| 168 |
+
* Returns a handle that may be passed to PyFunction_ClearWatcher on success,
|
| 169 |
+
* or -1 and sets an error if no more handles are available.
|
| 170 |
+
*/
|
| 171 |
+
PyAPI_FUNC(int) PyFunction_AddWatcher(PyFunction_WatchCallback callback);
|
| 172 |
+
|
| 173 |
+
/*
|
| 174 |
+
* Clear the watcher associated with the watcher_id handle.
|
| 175 |
+
*
|
| 176 |
+
* Returns 0 on success or -1 if no watcher exists for the supplied id.
|
| 177 |
+
*/
|
| 178 |
+
PyAPI_FUNC(int) PyFunction_ClearWatcher(int watcher_id);
|
| 179 |
+
|
| 180 |
+
#ifdef __cplusplus
|
| 181 |
+
}
|
| 182 |
+
#endif
|
| 183 |
+
#endif /* !Py_FUNCOBJECT_H */
|
| 184 |
+
#endif /* Py_LIMITED_API */
|
data/miniconda3/include/python3.13/cpython/genobject.h
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Generator object interface */
|
| 2 |
+
|
| 3 |
+
#ifndef Py_LIMITED_API
|
| 4 |
+
#ifndef Py_GENOBJECT_H
|
| 5 |
+
#define Py_GENOBJECT_H
|
| 6 |
+
#ifdef __cplusplus
|
| 7 |
+
extern "C" {
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
/* --- Generators --------------------------------------------------------- */
|
| 11 |
+
|
| 12 |
+
/* _PyGenObject_HEAD defines the initial segment of generator
|
| 13 |
+
and coroutine objects. */
|
| 14 |
+
#define _PyGenObject_HEAD(prefix) \
|
| 15 |
+
PyObject_HEAD \
|
| 16 |
+
/* List of weak reference. */ \
|
| 17 |
+
PyObject *prefix##_weakreflist; \
|
| 18 |
+
/* Name of the generator. */ \
|
| 19 |
+
PyObject *prefix##_name; \
|
| 20 |
+
/* Qualified name of the generator. */ \
|
| 21 |
+
PyObject *prefix##_qualname; \
|
| 22 |
+
_PyErr_StackItem prefix##_exc_state; \
|
| 23 |
+
PyObject *prefix##_origin_or_finalizer; \
|
| 24 |
+
char prefix##_hooks_inited; \
|
| 25 |
+
char prefix##_closed; \
|
| 26 |
+
char prefix##_running_async; \
|
| 27 |
+
/* The frame */ \
|
| 28 |
+
int8_t prefix##_frame_state; \
|
| 29 |
+
PyObject *prefix##_iframe[1]; \
|
| 30 |
+
|
| 31 |
+
typedef struct {
|
| 32 |
+
/* The gi_ prefix is intended to remind of generator-iterator. */
|
| 33 |
+
_PyGenObject_HEAD(gi)
|
| 34 |
+
} PyGenObject;
|
| 35 |
+
|
| 36 |
+
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
| 37 |
+
|
| 38 |
+
#define PyGen_Check(op) PyObject_TypeCheck((op), &PyGen_Type)
|
| 39 |
+
#define PyGen_CheckExact(op) Py_IS_TYPE((op), &PyGen_Type)
|
| 40 |
+
|
| 41 |
+
PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *);
|
| 42 |
+
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
|
| 43 |
+
PyObject *name, PyObject *qualname);
|
| 44 |
+
PyAPI_FUNC(PyCodeObject *) PyGen_GetCode(PyGenObject *gen);
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
/* --- PyCoroObject ------------------------------------------------------- */
|
| 48 |
+
|
| 49 |
+
typedef struct {
|
| 50 |
+
_PyGenObject_HEAD(cr)
|
| 51 |
+
} PyCoroObject;
|
| 52 |
+
|
| 53 |
+
PyAPI_DATA(PyTypeObject) PyCoro_Type;
|
| 54 |
+
|
| 55 |
+
#define PyCoro_CheckExact(op) Py_IS_TYPE((op), &PyCoro_Type)
|
| 56 |
+
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
|
| 57 |
+
PyObject *name, PyObject *qualname);
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
/* --- Asynchronous Generators -------------------------------------------- */
|
| 61 |
+
|
| 62 |
+
typedef struct {
|
| 63 |
+
_PyGenObject_HEAD(ag)
|
| 64 |
+
} PyAsyncGenObject;
|
| 65 |
+
|
| 66 |
+
PyAPI_DATA(PyTypeObject) PyAsyncGen_Type;
|
| 67 |
+
PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type;
|
| 68 |
+
|
| 69 |
+
PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,
|
| 70 |
+
PyObject *name, PyObject *qualname);
|
| 71 |
+
|
| 72 |
+
#define PyAsyncGen_CheckExact(op) Py_IS_TYPE((op), &PyAsyncGen_Type)
|
| 73 |
+
|
| 74 |
+
#define PyAsyncGenASend_CheckExact(op) Py_IS_TYPE((op), &_PyAsyncGenASend_Type)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
#undef _PyGenObject_HEAD
|
| 78 |
+
|
| 79 |
+
#ifdef __cplusplus
|
| 80 |
+
}
|
| 81 |
+
#endif
|
| 82 |
+
#endif /* !Py_GENOBJECT_H */
|
| 83 |
+
#endif /* Py_LIMITED_API */
|
data/miniconda3/include/python3.13/cpython/import.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
struct _inittab {
|
| 8 |
+
const char *name; /* ASCII encoded string */
|
| 9 |
+
PyObject* (*initfunc)(void);
|
| 10 |
+
};
|
| 11 |
+
// This is not used after Py_Initialize() is called.
|
| 12 |
+
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
| 13 |
+
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
|
| 14 |
+
|
| 15 |
+
struct _frozen {
|
| 16 |
+
const char *name; /* ASCII encoded string */
|
| 17 |
+
const unsigned char *code;
|
| 18 |
+
int size;
|
| 19 |
+
int is_package;
|
| 20 |
+
};
|
| 21 |
+
|
| 22 |
+
/* Embedding apps may change this pointer to point to their favorite
|
| 23 |
+
collection of frozen modules: */
|
| 24 |
+
|
| 25 |
+
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
|
data/miniconda3/include/python3.13/cpython/initconfig.h
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_PYCORECONFIG_H
|
| 2 |
+
#define Py_PYCORECONFIG_H
|
| 3 |
+
#ifndef Py_LIMITED_API
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
/* --- PyStatus ----------------------------------------------- */
|
| 9 |
+
|
| 10 |
+
typedef struct {
|
| 11 |
+
enum {
|
| 12 |
+
_PyStatus_TYPE_OK=0,
|
| 13 |
+
_PyStatus_TYPE_ERROR=1,
|
| 14 |
+
_PyStatus_TYPE_EXIT=2
|
| 15 |
+
} _type;
|
| 16 |
+
const char *func;
|
| 17 |
+
const char *err_msg;
|
| 18 |
+
int exitcode;
|
| 19 |
+
} PyStatus;
|
| 20 |
+
|
| 21 |
+
PyAPI_FUNC(PyStatus) PyStatus_Ok(void);
|
| 22 |
+
PyAPI_FUNC(PyStatus) PyStatus_Error(const char *err_msg);
|
| 23 |
+
PyAPI_FUNC(PyStatus) PyStatus_NoMemory(void);
|
| 24 |
+
PyAPI_FUNC(PyStatus) PyStatus_Exit(int exitcode);
|
| 25 |
+
PyAPI_FUNC(int) PyStatus_IsError(PyStatus err);
|
| 26 |
+
PyAPI_FUNC(int) PyStatus_IsExit(PyStatus err);
|
| 27 |
+
PyAPI_FUNC(int) PyStatus_Exception(PyStatus err);
|
| 28 |
+
|
| 29 |
+
/* --- PyWideStringList ------------------------------------------------ */
|
| 30 |
+
|
| 31 |
+
typedef struct {
|
| 32 |
+
/* If length is greater than zero, items must be non-NULL
|
| 33 |
+
and all items strings must be non-NULL */
|
| 34 |
+
Py_ssize_t length;
|
| 35 |
+
wchar_t **items;
|
| 36 |
+
} PyWideStringList;
|
| 37 |
+
|
| 38 |
+
PyAPI_FUNC(PyStatus) PyWideStringList_Append(PyWideStringList *list,
|
| 39 |
+
const wchar_t *item);
|
| 40 |
+
PyAPI_FUNC(PyStatus) PyWideStringList_Insert(PyWideStringList *list,
|
| 41 |
+
Py_ssize_t index,
|
| 42 |
+
const wchar_t *item);
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
/* --- PyPreConfig ----------------------------------------------- */
|
| 46 |
+
|
| 47 |
+
typedef struct PyPreConfig {
|
| 48 |
+
int _config_init; /* _PyConfigInitEnum value */
|
| 49 |
+
|
| 50 |
+
/* Parse Py_PreInitializeFromBytesArgs() arguments?
|
| 51 |
+
See PyConfig.parse_argv */
|
| 52 |
+
int parse_argv;
|
| 53 |
+
|
| 54 |
+
/* If greater than 0, enable isolated mode: sys.path contains
|
| 55 |
+
neither the script's directory nor the user's site-packages directory.
|
| 56 |
+
|
| 57 |
+
Set to 1 by the -I command line option. If set to -1 (default), inherit
|
| 58 |
+
Py_IsolatedFlag value. */
|
| 59 |
+
int isolated;
|
| 60 |
+
|
| 61 |
+
/* If greater than 0: use environment variables.
|
| 62 |
+
Set to 0 by -E command line option. If set to -1 (default), it is
|
| 63 |
+
set to !Py_IgnoreEnvironmentFlag. */
|
| 64 |
+
int use_environment;
|
| 65 |
+
|
| 66 |
+
/* Set the LC_CTYPE locale to the user preferred locale? If equals to 0,
|
| 67 |
+
set coerce_c_locale and coerce_c_locale_warn to 0. */
|
| 68 |
+
int configure_locale;
|
| 69 |
+
|
| 70 |
+
/* Coerce the LC_CTYPE locale if it's equal to "C"? (PEP 538)
|
| 71 |
+
|
| 72 |
+
Set to 0 by PYTHONCOERCECLOCALE=0. Set to 1 by PYTHONCOERCECLOCALE=1.
|
| 73 |
+
Set to 2 if the user preferred LC_CTYPE locale is "C".
|
| 74 |
+
|
| 75 |
+
If it is equal to 1, LC_CTYPE locale is read to decide if it should be
|
| 76 |
+
coerced or not (ex: PYTHONCOERCECLOCALE=1). Internally, it is set to 2
|
| 77 |
+
if the LC_CTYPE locale must be coerced.
|
| 78 |
+
|
| 79 |
+
Disable by default (set to 0). Set it to -1 to let Python decide if it
|
| 80 |
+
should be enabled or not. */
|
| 81 |
+
int coerce_c_locale;
|
| 82 |
+
|
| 83 |
+
/* Emit a warning if the LC_CTYPE locale is coerced?
|
| 84 |
+
|
| 85 |
+
Set to 1 by PYTHONCOERCECLOCALE=warn.
|
| 86 |
+
|
| 87 |
+
Disable by default (set to 0). Set it to -1 to let Python decide if it
|
| 88 |
+
should be enabled or not. */
|
| 89 |
+
int coerce_c_locale_warn;
|
| 90 |
+
|
| 91 |
+
#ifdef MS_WINDOWS
|
| 92 |
+
/* If greater than 1, use the "mbcs" encoding instead of the UTF-8
|
| 93 |
+
encoding for the filesystem encoding.
|
| 94 |
+
|
| 95 |
+
Set to 1 if the PYTHONLEGACYWINDOWSFSENCODING environment variable is
|
| 96 |
+
set to a non-empty string. If set to -1 (default), inherit
|
| 97 |
+
Py_LegacyWindowsFSEncodingFlag value.
|
| 98 |
+
|
| 99 |
+
See PEP 529 for more details. */
|
| 100 |
+
int legacy_windows_fs_encoding;
|
| 101 |
+
#endif
|
| 102 |
+
|
| 103 |
+
/* Enable UTF-8 mode? (PEP 540)
|
| 104 |
+
|
| 105 |
+
Disabled by default (equals to 0).
|
| 106 |
+
|
| 107 |
+
Set to 1 by "-X utf8" and "-X utf8=1" command line options.
|
| 108 |
+
Set to 1 by PYTHONUTF8=1 environment variable.
|
| 109 |
+
|
| 110 |
+
Set to 0 by "-X utf8=0" and PYTHONUTF8=0.
|
| 111 |
+
|
| 112 |
+
If equals to -1, it is set to 1 if the LC_CTYPE locale is "C" or
|
| 113 |
+
"POSIX", otherwise it is set to 0. Inherit Py_UTF8Mode value value. */
|
| 114 |
+
int utf8_mode;
|
| 115 |
+
|
| 116 |
+
/* If non-zero, enable the Python Development Mode.
|
| 117 |
+
|
| 118 |
+
Set to 1 by the -X dev command line option. Set by the PYTHONDEVMODE
|
| 119 |
+
environment variable. */
|
| 120 |
+
int dev_mode;
|
| 121 |
+
|
| 122 |
+
/* Memory allocator: PYTHONMALLOC env var.
|
| 123 |
+
See PyMemAllocatorName for valid values. */
|
| 124 |
+
int allocator;
|
| 125 |
+
} PyPreConfig;
|
| 126 |
+
|
| 127 |
+
PyAPI_FUNC(void) PyPreConfig_InitPythonConfig(PyPreConfig *config);
|
| 128 |
+
PyAPI_FUNC(void) PyPreConfig_InitIsolatedConfig(PyPreConfig *config);
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
/* --- PyConfig ---------------------------------------------- */
|
| 132 |
+
|
| 133 |
+
/* This structure is best documented in the Doc/c-api/init_config.rst file. */
|
| 134 |
+
typedef struct PyConfig {
|
| 135 |
+
int _config_init; /* _PyConfigInitEnum value */
|
| 136 |
+
|
| 137 |
+
int isolated;
|
| 138 |
+
int use_environment;
|
| 139 |
+
int dev_mode;
|
| 140 |
+
int install_signal_handlers;
|
| 141 |
+
int use_hash_seed;
|
| 142 |
+
unsigned long hash_seed;
|
| 143 |
+
int faulthandler;
|
| 144 |
+
int tracemalloc;
|
| 145 |
+
int perf_profiling;
|
| 146 |
+
int import_time;
|
| 147 |
+
int code_debug_ranges;
|
| 148 |
+
int show_ref_count;
|
| 149 |
+
int dump_refs;
|
| 150 |
+
wchar_t *dump_refs_file;
|
| 151 |
+
int malloc_stats;
|
| 152 |
+
wchar_t *filesystem_encoding;
|
| 153 |
+
wchar_t *filesystem_errors;
|
| 154 |
+
wchar_t *pycache_prefix;
|
| 155 |
+
int parse_argv;
|
| 156 |
+
PyWideStringList orig_argv;
|
| 157 |
+
PyWideStringList argv;
|
| 158 |
+
PyWideStringList xoptions;
|
| 159 |
+
PyWideStringList warnoptions;
|
| 160 |
+
int site_import;
|
| 161 |
+
int bytes_warning;
|
| 162 |
+
int warn_default_encoding;
|
| 163 |
+
int inspect;
|
| 164 |
+
int interactive;
|
| 165 |
+
int optimization_level;
|
| 166 |
+
int parser_debug;
|
| 167 |
+
int write_bytecode;
|
| 168 |
+
int verbose;
|
| 169 |
+
int quiet;
|
| 170 |
+
int user_site_directory;
|
| 171 |
+
int configure_c_stdio;
|
| 172 |
+
int buffered_stdio;
|
| 173 |
+
wchar_t *stdio_encoding;
|
| 174 |
+
wchar_t *stdio_errors;
|
| 175 |
+
#ifdef MS_WINDOWS
|
| 176 |
+
int legacy_windows_stdio;
|
| 177 |
+
#endif
|
| 178 |
+
wchar_t *check_hash_pycs_mode;
|
| 179 |
+
int use_frozen_modules;
|
| 180 |
+
int safe_path;
|
| 181 |
+
int int_max_str_digits;
|
| 182 |
+
|
| 183 |
+
int cpu_count;
|
| 184 |
+
#ifdef Py_GIL_DISABLED
|
| 185 |
+
int enable_gil;
|
| 186 |
+
#endif
|
| 187 |
+
|
| 188 |
+
/* --- Path configuration inputs ------------ */
|
| 189 |
+
int pathconfig_warnings;
|
| 190 |
+
wchar_t *program_name;
|
| 191 |
+
wchar_t *pythonpath_env;
|
| 192 |
+
wchar_t *home;
|
| 193 |
+
wchar_t *platlibdir;
|
| 194 |
+
|
| 195 |
+
/* --- Path configuration outputs ----------- */
|
| 196 |
+
int module_search_paths_set;
|
| 197 |
+
PyWideStringList module_search_paths;
|
| 198 |
+
wchar_t *stdlib_dir;
|
| 199 |
+
wchar_t *executable;
|
| 200 |
+
wchar_t *base_executable;
|
| 201 |
+
wchar_t *prefix;
|
| 202 |
+
wchar_t *base_prefix;
|
| 203 |
+
wchar_t *exec_prefix;
|
| 204 |
+
wchar_t *base_exec_prefix;
|
| 205 |
+
|
| 206 |
+
/* --- Parameter only used by Py_Main() ---------- */
|
| 207 |
+
int skip_source_first_line;
|
| 208 |
+
wchar_t *run_command;
|
| 209 |
+
wchar_t *run_module;
|
| 210 |
+
wchar_t *run_filename;
|
| 211 |
+
|
| 212 |
+
/* --- Set by Py_Main() -------------------------- */
|
| 213 |
+
wchar_t *sys_path_0;
|
| 214 |
+
|
| 215 |
+
/* --- Private fields ---------------------------- */
|
| 216 |
+
|
| 217 |
+
// Install importlib? If equals to 0, importlib is not initialized at all.
|
| 218 |
+
// Needed by freeze_importlib.
|
| 219 |
+
int _install_importlib;
|
| 220 |
+
|
| 221 |
+
// If equal to 0, stop Python initialization before the "main" phase.
|
| 222 |
+
int _init_main;
|
| 223 |
+
|
| 224 |
+
// If non-zero, we believe we're running from a source tree.
|
| 225 |
+
int _is_python_build;
|
| 226 |
+
|
| 227 |
+
#ifdef Py_STATS
|
| 228 |
+
// If non-zero, turns on statistics gathering.
|
| 229 |
+
int _pystats;
|
| 230 |
+
#endif
|
| 231 |
+
|
| 232 |
+
#ifdef Py_DEBUG
|
| 233 |
+
// If not empty, import a non-__main__ module before site.py is executed.
|
| 234 |
+
// PYTHON_PRESITE=package.module or -X presite=package.module
|
| 235 |
+
wchar_t *run_presite;
|
| 236 |
+
#endif
|
| 237 |
+
} PyConfig;
|
| 238 |
+
|
| 239 |
+
PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config);
|
| 240 |
+
PyAPI_FUNC(void) PyConfig_InitIsolatedConfig(PyConfig *config);
|
| 241 |
+
PyAPI_FUNC(void) PyConfig_Clear(PyConfig *);
|
| 242 |
+
PyAPI_FUNC(PyStatus) PyConfig_SetString(
|
| 243 |
+
PyConfig *config,
|
| 244 |
+
wchar_t **config_str,
|
| 245 |
+
const wchar_t *str);
|
| 246 |
+
PyAPI_FUNC(PyStatus) PyConfig_SetBytesString(
|
| 247 |
+
PyConfig *config,
|
| 248 |
+
wchar_t **config_str,
|
| 249 |
+
const char *str);
|
| 250 |
+
PyAPI_FUNC(PyStatus) PyConfig_Read(PyConfig *config);
|
| 251 |
+
PyAPI_FUNC(PyStatus) PyConfig_SetBytesArgv(
|
| 252 |
+
PyConfig *config,
|
| 253 |
+
Py_ssize_t argc,
|
| 254 |
+
char * const *argv);
|
| 255 |
+
PyAPI_FUNC(PyStatus) PyConfig_SetArgv(PyConfig *config,
|
| 256 |
+
Py_ssize_t argc,
|
| 257 |
+
wchar_t * const *argv);
|
| 258 |
+
PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
|
| 259 |
+
PyWideStringList *list,
|
| 260 |
+
Py_ssize_t length, wchar_t **items);
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
/* --- Helper functions --------------------------------------- */
|
| 264 |
+
|
| 265 |
+
/* Get the original command line arguments, before Python modified them.
|
| 266 |
+
|
| 267 |
+
See also PyConfig.orig_argv. */
|
| 268 |
+
PyAPI_FUNC(void) Py_GetArgcArgv(int *argc, wchar_t ***argv);
|
| 269 |
+
|
| 270 |
+
#ifdef __cplusplus
|
| 271 |
+
}
|
| 272 |
+
#endif
|
| 273 |
+
#endif /* !Py_LIMITED_API */
|
| 274 |
+
#endif /* !Py_PYCORECONFIG_H */
|
data/miniconda3/include/python3.13/cpython/listobject.h
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
/* Cast argument to PyListObject* type. */
|
| 25 |
+
#define _PyList_CAST(op) \
|
| 26 |
+
(assert(PyList_Check(op)), _Py_CAST(PyListObject*, (op)))
|
| 27 |
+
|
| 28 |
+
// Macros and static inline functions, trading safety for speed
|
| 29 |
+
|
| 30 |
+
static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
|
| 31 |
+
PyListObject *list = _PyList_CAST(op);
|
| 32 |
+
#ifdef Py_GIL_DISABLED
|
| 33 |
+
return _Py_atomic_load_ssize_relaxed(&(_PyVarObject_CAST(list)->ob_size));
|
| 34 |
+
#else
|
| 35 |
+
return Py_SIZE(list);
|
| 36 |
+
#endif
|
| 37 |
+
}
|
| 38 |
+
#define PyList_GET_SIZE(op) PyList_GET_SIZE(_PyObject_CAST(op))
|
| 39 |
+
|
| 40 |
+
#define PyList_GET_ITEM(op, index) (_PyList_CAST(op)->ob_item[(index)])
|
| 41 |
+
|
| 42 |
+
static inline void
|
| 43 |
+
PyList_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
|
| 44 |
+
PyListObject *list = _PyList_CAST(op);
|
| 45 |
+
assert(0 <= index);
|
| 46 |
+
assert(index < list->allocated);
|
| 47 |
+
list->ob_item[index] = value;
|
| 48 |
+
}
|
| 49 |
+
#define PyList_SET_ITEM(op, index, value) \
|
| 50 |
+
PyList_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))
|
| 51 |
+
|
| 52 |
+
PyAPI_FUNC(int) PyList_Extend(PyObject *self, PyObject *iterable);
|
| 53 |
+
PyAPI_FUNC(int) PyList_Clear(PyObject *self);
|
data/miniconda3/include/python3.13/cpython/lock.h
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_LOCK_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
#define _Py_UNLOCKED 0
|
| 6 |
+
#define _Py_LOCKED 1
|
| 7 |
+
|
| 8 |
+
// A mutex that occupies one byte. The lock can be zero initialized to
|
| 9 |
+
// represent the unlocked state.
|
| 10 |
+
//
|
| 11 |
+
// Typical initialization:
|
| 12 |
+
// PyMutex m = (PyMutex){0};
|
| 13 |
+
//
|
| 14 |
+
// Or initialize as global variables:
|
| 15 |
+
// static PyMutex m;
|
| 16 |
+
//
|
| 17 |
+
// Typical usage:
|
| 18 |
+
// PyMutex_Lock(&m);
|
| 19 |
+
// ...
|
| 20 |
+
// PyMutex_Unlock(&m);
|
| 21 |
+
//
|
| 22 |
+
// The contents of the PyMutex are not part of the public API, but are
|
| 23 |
+
// described to aid in understanding the implementation and debugging. Only
|
| 24 |
+
// the two least significant bits are used. The remaining bits are always zero:
|
| 25 |
+
// 0b00: unlocked
|
| 26 |
+
// 0b01: locked
|
| 27 |
+
// 0b10: unlocked and has parked threads
|
| 28 |
+
// 0b11: locked and has parked threads
|
| 29 |
+
typedef struct PyMutex {
|
| 30 |
+
uint8_t _bits; // (private)
|
| 31 |
+
} PyMutex;
|
| 32 |
+
|
| 33 |
+
// exported function for locking the mutex
|
| 34 |
+
PyAPI_FUNC(void) PyMutex_Lock(PyMutex *m);
|
| 35 |
+
|
| 36 |
+
// exported function for unlocking the mutex
|
| 37 |
+
PyAPI_FUNC(void) PyMutex_Unlock(PyMutex *m);
|
| 38 |
+
|
| 39 |
+
// Locks the mutex.
|
| 40 |
+
//
|
| 41 |
+
// If the mutex is currently locked, the calling thread will be parked until
|
| 42 |
+
// the mutex is unlocked. If the current thread holds the GIL, then the GIL
|
| 43 |
+
// will be released while the thread is parked.
|
| 44 |
+
static inline void
|
| 45 |
+
_PyMutex_Lock(PyMutex *m)
|
| 46 |
+
{
|
| 47 |
+
uint8_t expected = _Py_UNLOCKED;
|
| 48 |
+
if (!_Py_atomic_compare_exchange_uint8(&m->_bits, &expected, _Py_LOCKED)) {
|
| 49 |
+
PyMutex_Lock(m);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
#define PyMutex_Lock _PyMutex_Lock
|
| 53 |
+
|
| 54 |
+
// Unlocks the mutex.
|
| 55 |
+
static inline void
|
| 56 |
+
_PyMutex_Unlock(PyMutex *m)
|
| 57 |
+
{
|
| 58 |
+
uint8_t expected = _Py_LOCKED;
|
| 59 |
+
if (!_Py_atomic_compare_exchange_uint8(&m->_bits, &expected, _Py_UNLOCKED)) {
|
| 60 |
+
PyMutex_Unlock(m);
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
#define PyMutex_Unlock _PyMutex_Unlock
|
data/miniconda3/include/python3.13/cpython/longintrepr.h
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_LIMITED_API
|
| 2 |
+
#ifndef Py_LONGINTREPR_H
|
| 3 |
+
#define Py_LONGINTREPR_H
|
| 4 |
+
#ifdef __cplusplus
|
| 5 |
+
extern "C" {
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
/* This is published for the benefit of "friends" marshal.c and _decimal.c. */
|
| 10 |
+
|
| 11 |
+
/* Parameters of the integer representation. There are two different
|
| 12 |
+
sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
|
| 13 |
+
integer type, and one set for 15-bit digits with each digit stored in an
|
| 14 |
+
unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at
|
| 15 |
+
configure time or in pyport.h, is used to decide which digit size to use.
|
| 16 |
+
|
| 17 |
+
Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits'
|
| 18 |
+
should be an unsigned integer type able to hold all integers up to
|
| 19 |
+
PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type,
|
| 20 |
+
and that overflow is handled by taking the result modulo 2**N for some N >
|
| 21 |
+
PyLong_SHIFT. The majority of the code doesn't care about the precise
|
| 22 |
+
value of PyLong_SHIFT, but there are some notable exceptions:
|
| 23 |
+
|
| 24 |
+
- PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8
|
| 25 |
+
|
| 26 |
+
- long_hash() requires that PyLong_SHIFT is *strictly* less than the number
|
| 27 |
+
of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
|
| 28 |
+
conversion functions
|
| 29 |
+
|
| 30 |
+
- the Python int <-> size_t/Py_ssize_t conversion functions expect that
|
| 31 |
+
PyLong_SHIFT is strictly less than the number of bits in a size_t
|
| 32 |
+
|
| 33 |
+
- the marshal code currently expects that PyLong_SHIFT is a multiple of 15
|
| 34 |
+
|
| 35 |
+
- NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single
|
| 36 |
+
digit; with the current values this forces PyLong_SHIFT >= 9
|
| 37 |
+
|
| 38 |
+
The values 15 and 30 should fit all of the above requirements, on any
|
| 39 |
+
platform.
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
#if PYLONG_BITS_IN_DIGIT == 30
|
| 43 |
+
typedef uint32_t digit;
|
| 44 |
+
typedef int32_t sdigit; /* signed variant of digit */
|
| 45 |
+
typedef uint64_t twodigits;
|
| 46 |
+
typedef int64_t stwodigits; /* signed variant of twodigits */
|
| 47 |
+
#define PyLong_SHIFT 30
|
| 48 |
+
#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */
|
| 49 |
+
#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */
|
| 50 |
+
#elif PYLONG_BITS_IN_DIGIT == 15
|
| 51 |
+
typedef unsigned short digit;
|
| 52 |
+
typedef short sdigit; /* signed variant of digit */
|
| 53 |
+
typedef unsigned long twodigits;
|
| 54 |
+
typedef long stwodigits; /* signed variant of twodigits */
|
| 55 |
+
#define PyLong_SHIFT 15
|
| 56 |
+
#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */
|
| 57 |
+
#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */
|
| 58 |
+
#else
|
| 59 |
+
#error "PYLONG_BITS_IN_DIGIT should be 15 or 30"
|
| 60 |
+
#endif
|
| 61 |
+
#define PyLong_BASE ((digit)1 << PyLong_SHIFT)
|
| 62 |
+
#define PyLong_MASK ((digit)(PyLong_BASE - 1))
|
| 63 |
+
|
| 64 |
+
/* Long integer representation.
|
| 65 |
+
|
| 66 |
+
Long integers are made up of a number of 30- or 15-bit digits, depending on
|
| 67 |
+
the platform. The number of digits (ndigits) is stored in the high bits of
|
| 68 |
+
the lv_tag field (lvtag >> _PyLong_NON_SIZE_BITS).
|
| 69 |
+
|
| 70 |
+
The absolute value of a number is equal to
|
| 71 |
+
SUM(for i=0 through ndigits-1) ob_digit[i] * 2**(PyLong_SHIFT*i)
|
| 72 |
+
|
| 73 |
+
The sign of the value is stored in the lower 2 bits of lv_tag.
|
| 74 |
+
|
| 75 |
+
- 0: Positive
|
| 76 |
+
- 1: Zero
|
| 77 |
+
- 2: Negative
|
| 78 |
+
|
| 79 |
+
The third lowest bit of lv_tag is reserved for an immortality flag, but is
|
| 80 |
+
not currently used.
|
| 81 |
+
|
| 82 |
+
In a normalized number, ob_digit[ndigits-1] (the most significant
|
| 83 |
+
digit) is never zero. Also, in all cases, for all valid i,
|
| 84 |
+
0 <= ob_digit[i] <= PyLong_MASK.
|
| 85 |
+
|
| 86 |
+
The allocation function takes care of allocating extra memory
|
| 87 |
+
so that ob_digit[0] ... ob_digit[ndigits-1] are actually available.
|
| 88 |
+
We always allocate memory for at least one digit, so accessing ob_digit[0]
|
| 89 |
+
is always safe. However, in the case ndigits == 0, the contents of
|
| 90 |
+
ob_digit[0] may be undefined.
|
| 91 |
+
*/
|
| 92 |
+
|
| 93 |
+
typedef struct _PyLongValue {
|
| 94 |
+
uintptr_t lv_tag; /* Number of digits, sign and flags */
|
| 95 |
+
digit ob_digit[1];
|
| 96 |
+
} _PyLongValue;
|
| 97 |
+
|
| 98 |
+
struct _longobject {
|
| 99 |
+
PyObject_HEAD
|
| 100 |
+
_PyLongValue long_value;
|
| 101 |
+
};
|
| 102 |
+
|
| 103 |
+
PyAPI_FUNC(PyLongObject*) _PyLong_New(Py_ssize_t);
|
| 104 |
+
|
| 105 |
+
// Return a copy of src.
|
| 106 |
+
PyAPI_FUNC(PyObject*) _PyLong_Copy(PyLongObject *src);
|
| 107 |
+
|
| 108 |
+
PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits(
|
| 109 |
+
int negative,
|
| 110 |
+
Py_ssize_t digit_count,
|
| 111 |
+
digit *digits);
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
/* Inline some internals for speed. These should be in pycore_long.h
|
| 115 |
+
* if user code didn't need them inlined. */
|
| 116 |
+
|
| 117 |
+
#define _PyLong_SIGN_MASK 3
|
| 118 |
+
#define _PyLong_NON_SIZE_BITS 3
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
static inline int
|
| 122 |
+
_PyLong_IsCompact(const PyLongObject* op) {
|
| 123 |
+
assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS));
|
| 124 |
+
return op->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
#define PyUnstable_Long_IsCompact _PyLong_IsCompact
|
| 128 |
+
|
| 129 |
+
static inline Py_ssize_t
|
| 130 |
+
_PyLong_CompactValue(const PyLongObject *op)
|
| 131 |
+
{
|
| 132 |
+
Py_ssize_t sign;
|
| 133 |
+
assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS));
|
| 134 |
+
assert(PyUnstable_Long_IsCompact(op));
|
| 135 |
+
sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
|
| 136 |
+
return sign * (Py_ssize_t)op->long_value.ob_digit[0];
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
#define PyUnstable_Long_CompactValue _PyLong_CompactValue
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
#ifdef __cplusplus
|
| 143 |
+
}
|
| 144 |
+
#endif
|
| 145 |
+
#endif /* !Py_LONGINTREPR_H */
|
| 146 |
+
#endif /* Py_LIMITED_API */
|
data/miniconda3/include/python3.13/cpython/longobject.h
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_LONGOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_FUNC(PyObject*) PyLong_FromUnicodeObject(PyObject *u, int base);
|
| 6 |
+
|
| 7 |
+
#define Py_ASNATIVEBYTES_DEFAULTS -1
|
| 8 |
+
#define Py_ASNATIVEBYTES_BIG_ENDIAN 0
|
| 9 |
+
#define Py_ASNATIVEBYTES_LITTLE_ENDIAN 1
|
| 10 |
+
#define Py_ASNATIVEBYTES_NATIVE_ENDIAN 3
|
| 11 |
+
#define Py_ASNATIVEBYTES_UNSIGNED_BUFFER 4
|
| 12 |
+
#define Py_ASNATIVEBYTES_REJECT_NEGATIVE 8
|
| 13 |
+
#define Py_ASNATIVEBYTES_ALLOW_INDEX 16
|
| 14 |
+
|
| 15 |
+
/* PyLong_AsNativeBytes: Copy the integer value to a native variable.
|
| 16 |
+
buffer points to the first byte of the variable.
|
| 17 |
+
n_bytes is the number of bytes available in the buffer. Pass 0 to request
|
| 18 |
+
the required size for the value.
|
| 19 |
+
flags is a bitfield of the following flags:
|
| 20 |
+
* 1 - little endian
|
| 21 |
+
* 2 - native endian
|
| 22 |
+
* 4 - unsigned destination (e.g. don't reject copying 255 into one byte)
|
| 23 |
+
* 8 - raise an exception for negative inputs
|
| 24 |
+
* 16 - call __index__ on non-int types
|
| 25 |
+
If flags is -1 (all bits set), native endian is used, value truncation
|
| 26 |
+
behaves most like C (allows negative inputs and allow MSB set), and non-int
|
| 27 |
+
objects will raise a TypeError.
|
| 28 |
+
Big endian mode will write the most significant byte into the address
|
| 29 |
+
directly referenced by buffer; little endian will write the least significant
|
| 30 |
+
byte into that address.
|
| 31 |
+
|
| 32 |
+
If an exception is raised, returns a negative value.
|
| 33 |
+
Otherwise, returns the number of bytes that are required to store the value.
|
| 34 |
+
To check that the full value is represented, ensure that the return value is
|
| 35 |
+
equal or less than n_bytes.
|
| 36 |
+
All n_bytes are guaranteed to be written (unless an exception occurs), and
|
| 37 |
+
so ignoring a positive return value is the equivalent of a downcast in C.
|
| 38 |
+
In cases where the full value could not be represented, the returned value
|
| 39 |
+
may be larger than necessary - this function is not an accurate way to
|
| 40 |
+
calculate the bit length of an integer object.
|
| 41 |
+
*/
|
| 42 |
+
PyAPI_FUNC(Py_ssize_t) PyLong_AsNativeBytes(PyObject* v, void* buffer,
|
| 43 |
+
Py_ssize_t n_bytes, int flags);
|
| 44 |
+
|
| 45 |
+
/* PyLong_FromNativeBytes: Create an int value from a native integer
|
| 46 |
+
n_bytes is the number of bytes to read from the buffer. Passing 0 will
|
| 47 |
+
always produce the zero int.
|
| 48 |
+
PyLong_FromUnsignedNativeBytes always produces a non-negative int.
|
| 49 |
+
flags is the same as for PyLong_AsNativeBytes, but only supports selecting
|
| 50 |
+
the endianness or forcing an unsigned buffer.
|
| 51 |
+
|
| 52 |
+
Returns the int object, or NULL with an exception set. */
|
| 53 |
+
PyAPI_FUNC(PyObject*) PyLong_FromNativeBytes(const void* buffer, size_t n_bytes,
|
| 54 |
+
int flags);
|
| 55 |
+
PyAPI_FUNC(PyObject*) PyLong_FromUnsignedNativeBytes(const void* buffer,
|
| 56 |
+
size_t n_bytes, int flags);
|
| 57 |
+
|
| 58 |
+
PyAPI_FUNC(int) PyUnstable_Long_IsCompact(const PyLongObject* op);
|
| 59 |
+
PyAPI_FUNC(Py_ssize_t) PyUnstable_Long_CompactValue(const PyLongObject* op);
|
| 60 |
+
|
| 61 |
+
// _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
|
| 62 |
+
// v must not be NULL, and must be a normalized long.
|
| 63 |
+
// There are no error cases.
|
| 64 |
+
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
|
| 65 |
+
|
| 66 |
+
/* _PyLong_NumBits. Return the number of bits needed to represent the
|
| 67 |
+
absolute value of a long. For example, this returns 1 for 1 and -1, 2
|
| 68 |
+
for 2 and -2, and 2 for 3 and -3. It returns 0 for 0.
|
| 69 |
+
v must not be NULL, and must be a normalized long.
|
| 70 |
+
(size_t)-1 is returned and OverflowError set if the true result doesn't
|
| 71 |
+
fit in a size_t.
|
| 72 |
+
*/
|
| 73 |
+
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
|
| 74 |
+
|
| 75 |
+
/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in
|
| 76 |
+
base 256, and return a Python int with the same numeric value.
|
| 77 |
+
If n is 0, the integer is 0. Else:
|
| 78 |
+
If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB;
|
| 79 |
+
else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the
|
| 80 |
+
LSB.
|
| 81 |
+
If is_signed is 0/false, view the bytes as a non-negative integer.
|
| 82 |
+
If is_signed is 1/true, view the bytes as a 2's-complement integer,
|
| 83 |
+
non-negative if bit 0x80 of the MSB is clear, negative if set.
|
| 84 |
+
Error returns:
|
| 85 |
+
+ Return NULL with the appropriate exception set if there's not
|
| 86 |
+
enough memory to create the Python int.
|
| 87 |
+
*/
|
| 88 |
+
PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
|
| 89 |
+
const unsigned char* bytes, size_t n,
|
| 90 |
+
int little_endian, int is_signed);
|
| 91 |
+
|
| 92 |
+
/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
|
| 93 |
+
v to a base-256 integer, stored in array bytes. Normally return 0,
|
| 94 |
+
return -1 on error.
|
| 95 |
+
If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at
|
| 96 |
+
bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and
|
| 97 |
+
the LSB at bytes[n-1].
|
| 98 |
+
If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes
|
| 99 |
+
are filled and there's nothing special about bit 0x80 of the MSB.
|
| 100 |
+
If is_signed is 1/true, bytes is filled with the 2's-complement
|
| 101 |
+
representation of v's value. Bit 0x80 of the MSB is the sign bit.
|
| 102 |
+
Error returns (-1):
|
| 103 |
+
+ is_signed is 0 and v < 0. TypeError is set in this case, and bytes
|
| 104 |
+
isn't altered.
|
| 105 |
+
+ n isn't big enough to hold the full mathematical value of v. For
|
| 106 |
+
example, if is_signed is 0 and there are more digits in the v than
|
| 107 |
+
fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of
|
| 108 |
+
being large enough to hold a sign bit. OverflowError is set in this
|
| 109 |
+
case, but bytes holds the least-significant n bytes of the true value.
|
| 110 |
+
*/
|
| 111 |
+
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
|
| 112 |
+
unsigned char* bytes, size_t n,
|
| 113 |
+
int little_endian, int is_signed, int with_exceptions);
|
| 114 |
+
|
| 115 |
+
/* For use by the gcd function in mathmodule.c */
|
| 116 |
+
PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *);
|
data/miniconda3/include/python3.13/cpython/memoryobject.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_MEMORYOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* The structs are declared here so that macros can work, but they shouldn't
|
| 6 |
+
be considered public. Don't access their fields directly, use the macros
|
| 7 |
+
and functions instead! */
|
| 8 |
+
#define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */
|
| 9 |
+
#define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */
|
| 10 |
+
|
| 11 |
+
typedef struct {
|
| 12 |
+
PyObject_HEAD
|
| 13 |
+
int flags; /* state flags */
|
| 14 |
+
Py_ssize_t exports; /* number of direct memoryview exports */
|
| 15 |
+
Py_buffer master; /* snapshot buffer obtained from the original exporter */
|
| 16 |
+
} _PyManagedBufferObject;
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
/* memoryview state flags */
|
| 20 |
+
#define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */
|
| 21 |
+
#define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */
|
| 22 |
+
#define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */
|
| 23 |
+
#define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */
|
| 24 |
+
#define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */
|
| 25 |
+
#define _Py_MEMORYVIEW_RESTRICTED 0x020 /* Disallow new references to the memoryview's buffer */
|
| 26 |
+
|
| 27 |
+
typedef struct {
|
| 28 |
+
PyObject_VAR_HEAD
|
| 29 |
+
_PyManagedBufferObject *mbuf; /* managed buffer */
|
| 30 |
+
Py_hash_t hash; /* hash value for read-only views */
|
| 31 |
+
int flags; /* state flags */
|
| 32 |
+
Py_ssize_t exports; /* number of buffer re-exports */
|
| 33 |
+
Py_buffer view; /* private copy of the exporter's view */
|
| 34 |
+
PyObject *weakreflist;
|
| 35 |
+
Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */
|
| 36 |
+
} PyMemoryViewObject;
|
| 37 |
+
|
| 38 |
+
#define _PyMemoryView_CAST(op) _Py_CAST(PyMemoryViewObject*, op)
|
| 39 |
+
|
| 40 |
+
/* Get a pointer to the memoryview's private copy of the exporter's buffer. */
|
| 41 |
+
static inline Py_buffer* PyMemoryView_GET_BUFFER(PyObject *op) {
|
| 42 |
+
return (&_PyMemoryView_CAST(op)->view);
|
| 43 |
+
}
|
| 44 |
+
#define PyMemoryView_GET_BUFFER(op) PyMemoryView_GET_BUFFER(_PyObject_CAST(op))
|
| 45 |
+
|
| 46 |
+
/* Get a pointer to the exporting object (this may be NULL!). */
|
| 47 |
+
static inline PyObject* PyMemoryView_GET_BASE(PyObject *op) {
|
| 48 |
+
return _PyMemoryView_CAST(op)->view.obj;
|
| 49 |
+
}
|
| 50 |
+
#define PyMemoryView_GET_BASE(op) PyMemoryView_GET_BASE(_PyObject_CAST(op))
|
data/miniconda3/include/python3.13/cpython/methodobject.h
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_METHODOBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
// PyCFunctionObject structure
|
| 6 |
+
|
| 7 |
+
typedef struct {
|
| 8 |
+
PyObject_HEAD
|
| 9 |
+
PyMethodDef *m_ml; /* Description of the C function to call */
|
| 10 |
+
PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
|
| 11 |
+
PyObject *m_module; /* The __module__ attribute, can be anything */
|
| 12 |
+
PyObject *m_weakreflist; /* List of weak references */
|
| 13 |
+
vectorcallfunc vectorcall;
|
| 14 |
+
} PyCFunctionObject;
|
| 15 |
+
|
| 16 |
+
#define _PyCFunctionObject_CAST(func) \
|
| 17 |
+
(assert(PyCFunction_Check(func)), \
|
| 18 |
+
_Py_CAST(PyCFunctionObject*, (func)))
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
// PyCMethodObject structure
|
| 22 |
+
|
| 23 |
+
typedef struct {
|
| 24 |
+
PyCFunctionObject func;
|
| 25 |
+
PyTypeObject *mm_class; /* Class that defines this method */
|
| 26 |
+
} PyCMethodObject;
|
| 27 |
+
|
| 28 |
+
#define _PyCMethodObject_CAST(func) \
|
| 29 |
+
(assert(PyCMethod_Check(func)), \
|
| 30 |
+
_Py_CAST(PyCMethodObject*, (func)))
|
| 31 |
+
|
| 32 |
+
PyAPI_DATA(PyTypeObject) PyCMethod_Type;
|
| 33 |
+
|
| 34 |
+
#define PyCMethod_CheckExact(op) Py_IS_TYPE((op), &PyCMethod_Type)
|
| 35 |
+
#define PyCMethod_Check(op) PyObject_TypeCheck((op), &PyCMethod_Type)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
/* Static inline functions for direct access to these values.
|
| 39 |
+
Type checks are *not* done, so use with care. */
|
| 40 |
+
static inline PyCFunction PyCFunction_GET_FUNCTION(PyObject *func) {
|
| 41 |
+
return _PyCFunctionObject_CAST(func)->m_ml->ml_meth;
|
| 42 |
+
}
|
| 43 |
+
#define PyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(_PyObject_CAST(func))
|
| 44 |
+
|
| 45 |
+
static inline PyObject* PyCFunction_GET_SELF(PyObject *func_obj) {
|
| 46 |
+
PyCFunctionObject *func = _PyCFunctionObject_CAST(func_obj);
|
| 47 |
+
if (func->m_ml->ml_flags & METH_STATIC) {
|
| 48 |
+
return _Py_NULL;
|
| 49 |
+
}
|
| 50 |
+
return func->m_self;
|
| 51 |
+
}
|
| 52 |
+
#define PyCFunction_GET_SELF(func) PyCFunction_GET_SELF(_PyObject_CAST(func))
|
| 53 |
+
|
| 54 |
+
static inline int PyCFunction_GET_FLAGS(PyObject *func) {
|
| 55 |
+
return _PyCFunctionObject_CAST(func)->m_ml->ml_flags;
|
| 56 |
+
}
|
| 57 |
+
#define PyCFunction_GET_FLAGS(func) PyCFunction_GET_FLAGS(_PyObject_CAST(func))
|
| 58 |
+
|
| 59 |
+
static inline PyTypeObject* PyCFunction_GET_CLASS(PyObject *func_obj) {
|
| 60 |
+
PyCFunctionObject *func = _PyCFunctionObject_CAST(func_obj);
|
| 61 |
+
if (func->m_ml->ml_flags & METH_METHOD) {
|
| 62 |
+
return _PyCMethodObject_CAST(func)->mm_class;
|
| 63 |
+
}
|
| 64 |
+
return _Py_NULL;
|
| 65 |
+
}
|
| 66 |
+
#define PyCFunction_GET_CLASS(func) PyCFunction_GET_CLASS(_PyObject_CAST(func))
|
data/miniconda3/include/python3.13/cpython/modsupport.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_MODSUPPORT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
// A data structure that can be used to run initialization code once in a
|
| 6 |
+
// thread-safe manner. The C++11 equivalent is std::call_once.
|
| 7 |
+
typedef struct {
|
| 8 |
+
uint8_t v;
|
| 9 |
+
} _PyOnceFlag;
|
| 10 |
+
|
| 11 |
+
typedef struct _PyArg_Parser {
|
| 12 |
+
const char *format;
|
| 13 |
+
const char * const *keywords;
|
| 14 |
+
const char *fname;
|
| 15 |
+
const char *custom_msg;
|
| 16 |
+
_PyOnceFlag once; /* atomic one-time initialization flag */
|
| 17 |
+
int is_kwtuple_owned; /* does this parser own the kwtuple object? */
|
| 18 |
+
int pos; /* number of positional-only arguments */
|
| 19 |
+
int min; /* minimal number of arguments */
|
| 20 |
+
int max; /* maximal number of positional arguments */
|
| 21 |
+
PyObject *kwtuple; /* tuple of keyword parameter names */
|
| 22 |
+
struct _PyArg_Parser *next;
|
| 23 |
+
} _PyArg_Parser;
|
| 24 |
+
|
| 25 |
+
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
| 26 |
+
struct _PyArg_Parser *, ...);
|
data/miniconda3/include/python3.13/cpython/monitoring.h
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_MONITORING_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Local events.
|
| 6 |
+
* These require bytecode instrumentation */
|
| 7 |
+
|
| 8 |
+
#define PY_MONITORING_EVENT_PY_START 0
|
| 9 |
+
#define PY_MONITORING_EVENT_PY_RESUME 1
|
| 10 |
+
#define PY_MONITORING_EVENT_PY_RETURN 2
|
| 11 |
+
#define PY_MONITORING_EVENT_PY_YIELD 3
|
| 12 |
+
#define PY_MONITORING_EVENT_CALL 4
|
| 13 |
+
#define PY_MONITORING_EVENT_LINE 5
|
| 14 |
+
#define PY_MONITORING_EVENT_INSTRUCTION 6
|
| 15 |
+
#define PY_MONITORING_EVENT_JUMP 7
|
| 16 |
+
#define PY_MONITORING_EVENT_BRANCH 8
|
| 17 |
+
#define PY_MONITORING_EVENT_STOP_ITERATION 9
|
| 18 |
+
|
| 19 |
+
#define PY_MONITORING_IS_INSTRUMENTED_EVENT(ev) \
|
| 20 |
+
((ev) < _PY_MONITORING_LOCAL_EVENTS)
|
| 21 |
+
|
| 22 |
+
/* Other events, mainly exceptions */
|
| 23 |
+
|
| 24 |
+
#define PY_MONITORING_EVENT_RAISE 10
|
| 25 |
+
#define PY_MONITORING_EVENT_EXCEPTION_HANDLED 11
|
| 26 |
+
#define PY_MONITORING_EVENT_PY_UNWIND 12
|
| 27 |
+
#define PY_MONITORING_EVENT_PY_THROW 13
|
| 28 |
+
#define PY_MONITORING_EVENT_RERAISE 14
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
/* Ancillary events */
|
| 32 |
+
|
| 33 |
+
#define PY_MONITORING_EVENT_C_RETURN 15
|
| 34 |
+
#define PY_MONITORING_EVENT_C_RAISE 16
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
typedef struct _PyMonitoringState {
|
| 38 |
+
uint8_t active;
|
| 39 |
+
uint8_t opaque;
|
| 40 |
+
} PyMonitoringState;
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
PyAPI_FUNC(int)
|
| 44 |
+
PyMonitoring_EnterScope(PyMonitoringState *state_array, uint64_t *version,
|
| 45 |
+
const uint8_t *event_types, Py_ssize_t length);
|
| 46 |
+
|
| 47 |
+
PyAPI_FUNC(int)
|
| 48 |
+
PyMonitoring_ExitScope(void);
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
PyAPI_FUNC(int)
|
| 52 |
+
_PyMonitoring_FirePyStartEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 53 |
+
|
| 54 |
+
PyAPI_FUNC(int)
|
| 55 |
+
_PyMonitoring_FirePyResumeEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 56 |
+
|
| 57 |
+
PyAPI_FUNC(int)
|
| 58 |
+
_PyMonitoring_FirePyReturnEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 59 |
+
PyObject *retval);
|
| 60 |
+
|
| 61 |
+
PyAPI_FUNC(int)
|
| 62 |
+
_PyMonitoring_FirePyYieldEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 63 |
+
PyObject *retval);
|
| 64 |
+
|
| 65 |
+
PyAPI_FUNC(int)
|
| 66 |
+
_PyMonitoring_FireCallEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 67 |
+
PyObject* callable, PyObject *arg0);
|
| 68 |
+
|
| 69 |
+
PyAPI_FUNC(int)
|
| 70 |
+
_PyMonitoring_FireLineEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 71 |
+
int lineno);
|
| 72 |
+
|
| 73 |
+
PyAPI_FUNC(int)
|
| 74 |
+
_PyMonitoring_FireJumpEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 75 |
+
PyObject *target_offset);
|
| 76 |
+
|
| 77 |
+
PyAPI_FUNC(int)
|
| 78 |
+
_PyMonitoring_FireBranchEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 79 |
+
PyObject *target_offset);
|
| 80 |
+
|
| 81 |
+
PyAPI_FUNC(int)
|
| 82 |
+
_PyMonitoring_FireCReturnEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 83 |
+
PyObject *retval);
|
| 84 |
+
|
| 85 |
+
PyAPI_FUNC(int)
|
| 86 |
+
_PyMonitoring_FirePyThrowEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 87 |
+
|
| 88 |
+
PyAPI_FUNC(int)
|
| 89 |
+
_PyMonitoring_FireRaiseEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 90 |
+
|
| 91 |
+
PyAPI_FUNC(int)
|
| 92 |
+
_PyMonitoring_FireReraiseEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 93 |
+
|
| 94 |
+
PyAPI_FUNC(int)
|
| 95 |
+
_PyMonitoring_FireExceptionHandledEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 96 |
+
|
| 97 |
+
PyAPI_FUNC(int)
|
| 98 |
+
_PyMonitoring_FireCRaiseEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 99 |
+
|
| 100 |
+
PyAPI_FUNC(int)
|
| 101 |
+
_PyMonitoring_FirePyUnwindEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset);
|
| 102 |
+
|
| 103 |
+
PyAPI_FUNC(int)
|
| 104 |
+
_PyMonitoring_FireStopIterationEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset, PyObject *value);
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
#define _PYMONITORING_IF_ACTIVE(STATE, X) \
|
| 108 |
+
if ((STATE)->active) { \
|
| 109 |
+
return (X); \
|
| 110 |
+
} \
|
| 111 |
+
else { \
|
| 112 |
+
return 0; \
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
static inline int
|
| 116 |
+
PyMonitoring_FirePyStartEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 117 |
+
{
|
| 118 |
+
_PYMONITORING_IF_ACTIVE(
|
| 119 |
+
state,
|
| 120 |
+
_PyMonitoring_FirePyStartEvent(state, codelike, offset));
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
static inline int
|
| 124 |
+
PyMonitoring_FirePyResumeEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 125 |
+
{
|
| 126 |
+
_PYMONITORING_IF_ACTIVE(
|
| 127 |
+
state,
|
| 128 |
+
_PyMonitoring_FirePyResumeEvent(state, codelike, offset));
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
static inline int
|
| 132 |
+
PyMonitoring_FirePyReturnEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 133 |
+
PyObject *retval)
|
| 134 |
+
{
|
| 135 |
+
_PYMONITORING_IF_ACTIVE(
|
| 136 |
+
state,
|
| 137 |
+
_PyMonitoring_FirePyReturnEvent(state, codelike, offset, retval));
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
static inline int
|
| 141 |
+
PyMonitoring_FirePyYieldEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 142 |
+
PyObject *retval)
|
| 143 |
+
{
|
| 144 |
+
_PYMONITORING_IF_ACTIVE(
|
| 145 |
+
state,
|
| 146 |
+
_PyMonitoring_FirePyYieldEvent(state, codelike, offset, retval));
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
static inline int
|
| 150 |
+
PyMonitoring_FireCallEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 151 |
+
PyObject* callable, PyObject *arg0)
|
| 152 |
+
{
|
| 153 |
+
_PYMONITORING_IF_ACTIVE(
|
| 154 |
+
state,
|
| 155 |
+
_PyMonitoring_FireCallEvent(state, codelike, offset, callable, arg0));
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
static inline int
|
| 159 |
+
PyMonitoring_FireLineEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 160 |
+
int lineno)
|
| 161 |
+
{
|
| 162 |
+
_PYMONITORING_IF_ACTIVE(
|
| 163 |
+
state,
|
| 164 |
+
_PyMonitoring_FireLineEvent(state, codelike, offset, lineno));
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
static inline int
|
| 168 |
+
PyMonitoring_FireJumpEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 169 |
+
PyObject *target_offset)
|
| 170 |
+
{
|
| 171 |
+
_PYMONITORING_IF_ACTIVE(
|
| 172 |
+
state,
|
| 173 |
+
_PyMonitoring_FireJumpEvent(state, codelike, offset, target_offset));
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
static inline int
|
| 177 |
+
PyMonitoring_FireBranchEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 178 |
+
PyObject *target_offset)
|
| 179 |
+
{
|
| 180 |
+
_PYMONITORING_IF_ACTIVE(
|
| 181 |
+
state,
|
| 182 |
+
_PyMonitoring_FireBranchEvent(state, codelike, offset, target_offset));
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
static inline int
|
| 186 |
+
PyMonitoring_FireCReturnEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset,
|
| 187 |
+
PyObject *retval)
|
| 188 |
+
{
|
| 189 |
+
_PYMONITORING_IF_ACTIVE(
|
| 190 |
+
state,
|
| 191 |
+
_PyMonitoring_FireCReturnEvent(state, codelike, offset, retval));
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
static inline int
|
| 195 |
+
PyMonitoring_FirePyThrowEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 196 |
+
{
|
| 197 |
+
_PYMONITORING_IF_ACTIVE(
|
| 198 |
+
state,
|
| 199 |
+
_PyMonitoring_FirePyThrowEvent(state, codelike, offset));
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
static inline int
|
| 203 |
+
PyMonitoring_FireRaiseEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 204 |
+
{
|
| 205 |
+
_PYMONITORING_IF_ACTIVE(
|
| 206 |
+
state,
|
| 207 |
+
_PyMonitoring_FireRaiseEvent(state, codelike, offset));
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
static inline int
|
| 211 |
+
PyMonitoring_FireReraiseEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 212 |
+
{
|
| 213 |
+
_PYMONITORING_IF_ACTIVE(
|
| 214 |
+
state,
|
| 215 |
+
_PyMonitoring_FireReraiseEvent(state, codelike, offset));
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
static inline int
|
| 219 |
+
PyMonitoring_FireExceptionHandledEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 220 |
+
{
|
| 221 |
+
_PYMONITORING_IF_ACTIVE(
|
| 222 |
+
state,
|
| 223 |
+
_PyMonitoring_FireExceptionHandledEvent(state, codelike, offset));
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
static inline int
|
| 227 |
+
PyMonitoring_FireCRaiseEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 228 |
+
{
|
| 229 |
+
_PYMONITORING_IF_ACTIVE(
|
| 230 |
+
state,
|
| 231 |
+
_PyMonitoring_FireCRaiseEvent(state, codelike, offset));
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
static inline int
|
| 235 |
+
PyMonitoring_FirePyUnwindEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
|
| 236 |
+
{
|
| 237 |
+
_PYMONITORING_IF_ACTIVE(
|
| 238 |
+
state,
|
| 239 |
+
_PyMonitoring_FirePyUnwindEvent(state, codelike, offset));
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
static inline int
|
| 243 |
+
PyMonitoring_FireStopIterationEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset, PyObject *value)
|
| 244 |
+
{
|
| 245 |
+
_PYMONITORING_IF_ACTIVE(
|
| 246 |
+
state,
|
| 247 |
+
_PyMonitoring_FireStopIterationEvent(state, codelike, offset, value));
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
#undef _PYMONITORING_IF_ACTIVE
|
data/miniconda3/include/python3.13/cpython/object.h
ADDED
|
@@ -0,0 +1,525 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_OBJECT_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_FUNC(void) _Py_NewReference(PyObject *op);
|
| 6 |
+
PyAPI_FUNC(void) _Py_NewReferenceNoTotal(PyObject *op);
|
| 7 |
+
PyAPI_FUNC(void) _Py_ResurrectReference(PyObject *op);
|
| 8 |
+
|
| 9 |
+
#ifdef Py_REF_DEBUG
|
| 10 |
+
/* These are useful as debugging aids when chasing down refleaks. */
|
| 11 |
+
PyAPI_FUNC(Py_ssize_t) _Py_GetGlobalRefTotal(void);
|
| 12 |
+
# define _Py_GetRefTotal() _Py_GetGlobalRefTotal()
|
| 13 |
+
PyAPI_FUNC(Py_ssize_t) _Py_GetLegacyRefTotal(void);
|
| 14 |
+
PyAPI_FUNC(Py_ssize_t) _PyInterpreterState_GetRefTotal(PyInterpreterState *);
|
| 15 |
+
#endif
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
/********************* String Literals ****************************************/
|
| 19 |
+
/* This structure helps managing static strings. The basic usage goes like this:
|
| 20 |
+
Instead of doing
|
| 21 |
+
|
| 22 |
+
r = PyObject_CallMethod(o, "foo", "args", ...);
|
| 23 |
+
|
| 24 |
+
do
|
| 25 |
+
|
| 26 |
+
_Py_IDENTIFIER(foo);
|
| 27 |
+
...
|
| 28 |
+
r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...);
|
| 29 |
+
|
| 30 |
+
PyId_foo is a static variable, either on block level or file level. On first
|
| 31 |
+
usage, the string "foo" is interned, and the structures are linked. On interpreter
|
| 32 |
+
shutdown, all strings are released.
|
| 33 |
+
|
| 34 |
+
Alternatively, _Py_static_string allows choosing the variable name.
|
| 35 |
+
_PyUnicode_FromId returns a borrowed reference to the interned string.
|
| 36 |
+
_PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*.
|
| 37 |
+
*/
|
| 38 |
+
typedef struct _Py_Identifier {
|
| 39 |
+
const char* string;
|
| 40 |
+
// Index in PyInterpreterState.unicode.ids.array. It is process-wide
|
| 41 |
+
// unique and must be initialized to -1.
|
| 42 |
+
Py_ssize_t index;
|
| 43 |
+
// Hidden PyMutex struct for non free-threaded build.
|
| 44 |
+
struct {
|
| 45 |
+
uint8_t v;
|
| 46 |
+
} mutex;
|
| 47 |
+
} _Py_Identifier;
|
| 48 |
+
|
| 49 |
+
#ifndef Py_BUILD_CORE
|
| 50 |
+
// For now we are keeping _Py_IDENTIFIER for continued use
|
| 51 |
+
// in non-builtin extensions (and naughty PyPI modules).
|
| 52 |
+
|
| 53 |
+
#define _Py_static_string_init(value) { .string = (value), .index = -1 }
|
| 54 |
+
#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value)
|
| 55 |
+
#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
|
| 56 |
+
|
| 57 |
+
#endif /* !Py_BUILD_CORE */
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
typedef struct {
|
| 61 |
+
/* Number implementations must check *both*
|
| 62 |
+
arguments for proper type and implement the necessary conversions
|
| 63 |
+
in the slot functions themselves. */
|
| 64 |
+
|
| 65 |
+
binaryfunc nb_add;
|
| 66 |
+
binaryfunc nb_subtract;
|
| 67 |
+
binaryfunc nb_multiply;
|
| 68 |
+
binaryfunc nb_remainder;
|
| 69 |
+
binaryfunc nb_divmod;
|
| 70 |
+
ternaryfunc nb_power;
|
| 71 |
+
unaryfunc nb_negative;
|
| 72 |
+
unaryfunc nb_positive;
|
| 73 |
+
unaryfunc nb_absolute;
|
| 74 |
+
inquiry nb_bool;
|
| 75 |
+
unaryfunc nb_invert;
|
| 76 |
+
binaryfunc nb_lshift;
|
| 77 |
+
binaryfunc nb_rshift;
|
| 78 |
+
binaryfunc nb_and;
|
| 79 |
+
binaryfunc nb_xor;
|
| 80 |
+
binaryfunc nb_or;
|
| 81 |
+
unaryfunc nb_int;
|
| 82 |
+
void *nb_reserved; /* the slot formerly known as nb_long */
|
| 83 |
+
unaryfunc nb_float;
|
| 84 |
+
|
| 85 |
+
binaryfunc nb_inplace_add;
|
| 86 |
+
binaryfunc nb_inplace_subtract;
|
| 87 |
+
binaryfunc nb_inplace_multiply;
|
| 88 |
+
binaryfunc nb_inplace_remainder;
|
| 89 |
+
ternaryfunc nb_inplace_power;
|
| 90 |
+
binaryfunc nb_inplace_lshift;
|
| 91 |
+
binaryfunc nb_inplace_rshift;
|
| 92 |
+
binaryfunc nb_inplace_and;
|
| 93 |
+
binaryfunc nb_inplace_xor;
|
| 94 |
+
binaryfunc nb_inplace_or;
|
| 95 |
+
|
| 96 |
+
binaryfunc nb_floor_divide;
|
| 97 |
+
binaryfunc nb_true_divide;
|
| 98 |
+
binaryfunc nb_inplace_floor_divide;
|
| 99 |
+
binaryfunc nb_inplace_true_divide;
|
| 100 |
+
|
| 101 |
+
unaryfunc nb_index;
|
| 102 |
+
|
| 103 |
+
binaryfunc nb_matrix_multiply;
|
| 104 |
+
binaryfunc nb_inplace_matrix_multiply;
|
| 105 |
+
} PyNumberMethods;
|
| 106 |
+
|
| 107 |
+
typedef struct {
|
| 108 |
+
lenfunc sq_length;
|
| 109 |
+
binaryfunc sq_concat;
|
| 110 |
+
ssizeargfunc sq_repeat;
|
| 111 |
+
ssizeargfunc sq_item;
|
| 112 |
+
void *was_sq_slice;
|
| 113 |
+
ssizeobjargproc sq_ass_item;
|
| 114 |
+
void *was_sq_ass_slice;
|
| 115 |
+
objobjproc sq_contains;
|
| 116 |
+
|
| 117 |
+
binaryfunc sq_inplace_concat;
|
| 118 |
+
ssizeargfunc sq_inplace_repeat;
|
| 119 |
+
} PySequenceMethods;
|
| 120 |
+
|
| 121 |
+
typedef struct {
|
| 122 |
+
lenfunc mp_length;
|
| 123 |
+
binaryfunc mp_subscript;
|
| 124 |
+
objobjargproc mp_ass_subscript;
|
| 125 |
+
} PyMappingMethods;
|
| 126 |
+
|
| 127 |
+
typedef PySendResult (*sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
|
| 128 |
+
|
| 129 |
+
typedef struct {
|
| 130 |
+
unaryfunc am_await;
|
| 131 |
+
unaryfunc am_aiter;
|
| 132 |
+
unaryfunc am_anext;
|
| 133 |
+
sendfunc am_send;
|
| 134 |
+
} PyAsyncMethods;
|
| 135 |
+
|
| 136 |
+
typedef struct {
|
| 137 |
+
getbufferproc bf_getbuffer;
|
| 138 |
+
releasebufferproc bf_releasebuffer;
|
| 139 |
+
} PyBufferProcs;
|
| 140 |
+
|
| 141 |
+
/* Allow printfunc in the tp_vectorcall_offset slot for
|
| 142 |
+
* backwards-compatibility */
|
| 143 |
+
typedef Py_ssize_t printfunc;
|
| 144 |
+
|
| 145 |
+
// If this structure is modified, Doc/includes/typestruct.h should be updated
|
| 146 |
+
// as well.
|
| 147 |
+
struct _typeobject {
|
| 148 |
+
PyObject_VAR_HEAD
|
| 149 |
+
const char *tp_name; /* For printing, in format "<module>.<name>" */
|
| 150 |
+
Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
|
| 151 |
+
|
| 152 |
+
/* Methods to implement standard operations */
|
| 153 |
+
|
| 154 |
+
destructor tp_dealloc;
|
| 155 |
+
Py_ssize_t tp_vectorcall_offset;
|
| 156 |
+
getattrfunc tp_getattr;
|
| 157 |
+
setattrfunc tp_setattr;
|
| 158 |
+
PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
|
| 159 |
+
or tp_reserved (Python 3) */
|
| 160 |
+
reprfunc tp_repr;
|
| 161 |
+
|
| 162 |
+
/* Method suites for standard classes */
|
| 163 |
+
|
| 164 |
+
PyNumberMethods *tp_as_number;
|
| 165 |
+
PySequenceMethods *tp_as_sequence;
|
| 166 |
+
PyMappingMethods *tp_as_mapping;
|
| 167 |
+
|
| 168 |
+
/* More standard operations (here for binary compatibility) */
|
| 169 |
+
|
| 170 |
+
hashfunc tp_hash;
|
| 171 |
+
ternaryfunc tp_call;
|
| 172 |
+
reprfunc tp_str;
|
| 173 |
+
getattrofunc tp_getattro;
|
| 174 |
+
setattrofunc tp_setattro;
|
| 175 |
+
|
| 176 |
+
/* Functions to access object as input/output buffer */
|
| 177 |
+
PyBufferProcs *tp_as_buffer;
|
| 178 |
+
|
| 179 |
+
/* Flags to define presence of optional/expanded features */
|
| 180 |
+
unsigned long tp_flags;
|
| 181 |
+
|
| 182 |
+
const char *tp_doc; /* Documentation string */
|
| 183 |
+
|
| 184 |
+
/* Assigned meaning in release 2.0 */
|
| 185 |
+
/* call function for all accessible objects */
|
| 186 |
+
traverseproc tp_traverse;
|
| 187 |
+
|
| 188 |
+
/* delete references to contained objects */
|
| 189 |
+
inquiry tp_clear;
|
| 190 |
+
|
| 191 |
+
/* Assigned meaning in release 2.1 */
|
| 192 |
+
/* rich comparisons */
|
| 193 |
+
richcmpfunc tp_richcompare;
|
| 194 |
+
|
| 195 |
+
/* weak reference enabler */
|
| 196 |
+
Py_ssize_t tp_weaklistoffset;
|
| 197 |
+
|
| 198 |
+
/* Iterators */
|
| 199 |
+
getiterfunc tp_iter;
|
| 200 |
+
iternextfunc tp_iternext;
|
| 201 |
+
|
| 202 |
+
/* Attribute descriptor and subclassing stuff */
|
| 203 |
+
PyMethodDef *tp_methods;
|
| 204 |
+
PyMemberDef *tp_members;
|
| 205 |
+
PyGetSetDef *tp_getset;
|
| 206 |
+
// Strong reference on a heap type, borrowed reference on a static type
|
| 207 |
+
PyTypeObject *tp_base;
|
| 208 |
+
PyObject *tp_dict;
|
| 209 |
+
descrgetfunc tp_descr_get;
|
| 210 |
+
descrsetfunc tp_descr_set;
|
| 211 |
+
Py_ssize_t tp_dictoffset;
|
| 212 |
+
initproc tp_init;
|
| 213 |
+
allocfunc tp_alloc;
|
| 214 |
+
newfunc tp_new;
|
| 215 |
+
freefunc tp_free; /* Low-level free-memory routine */
|
| 216 |
+
inquiry tp_is_gc; /* For PyObject_IS_GC */
|
| 217 |
+
PyObject *tp_bases;
|
| 218 |
+
PyObject *tp_mro; /* method resolution order */
|
| 219 |
+
PyObject *tp_cache; /* no longer used */
|
| 220 |
+
void *tp_subclasses; /* for static builtin types this is an index */
|
| 221 |
+
PyObject *tp_weaklist; /* not used for static builtin types */
|
| 222 |
+
destructor tp_del;
|
| 223 |
+
|
| 224 |
+
/* Type attribute cache version tag. Added in version 2.6 */
|
| 225 |
+
unsigned int tp_version_tag;
|
| 226 |
+
|
| 227 |
+
destructor tp_finalize;
|
| 228 |
+
vectorcallfunc tp_vectorcall;
|
| 229 |
+
|
| 230 |
+
/* bitset of which type-watchers care about this type */
|
| 231 |
+
unsigned char tp_watched;
|
| 232 |
+
uint16_t tp_versions_used;
|
| 233 |
+
};
|
| 234 |
+
|
| 235 |
+
/* This struct is used by the specializer
|
| 236 |
+
* It should be treated as an opaque blob
|
| 237 |
+
* by code other than the specializer and interpreter. */
|
| 238 |
+
struct _specialization_cache {
|
| 239 |
+
// In order to avoid bloating the bytecode with lots of inline caches, the
|
| 240 |
+
// members of this structure have a somewhat unique contract. They are set
|
| 241 |
+
// by the specialization machinery, and are invalidated by PyType_Modified.
|
| 242 |
+
// The rules for using them are as follows:
|
| 243 |
+
// - If getitem is non-NULL, then it is the same Python function that
|
| 244 |
+
// PyType_Lookup(cls, "__getitem__") would return.
|
| 245 |
+
// - If getitem is NULL, then getitem_version is meaningless.
|
| 246 |
+
// - If getitem->func_version == getitem_version, then getitem can be called
|
| 247 |
+
// with two positional arguments and no keyword arguments, and has neither
|
| 248 |
+
// *args nor **kwargs (as required by BINARY_SUBSCR_GETITEM):
|
| 249 |
+
PyObject *getitem;
|
| 250 |
+
uint32_t getitem_version;
|
| 251 |
+
PyObject *init;
|
| 252 |
+
};
|
| 253 |
+
|
| 254 |
+
/* The *real* layout of a type object when allocated on the heap */
|
| 255 |
+
typedef struct _heaptypeobject {
|
| 256 |
+
/* Note: there's a dependency on the order of these members
|
| 257 |
+
in slotptr() in typeobject.c . */
|
| 258 |
+
PyTypeObject ht_type;
|
| 259 |
+
PyAsyncMethods as_async;
|
| 260 |
+
PyNumberMethods as_number;
|
| 261 |
+
PyMappingMethods as_mapping;
|
| 262 |
+
PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
|
| 263 |
+
so that the mapping wins when both
|
| 264 |
+
the mapping and the sequence define
|
| 265 |
+
a given operator (e.g. __getitem__).
|
| 266 |
+
see add_operators() in typeobject.c . */
|
| 267 |
+
PyBufferProcs as_buffer;
|
| 268 |
+
PyObject *ht_name, *ht_slots, *ht_qualname;
|
| 269 |
+
struct _dictkeysobject *ht_cached_keys;
|
| 270 |
+
PyObject *ht_module;
|
| 271 |
+
char *_ht_tpname; // Storage for "tp_name"; see PyType_FromModuleAndSpec
|
| 272 |
+
struct _specialization_cache _spec_cache; // For use by the specializer.
|
| 273 |
+
/* here are optional user slots, followed by the members. */
|
| 274 |
+
} PyHeapTypeObject;
|
| 275 |
+
|
| 276 |
+
PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *);
|
| 277 |
+
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
|
| 278 |
+
PyAPI_FUNC(PyObject *) _PyType_LookupRef(PyTypeObject *, PyObject *);
|
| 279 |
+
PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *);
|
| 280 |
+
|
| 281 |
+
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
|
| 282 |
+
PyAPI_FUNC(void) _Py_BreakPoint(void);
|
| 283 |
+
PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
|
| 284 |
+
|
| 285 |
+
PyAPI_FUNC(PyObject*) _PyObject_GetAttrId(PyObject *, _Py_Identifier *);
|
| 286 |
+
|
| 287 |
+
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
|
| 288 |
+
PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *);
|
| 289 |
+
PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *);
|
| 290 |
+
|
| 291 |
+
PyAPI_FUNC(void) PyUnstable_Object_ClearWeakRefsNoCallbacks(PyObject *);
|
| 292 |
+
|
| 293 |
+
/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes
|
| 294 |
+
dict as the last parameter. */
|
| 295 |
+
PyAPI_FUNC(PyObject *)
|
| 296 |
+
_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *, int);
|
| 297 |
+
PyAPI_FUNC(int)
|
| 298 |
+
_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *,
|
| 299 |
+
PyObject *, PyObject *);
|
| 300 |
+
|
| 301 |
+
PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *);
|
| 302 |
+
|
| 303 |
+
/* Safely decref `dst` and set `dst` to `src`.
|
| 304 |
+
*
|
| 305 |
+
* As in case of Py_CLEAR "the obvious" code can be deadly:
|
| 306 |
+
*
|
| 307 |
+
* Py_DECREF(dst);
|
| 308 |
+
* dst = src;
|
| 309 |
+
*
|
| 310 |
+
* The safe way is:
|
| 311 |
+
*
|
| 312 |
+
* Py_SETREF(dst, src);
|
| 313 |
+
*
|
| 314 |
+
* That arranges to set `dst` to `src` _before_ decref'ing, so that any code
|
| 315 |
+
* triggered as a side-effect of `dst` getting torn down no longer believes
|
| 316 |
+
* `dst` points to a valid object.
|
| 317 |
+
*
|
| 318 |
+
* Temporary variables are used to only evalutate macro arguments once and so
|
| 319 |
+
* avoid the duplication of side effects. _Py_TYPEOF() or memcpy() is used to
|
| 320 |
+
* avoid a miscompilation caused by type punning. See Py_CLEAR() comment for
|
| 321 |
+
* implementation details about type punning.
|
| 322 |
+
*
|
| 323 |
+
* The memcpy() implementation does not emit a compiler warning if 'src' has
|
| 324 |
+
* not the same type than 'src': any pointer type is accepted for 'src'.
|
| 325 |
+
*/
|
| 326 |
+
#ifdef _Py_TYPEOF
|
| 327 |
+
#define Py_SETREF(dst, src) \
|
| 328 |
+
do { \
|
| 329 |
+
_Py_TYPEOF(dst)* _tmp_dst_ptr = &(dst); \
|
| 330 |
+
_Py_TYPEOF(dst) _tmp_old_dst = (*_tmp_dst_ptr); \
|
| 331 |
+
*_tmp_dst_ptr = (src); \
|
| 332 |
+
Py_DECREF(_tmp_old_dst); \
|
| 333 |
+
} while (0)
|
| 334 |
+
#else
|
| 335 |
+
#define Py_SETREF(dst, src) \
|
| 336 |
+
do { \
|
| 337 |
+
PyObject **_tmp_dst_ptr = _Py_CAST(PyObject**, &(dst)); \
|
| 338 |
+
PyObject *_tmp_old_dst = (*_tmp_dst_ptr); \
|
| 339 |
+
PyObject *_tmp_src = _PyObject_CAST(src); \
|
| 340 |
+
memcpy(_tmp_dst_ptr, &_tmp_src, sizeof(PyObject*)); \
|
| 341 |
+
Py_DECREF(_tmp_old_dst); \
|
| 342 |
+
} while (0)
|
| 343 |
+
#endif
|
| 344 |
+
|
| 345 |
+
/* Py_XSETREF() is a variant of Py_SETREF() that uses Py_XDECREF() instead of
|
| 346 |
+
* Py_DECREF().
|
| 347 |
+
*/
|
| 348 |
+
#ifdef _Py_TYPEOF
|
| 349 |
+
#define Py_XSETREF(dst, src) \
|
| 350 |
+
do { \
|
| 351 |
+
_Py_TYPEOF(dst)* _tmp_dst_ptr = &(dst); \
|
| 352 |
+
_Py_TYPEOF(dst) _tmp_old_dst = (*_tmp_dst_ptr); \
|
| 353 |
+
*_tmp_dst_ptr = (src); \
|
| 354 |
+
Py_XDECREF(_tmp_old_dst); \
|
| 355 |
+
} while (0)
|
| 356 |
+
#else
|
| 357 |
+
#define Py_XSETREF(dst, src) \
|
| 358 |
+
do { \
|
| 359 |
+
PyObject **_tmp_dst_ptr = _Py_CAST(PyObject**, &(dst)); \
|
| 360 |
+
PyObject *_tmp_old_dst = (*_tmp_dst_ptr); \
|
| 361 |
+
PyObject *_tmp_src = _PyObject_CAST(src); \
|
| 362 |
+
memcpy(_tmp_dst_ptr, &_tmp_src, sizeof(PyObject*)); \
|
| 363 |
+
Py_XDECREF(_tmp_old_dst); \
|
| 364 |
+
} while (0)
|
| 365 |
+
#endif
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
/* Define a pair of assertion macros:
|
| 369 |
+
_PyObject_ASSERT_FROM(), _PyObject_ASSERT_WITH_MSG() and _PyObject_ASSERT().
|
| 370 |
+
|
| 371 |
+
These work like the regular C assert(), in that they will abort the
|
| 372 |
+
process with a message on stderr if the given condition fails to hold,
|
| 373 |
+
but compile away to nothing if NDEBUG is defined.
|
| 374 |
+
|
| 375 |
+
However, before aborting, Python will also try to call _PyObject_Dump() on
|
| 376 |
+
the given object. This may be of use when investigating bugs in which a
|
| 377 |
+
particular object is corrupt (e.g. buggy a tp_visit method in an extension
|
| 378 |
+
module breaking the garbage collector), to help locate the broken objects.
|
| 379 |
+
|
| 380 |
+
The WITH_MSG variant allows you to supply an additional message that Python
|
| 381 |
+
will attempt to print to stderr, after the object dump. */
|
| 382 |
+
#ifdef NDEBUG
|
| 383 |
+
/* No debugging: compile away the assertions: */
|
| 384 |
+
# define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \
|
| 385 |
+
((void)0)
|
| 386 |
+
#else
|
| 387 |
+
/* With debugging: generate checks: */
|
| 388 |
+
# define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \
|
| 389 |
+
((expr) \
|
| 390 |
+
? (void)(0) \
|
| 391 |
+
: _PyObject_AssertFailed((obj), Py_STRINGIFY(expr), \
|
| 392 |
+
(msg), (filename), (lineno), (func)))
|
| 393 |
+
#endif
|
| 394 |
+
|
| 395 |
+
#define _PyObject_ASSERT_WITH_MSG(obj, expr, msg) \
|
| 396 |
+
_PyObject_ASSERT_FROM((obj), expr, (msg), __FILE__, __LINE__, __func__)
|
| 397 |
+
#define _PyObject_ASSERT(obj, expr) \
|
| 398 |
+
_PyObject_ASSERT_WITH_MSG((obj), expr, NULL)
|
| 399 |
+
|
| 400 |
+
#define _PyObject_ASSERT_FAILED_MSG(obj, msg) \
|
| 401 |
+
_PyObject_AssertFailed((obj), NULL, (msg), __FILE__, __LINE__, __func__)
|
| 402 |
+
|
| 403 |
+
/* Declare and define _PyObject_AssertFailed() even when NDEBUG is defined,
|
| 404 |
+
to avoid causing compiler/linker errors when building extensions without
|
| 405 |
+
NDEBUG against a Python built with NDEBUG defined.
|
| 406 |
+
|
| 407 |
+
msg, expr and function can be NULL. */
|
| 408 |
+
PyAPI_FUNC(void) _Py_NO_RETURN _PyObject_AssertFailed(
|
| 409 |
+
PyObject *obj,
|
| 410 |
+
const char *expr,
|
| 411 |
+
const char *msg,
|
| 412 |
+
const char *file,
|
| 413 |
+
int line,
|
| 414 |
+
const char *function);
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
/* Trashcan mechanism, thanks to Christian Tismer.
|
| 418 |
+
|
| 419 |
+
When deallocating a container object, it's possible to trigger an unbounded
|
| 420 |
+
chain of deallocations, as each Py_DECREF in turn drops the refcount on "the
|
| 421 |
+
next" object in the chain to 0. This can easily lead to stack overflows,
|
| 422 |
+
especially in threads (which typically have less stack space to work with).
|
| 423 |
+
|
| 424 |
+
A container object can avoid this by bracketing the body of its tp_dealloc
|
| 425 |
+
function with a pair of macros:
|
| 426 |
+
|
| 427 |
+
static void
|
| 428 |
+
mytype_dealloc(mytype *p)
|
| 429 |
+
{
|
| 430 |
+
... declarations go here ...
|
| 431 |
+
|
| 432 |
+
PyObject_GC_UnTrack(p); // must untrack first
|
| 433 |
+
Py_TRASHCAN_BEGIN(p, mytype_dealloc)
|
| 434 |
+
... The body of the deallocator goes here, including all calls ...
|
| 435 |
+
... to Py_DECREF on contained objects. ...
|
| 436 |
+
Py_TRASHCAN_END // there should be no code after this
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
CAUTION: Never return from the middle of the body! If the body needs to
|
| 440 |
+
"get out early", put a label immediately before the Py_TRASHCAN_END
|
| 441 |
+
call, and goto it. Else the call-depth counter (see below) will stay
|
| 442 |
+
above 0 forever, and the trashcan will never get emptied.
|
| 443 |
+
|
| 444 |
+
How it works: The BEGIN macro increments a call-depth counter. So long
|
| 445 |
+
as this counter is small, the body of the deallocator is run directly without
|
| 446 |
+
further ado. But if the counter gets large, it instead adds p to a list of
|
| 447 |
+
objects to be deallocated later, skips the body of the deallocator, and
|
| 448 |
+
resumes execution after the END macro. The tp_dealloc routine then returns
|
| 449 |
+
without deallocating anything (and so unbounded call-stack depth is avoided).
|
| 450 |
+
|
| 451 |
+
When the call stack finishes unwinding again, code generated by the END macro
|
| 452 |
+
notices this, and calls another routine to deallocate all the objects that
|
| 453 |
+
may have been added to the list of deferred deallocations. In effect, a
|
| 454 |
+
chain of N deallocations is broken into (N-1)/(Py_TRASHCAN_HEADROOM-1) pieces,
|
| 455 |
+
with the call stack never exceeding a depth of Py_TRASHCAN_HEADROOM.
|
| 456 |
+
|
| 457 |
+
Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base
|
| 458 |
+
class, we need to ensure that the trashcan is only triggered on the tp_dealloc
|
| 459 |
+
of the actual class being deallocated. Otherwise we might end up with a
|
| 460 |
+
partially-deallocated object. To check this, the tp_dealloc function must be
|
| 461 |
+
passed as second argument to Py_TRASHCAN_BEGIN().
|
| 462 |
+
*/
|
| 463 |
+
|
| 464 |
+
/* Python 3.9 private API, invoked by the macros below. */
|
| 465 |
+
PyAPI_FUNC(int) _PyTrash_begin(PyThreadState *tstate, PyObject *op);
|
| 466 |
+
PyAPI_FUNC(void) _PyTrash_end(PyThreadState *tstate);
|
| 467 |
+
|
| 468 |
+
PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyThreadState *tstate, PyObject *op);
|
| 469 |
+
PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(PyThreadState *tstate);
|
| 470 |
+
|
| 471 |
+
|
| 472 |
+
/* Python 3.10 private API, invoked by the Py_TRASHCAN_BEGIN(). */
|
| 473 |
+
|
| 474 |
+
/* To avoid raising recursion errors during dealloc trigger trashcan before we reach
|
| 475 |
+
* recursion limit. To avoid trashing, we don't attempt to empty the trashcan until
|
| 476 |
+
* we have headroom above the trigger limit */
|
| 477 |
+
#define Py_TRASHCAN_HEADROOM 50
|
| 478 |
+
|
| 479 |
+
#define Py_TRASHCAN_BEGIN(op, dealloc) \
|
| 480 |
+
do { \
|
| 481 |
+
PyThreadState *tstate = PyThreadState_Get(); \
|
| 482 |
+
if (tstate->c_recursion_remaining <= Py_TRASHCAN_HEADROOM && Py_TYPE(op)->tp_dealloc == (destructor)dealloc) { \
|
| 483 |
+
_PyTrash_thread_deposit_object(tstate, (PyObject *)op); \
|
| 484 |
+
break; \
|
| 485 |
+
} \
|
| 486 |
+
tstate->c_recursion_remaining--;
|
| 487 |
+
/* The body of the deallocator is here. */
|
| 488 |
+
#define Py_TRASHCAN_END \
|
| 489 |
+
tstate->c_recursion_remaining++; \
|
| 490 |
+
if (tstate->delete_later && tstate->c_recursion_remaining > (Py_TRASHCAN_HEADROOM*2)) { \
|
| 491 |
+
_PyTrash_thread_destroy_chain(tstate); \
|
| 492 |
+
} \
|
| 493 |
+
} while (0);
|
| 494 |
+
|
| 495 |
+
|
| 496 |
+
PyAPI_FUNC(void *) PyObject_GetItemData(PyObject *obj);
|
| 497 |
+
|
| 498 |
+
PyAPI_FUNC(int) PyObject_VisitManagedDict(PyObject *obj, visitproc visit, void *arg);
|
| 499 |
+
PyAPI_FUNC(int) _PyObject_SetManagedDict(PyObject *obj, PyObject *new_dict);
|
| 500 |
+
PyAPI_FUNC(void) PyObject_ClearManagedDict(PyObject *obj);
|
| 501 |
+
|
| 502 |
+
#define TYPE_MAX_WATCHERS 8
|
| 503 |
+
|
| 504 |
+
typedef int(*PyType_WatchCallback)(PyTypeObject *);
|
| 505 |
+
PyAPI_FUNC(int) PyType_AddWatcher(PyType_WatchCallback callback);
|
| 506 |
+
PyAPI_FUNC(int) PyType_ClearWatcher(int watcher_id);
|
| 507 |
+
PyAPI_FUNC(int) PyType_Watch(int watcher_id, PyObject *type);
|
| 508 |
+
PyAPI_FUNC(int) PyType_Unwatch(int watcher_id, PyObject *type);
|
| 509 |
+
|
| 510 |
+
/* Attempt to assign a version tag to the given type.
|
| 511 |
+
*
|
| 512 |
+
* Returns 1 if the type already had a valid version tag or a new one was
|
| 513 |
+
* assigned, or 0 if a new tag could not be assigned.
|
| 514 |
+
*/
|
| 515 |
+
PyAPI_FUNC(int) PyUnstable_Type_AssignVersionTag(PyTypeObject *type);
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
typedef enum {
|
| 519 |
+
PyRefTracer_CREATE = 0,
|
| 520 |
+
PyRefTracer_DESTROY = 1,
|
| 521 |
+
} PyRefTracerEvent;
|
| 522 |
+
|
| 523 |
+
typedef int (*PyRefTracer)(PyObject *, PyRefTracerEvent event, void *);
|
| 524 |
+
PyAPI_FUNC(int) PyRefTracer_SetTracer(PyRefTracer tracer, void *data);
|
| 525 |
+
PyAPI_FUNC(PyRefTracer) PyRefTracer_GetTracer(void**);
|
data/miniconda3/include/python3.13/cpython/objimpl.h
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_OBJIMPL_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
static inline size_t _PyObject_SIZE(PyTypeObject *type) {
|
| 6 |
+
return _Py_STATIC_CAST(size_t, type->tp_basicsize);
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
|
| 10 |
+
vrbl-size object with nitems items, exclusive of gc overhead (if any). The
|
| 11 |
+
value is rounded up to the closest multiple of sizeof(void *), in order to
|
| 12 |
+
ensure that pointer fields at the end of the object are correctly aligned
|
| 13 |
+
for the platform (this is of special importance for subclasses of, e.g.,
|
| 14 |
+
str or int, so that pointers can be stored after the embedded data).
|
| 15 |
+
|
| 16 |
+
Note that there's no memory wastage in doing this, as malloc has to
|
| 17 |
+
return (at worst) pointer-aligned memory anyway.
|
| 18 |
+
*/
|
| 19 |
+
#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0
|
| 20 |
+
# error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2"
|
| 21 |
+
#endif
|
| 22 |
+
|
| 23 |
+
static inline size_t _PyObject_VAR_SIZE(PyTypeObject *type, Py_ssize_t nitems) {
|
| 24 |
+
size_t size = _Py_STATIC_CAST(size_t, type->tp_basicsize);
|
| 25 |
+
size += _Py_STATIC_CAST(size_t, nitems) * _Py_STATIC_CAST(size_t, type->tp_itemsize);
|
| 26 |
+
return _Py_SIZE_ROUND_UP(size, SIZEOF_VOID_P);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
/* This example code implements an object constructor with a custom
|
| 31 |
+
allocator, where PyObject_New is inlined, and shows the important
|
| 32 |
+
distinction between two steps (at least):
|
| 33 |
+
1) the actual allocation of the object storage;
|
| 34 |
+
2) the initialization of the Python specific fields
|
| 35 |
+
in this storage with PyObject_{Init, InitVar}.
|
| 36 |
+
|
| 37 |
+
PyObject *
|
| 38 |
+
YourObject_New(...)
|
| 39 |
+
{
|
| 40 |
+
PyObject *op;
|
| 41 |
+
|
| 42 |
+
op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
|
| 43 |
+
if (op == NULL) {
|
| 44 |
+
return PyErr_NoMemory();
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
PyObject_Init(op, &YourTypeStruct);
|
| 48 |
+
|
| 49 |
+
op->ob_field = value;
|
| 50 |
+
...
|
| 51 |
+
return op;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
Note that in C++, the use of the new operator usually implies that
|
| 55 |
+
the 1st step is performed automatically for you, so in a C++ class
|
| 56 |
+
constructor you would start directly with PyObject_Init/InitVar. */
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
typedef struct {
|
| 60 |
+
/* user context passed as the first argument to the 2 functions */
|
| 61 |
+
void *ctx;
|
| 62 |
+
|
| 63 |
+
/* allocate an arena of size bytes */
|
| 64 |
+
void* (*alloc) (void *ctx, size_t size);
|
| 65 |
+
|
| 66 |
+
/* free an arena */
|
| 67 |
+
void (*free) (void *ctx, void *ptr, size_t size);
|
| 68 |
+
} PyObjectArenaAllocator;
|
| 69 |
+
|
| 70 |
+
/* Get the arena allocator. */
|
| 71 |
+
PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator);
|
| 72 |
+
|
| 73 |
+
/* Set the arena allocator. */
|
| 74 |
+
PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator);
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
/* Test if an object implements the garbage collector protocol */
|
| 78 |
+
PyAPI_FUNC(int) PyObject_IS_GC(PyObject *obj);
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
// Test if a type supports weak references
|
| 82 |
+
PyAPI_FUNC(int) PyType_SUPPORTS_WEAKREFS(PyTypeObject *type);
|
| 83 |
+
|
| 84 |
+
PyAPI_FUNC(PyObject **) PyObject_GET_WEAKREFS_LISTPTR(PyObject *op);
|
| 85 |
+
|
| 86 |
+
PyAPI_FUNC(PyObject *) PyUnstable_Object_GC_NewWithExtraData(PyTypeObject *,
|
| 87 |
+
size_t);
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
/* Visit all live GC-capable objects, similar to gc.get_objects(None). The
|
| 91 |
+
* supplied callback is called on every such object with the void* arg set
|
| 92 |
+
* to the supplied arg. Returning 0 from the callback ends iteration, returning
|
| 93 |
+
* 1 allows iteration to continue. Returning any other value may result in
|
| 94 |
+
* undefined behaviour.
|
| 95 |
+
*
|
| 96 |
+
* If new objects are (de)allocated by the callback it is undefined if they
|
| 97 |
+
* will be visited.
|
| 98 |
+
|
| 99 |
+
* Garbage collection is disabled during operation. Explicitly running a
|
| 100 |
+
* collection in the callback may lead to undefined behaviour e.g. visiting the
|
| 101 |
+
* same objects multiple times or not at all.
|
| 102 |
+
*/
|
| 103 |
+
typedef int (*gcvisitobjects_t)(PyObject*, void*);
|
| 104 |
+
PyAPI_FUNC(void) PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void* arg);
|
data/miniconda3/include/python3.13/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 */
|
data/miniconda3/include/python3.13/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 */
|
data/miniconda3/include/python3.13/cpython/pthread_stubs.h
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PTRHEAD_STUBS_H
|
| 2 |
+
#define Py_CPYTHON_PTRHEAD_STUBS_H
|
| 3 |
+
|
| 4 |
+
#if !defined(HAVE_PTHREAD_STUBS)
|
| 5 |
+
# error "this header file requires stubbed pthreads."
|
| 6 |
+
#endif
|
| 7 |
+
|
| 8 |
+
#ifndef _POSIX_THREADS
|
| 9 |
+
# define _POSIX_THREADS 1
|
| 10 |
+
#endif
|
| 11 |
+
|
| 12 |
+
/* Minimal pthread stubs for CPython.
|
| 13 |
+
*
|
| 14 |
+
* The stubs implement the minimum pthread API for CPython.
|
| 15 |
+
* - pthread_create() fails.
|
| 16 |
+
* - pthread_exit() calls exit(0).
|
| 17 |
+
* - pthread_key_*() functions implement minimal TSS without destructor.
|
| 18 |
+
* - all other functions do nothing and return 0.
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
#ifdef __wasi__
|
| 22 |
+
// WASI's bits/alltypes.h provides type definitions when __NEED_ is set.
|
| 23 |
+
// The header file can be included multiple times.
|
| 24 |
+
//
|
| 25 |
+
// <sys/types.h> may also define these macros.
|
| 26 |
+
# ifndef __NEED_pthread_cond_t
|
| 27 |
+
# define __NEED_pthread_cond_t 1
|
| 28 |
+
# endif
|
| 29 |
+
# ifndef __NEED_pthread_condattr_t
|
| 30 |
+
# define __NEED_pthread_condattr_t 1
|
| 31 |
+
# endif
|
| 32 |
+
# ifndef __NEED_pthread_mutex_t
|
| 33 |
+
# define __NEED_pthread_mutex_t 1
|
| 34 |
+
# endif
|
| 35 |
+
# ifndef __NEED_pthread_mutexattr_t
|
| 36 |
+
# define __NEED_pthread_mutexattr_t 1
|
| 37 |
+
# endif
|
| 38 |
+
# ifndef __NEED_pthread_key_t
|
| 39 |
+
# define __NEED_pthread_key_t 1
|
| 40 |
+
# endif
|
| 41 |
+
# ifndef __NEED_pthread_t
|
| 42 |
+
# define __NEED_pthread_t 1
|
| 43 |
+
# endif
|
| 44 |
+
# ifndef __NEED_pthread_attr_t
|
| 45 |
+
# define __NEED_pthread_attr_t 1
|
| 46 |
+
# endif
|
| 47 |
+
# include <bits/alltypes.h>
|
| 48 |
+
#else
|
| 49 |
+
typedef struct { void *__x; } pthread_cond_t;
|
| 50 |
+
typedef struct { unsigned __attr; } pthread_condattr_t;
|
| 51 |
+
typedef struct { void *__x; } pthread_mutex_t;
|
| 52 |
+
typedef struct { unsigned __attr; } pthread_mutexattr_t;
|
| 53 |
+
typedef unsigned pthread_key_t;
|
| 54 |
+
typedef unsigned pthread_t;
|
| 55 |
+
typedef struct { unsigned __attr; } pthread_attr_t;
|
| 56 |
+
#endif
|
| 57 |
+
|
| 58 |
+
// mutex
|
| 59 |
+
PyAPI_FUNC(int) pthread_mutex_init(pthread_mutex_t *restrict mutex,
|
| 60 |
+
const pthread_mutexattr_t *restrict attr);
|
| 61 |
+
PyAPI_FUNC(int) pthread_mutex_destroy(pthread_mutex_t *mutex);
|
| 62 |
+
PyAPI_FUNC(int) pthread_mutex_trylock(pthread_mutex_t *mutex);
|
| 63 |
+
PyAPI_FUNC(int) pthread_mutex_lock(pthread_mutex_t *mutex);
|
| 64 |
+
PyAPI_FUNC(int) pthread_mutex_unlock(pthread_mutex_t *mutex);
|
| 65 |
+
|
| 66 |
+
// condition
|
| 67 |
+
PyAPI_FUNC(int) pthread_cond_init(pthread_cond_t *restrict cond,
|
| 68 |
+
const pthread_condattr_t *restrict attr);
|
| 69 |
+
PyAPI_FUNC(int) pthread_cond_destroy(pthread_cond_t *cond);
|
| 70 |
+
PyAPI_FUNC(int) pthread_cond_wait(pthread_cond_t *restrict cond,
|
| 71 |
+
pthread_mutex_t *restrict mutex);
|
| 72 |
+
PyAPI_FUNC(int) pthread_cond_timedwait(pthread_cond_t *restrict cond,
|
| 73 |
+
pthread_mutex_t *restrict mutex,
|
| 74 |
+
const struct timespec *restrict abstime);
|
| 75 |
+
PyAPI_FUNC(int) pthread_cond_signal(pthread_cond_t *cond);
|
| 76 |
+
PyAPI_FUNC(int) pthread_condattr_init(pthread_condattr_t *attr);
|
| 77 |
+
PyAPI_FUNC(int) pthread_condattr_setclock(
|
| 78 |
+
pthread_condattr_t *attr, clockid_t clock_id);
|
| 79 |
+
|
| 80 |
+
// pthread
|
| 81 |
+
PyAPI_FUNC(int) pthread_create(pthread_t *restrict thread,
|
| 82 |
+
const pthread_attr_t *restrict attr,
|
| 83 |
+
void *(*start_routine)(void *),
|
| 84 |
+
void *restrict arg);
|
| 85 |
+
PyAPI_FUNC(int) pthread_detach(pthread_t thread);
|
| 86 |
+
PyAPI_FUNC(int) pthread_join(pthread_t thread, void** value_ptr);
|
| 87 |
+
PyAPI_FUNC(pthread_t) pthread_self(void);
|
| 88 |
+
PyAPI_FUNC(int) pthread_exit(void *retval) __attribute__ ((__noreturn__));
|
| 89 |
+
PyAPI_FUNC(int) pthread_attr_init(pthread_attr_t *attr);
|
| 90 |
+
PyAPI_FUNC(int) pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
|
| 91 |
+
PyAPI_FUNC(int) pthread_attr_destroy(pthread_attr_t *attr);
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
// pthread_key
|
| 95 |
+
#ifndef PTHREAD_KEYS_MAX
|
| 96 |
+
# define PTHREAD_KEYS_MAX 128
|
| 97 |
+
#endif
|
| 98 |
+
|
| 99 |
+
PyAPI_FUNC(int) pthread_key_create(pthread_key_t *key,
|
| 100 |
+
void (*destr_function)(void *));
|
| 101 |
+
PyAPI_FUNC(int) pthread_key_delete(pthread_key_t key);
|
| 102 |
+
PyAPI_FUNC(void *) pthread_getspecific(pthread_key_t key);
|
| 103 |
+
PyAPI_FUNC(int) pthread_setspecific(pthread_key_t key, const void *value);
|
| 104 |
+
|
| 105 |
+
#endif // Py_CPYTHON_PTRHEAD_STUBS_H
|
data/miniconda3/include/python3.13/cpython/pyatomic.h
ADDED
|
@@ -0,0 +1,569 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This header provides cross-platform low-level atomic operations
|
| 2 |
+
// similar to C11 atomics.
|
| 3 |
+
//
|
| 4 |
+
// Operations are sequentially consistent unless they have a suffix indicating
|
| 5 |
+
// otherwise. If in doubt, prefer the sequentially consistent operations.
|
| 6 |
+
//
|
| 7 |
+
// The "_relaxed" suffix for load and store operations indicates the "relaxed"
|
| 8 |
+
// memory order. They don't provide synchronization, but (roughly speaking)
|
| 9 |
+
// guarantee somewhat sane behavior for races instead of undefined behavior.
|
| 10 |
+
// In practice, they correspond to "normal" hardware load and store
|
| 11 |
+
// instructions, so they are almost as inexpensive as plain loads and stores
|
| 12 |
+
// in C.
|
| 13 |
+
//
|
| 14 |
+
// Note that atomic read-modify-write operations like _Py_atomic_add_* return
|
| 15 |
+
// the previous value of the atomic variable, not the new value.
|
| 16 |
+
//
|
| 17 |
+
// See https://en.cppreference.com/w/c/atomic for more information on C11
|
| 18 |
+
// atomics.
|
| 19 |
+
// See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2055r0.pdf
|
| 20 |
+
// "A Relaxed Guide to memory_order_relaxed" for discussion of and common usage
|
| 21 |
+
// or relaxed atomics.
|
| 22 |
+
//
|
| 23 |
+
// Functions with pseudo Python code:
|
| 24 |
+
//
|
| 25 |
+
// def _Py_atomic_load(obj):
|
| 26 |
+
// return obj # sequential consistency
|
| 27 |
+
//
|
| 28 |
+
// def _Py_atomic_load_relaxed(obj):
|
| 29 |
+
// return obj # relaxed consistency
|
| 30 |
+
//
|
| 31 |
+
// def _Py_atomic_store(obj, value):
|
| 32 |
+
// obj = value # sequential consistency
|
| 33 |
+
//
|
| 34 |
+
// def _Py_atomic_store_relaxed(obj, value):
|
| 35 |
+
// obj = value # relaxed consistency
|
| 36 |
+
//
|
| 37 |
+
// def _Py_atomic_exchange(obj, value):
|
| 38 |
+
// # sequential consistency
|
| 39 |
+
// old_obj = obj
|
| 40 |
+
// obj = value
|
| 41 |
+
// return old_obj
|
| 42 |
+
//
|
| 43 |
+
// def _Py_atomic_compare_exchange(obj, expected, desired):
|
| 44 |
+
// # sequential consistency
|
| 45 |
+
// if obj == expected:
|
| 46 |
+
// obj = desired
|
| 47 |
+
// return True
|
| 48 |
+
// else:
|
| 49 |
+
// expected = obj
|
| 50 |
+
// return False
|
| 51 |
+
//
|
| 52 |
+
// def _Py_atomic_add(obj, value):
|
| 53 |
+
// # sequential consistency
|
| 54 |
+
// old_obj = obj
|
| 55 |
+
// obj += value
|
| 56 |
+
// return old_obj
|
| 57 |
+
//
|
| 58 |
+
// def _Py_atomic_and(obj, value):
|
| 59 |
+
// # sequential consistency
|
| 60 |
+
// old_obj = obj
|
| 61 |
+
// obj &= value
|
| 62 |
+
// return old_obj
|
| 63 |
+
//
|
| 64 |
+
// def _Py_atomic_or(obj, value):
|
| 65 |
+
// # sequential consistency
|
| 66 |
+
// old_obj = obj
|
| 67 |
+
// obj |= value
|
| 68 |
+
// return old_obj
|
| 69 |
+
//
|
| 70 |
+
// Other functions:
|
| 71 |
+
//
|
| 72 |
+
// def _Py_atomic_load_ptr_acquire(obj):
|
| 73 |
+
// return obj # acquire
|
| 74 |
+
//
|
| 75 |
+
// def _Py_atomic_store_ptr_release(obj):
|
| 76 |
+
// return obj # release
|
| 77 |
+
//
|
| 78 |
+
// def _Py_atomic_fence_seq_cst():
|
| 79 |
+
// # sequential consistency
|
| 80 |
+
// ...
|
| 81 |
+
//
|
| 82 |
+
// def _Py_atomic_fence_release():
|
| 83 |
+
// # release
|
| 84 |
+
// ...
|
| 85 |
+
|
| 86 |
+
#ifndef Py_CPYTHON_ATOMIC_H
|
| 87 |
+
# error "this header file must not be included directly"
|
| 88 |
+
#endif
|
| 89 |
+
|
| 90 |
+
// --- _Py_atomic_add --------------------------------------------------------
|
| 91 |
+
// Atomically adds `value` to `obj` and returns the previous value
|
| 92 |
+
|
| 93 |
+
static inline int
|
| 94 |
+
_Py_atomic_add_int(int *obj, int value);
|
| 95 |
+
|
| 96 |
+
static inline int8_t
|
| 97 |
+
_Py_atomic_add_int8(int8_t *obj, int8_t value);
|
| 98 |
+
|
| 99 |
+
static inline int16_t
|
| 100 |
+
_Py_atomic_add_int16(int16_t *obj, int16_t value);
|
| 101 |
+
|
| 102 |
+
static inline int32_t
|
| 103 |
+
_Py_atomic_add_int32(int32_t *obj, int32_t value);
|
| 104 |
+
|
| 105 |
+
static inline int64_t
|
| 106 |
+
_Py_atomic_add_int64(int64_t *obj, int64_t value);
|
| 107 |
+
|
| 108 |
+
static inline intptr_t
|
| 109 |
+
_Py_atomic_add_intptr(intptr_t *obj, intptr_t value);
|
| 110 |
+
|
| 111 |
+
static inline unsigned int
|
| 112 |
+
_Py_atomic_add_uint(unsigned int *obj, unsigned int value);
|
| 113 |
+
|
| 114 |
+
static inline uint8_t
|
| 115 |
+
_Py_atomic_add_uint8(uint8_t *obj, uint8_t value);
|
| 116 |
+
|
| 117 |
+
static inline uint16_t
|
| 118 |
+
_Py_atomic_add_uint16(uint16_t *obj, uint16_t value);
|
| 119 |
+
|
| 120 |
+
static inline uint32_t
|
| 121 |
+
_Py_atomic_add_uint32(uint32_t *obj, uint32_t value);
|
| 122 |
+
|
| 123 |
+
static inline uint64_t
|
| 124 |
+
_Py_atomic_add_uint64(uint64_t *obj, uint64_t value);
|
| 125 |
+
|
| 126 |
+
static inline uintptr_t
|
| 127 |
+
_Py_atomic_add_uintptr(uintptr_t *obj, uintptr_t value);
|
| 128 |
+
|
| 129 |
+
static inline Py_ssize_t
|
| 130 |
+
_Py_atomic_add_ssize(Py_ssize_t *obj, Py_ssize_t value);
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
// --- _Py_atomic_compare_exchange -------------------------------------------
|
| 134 |
+
// Performs an atomic compare-and-exchange.
|
| 135 |
+
//
|
| 136 |
+
// - If `*obj` and `*expected` are equal, store `desired` into `*obj`
|
| 137 |
+
// and return 1 (success).
|
| 138 |
+
// - Otherwise, store the `*obj` current value into `*expected`
|
| 139 |
+
// and return 0 (failure).
|
| 140 |
+
//
|
| 141 |
+
// These correspond to the C11 atomic_compare_exchange_strong() function.
|
| 142 |
+
|
| 143 |
+
static inline int
|
| 144 |
+
_Py_atomic_compare_exchange_int(int *obj, int *expected, int desired);
|
| 145 |
+
|
| 146 |
+
static inline int
|
| 147 |
+
_Py_atomic_compare_exchange_int8(int8_t *obj, int8_t *expected, int8_t desired);
|
| 148 |
+
|
| 149 |
+
static inline int
|
| 150 |
+
_Py_atomic_compare_exchange_int16(int16_t *obj, int16_t *expected, int16_t desired);
|
| 151 |
+
|
| 152 |
+
static inline int
|
| 153 |
+
_Py_atomic_compare_exchange_int32(int32_t *obj, int32_t *expected, int32_t desired);
|
| 154 |
+
|
| 155 |
+
static inline int
|
| 156 |
+
_Py_atomic_compare_exchange_int64(int64_t *obj, int64_t *expected, int64_t desired);
|
| 157 |
+
|
| 158 |
+
static inline int
|
| 159 |
+
_Py_atomic_compare_exchange_intptr(intptr_t *obj, intptr_t *expected, intptr_t desired);
|
| 160 |
+
|
| 161 |
+
static inline int
|
| 162 |
+
_Py_atomic_compare_exchange_uint(unsigned int *obj, unsigned int *expected, unsigned int desired);
|
| 163 |
+
|
| 164 |
+
static inline int
|
| 165 |
+
_Py_atomic_compare_exchange_uint8(uint8_t *obj, uint8_t *expected, uint8_t desired);
|
| 166 |
+
|
| 167 |
+
static inline int
|
| 168 |
+
_Py_atomic_compare_exchange_uint16(uint16_t *obj, uint16_t *expected, uint16_t desired);
|
| 169 |
+
|
| 170 |
+
static inline int
|
| 171 |
+
_Py_atomic_compare_exchange_uint32(uint32_t *obj, uint32_t *expected, uint32_t desired);
|
| 172 |
+
|
| 173 |
+
static inline int
|
| 174 |
+
_Py_atomic_compare_exchange_uint64(uint64_t *obj, uint64_t *expected, uint64_t desired);
|
| 175 |
+
|
| 176 |
+
static inline int
|
| 177 |
+
_Py_atomic_compare_exchange_uintptr(uintptr_t *obj, uintptr_t *expected, uintptr_t desired);
|
| 178 |
+
|
| 179 |
+
static inline int
|
| 180 |
+
_Py_atomic_compare_exchange_ssize(Py_ssize_t *obj, Py_ssize_t *expected, Py_ssize_t desired);
|
| 181 |
+
|
| 182 |
+
// NOTE: `obj` and `expected` are logically `void**` types, but we use `void*`
|
| 183 |
+
// so that we can pass types like `PyObject**` without a cast.
|
| 184 |
+
static inline int
|
| 185 |
+
_Py_atomic_compare_exchange_ptr(void *obj, void *expected, void *value);
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
// --- _Py_atomic_exchange ---------------------------------------------------
|
| 189 |
+
// Atomically replaces `*obj` with `value` and returns the previous value of `*obj`.
|
| 190 |
+
|
| 191 |
+
static inline int
|
| 192 |
+
_Py_atomic_exchange_int(int *obj, int value);
|
| 193 |
+
|
| 194 |
+
static inline int8_t
|
| 195 |
+
_Py_atomic_exchange_int8(int8_t *obj, int8_t value);
|
| 196 |
+
|
| 197 |
+
static inline int16_t
|
| 198 |
+
_Py_atomic_exchange_int16(int16_t *obj, int16_t value);
|
| 199 |
+
|
| 200 |
+
static inline int32_t
|
| 201 |
+
_Py_atomic_exchange_int32(int32_t *obj, int32_t value);
|
| 202 |
+
|
| 203 |
+
static inline int64_t
|
| 204 |
+
_Py_atomic_exchange_int64(int64_t *obj, int64_t value);
|
| 205 |
+
|
| 206 |
+
static inline intptr_t
|
| 207 |
+
_Py_atomic_exchange_intptr(intptr_t *obj, intptr_t value);
|
| 208 |
+
|
| 209 |
+
static inline unsigned int
|
| 210 |
+
_Py_atomic_exchange_uint(unsigned int *obj, unsigned int value);
|
| 211 |
+
|
| 212 |
+
static inline uint8_t
|
| 213 |
+
_Py_atomic_exchange_uint8(uint8_t *obj, uint8_t value);
|
| 214 |
+
|
| 215 |
+
static inline uint16_t
|
| 216 |
+
_Py_atomic_exchange_uint16(uint16_t *obj, uint16_t value);
|
| 217 |
+
|
| 218 |
+
static inline uint32_t
|
| 219 |
+
_Py_atomic_exchange_uint32(uint32_t *obj, uint32_t value);
|
| 220 |
+
|
| 221 |
+
static inline uint64_t
|
| 222 |
+
_Py_atomic_exchange_uint64(uint64_t *obj, uint64_t value);
|
| 223 |
+
|
| 224 |
+
static inline uintptr_t
|
| 225 |
+
_Py_atomic_exchange_uintptr(uintptr_t *obj, uintptr_t value);
|
| 226 |
+
|
| 227 |
+
static inline Py_ssize_t
|
| 228 |
+
_Py_atomic_exchange_ssize(Py_ssize_t *obj, Py_ssize_t value);
|
| 229 |
+
|
| 230 |
+
static inline void *
|
| 231 |
+
_Py_atomic_exchange_ptr(void *obj, void *value);
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
// --- _Py_atomic_and --------------------------------------------------------
|
| 235 |
+
// Performs `*obj &= value` atomically and returns the previous value of `*obj`.
|
| 236 |
+
|
| 237 |
+
static inline uint8_t
|
| 238 |
+
_Py_atomic_and_uint8(uint8_t *obj, uint8_t value);
|
| 239 |
+
|
| 240 |
+
static inline uint16_t
|
| 241 |
+
_Py_atomic_and_uint16(uint16_t *obj, uint16_t value);
|
| 242 |
+
|
| 243 |
+
static inline uint32_t
|
| 244 |
+
_Py_atomic_and_uint32(uint32_t *obj, uint32_t value);
|
| 245 |
+
|
| 246 |
+
static inline uint64_t
|
| 247 |
+
_Py_atomic_and_uint64(uint64_t *obj, uint64_t value);
|
| 248 |
+
|
| 249 |
+
static inline uintptr_t
|
| 250 |
+
_Py_atomic_and_uintptr(uintptr_t *obj, uintptr_t value);
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
// --- _Py_atomic_or ---------------------------------------------------------
|
| 254 |
+
// Performs `*obj |= value` atomically and returns the previous value of `*obj`.
|
| 255 |
+
|
| 256 |
+
static inline uint8_t
|
| 257 |
+
_Py_atomic_or_uint8(uint8_t *obj, uint8_t value);
|
| 258 |
+
|
| 259 |
+
static inline uint16_t
|
| 260 |
+
_Py_atomic_or_uint16(uint16_t *obj, uint16_t value);
|
| 261 |
+
|
| 262 |
+
static inline uint32_t
|
| 263 |
+
_Py_atomic_or_uint32(uint32_t *obj, uint32_t value);
|
| 264 |
+
|
| 265 |
+
static inline uint64_t
|
| 266 |
+
_Py_atomic_or_uint64(uint64_t *obj, uint64_t value);
|
| 267 |
+
|
| 268 |
+
static inline uintptr_t
|
| 269 |
+
_Py_atomic_or_uintptr(uintptr_t *obj, uintptr_t value);
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
// --- _Py_atomic_load -------------------------------------------------------
|
| 273 |
+
// Atomically loads `*obj` (sequential consistency)
|
| 274 |
+
|
| 275 |
+
static inline int
|
| 276 |
+
_Py_atomic_load_int(const int *obj);
|
| 277 |
+
|
| 278 |
+
static inline int8_t
|
| 279 |
+
_Py_atomic_load_int8(const int8_t *obj);
|
| 280 |
+
|
| 281 |
+
static inline int16_t
|
| 282 |
+
_Py_atomic_load_int16(const int16_t *obj);
|
| 283 |
+
|
| 284 |
+
static inline int32_t
|
| 285 |
+
_Py_atomic_load_int32(const int32_t *obj);
|
| 286 |
+
|
| 287 |
+
static inline int64_t
|
| 288 |
+
_Py_atomic_load_int64(const int64_t *obj);
|
| 289 |
+
|
| 290 |
+
static inline intptr_t
|
| 291 |
+
_Py_atomic_load_intptr(const intptr_t *obj);
|
| 292 |
+
|
| 293 |
+
static inline uint8_t
|
| 294 |
+
_Py_atomic_load_uint8(const uint8_t *obj);
|
| 295 |
+
|
| 296 |
+
static inline uint16_t
|
| 297 |
+
_Py_atomic_load_uint16(const uint16_t *obj);
|
| 298 |
+
|
| 299 |
+
static inline uint32_t
|
| 300 |
+
_Py_atomic_load_uint32(const uint32_t *obj);
|
| 301 |
+
|
| 302 |
+
static inline uint64_t
|
| 303 |
+
_Py_atomic_load_uint64(const uint64_t *obj);
|
| 304 |
+
|
| 305 |
+
static inline uintptr_t
|
| 306 |
+
_Py_atomic_load_uintptr(const uintptr_t *obj);
|
| 307 |
+
|
| 308 |
+
static inline unsigned int
|
| 309 |
+
_Py_atomic_load_uint(const unsigned int *obj);
|
| 310 |
+
|
| 311 |
+
static inline Py_ssize_t
|
| 312 |
+
_Py_atomic_load_ssize(const Py_ssize_t *obj);
|
| 313 |
+
|
| 314 |
+
static inline void *
|
| 315 |
+
_Py_atomic_load_ptr(const void *obj);
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
// --- _Py_atomic_load_relaxed -----------------------------------------------
|
| 319 |
+
// Loads `*obj` (relaxed consistency, i.e., no ordering)
|
| 320 |
+
|
| 321 |
+
static inline int
|
| 322 |
+
_Py_atomic_load_int_relaxed(const int *obj);
|
| 323 |
+
|
| 324 |
+
static inline int8_t
|
| 325 |
+
_Py_atomic_load_int8_relaxed(const int8_t *obj);
|
| 326 |
+
|
| 327 |
+
static inline int16_t
|
| 328 |
+
_Py_atomic_load_int16_relaxed(const int16_t *obj);
|
| 329 |
+
|
| 330 |
+
static inline int32_t
|
| 331 |
+
_Py_atomic_load_int32_relaxed(const int32_t *obj);
|
| 332 |
+
|
| 333 |
+
static inline int64_t
|
| 334 |
+
_Py_atomic_load_int64_relaxed(const int64_t *obj);
|
| 335 |
+
|
| 336 |
+
static inline intptr_t
|
| 337 |
+
_Py_atomic_load_intptr_relaxed(const intptr_t *obj);
|
| 338 |
+
|
| 339 |
+
static inline uint8_t
|
| 340 |
+
_Py_atomic_load_uint8_relaxed(const uint8_t *obj);
|
| 341 |
+
|
| 342 |
+
static inline uint16_t
|
| 343 |
+
_Py_atomic_load_uint16_relaxed(const uint16_t *obj);
|
| 344 |
+
|
| 345 |
+
static inline uint32_t
|
| 346 |
+
_Py_atomic_load_uint32_relaxed(const uint32_t *obj);
|
| 347 |
+
|
| 348 |
+
static inline uint64_t
|
| 349 |
+
_Py_atomic_load_uint64_relaxed(const uint64_t *obj);
|
| 350 |
+
|
| 351 |
+
static inline uintptr_t
|
| 352 |
+
_Py_atomic_load_uintptr_relaxed(const uintptr_t *obj);
|
| 353 |
+
|
| 354 |
+
static inline unsigned int
|
| 355 |
+
_Py_atomic_load_uint_relaxed(const unsigned int *obj);
|
| 356 |
+
|
| 357 |
+
static inline Py_ssize_t
|
| 358 |
+
_Py_atomic_load_ssize_relaxed(const Py_ssize_t *obj);
|
| 359 |
+
|
| 360 |
+
static inline void *
|
| 361 |
+
_Py_atomic_load_ptr_relaxed(const void *obj);
|
| 362 |
+
|
| 363 |
+
static inline unsigned long long
|
| 364 |
+
_Py_atomic_load_ullong_relaxed(const unsigned long long *obj);
|
| 365 |
+
|
| 366 |
+
// --- _Py_atomic_store ------------------------------------------------------
|
| 367 |
+
// Atomically performs `*obj = value` (sequential consistency)
|
| 368 |
+
|
| 369 |
+
static inline void
|
| 370 |
+
_Py_atomic_store_int(int *obj, int value);
|
| 371 |
+
|
| 372 |
+
static inline void
|
| 373 |
+
_Py_atomic_store_int8(int8_t *obj, int8_t value);
|
| 374 |
+
|
| 375 |
+
static inline void
|
| 376 |
+
_Py_atomic_store_int16(int16_t *obj, int16_t value);
|
| 377 |
+
|
| 378 |
+
static inline void
|
| 379 |
+
_Py_atomic_store_int32(int32_t *obj, int32_t value);
|
| 380 |
+
|
| 381 |
+
static inline void
|
| 382 |
+
_Py_atomic_store_int64(int64_t *obj, int64_t value);
|
| 383 |
+
|
| 384 |
+
static inline void
|
| 385 |
+
_Py_atomic_store_intptr(intptr_t *obj, intptr_t value);
|
| 386 |
+
|
| 387 |
+
static inline void
|
| 388 |
+
_Py_atomic_store_uint8(uint8_t *obj, uint8_t value);
|
| 389 |
+
|
| 390 |
+
static inline void
|
| 391 |
+
_Py_atomic_store_uint16(uint16_t *obj, uint16_t value);
|
| 392 |
+
|
| 393 |
+
static inline void
|
| 394 |
+
_Py_atomic_store_uint32(uint32_t *obj, uint32_t value);
|
| 395 |
+
|
| 396 |
+
static inline void
|
| 397 |
+
_Py_atomic_store_uint64(uint64_t *obj, uint64_t value);
|
| 398 |
+
|
| 399 |
+
static inline void
|
| 400 |
+
_Py_atomic_store_uintptr(uintptr_t *obj, uintptr_t value);
|
| 401 |
+
|
| 402 |
+
static inline void
|
| 403 |
+
_Py_atomic_store_uint(unsigned int *obj, unsigned int value);
|
| 404 |
+
|
| 405 |
+
static inline void
|
| 406 |
+
_Py_atomic_store_ptr(void *obj, void *value);
|
| 407 |
+
|
| 408 |
+
static inline void
|
| 409 |
+
_Py_atomic_store_ssize(Py_ssize_t* obj, Py_ssize_t value);
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
// --- _Py_atomic_store_relaxed ----------------------------------------------
|
| 413 |
+
// Stores `*obj = value` (relaxed consistency, i.e., no ordering)
|
| 414 |
+
|
| 415 |
+
static inline void
|
| 416 |
+
_Py_atomic_store_int_relaxed(int *obj, int value);
|
| 417 |
+
|
| 418 |
+
static inline void
|
| 419 |
+
_Py_atomic_store_int8_relaxed(int8_t *obj, int8_t value);
|
| 420 |
+
|
| 421 |
+
static inline void
|
| 422 |
+
_Py_atomic_store_int16_relaxed(int16_t *obj, int16_t value);
|
| 423 |
+
|
| 424 |
+
static inline void
|
| 425 |
+
_Py_atomic_store_int32_relaxed(int32_t *obj, int32_t value);
|
| 426 |
+
|
| 427 |
+
static inline void
|
| 428 |
+
_Py_atomic_store_int64_relaxed(int64_t *obj, int64_t value);
|
| 429 |
+
|
| 430 |
+
static inline void
|
| 431 |
+
_Py_atomic_store_intptr_relaxed(intptr_t *obj, intptr_t value);
|
| 432 |
+
|
| 433 |
+
static inline void
|
| 434 |
+
_Py_atomic_store_uint8_relaxed(uint8_t* obj, uint8_t value);
|
| 435 |
+
|
| 436 |
+
static inline void
|
| 437 |
+
_Py_atomic_store_uint16_relaxed(uint16_t *obj, uint16_t value);
|
| 438 |
+
|
| 439 |
+
static inline void
|
| 440 |
+
_Py_atomic_store_uint32_relaxed(uint32_t *obj, uint32_t value);
|
| 441 |
+
|
| 442 |
+
static inline void
|
| 443 |
+
_Py_atomic_store_uint64_relaxed(uint64_t *obj, uint64_t value);
|
| 444 |
+
|
| 445 |
+
static inline void
|
| 446 |
+
_Py_atomic_store_uintptr_relaxed(uintptr_t *obj, uintptr_t value);
|
| 447 |
+
|
| 448 |
+
static inline void
|
| 449 |
+
_Py_atomic_store_uint_relaxed(unsigned int *obj, unsigned int value);
|
| 450 |
+
|
| 451 |
+
static inline void
|
| 452 |
+
_Py_atomic_store_ptr_relaxed(void *obj, void *value);
|
| 453 |
+
|
| 454 |
+
static inline void
|
| 455 |
+
_Py_atomic_store_ssize_relaxed(Py_ssize_t *obj, Py_ssize_t value);
|
| 456 |
+
|
| 457 |
+
static inline void
|
| 458 |
+
_Py_atomic_store_ullong_relaxed(unsigned long long *obj,
|
| 459 |
+
unsigned long long value);
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
// --- _Py_atomic_load_ptr_acquire / _Py_atomic_store_ptr_release ------------
|
| 463 |
+
|
| 464 |
+
// Loads `*obj` (acquire operation)
|
| 465 |
+
static inline void *
|
| 466 |
+
_Py_atomic_load_ptr_acquire(const void *obj);
|
| 467 |
+
|
| 468 |
+
static inline uintptr_t
|
| 469 |
+
_Py_atomic_load_uintptr_acquire(const uintptr_t *obj);
|
| 470 |
+
|
| 471 |
+
// Stores `*obj = value` (release operation)
|
| 472 |
+
static inline void
|
| 473 |
+
_Py_atomic_store_ptr_release(void *obj, void *value);
|
| 474 |
+
|
| 475 |
+
static inline void
|
| 476 |
+
_Py_atomic_store_uintptr_release(uintptr_t *obj, uintptr_t value);
|
| 477 |
+
|
| 478 |
+
static inline void
|
| 479 |
+
_Py_atomic_store_ssize_release(Py_ssize_t *obj, Py_ssize_t value);
|
| 480 |
+
|
| 481 |
+
static inline void
|
| 482 |
+
_Py_atomic_store_int_release(int *obj, int value);
|
| 483 |
+
|
| 484 |
+
static inline int
|
| 485 |
+
_Py_atomic_load_int_acquire(const int *obj);
|
| 486 |
+
|
| 487 |
+
static inline void
|
| 488 |
+
_Py_atomic_store_uint32_release(uint32_t *obj, uint32_t value);
|
| 489 |
+
|
| 490 |
+
static inline void
|
| 491 |
+
_Py_atomic_store_uint64_release(uint64_t *obj, uint64_t value);
|
| 492 |
+
|
| 493 |
+
static inline uint64_t
|
| 494 |
+
_Py_atomic_load_uint64_acquire(const uint64_t *obj);
|
| 495 |
+
|
| 496 |
+
static inline uint32_t
|
| 497 |
+
_Py_atomic_load_uint32_acquire(const uint32_t *obj);
|
| 498 |
+
|
| 499 |
+
static inline Py_ssize_t
|
| 500 |
+
_Py_atomic_load_ssize_acquire(const Py_ssize_t *obj);
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
// --- _Py_atomic_fence ------------------------------------------------------
|
| 506 |
+
|
| 507 |
+
// Sequential consistency fence. C11 fences have complex semantics. When
|
| 508 |
+
// possible, use the atomic operations on variables defined above, which
|
| 509 |
+
// generally do not require explicit use of a fence.
|
| 510 |
+
// See https://en.cppreference.com/w/cpp/atomic/atomic_thread_fence
|
| 511 |
+
static inline void _Py_atomic_fence_seq_cst(void);
|
| 512 |
+
|
| 513 |
+
// Acquire fence
|
| 514 |
+
static inline void _Py_atomic_fence_acquire(void);
|
| 515 |
+
|
| 516 |
+
// Release fence
|
| 517 |
+
static inline void _Py_atomic_fence_release(void);
|
| 518 |
+
|
| 519 |
+
|
| 520 |
+
#ifndef _Py_USE_GCC_BUILTIN_ATOMICS
|
| 521 |
+
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
|
| 522 |
+
# define _Py_USE_GCC_BUILTIN_ATOMICS 1
|
| 523 |
+
# elif defined(__clang__)
|
| 524 |
+
# if __has_builtin(__atomic_load)
|
| 525 |
+
# define _Py_USE_GCC_BUILTIN_ATOMICS 1
|
| 526 |
+
# endif
|
| 527 |
+
# endif
|
| 528 |
+
#endif
|
| 529 |
+
|
| 530 |
+
#if _Py_USE_GCC_BUILTIN_ATOMICS
|
| 531 |
+
# define Py_ATOMIC_GCC_H
|
| 532 |
+
# include "pyatomic_gcc.h"
|
| 533 |
+
# undef Py_ATOMIC_GCC_H
|
| 534 |
+
#elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__)
|
| 535 |
+
# define Py_ATOMIC_STD_H
|
| 536 |
+
# include "pyatomic_std.h"
|
| 537 |
+
# undef Py_ATOMIC_STD_H
|
| 538 |
+
#elif defined(_MSC_VER)
|
| 539 |
+
# define Py_ATOMIC_MSC_H
|
| 540 |
+
# include "pyatomic_msc.h"
|
| 541 |
+
# undef Py_ATOMIC_MSC_H
|
| 542 |
+
#else
|
| 543 |
+
# error "no available pyatomic implementation for this platform/compiler"
|
| 544 |
+
#endif
|
| 545 |
+
|
| 546 |
+
|
| 547 |
+
// --- aliases ---------------------------------------------------------------
|
| 548 |
+
|
| 549 |
+
#if SIZEOF_LONG == 8
|
| 550 |
+
# define _Py_atomic_load_ulong(p) \
|
| 551 |
+
_Py_atomic_load_uint64((uint64_t *)p)
|
| 552 |
+
# define _Py_atomic_load_ulong_relaxed(p) \
|
| 553 |
+
_Py_atomic_load_uint64_relaxed((uint64_t *)p)
|
| 554 |
+
# define _Py_atomic_store_ulong(p, v) \
|
| 555 |
+
_Py_atomic_store_uint64((uint64_t *)p, v)
|
| 556 |
+
# define _Py_atomic_store_ulong_relaxed(p, v) \
|
| 557 |
+
_Py_atomic_store_uint64_relaxed((uint64_t *)p, v)
|
| 558 |
+
#elif SIZEOF_LONG == 4
|
| 559 |
+
# define _Py_atomic_load_ulong(p) \
|
| 560 |
+
_Py_atomic_load_uint32((uint32_t *)p)
|
| 561 |
+
# define _Py_atomic_load_ulong_relaxed(p) \
|
| 562 |
+
_Py_atomic_load_uint32_relaxed((uint32_t *)p)
|
| 563 |
+
# define _Py_atomic_store_ulong(p, v) \
|
| 564 |
+
_Py_atomic_store_uint32((uint32_t *)p, v)
|
| 565 |
+
# define _Py_atomic_store_ulong_relaxed(p, v) \
|
| 566 |
+
_Py_atomic_store_uint32_relaxed((uint32_t *)p, v)
|
| 567 |
+
#else
|
| 568 |
+
# error "long must be 4 or 8 bytes in size"
|
| 569 |
+
#endif // SIZEOF_LONG
|
data/miniconda3/include/python3.13/cpython/pyatomic_gcc.h
ADDED
|
@@ -0,0 +1,551 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This is the implementation of Python atomic operations using GCC's built-in
|
| 2 |
+
// functions that match the C+11 memory model. This implementation is preferred
|
| 3 |
+
// for GCC compatible compilers, such as Clang. These functions are available
|
| 4 |
+
// in GCC 4.8+ without needing to compile with --std=c11 or --std=gnu11.
|
| 5 |
+
|
| 6 |
+
#ifndef Py_ATOMIC_GCC_H
|
| 7 |
+
# error "this header file must not be included directly"
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
// --- _Py_atomic_add --------------------------------------------------------
|
| 12 |
+
|
| 13 |
+
static inline int
|
| 14 |
+
_Py_atomic_add_int(int *obj, int value)
|
| 15 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 16 |
+
|
| 17 |
+
static inline int8_t
|
| 18 |
+
_Py_atomic_add_int8(int8_t *obj, int8_t value)
|
| 19 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 20 |
+
|
| 21 |
+
static inline int16_t
|
| 22 |
+
_Py_atomic_add_int16(int16_t *obj, int16_t value)
|
| 23 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 24 |
+
|
| 25 |
+
static inline int32_t
|
| 26 |
+
_Py_atomic_add_int32(int32_t *obj, int32_t value)
|
| 27 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 28 |
+
|
| 29 |
+
static inline int64_t
|
| 30 |
+
_Py_atomic_add_int64(int64_t *obj, int64_t value)
|
| 31 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 32 |
+
|
| 33 |
+
static inline intptr_t
|
| 34 |
+
_Py_atomic_add_intptr(intptr_t *obj, intptr_t value)
|
| 35 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 36 |
+
|
| 37 |
+
static inline unsigned int
|
| 38 |
+
_Py_atomic_add_uint(unsigned int *obj, unsigned int value)
|
| 39 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 40 |
+
|
| 41 |
+
static inline uint8_t
|
| 42 |
+
_Py_atomic_add_uint8(uint8_t *obj, uint8_t value)
|
| 43 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 44 |
+
|
| 45 |
+
static inline uint16_t
|
| 46 |
+
_Py_atomic_add_uint16(uint16_t *obj, uint16_t value)
|
| 47 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 48 |
+
|
| 49 |
+
static inline uint32_t
|
| 50 |
+
_Py_atomic_add_uint32(uint32_t *obj, uint32_t value)
|
| 51 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 52 |
+
|
| 53 |
+
static inline uint64_t
|
| 54 |
+
_Py_atomic_add_uint64(uint64_t *obj, uint64_t value)
|
| 55 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 56 |
+
|
| 57 |
+
static inline uintptr_t
|
| 58 |
+
_Py_atomic_add_uintptr(uintptr_t *obj, uintptr_t value)
|
| 59 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 60 |
+
|
| 61 |
+
static inline Py_ssize_t
|
| 62 |
+
_Py_atomic_add_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 63 |
+
{ return __atomic_fetch_add(obj, value, __ATOMIC_SEQ_CST); }
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
// --- _Py_atomic_compare_exchange -------------------------------------------
|
| 67 |
+
|
| 68 |
+
static inline int
|
| 69 |
+
_Py_atomic_compare_exchange_int(int *obj, int *expected, int desired)
|
| 70 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 71 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 72 |
+
|
| 73 |
+
static inline int
|
| 74 |
+
_Py_atomic_compare_exchange_int8(int8_t *obj, int8_t *expected, int8_t desired)
|
| 75 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 76 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 77 |
+
|
| 78 |
+
static inline int
|
| 79 |
+
_Py_atomic_compare_exchange_int16(int16_t *obj, int16_t *expected, int16_t desired)
|
| 80 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 81 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 82 |
+
|
| 83 |
+
static inline int
|
| 84 |
+
_Py_atomic_compare_exchange_int32(int32_t *obj, int32_t *expected, int32_t desired)
|
| 85 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 86 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 87 |
+
|
| 88 |
+
static inline int
|
| 89 |
+
_Py_atomic_compare_exchange_int64(int64_t *obj, int64_t *expected, int64_t desired)
|
| 90 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 91 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 92 |
+
|
| 93 |
+
static inline int
|
| 94 |
+
_Py_atomic_compare_exchange_intptr(intptr_t *obj, intptr_t *expected, intptr_t desired)
|
| 95 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 96 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 97 |
+
|
| 98 |
+
static inline int
|
| 99 |
+
_Py_atomic_compare_exchange_uint(unsigned int *obj, unsigned int *expected, unsigned int desired)
|
| 100 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 101 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 102 |
+
|
| 103 |
+
static inline int
|
| 104 |
+
_Py_atomic_compare_exchange_uint8(uint8_t *obj, uint8_t *expected, uint8_t desired)
|
| 105 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 106 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 107 |
+
|
| 108 |
+
static inline int
|
| 109 |
+
_Py_atomic_compare_exchange_uint16(uint16_t *obj, uint16_t *expected, uint16_t desired)
|
| 110 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 111 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 112 |
+
|
| 113 |
+
static inline int
|
| 114 |
+
_Py_atomic_compare_exchange_uint32(uint32_t *obj, uint32_t *expected, uint32_t desired)
|
| 115 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 116 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 117 |
+
|
| 118 |
+
static inline int
|
| 119 |
+
_Py_atomic_compare_exchange_uint64(uint64_t *obj, uint64_t *expected, uint64_t desired)
|
| 120 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 121 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 122 |
+
|
| 123 |
+
static inline int
|
| 124 |
+
_Py_atomic_compare_exchange_uintptr(uintptr_t *obj, uintptr_t *expected, uintptr_t desired)
|
| 125 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 126 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 127 |
+
|
| 128 |
+
static inline int
|
| 129 |
+
_Py_atomic_compare_exchange_ssize(Py_ssize_t *obj, Py_ssize_t *expected, Py_ssize_t desired)
|
| 130 |
+
{ return __atomic_compare_exchange_n(obj, expected, desired, 0,
|
| 131 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 132 |
+
|
| 133 |
+
static inline int
|
| 134 |
+
_Py_atomic_compare_exchange_ptr(void *obj, void *expected, void *desired)
|
| 135 |
+
{ return __atomic_compare_exchange_n((void **)obj, (void **)expected, desired, 0,
|
| 136 |
+
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
// --- _Py_atomic_exchange ---------------------------------------------------
|
| 140 |
+
|
| 141 |
+
static inline int
|
| 142 |
+
_Py_atomic_exchange_int(int *obj, int value)
|
| 143 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 144 |
+
|
| 145 |
+
static inline int8_t
|
| 146 |
+
_Py_atomic_exchange_int8(int8_t *obj, int8_t value)
|
| 147 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 148 |
+
|
| 149 |
+
static inline int16_t
|
| 150 |
+
_Py_atomic_exchange_int16(int16_t *obj, int16_t value)
|
| 151 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 152 |
+
|
| 153 |
+
static inline int32_t
|
| 154 |
+
_Py_atomic_exchange_int32(int32_t *obj, int32_t value)
|
| 155 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 156 |
+
|
| 157 |
+
static inline int64_t
|
| 158 |
+
_Py_atomic_exchange_int64(int64_t *obj, int64_t value)
|
| 159 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 160 |
+
|
| 161 |
+
static inline intptr_t
|
| 162 |
+
_Py_atomic_exchange_intptr(intptr_t *obj, intptr_t value)
|
| 163 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 164 |
+
|
| 165 |
+
static inline unsigned int
|
| 166 |
+
_Py_atomic_exchange_uint(unsigned int *obj, unsigned int value)
|
| 167 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 168 |
+
|
| 169 |
+
static inline uint8_t
|
| 170 |
+
_Py_atomic_exchange_uint8(uint8_t *obj, uint8_t value)
|
| 171 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 172 |
+
|
| 173 |
+
static inline uint16_t
|
| 174 |
+
_Py_atomic_exchange_uint16(uint16_t *obj, uint16_t value)
|
| 175 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 176 |
+
|
| 177 |
+
static inline uint32_t
|
| 178 |
+
_Py_atomic_exchange_uint32(uint32_t *obj, uint32_t value)
|
| 179 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 180 |
+
|
| 181 |
+
static inline uint64_t
|
| 182 |
+
_Py_atomic_exchange_uint64(uint64_t *obj, uint64_t value)
|
| 183 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 184 |
+
|
| 185 |
+
static inline uintptr_t
|
| 186 |
+
_Py_atomic_exchange_uintptr(uintptr_t *obj, uintptr_t value)
|
| 187 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 188 |
+
|
| 189 |
+
static inline Py_ssize_t
|
| 190 |
+
_Py_atomic_exchange_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 191 |
+
{ return __atomic_exchange_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 192 |
+
|
| 193 |
+
static inline void *
|
| 194 |
+
_Py_atomic_exchange_ptr(void *obj, void *value)
|
| 195 |
+
{ return __atomic_exchange_n((void **)obj, value, __ATOMIC_SEQ_CST); }
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
// --- _Py_atomic_and --------------------------------------------------------
|
| 199 |
+
|
| 200 |
+
static inline uint8_t
|
| 201 |
+
_Py_atomic_and_uint8(uint8_t *obj, uint8_t value)
|
| 202 |
+
{ return __atomic_fetch_and(obj, value, __ATOMIC_SEQ_CST); }
|
| 203 |
+
|
| 204 |
+
static inline uint16_t
|
| 205 |
+
_Py_atomic_and_uint16(uint16_t *obj, uint16_t value)
|
| 206 |
+
{ return __atomic_fetch_and(obj, value, __ATOMIC_SEQ_CST); }
|
| 207 |
+
|
| 208 |
+
static inline uint32_t
|
| 209 |
+
_Py_atomic_and_uint32(uint32_t *obj, uint32_t value)
|
| 210 |
+
{ return __atomic_fetch_and(obj, value, __ATOMIC_SEQ_CST); }
|
| 211 |
+
|
| 212 |
+
static inline uint64_t
|
| 213 |
+
_Py_atomic_and_uint64(uint64_t *obj, uint64_t value)
|
| 214 |
+
{ return __atomic_fetch_and(obj, value, __ATOMIC_SEQ_CST); }
|
| 215 |
+
|
| 216 |
+
static inline uintptr_t
|
| 217 |
+
_Py_atomic_and_uintptr(uintptr_t *obj, uintptr_t value)
|
| 218 |
+
{ return __atomic_fetch_and(obj, value, __ATOMIC_SEQ_CST); }
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
// --- _Py_atomic_or ---------------------------------------------------------
|
| 222 |
+
|
| 223 |
+
static inline uint8_t
|
| 224 |
+
_Py_atomic_or_uint8(uint8_t *obj, uint8_t value)
|
| 225 |
+
{ return __atomic_fetch_or(obj, value, __ATOMIC_SEQ_CST); }
|
| 226 |
+
|
| 227 |
+
static inline uint16_t
|
| 228 |
+
_Py_atomic_or_uint16(uint16_t *obj, uint16_t value)
|
| 229 |
+
{ return __atomic_fetch_or(obj, value, __ATOMIC_SEQ_CST); }
|
| 230 |
+
|
| 231 |
+
static inline uint32_t
|
| 232 |
+
_Py_atomic_or_uint32(uint32_t *obj, uint32_t value)
|
| 233 |
+
{ return __atomic_fetch_or(obj, value, __ATOMIC_SEQ_CST); }
|
| 234 |
+
|
| 235 |
+
static inline uint64_t
|
| 236 |
+
_Py_atomic_or_uint64(uint64_t *obj, uint64_t value)
|
| 237 |
+
{ return __atomic_fetch_or(obj, value, __ATOMIC_SEQ_CST); }
|
| 238 |
+
|
| 239 |
+
static inline uintptr_t
|
| 240 |
+
_Py_atomic_or_uintptr(uintptr_t *obj, uintptr_t value)
|
| 241 |
+
{ return __atomic_fetch_or(obj, value, __ATOMIC_SEQ_CST); }
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
// --- _Py_atomic_load -------------------------------------------------------
|
| 245 |
+
|
| 246 |
+
static inline int
|
| 247 |
+
_Py_atomic_load_int(const int *obj)
|
| 248 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 249 |
+
|
| 250 |
+
static inline int8_t
|
| 251 |
+
_Py_atomic_load_int8(const int8_t *obj)
|
| 252 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 253 |
+
|
| 254 |
+
static inline int16_t
|
| 255 |
+
_Py_atomic_load_int16(const int16_t *obj)
|
| 256 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 257 |
+
|
| 258 |
+
static inline int32_t
|
| 259 |
+
_Py_atomic_load_int32(const int32_t *obj)
|
| 260 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 261 |
+
|
| 262 |
+
static inline int64_t
|
| 263 |
+
_Py_atomic_load_int64(const int64_t *obj)
|
| 264 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 265 |
+
|
| 266 |
+
static inline intptr_t
|
| 267 |
+
_Py_atomic_load_intptr(const intptr_t *obj)
|
| 268 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 269 |
+
|
| 270 |
+
static inline uint8_t
|
| 271 |
+
_Py_atomic_load_uint8(const uint8_t *obj)
|
| 272 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 273 |
+
|
| 274 |
+
static inline uint16_t
|
| 275 |
+
_Py_atomic_load_uint16(const uint16_t *obj)
|
| 276 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 277 |
+
|
| 278 |
+
static inline uint32_t
|
| 279 |
+
_Py_atomic_load_uint32(const uint32_t *obj)
|
| 280 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 281 |
+
|
| 282 |
+
static inline uint64_t
|
| 283 |
+
_Py_atomic_load_uint64(const uint64_t *obj)
|
| 284 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 285 |
+
|
| 286 |
+
static inline uintptr_t
|
| 287 |
+
_Py_atomic_load_uintptr(const uintptr_t *obj)
|
| 288 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 289 |
+
|
| 290 |
+
static inline unsigned int
|
| 291 |
+
_Py_atomic_load_uint(const unsigned int *obj)
|
| 292 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 293 |
+
|
| 294 |
+
static inline Py_ssize_t
|
| 295 |
+
_Py_atomic_load_ssize(const Py_ssize_t *obj)
|
| 296 |
+
{ return __atomic_load_n(obj, __ATOMIC_SEQ_CST); }
|
| 297 |
+
|
| 298 |
+
static inline void *
|
| 299 |
+
_Py_atomic_load_ptr(const void *obj)
|
| 300 |
+
{ return (void *)__atomic_load_n((void * const *)obj, __ATOMIC_SEQ_CST); }
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
// --- _Py_atomic_load_relaxed -----------------------------------------------
|
| 304 |
+
|
| 305 |
+
static inline int
|
| 306 |
+
_Py_atomic_load_int_relaxed(const int *obj)
|
| 307 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 308 |
+
|
| 309 |
+
static inline int8_t
|
| 310 |
+
_Py_atomic_load_int8_relaxed(const int8_t *obj)
|
| 311 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 312 |
+
|
| 313 |
+
static inline int16_t
|
| 314 |
+
_Py_atomic_load_int16_relaxed(const int16_t *obj)
|
| 315 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 316 |
+
|
| 317 |
+
static inline int32_t
|
| 318 |
+
_Py_atomic_load_int32_relaxed(const int32_t *obj)
|
| 319 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 320 |
+
|
| 321 |
+
static inline int64_t
|
| 322 |
+
_Py_atomic_load_int64_relaxed(const int64_t *obj)
|
| 323 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 324 |
+
|
| 325 |
+
static inline intptr_t
|
| 326 |
+
_Py_atomic_load_intptr_relaxed(const intptr_t *obj)
|
| 327 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 328 |
+
|
| 329 |
+
static inline uint8_t
|
| 330 |
+
_Py_atomic_load_uint8_relaxed(const uint8_t *obj)
|
| 331 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 332 |
+
|
| 333 |
+
static inline uint16_t
|
| 334 |
+
_Py_atomic_load_uint16_relaxed(const uint16_t *obj)
|
| 335 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 336 |
+
|
| 337 |
+
static inline uint32_t
|
| 338 |
+
_Py_atomic_load_uint32_relaxed(const uint32_t *obj)
|
| 339 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 340 |
+
|
| 341 |
+
static inline uint64_t
|
| 342 |
+
_Py_atomic_load_uint64_relaxed(const uint64_t *obj)
|
| 343 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 344 |
+
|
| 345 |
+
static inline uintptr_t
|
| 346 |
+
_Py_atomic_load_uintptr_relaxed(const uintptr_t *obj)
|
| 347 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 348 |
+
|
| 349 |
+
static inline unsigned int
|
| 350 |
+
_Py_atomic_load_uint_relaxed(const unsigned int *obj)
|
| 351 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 352 |
+
|
| 353 |
+
static inline Py_ssize_t
|
| 354 |
+
_Py_atomic_load_ssize_relaxed(const Py_ssize_t *obj)
|
| 355 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 356 |
+
|
| 357 |
+
static inline void *
|
| 358 |
+
_Py_atomic_load_ptr_relaxed(const void *obj)
|
| 359 |
+
{ return (void *)__atomic_load_n((void * const *)obj, __ATOMIC_RELAXED); }
|
| 360 |
+
|
| 361 |
+
static inline unsigned long long
|
| 362 |
+
_Py_atomic_load_ullong_relaxed(const unsigned long long *obj)
|
| 363 |
+
{ return __atomic_load_n(obj, __ATOMIC_RELAXED); }
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
// --- _Py_atomic_store ------------------------------------------------------
|
| 367 |
+
|
| 368 |
+
static inline void
|
| 369 |
+
_Py_atomic_store_int(int *obj, int value)
|
| 370 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 371 |
+
|
| 372 |
+
static inline void
|
| 373 |
+
_Py_atomic_store_int8(int8_t *obj, int8_t value)
|
| 374 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 375 |
+
|
| 376 |
+
static inline void
|
| 377 |
+
_Py_atomic_store_int16(int16_t *obj, int16_t value)
|
| 378 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 379 |
+
|
| 380 |
+
static inline void
|
| 381 |
+
_Py_atomic_store_int32(int32_t *obj, int32_t value)
|
| 382 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 383 |
+
|
| 384 |
+
static inline void
|
| 385 |
+
_Py_atomic_store_int64(int64_t *obj, int64_t value)
|
| 386 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 387 |
+
|
| 388 |
+
static inline void
|
| 389 |
+
_Py_atomic_store_intptr(intptr_t *obj, intptr_t value)
|
| 390 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 391 |
+
|
| 392 |
+
static inline void
|
| 393 |
+
_Py_atomic_store_uint8(uint8_t *obj, uint8_t value)
|
| 394 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 395 |
+
|
| 396 |
+
static inline void
|
| 397 |
+
_Py_atomic_store_uint16(uint16_t *obj, uint16_t value)
|
| 398 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 399 |
+
|
| 400 |
+
static inline void
|
| 401 |
+
_Py_atomic_store_uint32(uint32_t *obj, uint32_t value)
|
| 402 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 403 |
+
|
| 404 |
+
static inline void
|
| 405 |
+
_Py_atomic_store_uint64(uint64_t *obj, uint64_t value)
|
| 406 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 407 |
+
|
| 408 |
+
static inline void
|
| 409 |
+
_Py_atomic_store_uintptr(uintptr_t *obj, uintptr_t value)
|
| 410 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 411 |
+
|
| 412 |
+
static inline void
|
| 413 |
+
_Py_atomic_store_uint(unsigned int *obj, unsigned int value)
|
| 414 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 415 |
+
|
| 416 |
+
static inline void
|
| 417 |
+
_Py_atomic_store_ptr(void *obj, void *value)
|
| 418 |
+
{ __atomic_store_n((void **)obj, value, __ATOMIC_SEQ_CST); }
|
| 419 |
+
|
| 420 |
+
static inline void
|
| 421 |
+
_Py_atomic_store_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 422 |
+
{ __atomic_store_n(obj, value, __ATOMIC_SEQ_CST); }
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
// --- _Py_atomic_store_relaxed ----------------------------------------------
|
| 426 |
+
|
| 427 |
+
static inline void
|
| 428 |
+
_Py_atomic_store_int_relaxed(int *obj, int value)
|
| 429 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 430 |
+
|
| 431 |
+
static inline void
|
| 432 |
+
_Py_atomic_store_int8_relaxed(int8_t *obj, int8_t value)
|
| 433 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 434 |
+
|
| 435 |
+
static inline void
|
| 436 |
+
_Py_atomic_store_int16_relaxed(int16_t *obj, int16_t value)
|
| 437 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 438 |
+
|
| 439 |
+
static inline void
|
| 440 |
+
_Py_atomic_store_int32_relaxed(int32_t *obj, int32_t value)
|
| 441 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 442 |
+
|
| 443 |
+
static inline void
|
| 444 |
+
_Py_atomic_store_int64_relaxed(int64_t *obj, int64_t value)
|
| 445 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 446 |
+
|
| 447 |
+
static inline void
|
| 448 |
+
_Py_atomic_store_intptr_relaxed(intptr_t *obj, intptr_t value)
|
| 449 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 450 |
+
|
| 451 |
+
static inline void
|
| 452 |
+
_Py_atomic_store_uint8_relaxed(uint8_t *obj, uint8_t value)
|
| 453 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 454 |
+
|
| 455 |
+
static inline void
|
| 456 |
+
_Py_atomic_store_uint16_relaxed(uint16_t *obj, uint16_t value)
|
| 457 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 458 |
+
|
| 459 |
+
static inline void
|
| 460 |
+
_Py_atomic_store_uint32_relaxed(uint32_t *obj, uint32_t value)
|
| 461 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 462 |
+
|
| 463 |
+
static inline void
|
| 464 |
+
_Py_atomic_store_uint64_relaxed(uint64_t *obj, uint64_t value)
|
| 465 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 466 |
+
|
| 467 |
+
static inline void
|
| 468 |
+
_Py_atomic_store_uintptr_relaxed(uintptr_t *obj, uintptr_t value)
|
| 469 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 470 |
+
|
| 471 |
+
static inline void
|
| 472 |
+
_Py_atomic_store_uint_relaxed(unsigned int *obj, unsigned int value)
|
| 473 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 474 |
+
|
| 475 |
+
static inline void
|
| 476 |
+
_Py_atomic_store_ptr_relaxed(void *obj, void *value)
|
| 477 |
+
{ __atomic_store_n((void **)obj, value, __ATOMIC_RELAXED); }
|
| 478 |
+
|
| 479 |
+
static inline void
|
| 480 |
+
_Py_atomic_store_ssize_relaxed(Py_ssize_t *obj, Py_ssize_t value)
|
| 481 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 482 |
+
|
| 483 |
+
static inline void
|
| 484 |
+
_Py_atomic_store_ullong_relaxed(unsigned long long *obj,
|
| 485 |
+
unsigned long long value)
|
| 486 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELAXED); }
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
// --- _Py_atomic_load_ptr_acquire / _Py_atomic_store_ptr_release ------------
|
| 490 |
+
|
| 491 |
+
static inline void *
|
| 492 |
+
_Py_atomic_load_ptr_acquire(const void *obj)
|
| 493 |
+
{ return (void *)__atomic_load_n((void * const *)obj, __ATOMIC_ACQUIRE); }
|
| 494 |
+
|
| 495 |
+
static inline uintptr_t
|
| 496 |
+
_Py_atomic_load_uintptr_acquire(const uintptr_t *obj)
|
| 497 |
+
{ return (uintptr_t)__atomic_load_n(obj, __ATOMIC_ACQUIRE); }
|
| 498 |
+
|
| 499 |
+
static inline void
|
| 500 |
+
_Py_atomic_store_ptr_release(void *obj, void *value)
|
| 501 |
+
{ __atomic_store_n((void **)obj, value, __ATOMIC_RELEASE); }
|
| 502 |
+
|
| 503 |
+
static inline void
|
| 504 |
+
_Py_atomic_store_uintptr_release(uintptr_t *obj, uintptr_t value)
|
| 505 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELEASE); }
|
| 506 |
+
|
| 507 |
+
static inline void
|
| 508 |
+
_Py_atomic_store_int_release(int *obj, int value)
|
| 509 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELEASE); }
|
| 510 |
+
|
| 511 |
+
static inline void
|
| 512 |
+
_Py_atomic_store_ssize_release(Py_ssize_t *obj, Py_ssize_t value)
|
| 513 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELEASE); }
|
| 514 |
+
|
| 515 |
+
static inline int
|
| 516 |
+
_Py_atomic_load_int_acquire(const int *obj)
|
| 517 |
+
{ return __atomic_load_n(obj, __ATOMIC_ACQUIRE); }
|
| 518 |
+
|
| 519 |
+
static inline void
|
| 520 |
+
_Py_atomic_store_uint32_release(uint32_t *obj, uint32_t value)
|
| 521 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELEASE); }
|
| 522 |
+
|
| 523 |
+
static inline void
|
| 524 |
+
_Py_atomic_store_uint64_release(uint64_t *obj, uint64_t value)
|
| 525 |
+
{ __atomic_store_n(obj, value, __ATOMIC_RELEASE); }
|
| 526 |
+
|
| 527 |
+
static inline uint64_t
|
| 528 |
+
_Py_atomic_load_uint64_acquire(const uint64_t *obj)
|
| 529 |
+
{ return __atomic_load_n(obj, __ATOMIC_ACQUIRE); }
|
| 530 |
+
|
| 531 |
+
static inline uint32_t
|
| 532 |
+
_Py_atomic_load_uint32_acquire(const uint32_t *obj)
|
| 533 |
+
{ return __atomic_load_n(obj, __ATOMIC_ACQUIRE); }
|
| 534 |
+
|
| 535 |
+
static inline Py_ssize_t
|
| 536 |
+
_Py_atomic_load_ssize_acquire(const Py_ssize_t *obj)
|
| 537 |
+
{ return __atomic_load_n(obj, __ATOMIC_ACQUIRE); }
|
| 538 |
+
|
| 539 |
+
// --- _Py_atomic_fence ------------------------------------------------------
|
| 540 |
+
|
| 541 |
+
static inline void
|
| 542 |
+
_Py_atomic_fence_seq_cst(void)
|
| 543 |
+
{ __atomic_thread_fence(__ATOMIC_SEQ_CST); }
|
| 544 |
+
|
| 545 |
+
static inline void
|
| 546 |
+
_Py_atomic_fence_acquire(void)
|
| 547 |
+
{ __atomic_thread_fence(__ATOMIC_ACQUIRE); }
|
| 548 |
+
|
| 549 |
+
static inline void
|
| 550 |
+
_Py_atomic_fence_release(void)
|
| 551 |
+
{ __atomic_thread_fence(__ATOMIC_RELEASE); }
|
data/miniconda3/include/python3.13/cpython/pyatomic_msc.h
ADDED
|
@@ -0,0 +1,1095 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This is the implementation of Python atomic operations for MSVC if the
|
| 2 |
+
// compiler does not support C11 or C++11 atomics.
|
| 3 |
+
//
|
| 4 |
+
// MSVC intrinsics are defined on char, short, long, __int64, and pointer
|
| 5 |
+
// types. Note that long and int are both 32-bits even on 64-bit Windows,
|
| 6 |
+
// so operations on int are cast to long.
|
| 7 |
+
//
|
| 8 |
+
// The volatile keyword has additional memory ordering semantics on MSVC. On
|
| 9 |
+
// x86 and x86-64, volatile accesses have acquire-release semantics. On ARM64,
|
| 10 |
+
// volatile accesses behave like C11's memory_order_relaxed.
|
| 11 |
+
|
| 12 |
+
#ifndef Py_ATOMIC_MSC_H
|
| 13 |
+
# error "this header file must not be included directly"
|
| 14 |
+
#endif
|
| 15 |
+
|
| 16 |
+
#include <intrin.h>
|
| 17 |
+
|
| 18 |
+
#define _Py_atomic_ASSERT_ARG_TYPE(TYPE) \
|
| 19 |
+
Py_BUILD_ASSERT(sizeof(*obj) == sizeof(TYPE))
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
// --- _Py_atomic_add --------------------------------------------------------
|
| 23 |
+
|
| 24 |
+
static inline int8_t
|
| 25 |
+
_Py_atomic_add_int8(int8_t *obj, int8_t value)
|
| 26 |
+
{
|
| 27 |
+
_Py_atomic_ASSERT_ARG_TYPE(char);
|
| 28 |
+
return (int8_t)_InterlockedExchangeAdd8((volatile char *)obj, (char)value);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
static inline int16_t
|
| 32 |
+
_Py_atomic_add_int16(int16_t *obj, int16_t value)
|
| 33 |
+
{
|
| 34 |
+
_Py_atomic_ASSERT_ARG_TYPE(short);
|
| 35 |
+
return (int16_t)_InterlockedExchangeAdd16((volatile short *)obj, (short)value);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
static inline int32_t
|
| 39 |
+
_Py_atomic_add_int32(int32_t *obj, int32_t value)
|
| 40 |
+
{
|
| 41 |
+
_Py_atomic_ASSERT_ARG_TYPE(long);
|
| 42 |
+
return (int32_t)_InterlockedExchangeAdd((volatile long *)obj, (long)value);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
static inline int64_t
|
| 46 |
+
_Py_atomic_add_int64(int64_t *obj, int64_t value)
|
| 47 |
+
{
|
| 48 |
+
#if defined(_M_X64) || defined(_M_ARM64)
|
| 49 |
+
_Py_atomic_ASSERT_ARG_TYPE(__int64);
|
| 50 |
+
return (int64_t)_InterlockedExchangeAdd64((volatile __int64 *)obj, (__int64)value);
|
| 51 |
+
#else
|
| 52 |
+
int64_t old_value = _Py_atomic_load_int64_relaxed(obj);
|
| 53 |
+
for (;;) {
|
| 54 |
+
int64_t new_value = old_value + value;
|
| 55 |
+
if (_Py_atomic_compare_exchange_int64(obj, &old_value, new_value)) {
|
| 56 |
+
return old_value;
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
#endif
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
static inline uint8_t
|
| 64 |
+
_Py_atomic_add_uint8(uint8_t *obj, uint8_t value)
|
| 65 |
+
{
|
| 66 |
+
return (uint8_t)_Py_atomic_add_int8((int8_t *)obj, (int8_t)value);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
static inline uint16_t
|
| 70 |
+
_Py_atomic_add_uint16(uint16_t *obj, uint16_t value)
|
| 71 |
+
{
|
| 72 |
+
return (uint16_t)_Py_atomic_add_int16((int16_t *)obj, (int16_t)value);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
static inline uint32_t
|
| 76 |
+
_Py_atomic_add_uint32(uint32_t *obj, uint32_t value)
|
| 77 |
+
{
|
| 78 |
+
return (uint32_t)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
static inline int
|
| 82 |
+
_Py_atomic_add_int(int *obj, int value)
|
| 83 |
+
{
|
| 84 |
+
_Py_atomic_ASSERT_ARG_TYPE(int32_t);
|
| 85 |
+
return (int)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
static inline unsigned int
|
| 89 |
+
_Py_atomic_add_uint(unsigned int *obj, unsigned int value)
|
| 90 |
+
{
|
| 91 |
+
_Py_atomic_ASSERT_ARG_TYPE(int32_t);
|
| 92 |
+
return (unsigned int)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
static inline uint64_t
|
| 96 |
+
_Py_atomic_add_uint64(uint64_t *obj, uint64_t value)
|
| 97 |
+
{
|
| 98 |
+
return (uint64_t)_Py_atomic_add_int64((int64_t *)obj, (int64_t)value);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
static inline intptr_t
|
| 102 |
+
_Py_atomic_add_intptr(intptr_t *obj, intptr_t value)
|
| 103 |
+
{
|
| 104 |
+
#if SIZEOF_VOID_P == 8
|
| 105 |
+
_Py_atomic_ASSERT_ARG_TYPE(int64_t);
|
| 106 |
+
return (intptr_t)_Py_atomic_add_int64((int64_t *)obj, (int64_t)value);
|
| 107 |
+
#else
|
| 108 |
+
_Py_atomic_ASSERT_ARG_TYPE(int32_t);
|
| 109 |
+
return (intptr_t)_Py_atomic_add_int32((int32_t *)obj, (int32_t)value);
|
| 110 |
+
#endif
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
static inline uintptr_t
|
| 114 |
+
_Py_atomic_add_uintptr(uintptr_t *obj, uintptr_t value)
|
| 115 |
+
{
|
| 116 |
+
_Py_atomic_ASSERT_ARG_TYPE(intptr_t);
|
| 117 |
+
return (uintptr_t)_Py_atomic_add_intptr((intptr_t *)obj, (intptr_t)value);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
static inline Py_ssize_t
|
| 121 |
+
_Py_atomic_add_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 122 |
+
{
|
| 123 |
+
_Py_atomic_ASSERT_ARG_TYPE(intptr_t);
|
| 124 |
+
return (Py_ssize_t)_Py_atomic_add_intptr((intptr_t *)obj, (intptr_t)value);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
// --- _Py_atomic_compare_exchange -------------------------------------------
|
| 129 |
+
|
| 130 |
+
static inline int
|
| 131 |
+
_Py_atomic_compare_exchange_int8(int8_t *obj, int8_t *expected, int8_t value)
|
| 132 |
+
{
|
| 133 |
+
_Py_atomic_ASSERT_ARG_TYPE(char);
|
| 134 |
+
int8_t initial = (int8_t)_InterlockedCompareExchange8(
|
| 135 |
+
(volatile char *)obj,
|
| 136 |
+
(char)value,
|
| 137 |
+
(char)*expected);
|
| 138 |
+
if (initial == *expected) {
|
| 139 |
+
return 1;
|
| 140 |
+
}
|
| 141 |
+
*expected = initial;
|
| 142 |
+
return 0;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
static inline int
|
| 146 |
+
_Py_atomic_compare_exchange_int16(int16_t *obj, int16_t *expected, int16_t value)
|
| 147 |
+
{
|
| 148 |
+
_Py_atomic_ASSERT_ARG_TYPE(short);
|
| 149 |
+
int16_t initial = (int16_t)_InterlockedCompareExchange16(
|
| 150 |
+
(volatile short *)obj,
|
| 151 |
+
(short)value,
|
| 152 |
+
(short)*expected);
|
| 153 |
+
if (initial == *expected) {
|
| 154 |
+
return 1;
|
| 155 |
+
}
|
| 156 |
+
*expected = initial;
|
| 157 |
+
return 0;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
static inline int
|
| 161 |
+
_Py_atomic_compare_exchange_int32(int32_t *obj, int32_t *expected, int32_t value)
|
| 162 |
+
{
|
| 163 |
+
_Py_atomic_ASSERT_ARG_TYPE(long);
|
| 164 |
+
int32_t initial = (int32_t)_InterlockedCompareExchange(
|
| 165 |
+
(volatile long *)obj,
|
| 166 |
+
(long)value,
|
| 167 |
+
(long)*expected);
|
| 168 |
+
if (initial == *expected) {
|
| 169 |
+
return 1;
|
| 170 |
+
}
|
| 171 |
+
*expected = initial;
|
| 172 |
+
return 0;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
static inline int
|
| 176 |
+
_Py_atomic_compare_exchange_int64(int64_t *obj, int64_t *expected, int64_t value)
|
| 177 |
+
{
|
| 178 |
+
_Py_atomic_ASSERT_ARG_TYPE(__int64);
|
| 179 |
+
int64_t initial = (int64_t)_InterlockedCompareExchange64(
|
| 180 |
+
(volatile __int64 *)obj,
|
| 181 |
+
(__int64)value,
|
| 182 |
+
(__int64)*expected);
|
| 183 |
+
if (initial == *expected) {
|
| 184 |
+
return 1;
|
| 185 |
+
}
|
| 186 |
+
*expected = initial;
|
| 187 |
+
return 0;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
static inline int
|
| 191 |
+
_Py_atomic_compare_exchange_ptr(void *obj, void *expected, void *value)
|
| 192 |
+
{
|
| 193 |
+
void *initial = _InterlockedCompareExchangePointer(
|
| 194 |
+
(void**)obj,
|
| 195 |
+
value,
|
| 196 |
+
*(void**)expected);
|
| 197 |
+
if (initial == *(void**)expected) {
|
| 198 |
+
return 1;
|
| 199 |
+
}
|
| 200 |
+
*(void**)expected = initial;
|
| 201 |
+
return 0;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
static inline int
|
| 206 |
+
_Py_atomic_compare_exchange_uint8(uint8_t *obj, uint8_t *expected, uint8_t value)
|
| 207 |
+
{
|
| 208 |
+
return _Py_atomic_compare_exchange_int8((int8_t *)obj,
|
| 209 |
+
(int8_t *)expected,
|
| 210 |
+
(int8_t)value);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
static inline int
|
| 214 |
+
_Py_atomic_compare_exchange_uint16(uint16_t *obj, uint16_t *expected, uint16_t value)
|
| 215 |
+
{
|
| 216 |
+
return _Py_atomic_compare_exchange_int16((int16_t *)obj,
|
| 217 |
+
(int16_t *)expected,
|
| 218 |
+
(int16_t)value);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
static inline int
|
| 222 |
+
_Py_atomic_compare_exchange_uint32(uint32_t *obj, uint32_t *expected, uint32_t value)
|
| 223 |
+
{
|
| 224 |
+
return _Py_atomic_compare_exchange_int32((int32_t *)obj,
|
| 225 |
+
(int32_t *)expected,
|
| 226 |
+
(int32_t)value);
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
static inline int
|
| 230 |
+
_Py_atomic_compare_exchange_int(int *obj, int *expected, int value)
|
| 231 |
+
{
|
| 232 |
+
_Py_atomic_ASSERT_ARG_TYPE(int32_t);
|
| 233 |
+
return _Py_atomic_compare_exchange_int32((int32_t *)obj,
|
| 234 |
+
(int32_t *)expected,
|
| 235 |
+
(int32_t)value);
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
static inline int
|
| 239 |
+
_Py_atomic_compare_exchange_uint(unsigned int *obj, unsigned int *expected, unsigned int value)
|
| 240 |
+
{
|
| 241 |
+
_Py_atomic_ASSERT_ARG_TYPE(int32_t);
|
| 242 |
+
return _Py_atomic_compare_exchange_int32((int32_t *)obj,
|
| 243 |
+
(int32_t *)expected,
|
| 244 |
+
(int32_t)value);
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
static inline int
|
| 248 |
+
_Py_atomic_compare_exchange_uint64(uint64_t *obj, uint64_t *expected, uint64_t value)
|
| 249 |
+
{
|
| 250 |
+
return _Py_atomic_compare_exchange_int64((int64_t *)obj,
|
| 251 |
+
(int64_t *)expected,
|
| 252 |
+
(int64_t)value);
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
static inline int
|
| 256 |
+
_Py_atomic_compare_exchange_intptr(intptr_t *obj, intptr_t *expected, intptr_t value)
|
| 257 |
+
{
|
| 258 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 259 |
+
return _Py_atomic_compare_exchange_ptr((void**)obj,
|
| 260 |
+
(void**)expected,
|
| 261 |
+
(void*)value);
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
static inline int
|
| 265 |
+
_Py_atomic_compare_exchange_uintptr(uintptr_t *obj, uintptr_t *expected, uintptr_t value)
|
| 266 |
+
{
|
| 267 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 268 |
+
return _Py_atomic_compare_exchange_ptr((void**)obj,
|
| 269 |
+
(void**)expected,
|
| 270 |
+
(void*)value);
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
static inline int
|
| 274 |
+
_Py_atomic_compare_exchange_ssize(Py_ssize_t *obj, Py_ssize_t *expected, Py_ssize_t value)
|
| 275 |
+
{
|
| 276 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 277 |
+
return _Py_atomic_compare_exchange_ptr((void**)obj,
|
| 278 |
+
(void**)expected,
|
| 279 |
+
(void*)value);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
// --- _Py_atomic_exchange ---------------------------------------------------
|
| 284 |
+
|
| 285 |
+
static inline int8_t
|
| 286 |
+
_Py_atomic_exchange_int8(int8_t *obj, int8_t value)
|
| 287 |
+
{
|
| 288 |
+
_Py_atomic_ASSERT_ARG_TYPE(char);
|
| 289 |
+
return (int8_t)_InterlockedExchange8((volatile char *)obj, (char)value);
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
static inline int16_t
|
| 293 |
+
_Py_atomic_exchange_int16(int16_t *obj, int16_t value)
|
| 294 |
+
{
|
| 295 |
+
_Py_atomic_ASSERT_ARG_TYPE(short);
|
| 296 |
+
return (int16_t)_InterlockedExchange16((volatile short *)obj, (short)value);
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
static inline int32_t
|
| 300 |
+
_Py_atomic_exchange_int32(int32_t *obj, int32_t value)
|
| 301 |
+
{
|
| 302 |
+
_Py_atomic_ASSERT_ARG_TYPE(long);
|
| 303 |
+
return (int32_t)_InterlockedExchange((volatile long *)obj, (long)value);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
static inline int64_t
|
| 307 |
+
_Py_atomic_exchange_int64(int64_t *obj, int64_t value)
|
| 308 |
+
{
|
| 309 |
+
#if defined(_M_X64) || defined(_M_ARM64)
|
| 310 |
+
_Py_atomic_ASSERT_ARG_TYPE(__int64);
|
| 311 |
+
return (int64_t)_InterlockedExchange64((volatile __int64 *)obj, (__int64)value);
|
| 312 |
+
#else
|
| 313 |
+
int64_t old_value = _Py_atomic_load_int64_relaxed(obj);
|
| 314 |
+
for (;;) {
|
| 315 |
+
if (_Py_atomic_compare_exchange_int64(obj, &old_value, value)) {
|
| 316 |
+
return old_value;
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
#endif
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
static inline void*
|
| 323 |
+
_Py_atomic_exchange_ptr(void *obj, void *value)
|
| 324 |
+
{
|
| 325 |
+
return (void*)_InterlockedExchangePointer((void * volatile *)obj, (void *)value);
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
static inline uint8_t
|
| 330 |
+
_Py_atomic_exchange_uint8(uint8_t *obj, uint8_t value)
|
| 331 |
+
{
|
| 332 |
+
return (uint8_t)_Py_atomic_exchange_int8((int8_t *)obj,
|
| 333 |
+
(int8_t)value);
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
static inline uint16_t
|
| 337 |
+
_Py_atomic_exchange_uint16(uint16_t *obj, uint16_t value)
|
| 338 |
+
{
|
| 339 |
+
return (uint16_t)_Py_atomic_exchange_int16((int16_t *)obj,
|
| 340 |
+
(int16_t)value);
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
static inline uint32_t
|
| 344 |
+
_Py_atomic_exchange_uint32(uint32_t *obj, uint32_t value)
|
| 345 |
+
{
|
| 346 |
+
return (uint32_t)_Py_atomic_exchange_int32((int32_t *)obj,
|
| 347 |
+
(int32_t)value);
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
static inline int
|
| 351 |
+
_Py_atomic_exchange_int(int *obj, int value)
|
| 352 |
+
{
|
| 353 |
+
_Py_atomic_ASSERT_ARG_TYPE(int32_t);
|
| 354 |
+
return (int)_Py_atomic_exchange_int32((int32_t *)obj,
|
| 355 |
+
(int32_t)value);
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
static inline unsigned int
|
| 359 |
+
_Py_atomic_exchange_uint(unsigned int *obj, unsigned int value)
|
| 360 |
+
{
|
| 361 |
+
_Py_atomic_ASSERT_ARG_TYPE(int32_t);
|
| 362 |
+
return (unsigned int)_Py_atomic_exchange_int32((int32_t *)obj,
|
| 363 |
+
(int32_t)value);
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
static inline uint64_t
|
| 367 |
+
_Py_atomic_exchange_uint64(uint64_t *obj, uint64_t value)
|
| 368 |
+
{
|
| 369 |
+
return (uint64_t)_Py_atomic_exchange_int64((int64_t *)obj,
|
| 370 |
+
(int64_t)value);
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
static inline intptr_t
|
| 374 |
+
_Py_atomic_exchange_intptr(intptr_t *obj, intptr_t value)
|
| 375 |
+
{
|
| 376 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 377 |
+
return (intptr_t)_Py_atomic_exchange_ptr((void**)obj,
|
| 378 |
+
(void*)value);
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
static inline uintptr_t
|
| 382 |
+
_Py_atomic_exchange_uintptr(uintptr_t *obj, uintptr_t value)
|
| 383 |
+
{
|
| 384 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 385 |
+
return (uintptr_t)_Py_atomic_exchange_ptr((void**)obj,
|
| 386 |
+
(void*)value);
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
static inline Py_ssize_t
|
| 390 |
+
_Py_atomic_exchange_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 391 |
+
{
|
| 392 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 393 |
+
return (Py_ssize_t)_Py_atomic_exchange_ptr((void**)obj,
|
| 394 |
+
(void*)value);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
// --- _Py_atomic_and --------------------------------------------------------
|
| 399 |
+
|
| 400 |
+
static inline uint8_t
|
| 401 |
+
_Py_atomic_and_uint8(uint8_t *obj, uint8_t value)
|
| 402 |
+
{
|
| 403 |
+
_Py_atomic_ASSERT_ARG_TYPE(char);
|
| 404 |
+
return (uint8_t)_InterlockedAnd8((volatile char *)obj, (char)value);
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
static inline uint16_t
|
| 408 |
+
_Py_atomic_and_uint16(uint16_t *obj, uint16_t value)
|
| 409 |
+
{
|
| 410 |
+
_Py_atomic_ASSERT_ARG_TYPE(short);
|
| 411 |
+
return (uint16_t)_InterlockedAnd16((volatile short *)obj, (short)value);
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
static inline uint32_t
|
| 415 |
+
_Py_atomic_and_uint32(uint32_t *obj, uint32_t value)
|
| 416 |
+
{
|
| 417 |
+
_Py_atomic_ASSERT_ARG_TYPE(long);
|
| 418 |
+
return (uint32_t)_InterlockedAnd((volatile long *)obj, (long)value);
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
static inline uint64_t
|
| 422 |
+
_Py_atomic_and_uint64(uint64_t *obj, uint64_t value)
|
| 423 |
+
{
|
| 424 |
+
#if defined(_M_X64) || defined(_M_ARM64)
|
| 425 |
+
_Py_atomic_ASSERT_ARG_TYPE(__int64);
|
| 426 |
+
return (uint64_t)_InterlockedAnd64((volatile __int64 *)obj, (__int64)value);
|
| 427 |
+
#else
|
| 428 |
+
uint64_t old_value = _Py_atomic_load_uint64_relaxed(obj);
|
| 429 |
+
for (;;) {
|
| 430 |
+
uint64_t new_value = old_value & value;
|
| 431 |
+
if (_Py_atomic_compare_exchange_uint64(obj, &old_value, new_value)) {
|
| 432 |
+
return old_value;
|
| 433 |
+
}
|
| 434 |
+
}
|
| 435 |
+
#endif
|
| 436 |
+
}
|
| 437 |
+
|
| 438 |
+
static inline uintptr_t
|
| 439 |
+
_Py_atomic_and_uintptr(uintptr_t *obj, uintptr_t value)
|
| 440 |
+
{
|
| 441 |
+
#if SIZEOF_VOID_P == 8
|
| 442 |
+
_Py_atomic_ASSERT_ARG_TYPE(uint64_t);
|
| 443 |
+
return (uintptr_t)_Py_atomic_and_uint64((uint64_t *)obj,
|
| 444 |
+
(uint64_t)value);
|
| 445 |
+
#else
|
| 446 |
+
_Py_atomic_ASSERT_ARG_TYPE(uint32_t);
|
| 447 |
+
return (uintptr_t)_Py_atomic_and_uint32((uint32_t *)obj,
|
| 448 |
+
(uint32_t)value);
|
| 449 |
+
#endif
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
|
| 453 |
+
// --- _Py_atomic_or ---------------------------------------------------------
|
| 454 |
+
|
| 455 |
+
static inline uint8_t
|
| 456 |
+
_Py_atomic_or_uint8(uint8_t *obj, uint8_t value)
|
| 457 |
+
{
|
| 458 |
+
_Py_atomic_ASSERT_ARG_TYPE(char);
|
| 459 |
+
return (uint8_t)_InterlockedOr8((volatile char *)obj, (char)value);
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
static inline uint16_t
|
| 463 |
+
_Py_atomic_or_uint16(uint16_t *obj, uint16_t value)
|
| 464 |
+
{
|
| 465 |
+
_Py_atomic_ASSERT_ARG_TYPE(short);
|
| 466 |
+
return (uint16_t)_InterlockedOr16((volatile short *)obj, (short)value);
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
static inline uint32_t
|
| 470 |
+
_Py_atomic_or_uint32(uint32_t *obj, uint32_t value)
|
| 471 |
+
{
|
| 472 |
+
_Py_atomic_ASSERT_ARG_TYPE(long);
|
| 473 |
+
return (uint32_t)_InterlockedOr((volatile long *)obj, (long)value);
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
static inline uint64_t
|
| 477 |
+
_Py_atomic_or_uint64(uint64_t *obj, uint64_t value)
|
| 478 |
+
{
|
| 479 |
+
#if defined(_M_X64) || defined(_M_ARM64)
|
| 480 |
+
_Py_atomic_ASSERT_ARG_TYPE(__int64);
|
| 481 |
+
return (uint64_t)_InterlockedOr64((volatile __int64 *)obj, (__int64)value);
|
| 482 |
+
#else
|
| 483 |
+
uint64_t old_value = _Py_atomic_load_uint64_relaxed(obj);
|
| 484 |
+
for (;;) {
|
| 485 |
+
uint64_t new_value = old_value | value;
|
| 486 |
+
if (_Py_atomic_compare_exchange_uint64(obj, &old_value, new_value)) {
|
| 487 |
+
return old_value;
|
| 488 |
+
}
|
| 489 |
+
}
|
| 490 |
+
#endif
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
static inline uintptr_t
|
| 495 |
+
_Py_atomic_or_uintptr(uintptr_t *obj, uintptr_t value)
|
| 496 |
+
{
|
| 497 |
+
#if SIZEOF_VOID_P == 8
|
| 498 |
+
_Py_atomic_ASSERT_ARG_TYPE(uint64_t);
|
| 499 |
+
return (uintptr_t)_Py_atomic_or_uint64((uint64_t *)obj,
|
| 500 |
+
(uint64_t)value);
|
| 501 |
+
#else
|
| 502 |
+
_Py_atomic_ASSERT_ARG_TYPE(uint32_t);
|
| 503 |
+
return (uintptr_t)_Py_atomic_or_uint32((uint32_t *)obj,
|
| 504 |
+
(uint32_t)value);
|
| 505 |
+
#endif
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
// --- _Py_atomic_load -------------------------------------------------------
|
| 510 |
+
|
| 511 |
+
static inline uint8_t
|
| 512 |
+
_Py_atomic_load_uint8(const uint8_t *obj)
|
| 513 |
+
{
|
| 514 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 515 |
+
return *(volatile uint8_t *)obj;
|
| 516 |
+
#elif defined(_M_ARM64)
|
| 517 |
+
return (uint8_t)__ldar8((unsigned __int8 volatile *)obj);
|
| 518 |
+
#else
|
| 519 |
+
# error "no implementation of _Py_atomic_load_uint8"
|
| 520 |
+
#endif
|
| 521 |
+
}
|
| 522 |
+
|
| 523 |
+
static inline uint16_t
|
| 524 |
+
_Py_atomic_load_uint16(const uint16_t *obj)
|
| 525 |
+
{
|
| 526 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 527 |
+
return *(volatile uint16_t *)obj;
|
| 528 |
+
#elif defined(_M_ARM64)
|
| 529 |
+
return (uint16_t)__ldar16((unsigned __int16 volatile *)obj);
|
| 530 |
+
#else
|
| 531 |
+
# error "no implementation of _Py_atomic_load_uint16"
|
| 532 |
+
#endif
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
static inline uint32_t
|
| 536 |
+
_Py_atomic_load_uint32(const uint32_t *obj)
|
| 537 |
+
{
|
| 538 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 539 |
+
return *(volatile uint32_t *)obj;
|
| 540 |
+
#elif defined(_M_ARM64)
|
| 541 |
+
return (uint32_t)__ldar32((unsigned __int32 volatile *)obj);
|
| 542 |
+
#else
|
| 543 |
+
# error "no implementation of _Py_atomic_load_uint32"
|
| 544 |
+
#endif
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
static inline uint64_t
|
| 548 |
+
_Py_atomic_load_uint64(const uint64_t *obj)
|
| 549 |
+
{
|
| 550 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 551 |
+
return *(volatile uint64_t *)obj;
|
| 552 |
+
#elif defined(_M_ARM64)
|
| 553 |
+
return (uint64_t)__ldar64((unsigned __int64 volatile *)obj);
|
| 554 |
+
#else
|
| 555 |
+
# error "no implementation of _Py_atomic_load_uint64"
|
| 556 |
+
#endif
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
static inline int8_t
|
| 560 |
+
_Py_atomic_load_int8(const int8_t *obj)
|
| 561 |
+
{
|
| 562 |
+
return (int8_t)_Py_atomic_load_uint8((const uint8_t *)obj);
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
static inline int16_t
|
| 566 |
+
_Py_atomic_load_int16(const int16_t *obj)
|
| 567 |
+
{
|
| 568 |
+
return (int16_t)_Py_atomic_load_uint16((const uint16_t *)obj);
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
static inline int32_t
|
| 572 |
+
_Py_atomic_load_int32(const int32_t *obj)
|
| 573 |
+
{
|
| 574 |
+
return (int32_t)_Py_atomic_load_uint32((const uint32_t *)obj);
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
static inline int
|
| 578 |
+
_Py_atomic_load_int(const int *obj)
|
| 579 |
+
{
|
| 580 |
+
_Py_atomic_ASSERT_ARG_TYPE(uint32_t);
|
| 581 |
+
return (int)_Py_atomic_load_uint32((uint32_t *)obj);
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
static inline unsigned int
|
| 585 |
+
_Py_atomic_load_uint(const unsigned int *obj)
|
| 586 |
+
{
|
| 587 |
+
_Py_atomic_ASSERT_ARG_TYPE(uint32_t);
|
| 588 |
+
return (unsigned int)_Py_atomic_load_uint32((uint32_t *)obj);
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
static inline int64_t
|
| 592 |
+
_Py_atomic_load_int64(const int64_t *obj)
|
| 593 |
+
{
|
| 594 |
+
return (int64_t)_Py_atomic_load_uint64((const uint64_t *)obj);
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
static inline void*
|
| 598 |
+
_Py_atomic_load_ptr(const void *obj)
|
| 599 |
+
{
|
| 600 |
+
#if SIZEOF_VOID_P == 8
|
| 601 |
+
return (void*)_Py_atomic_load_uint64((const uint64_t *)obj);
|
| 602 |
+
#else
|
| 603 |
+
return (void*)_Py_atomic_load_uint32((const uint32_t *)obj);
|
| 604 |
+
#endif
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
static inline intptr_t
|
| 608 |
+
_Py_atomic_load_intptr(const intptr_t *obj)
|
| 609 |
+
{
|
| 610 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 611 |
+
return (intptr_t)_Py_atomic_load_ptr((void*)obj);
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
static inline uintptr_t
|
| 615 |
+
_Py_atomic_load_uintptr(const uintptr_t *obj)
|
| 616 |
+
{
|
| 617 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 618 |
+
return (uintptr_t)_Py_atomic_load_ptr((void*)obj);
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
static inline Py_ssize_t
|
| 622 |
+
_Py_atomic_load_ssize(const Py_ssize_t *obj)
|
| 623 |
+
{
|
| 624 |
+
_Py_atomic_ASSERT_ARG_TYPE(void*);
|
| 625 |
+
return (Py_ssize_t)_Py_atomic_load_ptr((void*)obj);
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
|
| 629 |
+
// --- _Py_atomic_load_relaxed -----------------------------------------------
|
| 630 |
+
|
| 631 |
+
static inline int
|
| 632 |
+
_Py_atomic_load_int_relaxed(const int *obj)
|
| 633 |
+
{
|
| 634 |
+
return *(volatile int *)obj;
|
| 635 |
+
}
|
| 636 |
+
|
| 637 |
+
static inline int8_t
|
| 638 |
+
_Py_atomic_load_int8_relaxed(const int8_t *obj)
|
| 639 |
+
{
|
| 640 |
+
return *(volatile int8_t *)obj;
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
static inline int16_t
|
| 644 |
+
_Py_atomic_load_int16_relaxed(const int16_t *obj)
|
| 645 |
+
{
|
| 646 |
+
return *(volatile int16_t *)obj;
|
| 647 |
+
}
|
| 648 |
+
|
| 649 |
+
static inline int32_t
|
| 650 |
+
_Py_atomic_load_int32_relaxed(const int32_t *obj)
|
| 651 |
+
{
|
| 652 |
+
return *(volatile int32_t *)obj;
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
static inline int64_t
|
| 656 |
+
_Py_atomic_load_int64_relaxed(const int64_t *obj)
|
| 657 |
+
{
|
| 658 |
+
return *(volatile int64_t *)obj;
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
static inline intptr_t
|
| 662 |
+
_Py_atomic_load_intptr_relaxed(const intptr_t *obj)
|
| 663 |
+
{
|
| 664 |
+
return *(volatile intptr_t *)obj;
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
static inline uint8_t
|
| 668 |
+
_Py_atomic_load_uint8_relaxed(const uint8_t *obj)
|
| 669 |
+
{
|
| 670 |
+
return *(volatile uint8_t *)obj;
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
static inline uint16_t
|
| 674 |
+
_Py_atomic_load_uint16_relaxed(const uint16_t *obj)
|
| 675 |
+
{
|
| 676 |
+
return *(volatile uint16_t *)obj;
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
static inline uint32_t
|
| 680 |
+
_Py_atomic_load_uint32_relaxed(const uint32_t *obj)
|
| 681 |
+
{
|
| 682 |
+
return *(volatile uint32_t *)obj;
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
static inline uint64_t
|
| 686 |
+
_Py_atomic_load_uint64_relaxed(const uint64_t *obj)
|
| 687 |
+
{
|
| 688 |
+
return *(volatile uint64_t *)obj;
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
static inline uintptr_t
|
| 692 |
+
_Py_atomic_load_uintptr_relaxed(const uintptr_t *obj)
|
| 693 |
+
{
|
| 694 |
+
return *(volatile uintptr_t *)obj;
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
static inline unsigned int
|
| 698 |
+
_Py_atomic_load_uint_relaxed(const unsigned int *obj)
|
| 699 |
+
{
|
| 700 |
+
return *(volatile unsigned int *)obj;
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
static inline Py_ssize_t
|
| 704 |
+
_Py_atomic_load_ssize_relaxed(const Py_ssize_t *obj)
|
| 705 |
+
{
|
| 706 |
+
return *(volatile Py_ssize_t *)obj;
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
static inline void*
|
| 710 |
+
_Py_atomic_load_ptr_relaxed(const void *obj)
|
| 711 |
+
{
|
| 712 |
+
return *(void * volatile *)obj;
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
static inline unsigned long long
|
| 716 |
+
_Py_atomic_load_ullong_relaxed(const unsigned long long *obj)
|
| 717 |
+
{
|
| 718 |
+
return *(volatile unsigned long long *)obj;
|
| 719 |
+
}
|
| 720 |
+
|
| 721 |
+
|
| 722 |
+
// --- _Py_atomic_store ------------------------------------------------------
|
| 723 |
+
|
| 724 |
+
static inline void
|
| 725 |
+
_Py_atomic_store_int(int *obj, int value)
|
| 726 |
+
{
|
| 727 |
+
(void)_Py_atomic_exchange_int(obj, value);
|
| 728 |
+
}
|
| 729 |
+
|
| 730 |
+
static inline void
|
| 731 |
+
_Py_atomic_store_int8(int8_t *obj, int8_t value)
|
| 732 |
+
{
|
| 733 |
+
(void)_Py_atomic_exchange_int8(obj, value);
|
| 734 |
+
}
|
| 735 |
+
|
| 736 |
+
static inline void
|
| 737 |
+
_Py_atomic_store_int16(int16_t *obj, int16_t value)
|
| 738 |
+
{
|
| 739 |
+
(void)_Py_atomic_exchange_int16(obj, value);
|
| 740 |
+
}
|
| 741 |
+
|
| 742 |
+
static inline void
|
| 743 |
+
_Py_atomic_store_int32(int32_t *obj, int32_t value)
|
| 744 |
+
{
|
| 745 |
+
(void)_Py_atomic_exchange_int32(obj, value);
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
static inline void
|
| 749 |
+
_Py_atomic_store_int64(int64_t *obj, int64_t value)
|
| 750 |
+
{
|
| 751 |
+
(void)_Py_atomic_exchange_int64(obj, value);
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
static inline void
|
| 755 |
+
_Py_atomic_store_intptr(intptr_t *obj, intptr_t value)
|
| 756 |
+
{
|
| 757 |
+
(void)_Py_atomic_exchange_intptr(obj, value);
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
+
static inline void
|
| 761 |
+
_Py_atomic_store_uint8(uint8_t *obj, uint8_t value)
|
| 762 |
+
{
|
| 763 |
+
(void)_Py_atomic_exchange_uint8(obj, value);
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
static inline void
|
| 767 |
+
_Py_atomic_store_uint16(uint16_t *obj, uint16_t value)
|
| 768 |
+
{
|
| 769 |
+
(void)_Py_atomic_exchange_uint16(obj, value);
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
static inline void
|
| 773 |
+
_Py_atomic_store_uint32(uint32_t *obj, uint32_t value)
|
| 774 |
+
{
|
| 775 |
+
(void)_Py_atomic_exchange_uint32(obj, value);
|
| 776 |
+
}
|
| 777 |
+
|
| 778 |
+
static inline void
|
| 779 |
+
_Py_atomic_store_uint64(uint64_t *obj, uint64_t value)
|
| 780 |
+
{
|
| 781 |
+
(void)_Py_atomic_exchange_uint64(obj, value);
|
| 782 |
+
}
|
| 783 |
+
|
| 784 |
+
static inline void
|
| 785 |
+
_Py_atomic_store_uintptr(uintptr_t *obj, uintptr_t value)
|
| 786 |
+
{
|
| 787 |
+
(void)_Py_atomic_exchange_uintptr(obj, value);
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
static inline void
|
| 791 |
+
_Py_atomic_store_uint(unsigned int *obj, unsigned int value)
|
| 792 |
+
{
|
| 793 |
+
(void)_Py_atomic_exchange_uint(obj, value);
|
| 794 |
+
}
|
| 795 |
+
|
| 796 |
+
static inline void
|
| 797 |
+
_Py_atomic_store_ptr(void *obj, void *value)
|
| 798 |
+
{
|
| 799 |
+
(void)_Py_atomic_exchange_ptr(obj, value);
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
static inline void
|
| 803 |
+
_Py_atomic_store_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 804 |
+
{
|
| 805 |
+
(void)_Py_atomic_exchange_ssize(obj, value);
|
| 806 |
+
}
|
| 807 |
+
|
| 808 |
+
|
| 809 |
+
// --- _Py_atomic_store_relaxed ----------------------------------------------
|
| 810 |
+
|
| 811 |
+
static inline void
|
| 812 |
+
_Py_atomic_store_int_relaxed(int *obj, int value)
|
| 813 |
+
{
|
| 814 |
+
*(volatile int *)obj = value;
|
| 815 |
+
}
|
| 816 |
+
|
| 817 |
+
static inline void
|
| 818 |
+
_Py_atomic_store_int8_relaxed(int8_t *obj, int8_t value)
|
| 819 |
+
{
|
| 820 |
+
*(volatile int8_t *)obj = value;
|
| 821 |
+
}
|
| 822 |
+
|
| 823 |
+
static inline void
|
| 824 |
+
_Py_atomic_store_int16_relaxed(int16_t *obj, int16_t value)
|
| 825 |
+
{
|
| 826 |
+
*(volatile int16_t *)obj = value;
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
static inline void
|
| 830 |
+
_Py_atomic_store_int32_relaxed(int32_t *obj, int32_t value)
|
| 831 |
+
{
|
| 832 |
+
*(volatile int32_t *)obj = value;
|
| 833 |
+
}
|
| 834 |
+
|
| 835 |
+
static inline void
|
| 836 |
+
_Py_atomic_store_int64_relaxed(int64_t *obj, int64_t value)
|
| 837 |
+
{
|
| 838 |
+
*(volatile int64_t *)obj = value;
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
static inline void
|
| 842 |
+
_Py_atomic_store_intptr_relaxed(intptr_t *obj, intptr_t value)
|
| 843 |
+
{
|
| 844 |
+
*(volatile intptr_t *)obj = value;
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
static inline void
|
| 848 |
+
_Py_atomic_store_uint8_relaxed(uint8_t *obj, uint8_t value)
|
| 849 |
+
{
|
| 850 |
+
*(volatile uint8_t *)obj = value;
|
| 851 |
+
}
|
| 852 |
+
|
| 853 |
+
static inline void
|
| 854 |
+
_Py_atomic_store_uint16_relaxed(uint16_t *obj, uint16_t value)
|
| 855 |
+
{
|
| 856 |
+
*(volatile uint16_t *)obj = value;
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
static inline void
|
| 860 |
+
_Py_atomic_store_uint32_relaxed(uint32_t *obj, uint32_t value)
|
| 861 |
+
{
|
| 862 |
+
*(volatile uint32_t *)obj = value;
|
| 863 |
+
}
|
| 864 |
+
|
| 865 |
+
static inline void
|
| 866 |
+
_Py_atomic_store_uint64_relaxed(uint64_t *obj, uint64_t value)
|
| 867 |
+
{
|
| 868 |
+
*(volatile uint64_t *)obj = value;
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
+
static inline void
|
| 872 |
+
_Py_atomic_store_uintptr_relaxed(uintptr_t *obj, uintptr_t value)
|
| 873 |
+
{
|
| 874 |
+
*(volatile uintptr_t *)obj = value;
|
| 875 |
+
}
|
| 876 |
+
|
| 877 |
+
static inline void
|
| 878 |
+
_Py_atomic_store_uint_relaxed(unsigned int *obj, unsigned int value)
|
| 879 |
+
{
|
| 880 |
+
*(volatile unsigned int *)obj = value;
|
| 881 |
+
}
|
| 882 |
+
|
| 883 |
+
static inline void
|
| 884 |
+
_Py_atomic_store_ptr_relaxed(void *obj, void* value)
|
| 885 |
+
{
|
| 886 |
+
*(void * volatile *)obj = value;
|
| 887 |
+
}
|
| 888 |
+
|
| 889 |
+
static inline void
|
| 890 |
+
_Py_atomic_store_ssize_relaxed(Py_ssize_t *obj, Py_ssize_t value)
|
| 891 |
+
{
|
| 892 |
+
*(volatile Py_ssize_t *)obj = value;
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
static inline void
|
| 896 |
+
_Py_atomic_store_ullong_relaxed(unsigned long long *obj,
|
| 897 |
+
unsigned long long value)
|
| 898 |
+
{
|
| 899 |
+
*(volatile unsigned long long *)obj = value;
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
// --- _Py_atomic_load_ptr_acquire / _Py_atomic_store_ptr_release ------------
|
| 904 |
+
|
| 905 |
+
static inline void *
|
| 906 |
+
_Py_atomic_load_ptr_acquire(const void *obj)
|
| 907 |
+
{
|
| 908 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 909 |
+
return *(void * volatile *)obj;
|
| 910 |
+
#elif defined(_M_ARM64)
|
| 911 |
+
return (void *)__ldar64((unsigned __int64 volatile *)obj);
|
| 912 |
+
#else
|
| 913 |
+
# error "no implementation of _Py_atomic_load_ptr_acquire"
|
| 914 |
+
#endif
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
static inline uintptr_t
|
| 918 |
+
_Py_atomic_load_uintptr_acquire(const uintptr_t *obj)
|
| 919 |
+
{
|
| 920 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 921 |
+
return *(uintptr_t volatile *)obj;
|
| 922 |
+
#elif defined(_M_ARM64)
|
| 923 |
+
return (uintptr_t)__ldar64((unsigned __int64 volatile *)obj);
|
| 924 |
+
#else
|
| 925 |
+
# error "no implementation of _Py_atomic_load_uintptr_acquire"
|
| 926 |
+
#endif
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
static inline void
|
| 930 |
+
_Py_atomic_store_ptr_release(void *obj, void *value)
|
| 931 |
+
{
|
| 932 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 933 |
+
*(void * volatile *)obj = value;
|
| 934 |
+
#elif defined(_M_ARM64)
|
| 935 |
+
__stlr64((unsigned __int64 volatile *)obj, (uintptr_t)value);
|
| 936 |
+
#else
|
| 937 |
+
# error "no implementation of _Py_atomic_store_ptr_release"
|
| 938 |
+
#endif
|
| 939 |
+
}
|
| 940 |
+
|
| 941 |
+
static inline void
|
| 942 |
+
_Py_atomic_store_uintptr_release(uintptr_t *obj, uintptr_t value)
|
| 943 |
+
{
|
| 944 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 945 |
+
*(uintptr_t volatile *)obj = value;
|
| 946 |
+
#elif defined(_M_ARM64)
|
| 947 |
+
_Py_atomic_ASSERT_ARG_TYPE(unsigned __int64);
|
| 948 |
+
__stlr64((unsigned __int64 volatile *)obj, (unsigned __int64)value);
|
| 949 |
+
#else
|
| 950 |
+
# error "no implementation of _Py_atomic_store_uintptr_release"
|
| 951 |
+
#endif
|
| 952 |
+
}
|
| 953 |
+
|
| 954 |
+
static inline void
|
| 955 |
+
_Py_atomic_store_int_release(int *obj, int value)
|
| 956 |
+
{
|
| 957 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 958 |
+
*(int volatile *)obj = value;
|
| 959 |
+
#elif defined(_M_ARM64)
|
| 960 |
+
_Py_atomic_ASSERT_ARG_TYPE(unsigned __int32);
|
| 961 |
+
__stlr32((unsigned __int32 volatile *)obj, (unsigned __int32)value);
|
| 962 |
+
#else
|
| 963 |
+
# error "no implementation of _Py_atomic_store_int_release"
|
| 964 |
+
#endif
|
| 965 |
+
}
|
| 966 |
+
|
| 967 |
+
static inline void
|
| 968 |
+
_Py_atomic_store_ssize_release(Py_ssize_t *obj, Py_ssize_t value)
|
| 969 |
+
{
|
| 970 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 971 |
+
*(Py_ssize_t volatile *)obj = value;
|
| 972 |
+
#elif defined(_M_ARM64)
|
| 973 |
+
__stlr64((unsigned __int64 volatile *)obj, (unsigned __int64)value);
|
| 974 |
+
#else
|
| 975 |
+
# error "no implementation of _Py_atomic_store_ssize_release"
|
| 976 |
+
#endif
|
| 977 |
+
}
|
| 978 |
+
|
| 979 |
+
static inline int
|
| 980 |
+
_Py_atomic_load_int_acquire(const int *obj)
|
| 981 |
+
{
|
| 982 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 983 |
+
return *(int volatile *)obj;
|
| 984 |
+
#elif defined(_M_ARM64)
|
| 985 |
+
_Py_atomic_ASSERT_ARG_TYPE(unsigned __int32);
|
| 986 |
+
return (int)__ldar32((unsigned __int32 volatile *)obj);
|
| 987 |
+
#else
|
| 988 |
+
# error "no implementation of _Py_atomic_load_int_acquire"
|
| 989 |
+
#endif
|
| 990 |
+
}
|
| 991 |
+
|
| 992 |
+
static inline void
|
| 993 |
+
_Py_atomic_store_uint32_release(uint32_t *obj, uint32_t value)
|
| 994 |
+
{
|
| 995 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 996 |
+
*(uint32_t volatile *)obj = value;
|
| 997 |
+
#elif defined(_M_ARM64)
|
| 998 |
+
_Py_atomic_ASSERT_ARG_TYPE(unsigned __int32);
|
| 999 |
+
__stlr32((unsigned __int32 volatile *)obj, (unsigned __int32)value);
|
| 1000 |
+
#else
|
| 1001 |
+
# error "no implementation of _Py_atomic_store_uint32_release"
|
| 1002 |
+
#endif
|
| 1003 |
+
}
|
| 1004 |
+
|
| 1005 |
+
static inline void
|
| 1006 |
+
_Py_atomic_store_uint64_release(uint64_t *obj, uint64_t value)
|
| 1007 |
+
{
|
| 1008 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 1009 |
+
*(uint64_t volatile *)obj = value;
|
| 1010 |
+
#elif defined(_M_ARM64)
|
| 1011 |
+
_Py_atomic_ASSERT_ARG_TYPE(unsigned __int64);
|
| 1012 |
+
__stlr64((unsigned __int64 volatile *)obj, (unsigned __int64)value);
|
| 1013 |
+
#else
|
| 1014 |
+
# error "no implementation of _Py_atomic_store_uint64_release"
|
| 1015 |
+
#endif
|
| 1016 |
+
}
|
| 1017 |
+
|
| 1018 |
+
static inline uint64_t
|
| 1019 |
+
_Py_atomic_load_uint64_acquire(const uint64_t *obj)
|
| 1020 |
+
{
|
| 1021 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 1022 |
+
return *(uint64_t volatile *)obj;
|
| 1023 |
+
#elif defined(_M_ARM64)
|
| 1024 |
+
_Py_atomic_ASSERT_ARG_TYPE(__int64);
|
| 1025 |
+
return (uint64_t)__ldar64((unsigned __int64 volatile *)obj);
|
| 1026 |
+
#else
|
| 1027 |
+
# error "no implementation of _Py_atomic_load_uint64_acquire"
|
| 1028 |
+
#endif
|
| 1029 |
+
}
|
| 1030 |
+
|
| 1031 |
+
static inline uint32_t
|
| 1032 |
+
_Py_atomic_load_uint32_acquire(const uint32_t *obj)
|
| 1033 |
+
{
|
| 1034 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 1035 |
+
return *(uint32_t volatile *)obj;
|
| 1036 |
+
#elif defined(_M_ARM64)
|
| 1037 |
+
return (uint32_t)__ldar32((uint32_t volatile *)obj);
|
| 1038 |
+
#else
|
| 1039 |
+
# error "no implementation of _Py_atomic_load_uint32_acquire"
|
| 1040 |
+
#endif
|
| 1041 |
+
}
|
| 1042 |
+
|
| 1043 |
+
static inline Py_ssize_t
|
| 1044 |
+
_Py_atomic_load_ssize_acquire(const Py_ssize_t *obj)
|
| 1045 |
+
{
|
| 1046 |
+
#if defined(_M_X64) || defined(_M_IX86)
|
| 1047 |
+
return *(Py_ssize_t volatile *)obj;
|
| 1048 |
+
#elif defined(_M_ARM64)
|
| 1049 |
+
return (Py_ssize_t)__ldar64((unsigned __int64 volatile *)obj);
|
| 1050 |
+
#else
|
| 1051 |
+
# error "no implementation of _Py_atomic_load_ssize_acquire"
|
| 1052 |
+
#endif
|
| 1053 |
+
}
|
| 1054 |
+
|
| 1055 |
+
// --- _Py_atomic_fence ------------------------------------------------------
|
| 1056 |
+
|
| 1057 |
+
static inline void
|
| 1058 |
+
_Py_atomic_fence_seq_cst(void)
|
| 1059 |
+
{
|
| 1060 |
+
#if defined(_M_ARM64)
|
| 1061 |
+
__dmb(_ARM64_BARRIER_ISH);
|
| 1062 |
+
#elif defined(_M_X64)
|
| 1063 |
+
__faststorefence();
|
| 1064 |
+
#elif defined(_M_IX86)
|
| 1065 |
+
_mm_mfence();
|
| 1066 |
+
#else
|
| 1067 |
+
# error "no implementation of _Py_atomic_fence_seq_cst"
|
| 1068 |
+
#endif
|
| 1069 |
+
}
|
| 1070 |
+
|
| 1071 |
+
static inline void
|
| 1072 |
+
_Py_atomic_fence_acquire(void)
|
| 1073 |
+
{
|
| 1074 |
+
#if defined(_M_ARM64)
|
| 1075 |
+
__dmb(_ARM64_BARRIER_ISHLD);
|
| 1076 |
+
#elif defined(_M_X64) || defined(_M_IX86)
|
| 1077 |
+
_ReadBarrier();
|
| 1078 |
+
#else
|
| 1079 |
+
# error "no implementation of _Py_atomic_fence_acquire"
|
| 1080 |
+
#endif
|
| 1081 |
+
}
|
| 1082 |
+
|
| 1083 |
+
static inline void
|
| 1084 |
+
_Py_atomic_fence_release(void)
|
| 1085 |
+
{
|
| 1086 |
+
#if defined(_M_ARM64)
|
| 1087 |
+
__dmb(_ARM64_BARRIER_ISH);
|
| 1088 |
+
#elif defined(_M_X64) || defined(_M_IX86)
|
| 1089 |
+
_ReadWriteBarrier();
|
| 1090 |
+
#else
|
| 1091 |
+
# error "no implementation of _Py_atomic_fence_release"
|
| 1092 |
+
#endif
|
| 1093 |
+
}
|
| 1094 |
+
|
| 1095 |
+
#undef _Py_atomic_ASSERT_ARG_TYPE
|
data/miniconda3/include/python3.13/cpython/pyatomic_std.h
ADDED
|
@@ -0,0 +1,976 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This is the implementation of Python atomic operations using C++11 or C11
|
| 2 |
+
// atomics. Note that the pyatomic_gcc.h implementation is preferred for GCC
|
| 3 |
+
// compatible compilers, even if they support C++11 atomics.
|
| 4 |
+
|
| 5 |
+
#ifndef Py_ATOMIC_STD_H
|
| 6 |
+
# error "this header file must not be included directly"
|
| 7 |
+
#endif
|
| 8 |
+
|
| 9 |
+
#ifdef __cplusplus
|
| 10 |
+
extern "C++" {
|
| 11 |
+
# include <atomic>
|
| 12 |
+
}
|
| 13 |
+
# define _Py_USING_STD using namespace std
|
| 14 |
+
# define _Atomic(tp) atomic<tp>
|
| 15 |
+
#else
|
| 16 |
+
# define _Py_USING_STD
|
| 17 |
+
# include <stdatomic.h>
|
| 18 |
+
#endif
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
// --- _Py_atomic_add --------------------------------------------------------
|
| 22 |
+
|
| 23 |
+
static inline int
|
| 24 |
+
_Py_atomic_add_int(int *obj, int value)
|
| 25 |
+
{
|
| 26 |
+
_Py_USING_STD;
|
| 27 |
+
return atomic_fetch_add((_Atomic(int)*)obj, value);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
static inline int8_t
|
| 31 |
+
_Py_atomic_add_int8(int8_t *obj, int8_t value)
|
| 32 |
+
{
|
| 33 |
+
_Py_USING_STD;
|
| 34 |
+
return atomic_fetch_add((_Atomic(int8_t)*)obj, value);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
static inline int16_t
|
| 38 |
+
_Py_atomic_add_int16(int16_t *obj, int16_t value)
|
| 39 |
+
{
|
| 40 |
+
_Py_USING_STD;
|
| 41 |
+
return atomic_fetch_add((_Atomic(int16_t)*)obj, value);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
static inline int32_t
|
| 45 |
+
_Py_atomic_add_int32(int32_t *obj, int32_t value)
|
| 46 |
+
{
|
| 47 |
+
_Py_USING_STD;
|
| 48 |
+
return atomic_fetch_add((_Atomic(int32_t)*)obj, value);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
static inline int64_t
|
| 52 |
+
_Py_atomic_add_int64(int64_t *obj, int64_t value)
|
| 53 |
+
{
|
| 54 |
+
_Py_USING_STD;
|
| 55 |
+
return atomic_fetch_add((_Atomic(int64_t)*)obj, value);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
static inline intptr_t
|
| 59 |
+
_Py_atomic_add_intptr(intptr_t *obj, intptr_t value)
|
| 60 |
+
{
|
| 61 |
+
_Py_USING_STD;
|
| 62 |
+
return atomic_fetch_add((_Atomic(intptr_t)*)obj, value);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
static inline unsigned int
|
| 66 |
+
_Py_atomic_add_uint(unsigned int *obj, unsigned int value)
|
| 67 |
+
{
|
| 68 |
+
_Py_USING_STD;
|
| 69 |
+
return atomic_fetch_add((_Atomic(unsigned int)*)obj, value);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
static inline uint8_t
|
| 73 |
+
_Py_atomic_add_uint8(uint8_t *obj, uint8_t value)
|
| 74 |
+
{
|
| 75 |
+
_Py_USING_STD;
|
| 76 |
+
return atomic_fetch_add((_Atomic(uint8_t)*)obj, value);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
static inline uint16_t
|
| 80 |
+
_Py_atomic_add_uint16(uint16_t *obj, uint16_t value)
|
| 81 |
+
{
|
| 82 |
+
_Py_USING_STD;
|
| 83 |
+
return atomic_fetch_add((_Atomic(uint16_t)*)obj, value);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
static inline uint32_t
|
| 87 |
+
_Py_atomic_add_uint32(uint32_t *obj, uint32_t value)
|
| 88 |
+
{
|
| 89 |
+
_Py_USING_STD;
|
| 90 |
+
return atomic_fetch_add((_Atomic(uint32_t)*)obj, value);
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
static inline uint64_t
|
| 94 |
+
_Py_atomic_add_uint64(uint64_t *obj, uint64_t value)
|
| 95 |
+
{
|
| 96 |
+
_Py_USING_STD;
|
| 97 |
+
return atomic_fetch_add((_Atomic(uint64_t)*)obj, value);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
static inline uintptr_t
|
| 101 |
+
_Py_atomic_add_uintptr(uintptr_t *obj, uintptr_t value)
|
| 102 |
+
{
|
| 103 |
+
_Py_USING_STD;
|
| 104 |
+
return atomic_fetch_add((_Atomic(uintptr_t)*)obj, value);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
static inline Py_ssize_t
|
| 108 |
+
_Py_atomic_add_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 109 |
+
{
|
| 110 |
+
_Py_USING_STD;
|
| 111 |
+
return atomic_fetch_add((_Atomic(Py_ssize_t)*)obj, value);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
// --- _Py_atomic_compare_exchange -------------------------------------------
|
| 116 |
+
|
| 117 |
+
static inline int
|
| 118 |
+
_Py_atomic_compare_exchange_int(int *obj, int *expected, int desired)
|
| 119 |
+
{
|
| 120 |
+
_Py_USING_STD;
|
| 121 |
+
return atomic_compare_exchange_strong((_Atomic(int)*)obj,
|
| 122 |
+
expected, desired);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
static inline int
|
| 126 |
+
_Py_atomic_compare_exchange_int8(int8_t *obj, int8_t *expected, int8_t desired)
|
| 127 |
+
{
|
| 128 |
+
_Py_USING_STD;
|
| 129 |
+
return atomic_compare_exchange_strong((_Atomic(int8_t)*)obj,
|
| 130 |
+
expected, desired);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
static inline int
|
| 134 |
+
_Py_atomic_compare_exchange_int16(int16_t *obj, int16_t *expected, int16_t desired)
|
| 135 |
+
{
|
| 136 |
+
_Py_USING_STD;
|
| 137 |
+
return atomic_compare_exchange_strong((_Atomic(int16_t)*)obj,
|
| 138 |
+
expected, desired);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
static inline int
|
| 142 |
+
_Py_atomic_compare_exchange_int32(int32_t *obj, int32_t *expected, int32_t desired)
|
| 143 |
+
{
|
| 144 |
+
_Py_USING_STD;
|
| 145 |
+
return atomic_compare_exchange_strong((_Atomic(int32_t)*)obj,
|
| 146 |
+
expected, desired);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
static inline int
|
| 150 |
+
_Py_atomic_compare_exchange_int64(int64_t *obj, int64_t *expected, int64_t desired)
|
| 151 |
+
{
|
| 152 |
+
_Py_USING_STD;
|
| 153 |
+
return atomic_compare_exchange_strong((_Atomic(int64_t)*)obj,
|
| 154 |
+
expected, desired);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
static inline int
|
| 158 |
+
_Py_atomic_compare_exchange_intptr(intptr_t *obj, intptr_t *expected, intptr_t desired)
|
| 159 |
+
{
|
| 160 |
+
_Py_USING_STD;
|
| 161 |
+
return atomic_compare_exchange_strong((_Atomic(intptr_t)*)obj,
|
| 162 |
+
expected, desired);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
static inline int
|
| 166 |
+
_Py_atomic_compare_exchange_uint(unsigned int *obj, unsigned int *expected, unsigned int desired)
|
| 167 |
+
{
|
| 168 |
+
_Py_USING_STD;
|
| 169 |
+
return atomic_compare_exchange_strong((_Atomic(unsigned int)*)obj,
|
| 170 |
+
expected, desired);
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
static inline int
|
| 174 |
+
_Py_atomic_compare_exchange_uint8(uint8_t *obj, uint8_t *expected, uint8_t desired)
|
| 175 |
+
{
|
| 176 |
+
_Py_USING_STD;
|
| 177 |
+
return atomic_compare_exchange_strong((_Atomic(uint8_t)*)obj,
|
| 178 |
+
expected, desired);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
static inline int
|
| 182 |
+
_Py_atomic_compare_exchange_uint16(uint16_t *obj, uint16_t *expected, uint16_t desired)
|
| 183 |
+
{
|
| 184 |
+
_Py_USING_STD;
|
| 185 |
+
return atomic_compare_exchange_strong((_Atomic(uint16_t)*)obj,
|
| 186 |
+
expected, desired);
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
static inline int
|
| 190 |
+
_Py_atomic_compare_exchange_uint32(uint32_t *obj, uint32_t *expected, uint32_t desired)
|
| 191 |
+
{
|
| 192 |
+
_Py_USING_STD;
|
| 193 |
+
return atomic_compare_exchange_strong((_Atomic(uint32_t)*)obj,
|
| 194 |
+
expected, desired);
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
static inline int
|
| 198 |
+
_Py_atomic_compare_exchange_uint64(uint64_t *obj, uint64_t *expected, uint64_t desired)
|
| 199 |
+
{
|
| 200 |
+
_Py_USING_STD;
|
| 201 |
+
return atomic_compare_exchange_strong((_Atomic(uint64_t)*)obj,
|
| 202 |
+
expected, desired);
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
static inline int
|
| 206 |
+
_Py_atomic_compare_exchange_uintptr(uintptr_t *obj, uintptr_t *expected, uintptr_t desired)
|
| 207 |
+
{
|
| 208 |
+
_Py_USING_STD;
|
| 209 |
+
return atomic_compare_exchange_strong((_Atomic(uintptr_t)*)obj,
|
| 210 |
+
expected, desired);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
static inline int
|
| 214 |
+
_Py_atomic_compare_exchange_ssize(Py_ssize_t *obj, Py_ssize_t *expected, Py_ssize_t desired)
|
| 215 |
+
{
|
| 216 |
+
_Py_USING_STD;
|
| 217 |
+
return atomic_compare_exchange_strong((_Atomic(Py_ssize_t)*)obj,
|
| 218 |
+
expected, desired);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
static inline int
|
| 222 |
+
_Py_atomic_compare_exchange_ptr(void *obj, void *expected, void *desired)
|
| 223 |
+
{
|
| 224 |
+
_Py_USING_STD;
|
| 225 |
+
return atomic_compare_exchange_strong((_Atomic(void *)*)obj,
|
| 226 |
+
(void **)expected, desired);
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
// --- _Py_atomic_exchange ---------------------------------------------------
|
| 231 |
+
|
| 232 |
+
static inline int
|
| 233 |
+
_Py_atomic_exchange_int(int *obj, int value)
|
| 234 |
+
{
|
| 235 |
+
_Py_USING_STD;
|
| 236 |
+
return atomic_exchange((_Atomic(int)*)obj, value);
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
static inline int8_t
|
| 240 |
+
_Py_atomic_exchange_int8(int8_t *obj, int8_t value)
|
| 241 |
+
{
|
| 242 |
+
_Py_USING_STD;
|
| 243 |
+
return atomic_exchange((_Atomic(int8_t)*)obj, value);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
static inline int16_t
|
| 247 |
+
_Py_atomic_exchange_int16(int16_t *obj, int16_t value)
|
| 248 |
+
{
|
| 249 |
+
_Py_USING_STD;
|
| 250 |
+
return atomic_exchange((_Atomic(int16_t)*)obj, value);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
static inline int32_t
|
| 254 |
+
_Py_atomic_exchange_int32(int32_t *obj, int32_t value)
|
| 255 |
+
{
|
| 256 |
+
_Py_USING_STD;
|
| 257 |
+
return atomic_exchange((_Atomic(int32_t)*)obj, value);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
static inline int64_t
|
| 261 |
+
_Py_atomic_exchange_int64(int64_t *obj, int64_t value)
|
| 262 |
+
{
|
| 263 |
+
_Py_USING_STD;
|
| 264 |
+
return atomic_exchange((_Atomic(int64_t)*)obj, value);
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
static inline intptr_t
|
| 268 |
+
_Py_atomic_exchange_intptr(intptr_t *obj, intptr_t value)
|
| 269 |
+
{
|
| 270 |
+
_Py_USING_STD;
|
| 271 |
+
return atomic_exchange((_Atomic(intptr_t)*)obj, value);
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
static inline unsigned int
|
| 275 |
+
_Py_atomic_exchange_uint(unsigned int *obj, unsigned int value)
|
| 276 |
+
{
|
| 277 |
+
_Py_USING_STD;
|
| 278 |
+
return atomic_exchange((_Atomic(unsigned int)*)obj, value);
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
static inline uint8_t
|
| 282 |
+
_Py_atomic_exchange_uint8(uint8_t *obj, uint8_t value)
|
| 283 |
+
{
|
| 284 |
+
_Py_USING_STD;
|
| 285 |
+
return atomic_exchange((_Atomic(uint8_t)*)obj, value);
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
static inline uint16_t
|
| 289 |
+
_Py_atomic_exchange_uint16(uint16_t *obj, uint16_t value)
|
| 290 |
+
{
|
| 291 |
+
_Py_USING_STD;
|
| 292 |
+
return atomic_exchange((_Atomic(uint16_t)*)obj, value);
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
static inline uint32_t
|
| 296 |
+
_Py_atomic_exchange_uint32(uint32_t *obj, uint32_t value)
|
| 297 |
+
{
|
| 298 |
+
_Py_USING_STD;
|
| 299 |
+
return atomic_exchange((_Atomic(uint32_t)*)obj, value);
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
static inline uint64_t
|
| 303 |
+
_Py_atomic_exchange_uint64(uint64_t *obj, uint64_t value)
|
| 304 |
+
{
|
| 305 |
+
_Py_USING_STD;
|
| 306 |
+
return atomic_exchange((_Atomic(uint64_t)*)obj, value);
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
static inline uintptr_t
|
| 310 |
+
_Py_atomic_exchange_uintptr(uintptr_t *obj, uintptr_t value)
|
| 311 |
+
{
|
| 312 |
+
_Py_USING_STD;
|
| 313 |
+
return atomic_exchange((_Atomic(uintptr_t)*)obj, value);
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
static inline Py_ssize_t
|
| 317 |
+
_Py_atomic_exchange_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 318 |
+
{
|
| 319 |
+
_Py_USING_STD;
|
| 320 |
+
return atomic_exchange((_Atomic(Py_ssize_t)*)obj, value);
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
static inline void*
|
| 324 |
+
_Py_atomic_exchange_ptr(void *obj, void *value)
|
| 325 |
+
{
|
| 326 |
+
_Py_USING_STD;
|
| 327 |
+
return atomic_exchange((_Atomic(void *)*)obj, value);
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
// --- _Py_atomic_and --------------------------------------------------------
|
| 332 |
+
|
| 333 |
+
static inline uint8_t
|
| 334 |
+
_Py_atomic_and_uint8(uint8_t *obj, uint8_t value)
|
| 335 |
+
{
|
| 336 |
+
_Py_USING_STD;
|
| 337 |
+
return atomic_fetch_and((_Atomic(uint8_t)*)obj, value);
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
static inline uint16_t
|
| 341 |
+
_Py_atomic_and_uint16(uint16_t *obj, uint16_t value)
|
| 342 |
+
{
|
| 343 |
+
_Py_USING_STD;
|
| 344 |
+
return atomic_fetch_and((_Atomic(uint16_t)*)obj, value);
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
static inline uint32_t
|
| 348 |
+
_Py_atomic_and_uint32(uint32_t *obj, uint32_t value)
|
| 349 |
+
{
|
| 350 |
+
_Py_USING_STD;
|
| 351 |
+
return atomic_fetch_and((_Atomic(uint32_t)*)obj, value);
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
static inline uint64_t
|
| 355 |
+
_Py_atomic_and_uint64(uint64_t *obj, uint64_t value)
|
| 356 |
+
{
|
| 357 |
+
_Py_USING_STD;
|
| 358 |
+
return atomic_fetch_and((_Atomic(uint64_t)*)obj, value);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
static inline uintptr_t
|
| 362 |
+
_Py_atomic_and_uintptr(uintptr_t *obj, uintptr_t value)
|
| 363 |
+
{
|
| 364 |
+
_Py_USING_STD;
|
| 365 |
+
return atomic_fetch_and((_Atomic(uintptr_t)*)obj, value);
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
// --- _Py_atomic_or ---------------------------------------------------------
|
| 370 |
+
|
| 371 |
+
static inline uint8_t
|
| 372 |
+
_Py_atomic_or_uint8(uint8_t *obj, uint8_t value)
|
| 373 |
+
{
|
| 374 |
+
_Py_USING_STD;
|
| 375 |
+
return atomic_fetch_or((_Atomic(uint8_t)*)obj, value);
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
static inline uint16_t
|
| 379 |
+
_Py_atomic_or_uint16(uint16_t *obj, uint16_t value)
|
| 380 |
+
{
|
| 381 |
+
_Py_USING_STD;
|
| 382 |
+
return atomic_fetch_or((_Atomic(uint16_t)*)obj, value);
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
static inline uint32_t
|
| 386 |
+
_Py_atomic_or_uint32(uint32_t *obj, uint32_t value)
|
| 387 |
+
{
|
| 388 |
+
_Py_USING_STD;
|
| 389 |
+
return atomic_fetch_or((_Atomic(uint32_t)*)obj, value);
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
static inline uint64_t
|
| 393 |
+
_Py_atomic_or_uint64(uint64_t *obj, uint64_t value)
|
| 394 |
+
{
|
| 395 |
+
_Py_USING_STD;
|
| 396 |
+
return atomic_fetch_or((_Atomic(uint64_t)*)obj, value);
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
static inline uintptr_t
|
| 400 |
+
_Py_atomic_or_uintptr(uintptr_t *obj, uintptr_t value)
|
| 401 |
+
{
|
| 402 |
+
_Py_USING_STD;
|
| 403 |
+
return atomic_fetch_or((_Atomic(uintptr_t)*)obj, value);
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
// --- _Py_atomic_load -------------------------------------------------------
|
| 408 |
+
|
| 409 |
+
static inline int
|
| 410 |
+
_Py_atomic_load_int(const int *obj)
|
| 411 |
+
{
|
| 412 |
+
_Py_USING_STD;
|
| 413 |
+
return atomic_load((const _Atomic(int)*)obj);
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
static inline int8_t
|
| 417 |
+
_Py_atomic_load_int8(const int8_t *obj)
|
| 418 |
+
{
|
| 419 |
+
_Py_USING_STD;
|
| 420 |
+
return atomic_load((const _Atomic(int8_t)*)obj);
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
static inline int16_t
|
| 424 |
+
_Py_atomic_load_int16(const int16_t *obj)
|
| 425 |
+
{
|
| 426 |
+
_Py_USING_STD;
|
| 427 |
+
return atomic_load((const _Atomic(int16_t)*)obj);
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
static inline int32_t
|
| 431 |
+
_Py_atomic_load_int32(const int32_t *obj)
|
| 432 |
+
{
|
| 433 |
+
_Py_USING_STD;
|
| 434 |
+
return atomic_load((const _Atomic(int32_t)*)obj);
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
static inline int64_t
|
| 438 |
+
_Py_atomic_load_int64(const int64_t *obj)
|
| 439 |
+
{
|
| 440 |
+
_Py_USING_STD;
|
| 441 |
+
return atomic_load((const _Atomic(int64_t)*)obj);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
static inline intptr_t
|
| 445 |
+
_Py_atomic_load_intptr(const intptr_t *obj)
|
| 446 |
+
{
|
| 447 |
+
_Py_USING_STD;
|
| 448 |
+
return atomic_load((const _Atomic(intptr_t)*)obj);
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
static inline uint8_t
|
| 452 |
+
_Py_atomic_load_uint8(const uint8_t *obj)
|
| 453 |
+
{
|
| 454 |
+
_Py_USING_STD;
|
| 455 |
+
return atomic_load((const _Atomic(uint8_t)*)obj);
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
static inline uint16_t
|
| 459 |
+
_Py_atomic_load_uint16(const uint16_t *obj)
|
| 460 |
+
{
|
| 461 |
+
_Py_USING_STD;
|
| 462 |
+
return atomic_load((const _Atomic(uint32_t)*)obj);
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
static inline uint32_t
|
| 466 |
+
_Py_atomic_load_uint32(const uint32_t *obj)
|
| 467 |
+
{
|
| 468 |
+
_Py_USING_STD;
|
| 469 |
+
return atomic_load((const _Atomic(uint32_t)*)obj);
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
static inline uint64_t
|
| 473 |
+
_Py_atomic_load_uint64(const uint64_t *obj)
|
| 474 |
+
{
|
| 475 |
+
_Py_USING_STD;
|
| 476 |
+
return atomic_load((const _Atomic(uint64_t)*)obj);
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
static inline uintptr_t
|
| 480 |
+
_Py_atomic_load_uintptr(const uintptr_t *obj)
|
| 481 |
+
{
|
| 482 |
+
_Py_USING_STD;
|
| 483 |
+
return atomic_load((const _Atomic(uintptr_t)*)obj);
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
static inline unsigned int
|
| 487 |
+
_Py_atomic_load_uint(const unsigned int *obj)
|
| 488 |
+
{
|
| 489 |
+
_Py_USING_STD;
|
| 490 |
+
return atomic_load((const _Atomic(unsigned int)*)obj);
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
static inline Py_ssize_t
|
| 494 |
+
_Py_atomic_load_ssize(const Py_ssize_t *obj)
|
| 495 |
+
{
|
| 496 |
+
_Py_USING_STD;
|
| 497 |
+
return atomic_load((const _Atomic(Py_ssize_t)*)obj);
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
static inline void*
|
| 501 |
+
_Py_atomic_load_ptr(const void *obj)
|
| 502 |
+
{
|
| 503 |
+
_Py_USING_STD;
|
| 504 |
+
return atomic_load((const _Atomic(void*)*)obj);
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
// --- _Py_atomic_load_relaxed -----------------------------------------------
|
| 509 |
+
|
| 510 |
+
static inline int
|
| 511 |
+
_Py_atomic_load_int_relaxed(const int *obj)
|
| 512 |
+
{
|
| 513 |
+
_Py_USING_STD;
|
| 514 |
+
return atomic_load_explicit((const _Atomic(int)*)obj,
|
| 515 |
+
memory_order_relaxed);
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
static inline int8_t
|
| 519 |
+
_Py_atomic_load_int8_relaxed(const int8_t *obj)
|
| 520 |
+
{
|
| 521 |
+
_Py_USING_STD;
|
| 522 |
+
return atomic_load_explicit((const _Atomic(int8_t)*)obj,
|
| 523 |
+
memory_order_relaxed);
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
static inline int16_t
|
| 527 |
+
_Py_atomic_load_int16_relaxed(const int16_t *obj)
|
| 528 |
+
{
|
| 529 |
+
_Py_USING_STD;
|
| 530 |
+
return atomic_load_explicit((const _Atomic(int16_t)*)obj,
|
| 531 |
+
memory_order_relaxed);
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
static inline int32_t
|
| 535 |
+
_Py_atomic_load_int32_relaxed(const int32_t *obj)
|
| 536 |
+
{
|
| 537 |
+
_Py_USING_STD;
|
| 538 |
+
return atomic_load_explicit((const _Atomic(int32_t)*)obj,
|
| 539 |
+
memory_order_relaxed);
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
static inline int64_t
|
| 543 |
+
_Py_atomic_load_int64_relaxed(const int64_t *obj)
|
| 544 |
+
{
|
| 545 |
+
_Py_USING_STD;
|
| 546 |
+
return atomic_load_explicit((const _Atomic(int64_t)*)obj,
|
| 547 |
+
memory_order_relaxed);
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
static inline intptr_t
|
| 551 |
+
_Py_atomic_load_intptr_relaxed(const intptr_t *obj)
|
| 552 |
+
{
|
| 553 |
+
_Py_USING_STD;
|
| 554 |
+
return atomic_load_explicit((const _Atomic(intptr_t)*)obj,
|
| 555 |
+
memory_order_relaxed);
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
static inline uint8_t
|
| 559 |
+
_Py_atomic_load_uint8_relaxed(const uint8_t *obj)
|
| 560 |
+
{
|
| 561 |
+
_Py_USING_STD;
|
| 562 |
+
return atomic_load_explicit((const _Atomic(uint8_t)*)obj,
|
| 563 |
+
memory_order_relaxed);
|
| 564 |
+
}
|
| 565 |
+
|
| 566 |
+
static inline uint16_t
|
| 567 |
+
_Py_atomic_load_uint16_relaxed(const uint16_t *obj)
|
| 568 |
+
{
|
| 569 |
+
_Py_USING_STD;
|
| 570 |
+
return atomic_load_explicit((const _Atomic(uint16_t)*)obj,
|
| 571 |
+
memory_order_relaxed);
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
static inline uint32_t
|
| 575 |
+
_Py_atomic_load_uint32_relaxed(const uint32_t *obj)
|
| 576 |
+
{
|
| 577 |
+
_Py_USING_STD;
|
| 578 |
+
return atomic_load_explicit((const _Atomic(uint32_t)*)obj,
|
| 579 |
+
memory_order_relaxed);
|
| 580 |
+
}
|
| 581 |
+
|
| 582 |
+
static inline uint64_t
|
| 583 |
+
_Py_atomic_load_uint64_relaxed(const uint64_t *obj)
|
| 584 |
+
{
|
| 585 |
+
_Py_USING_STD;
|
| 586 |
+
return atomic_load_explicit((const _Atomic(uint64_t)*)obj,
|
| 587 |
+
memory_order_relaxed);
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
static inline uintptr_t
|
| 591 |
+
_Py_atomic_load_uintptr_relaxed(const uintptr_t *obj)
|
| 592 |
+
{
|
| 593 |
+
_Py_USING_STD;
|
| 594 |
+
return atomic_load_explicit((const _Atomic(uintptr_t)*)obj,
|
| 595 |
+
memory_order_relaxed);
|
| 596 |
+
}
|
| 597 |
+
|
| 598 |
+
static inline unsigned int
|
| 599 |
+
_Py_atomic_load_uint_relaxed(const unsigned int *obj)
|
| 600 |
+
{
|
| 601 |
+
_Py_USING_STD;
|
| 602 |
+
return atomic_load_explicit((const _Atomic(unsigned int)*)obj,
|
| 603 |
+
memory_order_relaxed);
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
static inline Py_ssize_t
|
| 607 |
+
_Py_atomic_load_ssize_relaxed(const Py_ssize_t *obj)
|
| 608 |
+
{
|
| 609 |
+
_Py_USING_STD;
|
| 610 |
+
return atomic_load_explicit((const _Atomic(Py_ssize_t)*)obj,
|
| 611 |
+
memory_order_relaxed);
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
static inline void*
|
| 615 |
+
_Py_atomic_load_ptr_relaxed(const void *obj)
|
| 616 |
+
{
|
| 617 |
+
_Py_USING_STD;
|
| 618 |
+
return atomic_load_explicit((const _Atomic(void*)*)obj,
|
| 619 |
+
memory_order_relaxed);
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
+
static inline unsigned long long
|
| 623 |
+
_Py_atomic_load_ullong_relaxed(const unsigned long long *obj)
|
| 624 |
+
{
|
| 625 |
+
_Py_USING_STD;
|
| 626 |
+
return atomic_load_explicit((const _Atomic(unsigned long long)*)obj,
|
| 627 |
+
memory_order_relaxed);
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
|
| 631 |
+
// --- _Py_atomic_store ------------------------------------------------------
|
| 632 |
+
|
| 633 |
+
static inline void
|
| 634 |
+
_Py_atomic_store_int(int *obj, int value)
|
| 635 |
+
{
|
| 636 |
+
_Py_USING_STD;
|
| 637 |
+
atomic_store((_Atomic(int)*)obj, value);
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
static inline void
|
| 641 |
+
_Py_atomic_store_int8(int8_t *obj, int8_t value)
|
| 642 |
+
{
|
| 643 |
+
_Py_USING_STD;
|
| 644 |
+
atomic_store((_Atomic(int8_t)*)obj, value);
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
static inline void
|
| 648 |
+
_Py_atomic_store_int16(int16_t *obj, int16_t value)
|
| 649 |
+
{
|
| 650 |
+
_Py_USING_STD;
|
| 651 |
+
atomic_store((_Atomic(int16_t)*)obj, value);
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
static inline void
|
| 655 |
+
_Py_atomic_store_int32(int32_t *obj, int32_t value)
|
| 656 |
+
{
|
| 657 |
+
_Py_USING_STD;
|
| 658 |
+
atomic_store((_Atomic(int32_t)*)obj, value);
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
static inline void
|
| 662 |
+
_Py_atomic_store_int64(int64_t *obj, int64_t value)
|
| 663 |
+
{
|
| 664 |
+
_Py_USING_STD;
|
| 665 |
+
atomic_store((_Atomic(int64_t)*)obj, value);
|
| 666 |
+
}
|
| 667 |
+
|
| 668 |
+
static inline void
|
| 669 |
+
_Py_atomic_store_intptr(intptr_t *obj, intptr_t value)
|
| 670 |
+
{
|
| 671 |
+
_Py_USING_STD;
|
| 672 |
+
atomic_store((_Atomic(intptr_t)*)obj, value);
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
static inline void
|
| 676 |
+
_Py_atomic_store_uint8(uint8_t *obj, uint8_t value)
|
| 677 |
+
{
|
| 678 |
+
_Py_USING_STD;
|
| 679 |
+
atomic_store((_Atomic(uint8_t)*)obj, value);
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
static inline void
|
| 683 |
+
_Py_atomic_store_uint16(uint16_t *obj, uint16_t value)
|
| 684 |
+
{
|
| 685 |
+
_Py_USING_STD;
|
| 686 |
+
atomic_store((_Atomic(uint16_t)*)obj, value);
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
static inline void
|
| 690 |
+
_Py_atomic_store_uint32(uint32_t *obj, uint32_t value)
|
| 691 |
+
{
|
| 692 |
+
_Py_USING_STD;
|
| 693 |
+
atomic_store((_Atomic(uint32_t)*)obj, value);
|
| 694 |
+
}
|
| 695 |
+
|
| 696 |
+
static inline void
|
| 697 |
+
_Py_atomic_store_uint64(uint64_t *obj, uint64_t value)
|
| 698 |
+
{
|
| 699 |
+
_Py_USING_STD;
|
| 700 |
+
atomic_store((_Atomic(uint64_t)*)obj, value);
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
static inline void
|
| 704 |
+
_Py_atomic_store_uintptr(uintptr_t *obj, uintptr_t value)
|
| 705 |
+
{
|
| 706 |
+
_Py_USING_STD;
|
| 707 |
+
atomic_store((_Atomic(uintptr_t)*)obj, value);
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
static inline void
|
| 711 |
+
_Py_atomic_store_uint(unsigned int *obj, unsigned int value)
|
| 712 |
+
{
|
| 713 |
+
_Py_USING_STD;
|
| 714 |
+
atomic_store((_Atomic(unsigned int)*)obj, value);
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
static inline void
|
| 718 |
+
_Py_atomic_store_ptr(void *obj, void *value)
|
| 719 |
+
{
|
| 720 |
+
_Py_USING_STD;
|
| 721 |
+
atomic_store((_Atomic(void*)*)obj, value);
|
| 722 |
+
}
|
| 723 |
+
|
| 724 |
+
static inline void
|
| 725 |
+
_Py_atomic_store_ssize(Py_ssize_t *obj, Py_ssize_t value)
|
| 726 |
+
{
|
| 727 |
+
_Py_USING_STD;
|
| 728 |
+
atomic_store((_Atomic(Py_ssize_t)*)obj, value);
|
| 729 |
+
}
|
| 730 |
+
|
| 731 |
+
|
| 732 |
+
// --- _Py_atomic_store_relaxed ----------------------------------------------
|
| 733 |
+
|
| 734 |
+
static inline void
|
| 735 |
+
_Py_atomic_store_int_relaxed(int *obj, int value)
|
| 736 |
+
{
|
| 737 |
+
_Py_USING_STD;
|
| 738 |
+
atomic_store_explicit((_Atomic(int)*)obj, value,
|
| 739 |
+
memory_order_relaxed);
|
| 740 |
+
}
|
| 741 |
+
|
| 742 |
+
static inline void
|
| 743 |
+
_Py_atomic_store_int8_relaxed(int8_t *obj, int8_t value)
|
| 744 |
+
{
|
| 745 |
+
_Py_USING_STD;
|
| 746 |
+
atomic_store_explicit((_Atomic(int8_t)*)obj, value,
|
| 747 |
+
memory_order_relaxed);
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
static inline void
|
| 751 |
+
_Py_atomic_store_int16_relaxed(int16_t *obj, int16_t value)
|
| 752 |
+
{
|
| 753 |
+
_Py_USING_STD;
|
| 754 |
+
atomic_store_explicit((_Atomic(int16_t)*)obj, value,
|
| 755 |
+
memory_order_relaxed);
|
| 756 |
+
}
|
| 757 |
+
|
| 758 |
+
static inline void
|
| 759 |
+
_Py_atomic_store_int32_relaxed(int32_t *obj, int32_t value)
|
| 760 |
+
{
|
| 761 |
+
_Py_USING_STD;
|
| 762 |
+
atomic_store_explicit((_Atomic(int32_t)*)obj, value,
|
| 763 |
+
memory_order_relaxed);
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
static inline void
|
| 767 |
+
_Py_atomic_store_int64_relaxed(int64_t *obj, int64_t value)
|
| 768 |
+
{
|
| 769 |
+
_Py_USING_STD;
|
| 770 |
+
atomic_store_explicit((_Atomic(int64_t)*)obj, value,
|
| 771 |
+
memory_order_relaxed);
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
static inline void
|
| 775 |
+
_Py_atomic_store_intptr_relaxed(intptr_t *obj, intptr_t value)
|
| 776 |
+
{
|
| 777 |
+
_Py_USING_STD;
|
| 778 |
+
atomic_store_explicit((_Atomic(intptr_t)*)obj, value,
|
| 779 |
+
memory_order_relaxed);
|
| 780 |
+
}
|
| 781 |
+
|
| 782 |
+
static inline void
|
| 783 |
+
_Py_atomic_store_uint8_relaxed(uint8_t *obj, uint8_t value)
|
| 784 |
+
{
|
| 785 |
+
_Py_USING_STD;
|
| 786 |
+
atomic_store_explicit((_Atomic(uint8_t)*)obj, value,
|
| 787 |
+
memory_order_relaxed);
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
static inline void
|
| 791 |
+
_Py_atomic_store_uint16_relaxed(uint16_t *obj, uint16_t value)
|
| 792 |
+
{
|
| 793 |
+
_Py_USING_STD;
|
| 794 |
+
atomic_store_explicit((_Atomic(uint16_t)*)obj, value,
|
| 795 |
+
memory_order_relaxed);
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
static inline void
|
| 799 |
+
_Py_atomic_store_uint32_relaxed(uint32_t *obj, uint32_t value)
|
| 800 |
+
{
|
| 801 |
+
_Py_USING_STD;
|
| 802 |
+
atomic_store_explicit((_Atomic(uint32_t)*)obj, value,
|
| 803 |
+
memory_order_relaxed);
|
| 804 |
+
}
|
| 805 |
+
|
| 806 |
+
static inline void
|
| 807 |
+
_Py_atomic_store_uint64_relaxed(uint64_t *obj, uint64_t value)
|
| 808 |
+
{
|
| 809 |
+
_Py_USING_STD;
|
| 810 |
+
atomic_store_explicit((_Atomic(uint64_t)*)obj, value,
|
| 811 |
+
memory_order_relaxed);
|
| 812 |
+
}
|
| 813 |
+
|
| 814 |
+
static inline void
|
| 815 |
+
_Py_atomic_store_uintptr_relaxed(uintptr_t *obj, uintptr_t value)
|
| 816 |
+
{
|
| 817 |
+
_Py_USING_STD;
|
| 818 |
+
atomic_store_explicit((_Atomic(uintptr_t)*)obj, value,
|
| 819 |
+
memory_order_relaxed);
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
static inline void
|
| 823 |
+
_Py_atomic_store_uint_relaxed(unsigned int *obj, unsigned int value)
|
| 824 |
+
{
|
| 825 |
+
_Py_USING_STD;
|
| 826 |
+
atomic_store_explicit((_Atomic(unsigned int)*)obj, value,
|
| 827 |
+
memory_order_relaxed);
|
| 828 |
+
}
|
| 829 |
+
|
| 830 |
+
static inline void
|
| 831 |
+
_Py_atomic_store_ptr_relaxed(void *obj, void *value)
|
| 832 |
+
{
|
| 833 |
+
_Py_USING_STD;
|
| 834 |
+
atomic_store_explicit((_Atomic(void*)*)obj, value,
|
| 835 |
+
memory_order_relaxed);
|
| 836 |
+
}
|
| 837 |
+
|
| 838 |
+
static inline void
|
| 839 |
+
_Py_atomic_store_ssize_relaxed(Py_ssize_t *obj, Py_ssize_t value)
|
| 840 |
+
{
|
| 841 |
+
_Py_USING_STD;
|
| 842 |
+
atomic_store_explicit((_Atomic(Py_ssize_t)*)obj, value,
|
| 843 |
+
memory_order_relaxed);
|
| 844 |
+
}
|
| 845 |
+
|
| 846 |
+
static inline void
|
| 847 |
+
_Py_atomic_store_ullong_relaxed(unsigned long long *obj,
|
| 848 |
+
unsigned long long value)
|
| 849 |
+
{
|
| 850 |
+
_Py_USING_STD;
|
| 851 |
+
atomic_store_explicit((_Atomic(unsigned long long)*)obj, value,
|
| 852 |
+
memory_order_relaxed);
|
| 853 |
+
}
|
| 854 |
+
|
| 855 |
+
|
| 856 |
+
// --- _Py_atomic_load_ptr_acquire / _Py_atomic_store_ptr_release ------------
|
| 857 |
+
|
| 858 |
+
static inline void *
|
| 859 |
+
_Py_atomic_load_ptr_acquire(const void *obj)
|
| 860 |
+
{
|
| 861 |
+
_Py_USING_STD;
|
| 862 |
+
return atomic_load_explicit((const _Atomic(void*)*)obj,
|
| 863 |
+
memory_order_acquire);
|
| 864 |
+
}
|
| 865 |
+
|
| 866 |
+
static inline uintptr_t
|
| 867 |
+
_Py_atomic_load_uintptr_acquire(const uintptr_t *obj)
|
| 868 |
+
{
|
| 869 |
+
_Py_USING_STD;
|
| 870 |
+
return atomic_load_explicit((const _Atomic(uintptr_t)*)obj,
|
| 871 |
+
memory_order_acquire);
|
| 872 |
+
}
|
| 873 |
+
|
| 874 |
+
static inline void
|
| 875 |
+
_Py_atomic_store_ptr_release(void *obj, void *value)
|
| 876 |
+
{
|
| 877 |
+
_Py_USING_STD;
|
| 878 |
+
atomic_store_explicit((_Atomic(void*)*)obj, value,
|
| 879 |
+
memory_order_release);
|
| 880 |
+
}
|
| 881 |
+
|
| 882 |
+
static inline void
|
| 883 |
+
_Py_atomic_store_uintptr_release(uintptr_t *obj, uintptr_t value)
|
| 884 |
+
{
|
| 885 |
+
_Py_USING_STD;
|
| 886 |
+
atomic_store_explicit((_Atomic(uintptr_t)*)obj, value,
|
| 887 |
+
memory_order_release);
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
static inline void
|
| 891 |
+
_Py_atomic_store_int_release(int *obj, int value)
|
| 892 |
+
{
|
| 893 |
+
_Py_USING_STD;
|
| 894 |
+
atomic_store_explicit((_Atomic(int)*)obj, value,
|
| 895 |
+
memory_order_release);
|
| 896 |
+
}
|
| 897 |
+
|
| 898 |
+
static inline void
|
| 899 |
+
_Py_atomic_store_ssize_release(Py_ssize_t *obj, Py_ssize_t value)
|
| 900 |
+
{
|
| 901 |
+
_Py_USING_STD;
|
| 902 |
+
atomic_store_explicit((_Atomic(Py_ssize_t)*)obj, value,
|
| 903 |
+
memory_order_release);
|
| 904 |
+
}
|
| 905 |
+
|
| 906 |
+
static inline int
|
| 907 |
+
_Py_atomic_load_int_acquire(const int *obj)
|
| 908 |
+
{
|
| 909 |
+
_Py_USING_STD;
|
| 910 |
+
return atomic_load_explicit((const _Atomic(int)*)obj,
|
| 911 |
+
memory_order_acquire);
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
+
static inline void
|
| 915 |
+
_Py_atomic_store_uint32_release(uint32_t *obj, uint32_t value)
|
| 916 |
+
{
|
| 917 |
+
_Py_USING_STD;
|
| 918 |
+
atomic_store_explicit((_Atomic(uint32_t)*)obj, value,
|
| 919 |
+
memory_order_release);
|
| 920 |
+
}
|
| 921 |
+
|
| 922 |
+
static inline void
|
| 923 |
+
_Py_atomic_store_uint64_release(uint64_t *obj, uint64_t value)
|
| 924 |
+
{
|
| 925 |
+
_Py_USING_STD;
|
| 926 |
+
atomic_store_explicit((_Atomic(uint64_t)*)obj, value,
|
| 927 |
+
memory_order_release);
|
| 928 |
+
}
|
| 929 |
+
|
| 930 |
+
static inline uint64_t
|
| 931 |
+
_Py_atomic_load_uint64_acquire(const uint64_t *obj)
|
| 932 |
+
{
|
| 933 |
+
_Py_USING_STD;
|
| 934 |
+
return atomic_load_explicit((const _Atomic(uint64_t)*)obj,
|
| 935 |
+
memory_order_acquire);
|
| 936 |
+
}
|
| 937 |
+
|
| 938 |
+
static inline uint32_t
|
| 939 |
+
_Py_atomic_load_uint32_acquire(const uint32_t *obj)
|
| 940 |
+
{
|
| 941 |
+
_Py_USING_STD;
|
| 942 |
+
return atomic_load_explicit((const _Atomic(uint32_t)*)obj,
|
| 943 |
+
memory_order_acquire);
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
static inline Py_ssize_t
|
| 947 |
+
_Py_atomic_load_ssize_acquire(const Py_ssize_t *obj)
|
| 948 |
+
{
|
| 949 |
+
_Py_USING_STD;
|
| 950 |
+
return atomic_load_explicit((const _Atomic(Py_ssize_t)*)obj,
|
| 951 |
+
memory_order_acquire);
|
| 952 |
+
}
|
| 953 |
+
|
| 954 |
+
|
| 955 |
+
// --- _Py_atomic_fence ------------------------------------------------------
|
| 956 |
+
|
| 957 |
+
static inline void
|
| 958 |
+
_Py_atomic_fence_seq_cst(void)
|
| 959 |
+
{
|
| 960 |
+
_Py_USING_STD;
|
| 961 |
+
atomic_thread_fence(memory_order_seq_cst);
|
| 962 |
+
}
|
| 963 |
+
|
| 964 |
+
static inline void
|
| 965 |
+
_Py_atomic_fence_acquire(void)
|
| 966 |
+
{
|
| 967 |
+
_Py_USING_STD;
|
| 968 |
+
atomic_thread_fence(memory_order_acquire);
|
| 969 |
+
}
|
| 970 |
+
|
| 971 |
+
static inline void
|
| 972 |
+
_Py_atomic_fence_release(void)
|
| 973 |
+
{
|
| 974 |
+
_Py_USING_STD;
|
| 975 |
+
atomic_thread_fence(memory_order_release);
|
| 976 |
+
}
|
data/miniconda3/include/python3.13/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 */
|
data/miniconda3/include/python3.13/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 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_DebugFlag;
|
| 9 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_VerboseFlag;
|
| 10 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_QuietFlag;
|
| 11 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_InteractiveFlag;
|
| 12 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_InspectFlag;
|
| 13 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_OptimizeFlag;
|
| 14 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_NoSiteFlag;
|
| 15 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_BytesWarningFlag;
|
| 16 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_FrozenFlag;
|
| 17 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
|
| 18 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_DontWriteBytecodeFlag;
|
| 19 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_NoUserSiteDirectory;
|
| 20 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_UnbufferedStdioFlag;
|
| 21 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_HashRandomizationFlag;
|
| 22 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_IsolatedFlag;
|
| 23 |
+
|
| 24 |
+
#ifdef MS_WINDOWS
|
| 25 |
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_LegacyWindowsFSEncodingFlag;
|
| 26 |
+
Py_DEPRECATED(3.12) 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 |
+
PyAPI_FUNC(char*) Py_GETENV(const char *name);
|
| 33 |
+
|
| 34 |
+
#ifdef __cplusplus
|
| 35 |
+
}
|
| 36 |
+
#endif
|
| 37 |
+
#endif /* !Py_PYDEBUG_H */
|
| 38 |
+
#endif /* Py_LIMITED_API */
|
data/miniconda3/include/python3.13/cpython/pyerrors.h
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_ERRORS_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Error objects */
|
| 6 |
+
|
| 7 |
+
/* PyException_HEAD defines the initial segment of every exception class. */
|
| 8 |
+
#define PyException_HEAD PyObject_HEAD PyObject *dict;\
|
| 9 |
+
PyObject *args; PyObject *notes; PyObject *traceback;\
|
| 10 |
+
PyObject *context; PyObject *cause;\
|
| 11 |
+
char suppress_context;
|
| 12 |
+
|
| 13 |
+
typedef struct {
|
| 14 |
+
PyException_HEAD
|
| 15 |
+
} PyBaseExceptionObject;
|
| 16 |
+
|
| 17 |
+
typedef struct {
|
| 18 |
+
PyException_HEAD
|
| 19 |
+
PyObject *msg;
|
| 20 |
+
PyObject *excs;
|
| 21 |
+
} PyBaseExceptionGroupObject;
|
| 22 |
+
|
| 23 |
+
typedef struct {
|
| 24 |
+
PyException_HEAD
|
| 25 |
+
PyObject *msg;
|
| 26 |
+
PyObject *filename;
|
| 27 |
+
PyObject *lineno;
|
| 28 |
+
PyObject *offset;
|
| 29 |
+
PyObject *end_lineno;
|
| 30 |
+
PyObject *end_offset;
|
| 31 |
+
PyObject *text;
|
| 32 |
+
PyObject *print_file_and_line;
|
| 33 |
+
} PySyntaxErrorObject;
|
| 34 |
+
|
| 35 |
+
typedef struct {
|
| 36 |
+
PyException_HEAD
|
| 37 |
+
PyObject *msg;
|
| 38 |
+
PyObject *name;
|
| 39 |
+
PyObject *path;
|
| 40 |
+
PyObject *name_from;
|
| 41 |
+
} PyImportErrorObject;
|
| 42 |
+
|
| 43 |
+
typedef struct {
|
| 44 |
+
PyException_HEAD
|
| 45 |
+
PyObject *encoding;
|
| 46 |
+
PyObject *object;
|
| 47 |
+
Py_ssize_t start;
|
| 48 |
+
Py_ssize_t end;
|
| 49 |
+
PyObject *reason;
|
| 50 |
+
} PyUnicodeErrorObject;
|
| 51 |
+
|
| 52 |
+
typedef struct {
|
| 53 |
+
PyException_HEAD
|
| 54 |
+
PyObject *code;
|
| 55 |
+
} PySystemExitObject;
|
| 56 |
+
|
| 57 |
+
typedef struct {
|
| 58 |
+
PyException_HEAD
|
| 59 |
+
PyObject *myerrno;
|
| 60 |
+
PyObject *strerror;
|
| 61 |
+
PyObject *filename;
|
| 62 |
+
PyObject *filename2;
|
| 63 |
+
#ifdef MS_WINDOWS
|
| 64 |
+
PyObject *winerror;
|
| 65 |
+
#endif
|
| 66 |
+
Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */
|
| 67 |
+
} PyOSErrorObject;
|
| 68 |
+
|
| 69 |
+
typedef struct {
|
| 70 |
+
PyException_HEAD
|
| 71 |
+
PyObject *value;
|
| 72 |
+
} PyStopIterationObject;
|
| 73 |
+
|
| 74 |
+
typedef struct {
|
| 75 |
+
PyException_HEAD
|
| 76 |
+
PyObject *name;
|
| 77 |
+
} PyNameErrorObject;
|
| 78 |
+
|
| 79 |
+
typedef struct {
|
| 80 |
+
PyException_HEAD
|
| 81 |
+
PyObject *obj;
|
| 82 |
+
PyObject *name;
|
| 83 |
+
} PyAttributeErrorObject;
|
| 84 |
+
|
| 85 |
+
/* Compatibility typedefs */
|
| 86 |
+
typedef PyOSErrorObject PyEnvironmentErrorObject;
|
| 87 |
+
#ifdef MS_WINDOWS
|
| 88 |
+
typedef PyOSErrorObject PyWindowsErrorObject;
|
| 89 |
+
#endif
|
| 90 |
+
|
| 91 |
+
/* Context manipulation (PEP 3134) */
|
| 92 |
+
|
| 93 |
+
PyAPI_FUNC(void) _PyErr_ChainExceptions1(PyObject *);
|
| 94 |
+
|
| 95 |
+
/* In exceptions.c */
|
| 96 |
+
|
| 97 |
+
PyAPI_FUNC(PyObject*) PyUnstable_Exc_PrepReraiseStar(
|
| 98 |
+
PyObject *orig,
|
| 99 |
+
PyObject *excs);
|
| 100 |
+
|
| 101 |
+
/* In signalmodule.c */
|
| 102 |
+
|
| 103 |
+
PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd);
|
| 104 |
+
|
| 105 |
+
/* Support for adding program text to SyntaxErrors */
|
| 106 |
+
|
| 107 |
+
PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
|
| 108 |
+
PyObject *filename,
|
| 109 |
+
int lineno,
|
| 110 |
+
int col_offset);
|
| 111 |
+
|
| 112 |
+
PyAPI_FUNC(void) PyErr_RangedSyntaxLocationObject(
|
| 113 |
+
PyObject *filename,
|
| 114 |
+
int lineno,
|
| 115 |
+
int col_offset,
|
| 116 |
+
int end_lineno,
|
| 117 |
+
int end_col_offset);
|
| 118 |
+
|
| 119 |
+
PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
|
| 120 |
+
PyObject *filename,
|
| 121 |
+
int lineno);
|
| 122 |
+
|
| 123 |
+
PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc(
|
| 124 |
+
const char *func,
|
| 125 |
+
const char *message);
|
| 126 |
+
|
| 127 |
+
PyAPI_FUNC(void) PyErr_FormatUnraisable(const char *, ...);
|
| 128 |
+
|
| 129 |
+
PyAPI_DATA(PyObject *) PyExc_PythonFinalizationError;
|
| 130 |
+
|
| 131 |
+
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, (message))
|
data/miniconda3/include/python3.13/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 */
|
data/miniconda3/include/python3.13/cpython/pyframe.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PYFRAME_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
| 6 |
+
PyAPI_DATA(PyTypeObject) PyFrameLocalsProxy_Type;
|
| 7 |
+
|
| 8 |
+
#define PyFrame_Check(op) Py_IS_TYPE((op), &PyFrame_Type)
|
| 9 |
+
#define PyFrameLocalsProxy_Check(op) Py_IS_TYPE((op), &PyFrameLocalsProxy_Type)
|
| 10 |
+
|
| 11 |
+
PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
|
| 12 |
+
PyAPI_FUNC(PyObject *) PyFrame_GetLocals(PyFrameObject *frame);
|
| 13 |
+
|
| 14 |
+
PyAPI_FUNC(PyObject *) PyFrame_GetGlobals(PyFrameObject *frame);
|
| 15 |
+
PyAPI_FUNC(PyObject *) PyFrame_GetBuiltins(PyFrameObject *frame);
|
| 16 |
+
|
| 17 |
+
PyAPI_FUNC(PyObject *) PyFrame_GetGenerator(PyFrameObject *frame);
|
| 18 |
+
PyAPI_FUNC(int) PyFrame_GetLasti(PyFrameObject *frame);
|
| 19 |
+
PyAPI_FUNC(PyObject*) PyFrame_GetVar(PyFrameObject *frame, PyObject *name);
|
| 20 |
+
PyAPI_FUNC(PyObject*) PyFrame_GetVarString(PyFrameObject *frame, const char *name);
|
| 21 |
+
|
| 22 |
+
/* The following functions are for use by debuggers and other tools
|
| 23 |
+
* implementing custom frame evaluators with PEP 523. */
|
| 24 |
+
|
| 25 |
+
struct _PyInterpreterFrame;
|
| 26 |
+
|
| 27 |
+
/* Returns the code object of the frame (strong reference).
|
| 28 |
+
* Does not raise an exception. */
|
| 29 |
+
PyAPI_FUNC(PyObject *) PyUnstable_InterpreterFrame_GetCode(struct _PyInterpreterFrame *frame);
|
| 30 |
+
|
| 31 |
+
/* Returns a byte ofsset into the last executed instruction.
|
| 32 |
+
* Does not raise an exception. */
|
| 33 |
+
PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame *frame);
|
| 34 |
+
|
| 35 |
+
/* Returns the currently executing line number, or -1 if there is no line number.
|
| 36 |
+
* Does not raise an exception. */
|
| 37 |
+
PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);
|
| 38 |
+
|
| 39 |
+
#define PyUnstable_EXECUTABLE_KIND_SKIP 0
|
| 40 |
+
#define PyUnstable_EXECUTABLE_KIND_PY_FUNCTION 1
|
| 41 |
+
#define PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION 3
|
| 42 |
+
#define PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR 4
|
| 43 |
+
#define PyUnstable_EXECUTABLE_KINDS 5
|
| 44 |
+
|
| 45 |
+
PyAPI_DATA(const PyTypeObject *) const PyUnstable_ExecutableKinds[PyUnstable_EXECUTABLE_KINDS+1];
|
data/miniconda3/include/python3.13/cpython/pyhash.h
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_HASH_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
/* Prime multiplier used in string and various other hashes. */
|
| 6 |
+
#define PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */
|
| 7 |
+
|
| 8 |
+
/* Parameters used for the numeric hash implementation. See notes for
|
| 9 |
+
_Py_HashDouble in Python/pyhash.c. Numeric hashes are based on
|
| 10 |
+
reduction modulo the prime 2**_PyHASH_BITS - 1. */
|
| 11 |
+
|
| 12 |
+
#if SIZEOF_VOID_P >= 8
|
| 13 |
+
# define PyHASH_BITS 61
|
| 14 |
+
#else
|
| 15 |
+
# define PyHASH_BITS 31
|
| 16 |
+
#endif
|
| 17 |
+
|
| 18 |
+
#define PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
|
| 19 |
+
#define PyHASH_INF 314159
|
| 20 |
+
#define PyHASH_IMAG PyHASH_MULTIPLIER
|
| 21 |
+
|
| 22 |
+
/* Aliases kept for backward compatibility with Python 3.12 */
|
| 23 |
+
#define _PyHASH_MULTIPLIER PyHASH_MULTIPLIER
|
| 24 |
+
#define _PyHASH_BITS PyHASH_BITS
|
| 25 |
+
#define _PyHASH_MODULUS PyHASH_MODULUS
|
| 26 |
+
#define _PyHASH_INF PyHASH_INF
|
| 27 |
+
#define _PyHASH_IMAG PyHASH_IMAG
|
| 28 |
+
|
| 29 |
+
/* Helpers for hash functions */
|
| 30 |
+
PyAPI_FUNC(Py_hash_t) _Py_HashDouble(PyObject *, double);
|
| 31 |
+
|
| 32 |
+
// Kept for backward compatibility
|
| 33 |
+
#define _Py_HashPointer Py_HashPointer
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
/* hash function definition */
|
| 37 |
+
typedef struct {
|
| 38 |
+
Py_hash_t (*const hash)(const void *, Py_ssize_t);
|
| 39 |
+
const char *name;
|
| 40 |
+
const int hash_bits;
|
| 41 |
+
const int seed_bits;
|
| 42 |
+
} PyHash_FuncDef;
|
| 43 |
+
|
| 44 |
+
PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);
|
| 45 |
+
|
| 46 |
+
PyAPI_FUNC(Py_hash_t) Py_HashPointer(const void *ptr);
|
| 47 |
+
PyAPI_FUNC(Py_hash_t) PyObject_GenericHash(PyObject *);
|
data/miniconda3/include/python3.13/cpython/pylifecycle.h
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
/* PEP 432 Multi-phase initialization API (Private while provisional!) */
|
| 10 |
+
|
| 11 |
+
PyAPI_FUNC(PyStatus) Py_PreInitialize(
|
| 12 |
+
const PyPreConfig *src_config);
|
| 13 |
+
PyAPI_FUNC(PyStatus) Py_PreInitializeFromBytesArgs(
|
| 14 |
+
const PyPreConfig *src_config,
|
| 15 |
+
Py_ssize_t argc,
|
| 16 |
+
char **argv);
|
| 17 |
+
PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs(
|
| 18 |
+
const PyPreConfig *src_config,
|
| 19 |
+
Py_ssize_t argc,
|
| 20 |
+
wchar_t **argv);
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
/* Initialization and finalization */
|
| 24 |
+
|
| 25 |
+
PyAPI_FUNC(PyStatus) Py_InitializeFromConfig(
|
| 26 |
+
const PyConfig *config);
|
| 27 |
+
|
| 28 |
+
// Python 3.8 provisional API (PEP 587)
|
| 29 |
+
PyAPI_FUNC(PyStatus) _Py_InitializeMain(void);
|
| 30 |
+
|
| 31 |
+
PyAPI_FUNC(int) Py_RunMain(void);
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
|
| 35 |
+
|
| 36 |
+
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
|
| 37 |
+
|
| 38 |
+
/* --- PyInterpreterConfig ------------------------------------ */
|
| 39 |
+
|
| 40 |
+
#define PyInterpreterConfig_DEFAULT_GIL (0)
|
| 41 |
+
#define PyInterpreterConfig_SHARED_GIL (1)
|
| 42 |
+
#define PyInterpreterConfig_OWN_GIL (2)
|
| 43 |
+
|
| 44 |
+
typedef struct {
|
| 45 |
+
// XXX "allow_object_sharing"? "own_objects"?
|
| 46 |
+
int use_main_obmalloc;
|
| 47 |
+
int allow_fork;
|
| 48 |
+
int allow_exec;
|
| 49 |
+
int allow_threads;
|
| 50 |
+
int allow_daemon_threads;
|
| 51 |
+
int check_multi_interp_extensions;
|
| 52 |
+
int gil;
|
| 53 |
+
} PyInterpreterConfig;
|
| 54 |
+
|
| 55 |
+
#define _PyInterpreterConfig_INIT \
|
| 56 |
+
{ \
|
| 57 |
+
.use_main_obmalloc = 0, \
|
| 58 |
+
.allow_fork = 0, \
|
| 59 |
+
.allow_exec = 0, \
|
| 60 |
+
.allow_threads = 1, \
|
| 61 |
+
.allow_daemon_threads = 0, \
|
| 62 |
+
.check_multi_interp_extensions = 1, \
|
| 63 |
+
.gil = PyInterpreterConfig_OWN_GIL, \
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
// gh-117649: The free-threaded build does not currently support single-phase
|
| 67 |
+
// init extensions in subinterpreters. For now, we ensure that
|
| 68 |
+
// `check_multi_interp_extensions` is always `1`, even in the legacy config.
|
| 69 |
+
#ifdef Py_GIL_DISABLED
|
| 70 |
+
# define _PyInterpreterConfig_LEGACY_CHECK_MULTI_INTERP_EXTENSIONS 1
|
| 71 |
+
#else
|
| 72 |
+
# define _PyInterpreterConfig_LEGACY_CHECK_MULTI_INTERP_EXTENSIONS 0
|
| 73 |
+
#endif
|
| 74 |
+
|
| 75 |
+
#define _PyInterpreterConfig_LEGACY_INIT \
|
| 76 |
+
{ \
|
| 77 |
+
.use_main_obmalloc = 1, \
|
| 78 |
+
.allow_fork = 1, \
|
| 79 |
+
.allow_exec = 1, \
|
| 80 |
+
.allow_threads = 1, \
|
| 81 |
+
.allow_daemon_threads = 1, \
|
| 82 |
+
.check_multi_interp_extensions = _PyInterpreterConfig_LEGACY_CHECK_MULTI_INTERP_EXTENSIONS, \
|
| 83 |
+
.gil = PyInterpreterConfig_SHARED_GIL, \
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig(
|
| 87 |
+
PyThreadState **tstate_p,
|
| 88 |
+
const PyInterpreterConfig *config);
|
| 89 |
+
|
| 90 |
+
typedef void (*atexit_datacallbackfunc)(void *);
|
| 91 |
+
PyAPI_FUNC(int) PyUnstable_AtExit(
|
| 92 |
+
PyInterpreterState *, atexit_datacallbackfunc, void *);
|
data/miniconda3/include/python3.13/cpython/pymem.h
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PYMEM_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
typedef enum {
|
| 6 |
+
/* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */
|
| 7 |
+
PYMEM_DOMAIN_RAW,
|
| 8 |
+
|
| 9 |
+
/* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */
|
| 10 |
+
PYMEM_DOMAIN_MEM,
|
| 11 |
+
|
| 12 |
+
/* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */
|
| 13 |
+
PYMEM_DOMAIN_OBJ
|
| 14 |
+
} PyMemAllocatorDomain;
|
| 15 |
+
|
| 16 |
+
typedef enum {
|
| 17 |
+
PYMEM_ALLOCATOR_NOT_SET = 0,
|
| 18 |
+
PYMEM_ALLOCATOR_DEFAULT = 1,
|
| 19 |
+
PYMEM_ALLOCATOR_DEBUG = 2,
|
| 20 |
+
PYMEM_ALLOCATOR_MALLOC = 3,
|
| 21 |
+
PYMEM_ALLOCATOR_MALLOC_DEBUG = 4,
|
| 22 |
+
#ifdef WITH_PYMALLOC
|
| 23 |
+
PYMEM_ALLOCATOR_PYMALLOC = 5,
|
| 24 |
+
PYMEM_ALLOCATOR_PYMALLOC_DEBUG = 6,
|
| 25 |
+
#endif
|
| 26 |
+
#ifdef WITH_MIMALLOC
|
| 27 |
+
PYMEM_ALLOCATOR_MIMALLOC = 7,
|
| 28 |
+
PYMEM_ALLOCATOR_MIMALLOC_DEBUG = 8,
|
| 29 |
+
#endif
|
| 30 |
+
} PyMemAllocatorName;
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
typedef struct {
|
| 34 |
+
/* user context passed as the first argument to the 4 functions */
|
| 35 |
+
void *ctx;
|
| 36 |
+
|
| 37 |
+
/* allocate a memory block */
|
| 38 |
+
void* (*malloc) (void *ctx, size_t size);
|
| 39 |
+
|
| 40 |
+
/* allocate a memory block initialized by zeros */
|
| 41 |
+
void* (*calloc) (void *ctx, size_t nelem, size_t elsize);
|
| 42 |
+
|
| 43 |
+
/* allocate or resize a memory block */
|
| 44 |
+
void* (*realloc) (void *ctx, void *ptr, size_t new_size);
|
| 45 |
+
|
| 46 |
+
/* release a memory block */
|
| 47 |
+
void (*free) (void *ctx, void *ptr);
|
| 48 |
+
} PyMemAllocatorEx;
|
| 49 |
+
|
| 50 |
+
/* Get the memory block allocator of the specified domain. */
|
| 51 |
+
PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain,
|
| 52 |
+
PyMemAllocatorEx *allocator);
|
| 53 |
+
|
| 54 |
+
/* Set the memory block allocator of the specified domain.
|
| 55 |
+
|
| 56 |
+
The new allocator must return a distinct non-NULL pointer when requesting
|
| 57 |
+
zero bytes.
|
| 58 |
+
|
| 59 |
+
For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL
|
| 60 |
+
is not held when the allocator is called.
|
| 61 |
+
|
| 62 |
+
If the new allocator is not a hook (don't call the previous allocator), the
|
| 63 |
+
PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks
|
| 64 |
+
on top on the new allocator. */
|
| 65 |
+
PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain,
|
| 66 |
+
PyMemAllocatorEx *allocator);
|
| 67 |
+
|
| 68 |
+
/* Setup hooks to detect bugs in the following Python memory allocator
|
| 69 |
+
functions:
|
| 70 |
+
|
| 71 |
+
- PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
|
| 72 |
+
- PyMem_Malloc(), PyMem_Realloc(), PyMem_Free()
|
| 73 |
+
- PyObject_Malloc(), PyObject_Realloc() and PyObject_Free()
|
| 74 |
+
|
| 75 |
+
Newly allocated memory is filled with the byte 0xCB, freed memory is filled
|
| 76 |
+
with the byte 0xDB. Additional checks:
|
| 77 |
+
|
| 78 |
+
- detect API violations, ex: PyObject_Free() called on a buffer allocated
|
| 79 |
+
by PyMem_Malloc()
|
| 80 |
+
- detect write before the start of the buffer (buffer underflow)
|
| 81 |
+
- detect write after the end of the buffer (buffer overflow)
|
| 82 |
+
|
| 83 |
+
The function does nothing if Python is not compiled is debug mode. */
|
| 84 |
+
PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
|
data/miniconda3/include/python3.13/cpython/pystate.h
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PYSTATE_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
/* private interpreter helpers */
|
| 7 |
+
|
| 8 |
+
PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *);
|
| 9 |
+
PyAPI_FUNC(void) _PyInterpreterState_RequireIDRef(PyInterpreterState *, int);
|
| 10 |
+
|
| 11 |
+
PyAPI_FUNC(PyObject *) PyUnstable_InterpreterState_GetMainModule(PyInterpreterState *);
|
| 12 |
+
|
| 13 |
+
/* State unique per thread */
|
| 14 |
+
|
| 15 |
+
/* Py_tracefunc return -1 when raising an exception, or 0 for success. */
|
| 16 |
+
typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
|
| 17 |
+
|
| 18 |
+
/* The following values are used for 'what' for tracefunc functions
|
| 19 |
+
*
|
| 20 |
+
* To add a new kind of trace event, also update "trace_init" in
|
| 21 |
+
* Python/sysmodule.c to define the Python level event name
|
| 22 |
+
*/
|
| 23 |
+
#define PyTrace_CALL 0
|
| 24 |
+
#define PyTrace_EXCEPTION 1
|
| 25 |
+
#define PyTrace_LINE 2
|
| 26 |
+
#define PyTrace_RETURN 3
|
| 27 |
+
#define PyTrace_C_CALL 4
|
| 28 |
+
#define PyTrace_C_EXCEPTION 5
|
| 29 |
+
#define PyTrace_C_RETURN 6
|
| 30 |
+
#define PyTrace_OPCODE 7
|
| 31 |
+
|
| 32 |
+
typedef struct _err_stackitem {
|
| 33 |
+
/* This struct represents a single execution context where we might
|
| 34 |
+
* be currently handling an exception. It is a per-coroutine state
|
| 35 |
+
* (coroutine in the computer science sense, including the thread
|
| 36 |
+
* and generators).
|
| 37 |
+
*
|
| 38 |
+
* This is used as an entry on the exception stack, where each
|
| 39 |
+
* entry indicates if it is currently handling an exception.
|
| 40 |
+
* This ensures that the exception state is not impacted
|
| 41 |
+
* by "yields" from an except handler. The thread
|
| 42 |
+
* always has an entry (the bottom-most one).
|
| 43 |
+
*/
|
| 44 |
+
|
| 45 |
+
/* The exception currently being handled in this context, if any. */
|
| 46 |
+
PyObject *exc_value;
|
| 47 |
+
|
| 48 |
+
struct _err_stackitem *previous_item;
|
| 49 |
+
|
| 50 |
+
} _PyErr_StackItem;
|
| 51 |
+
|
| 52 |
+
typedef struct _stack_chunk {
|
| 53 |
+
struct _stack_chunk *previous;
|
| 54 |
+
size_t size;
|
| 55 |
+
size_t top;
|
| 56 |
+
PyObject * data[1]; /* Variable sized */
|
| 57 |
+
} _PyStackChunk;
|
| 58 |
+
|
| 59 |
+
struct _ts {
|
| 60 |
+
/* See Python/ceval.c for comments explaining most fields */
|
| 61 |
+
|
| 62 |
+
PyThreadState *prev;
|
| 63 |
+
PyThreadState *next;
|
| 64 |
+
PyInterpreterState *interp;
|
| 65 |
+
|
| 66 |
+
/* The global instrumentation version in high bits, plus flags indicating
|
| 67 |
+
when to break out of the interpreter loop in lower bits. See details in
|
| 68 |
+
pycore_ceval.h. */
|
| 69 |
+
uintptr_t eval_breaker;
|
| 70 |
+
|
| 71 |
+
struct {
|
| 72 |
+
/* Has been initialized to a safe state.
|
| 73 |
+
|
| 74 |
+
In order to be effective, this must be set to 0 during or right
|
| 75 |
+
after allocation. */
|
| 76 |
+
unsigned int initialized:1;
|
| 77 |
+
|
| 78 |
+
/* Has been bound to an OS thread. */
|
| 79 |
+
unsigned int bound:1;
|
| 80 |
+
/* Has been unbound from its OS thread. */
|
| 81 |
+
unsigned int unbound:1;
|
| 82 |
+
/* Has been bound aa current for the GILState API. */
|
| 83 |
+
unsigned int bound_gilstate:1;
|
| 84 |
+
/* Currently in use (maybe holds the GIL). */
|
| 85 |
+
unsigned int active:1;
|
| 86 |
+
/* Currently holds the GIL. */
|
| 87 |
+
unsigned int holds_gil:1;
|
| 88 |
+
|
| 89 |
+
/* various stages of finalization */
|
| 90 |
+
unsigned int finalizing:1;
|
| 91 |
+
unsigned int cleared:1;
|
| 92 |
+
unsigned int finalized:1;
|
| 93 |
+
|
| 94 |
+
/* padding to align to 4 bytes */
|
| 95 |
+
unsigned int :23;
|
| 96 |
+
} _status;
|
| 97 |
+
#ifdef Py_BUILD_CORE
|
| 98 |
+
# define _PyThreadState_WHENCE_NOTSET -1
|
| 99 |
+
# define _PyThreadState_WHENCE_UNKNOWN 0
|
| 100 |
+
# define _PyThreadState_WHENCE_INIT 1
|
| 101 |
+
# define _PyThreadState_WHENCE_FINI 2
|
| 102 |
+
# define _PyThreadState_WHENCE_THREADING 3
|
| 103 |
+
# define _PyThreadState_WHENCE_GILSTATE 4
|
| 104 |
+
# define _PyThreadState_WHENCE_EXEC 5
|
| 105 |
+
#endif
|
| 106 |
+
int _whence;
|
| 107 |
+
|
| 108 |
+
/* Thread state (_Py_THREAD_ATTACHED, _Py_THREAD_DETACHED, _Py_THREAD_SUSPENDED).
|
| 109 |
+
See Include/internal/pycore_pystate.h for more details. */
|
| 110 |
+
int state;
|
| 111 |
+
|
| 112 |
+
int py_recursion_remaining;
|
| 113 |
+
int py_recursion_limit;
|
| 114 |
+
|
| 115 |
+
int c_recursion_remaining;
|
| 116 |
+
int recursion_headroom; /* Allow 50 more calls to handle any errors. */
|
| 117 |
+
|
| 118 |
+
/* 'tracing' keeps track of the execution depth when tracing/profiling.
|
| 119 |
+
This is to prevent the actual trace/profile code from being recorded in
|
| 120 |
+
the trace/profile. */
|
| 121 |
+
int tracing;
|
| 122 |
+
int what_event; /* The event currently being monitored, if any. */
|
| 123 |
+
|
| 124 |
+
/* Pointer to currently executing frame. */
|
| 125 |
+
struct _PyInterpreterFrame *current_frame;
|
| 126 |
+
|
| 127 |
+
Py_tracefunc c_profilefunc;
|
| 128 |
+
Py_tracefunc c_tracefunc;
|
| 129 |
+
PyObject *c_profileobj;
|
| 130 |
+
PyObject *c_traceobj;
|
| 131 |
+
|
| 132 |
+
/* The exception currently being raised */
|
| 133 |
+
PyObject *current_exception;
|
| 134 |
+
|
| 135 |
+
/* Pointer to the top of the exception stack for the exceptions
|
| 136 |
+
* we may be currently handling. (See _PyErr_StackItem above.)
|
| 137 |
+
* This is never NULL. */
|
| 138 |
+
_PyErr_StackItem *exc_info;
|
| 139 |
+
|
| 140 |
+
PyObject *dict; /* Stores per-thread state */
|
| 141 |
+
|
| 142 |
+
int gilstate_counter;
|
| 143 |
+
|
| 144 |
+
PyObject *async_exc; /* Asynchronous exception to raise */
|
| 145 |
+
unsigned long thread_id; /* Thread id where this tstate was created */
|
| 146 |
+
|
| 147 |
+
/* Native thread id where this tstate was created. This will be 0 except on
|
| 148 |
+
* those platforms that have the notion of native thread id, for which the
|
| 149 |
+
* macro PY_HAVE_THREAD_NATIVE_ID is then defined.
|
| 150 |
+
*/
|
| 151 |
+
unsigned long native_thread_id;
|
| 152 |
+
|
| 153 |
+
PyObject *delete_later;
|
| 154 |
+
|
| 155 |
+
/* Tagged pointer to top-most critical section, or zero if there is no
|
| 156 |
+
* active critical section. Critical sections are only used in
|
| 157 |
+
* `--disable-gil` builds (i.e., when Py_GIL_DISABLED is defined to 1). In the
|
| 158 |
+
* default build, this field is always zero.
|
| 159 |
+
*/
|
| 160 |
+
uintptr_t critical_section;
|
| 161 |
+
|
| 162 |
+
int coroutine_origin_tracking_depth;
|
| 163 |
+
|
| 164 |
+
PyObject *async_gen_firstiter;
|
| 165 |
+
PyObject *async_gen_finalizer;
|
| 166 |
+
|
| 167 |
+
PyObject *context;
|
| 168 |
+
uint64_t context_ver;
|
| 169 |
+
|
| 170 |
+
/* Unique thread state id. */
|
| 171 |
+
uint64_t id;
|
| 172 |
+
|
| 173 |
+
_PyStackChunk *datastack_chunk;
|
| 174 |
+
PyObject **datastack_top;
|
| 175 |
+
PyObject **datastack_limit;
|
| 176 |
+
/* XXX signal handlers should also be here */
|
| 177 |
+
|
| 178 |
+
/* The following fields are here to avoid allocation during init.
|
| 179 |
+
The data is exposed through PyThreadState pointer fields.
|
| 180 |
+
These fields should not be accessed directly outside of init.
|
| 181 |
+
This is indicated by an underscore prefix on the field names.
|
| 182 |
+
|
| 183 |
+
All other PyInterpreterState pointer fields are populated when
|
| 184 |
+
needed and default to NULL.
|
| 185 |
+
*/
|
| 186 |
+
// Note some fields do not have a leading underscore for backward
|
| 187 |
+
// compatibility. See https://bugs.python.org/issue45953#msg412046.
|
| 188 |
+
|
| 189 |
+
/* The thread's exception stack entry. (Always the last entry.) */
|
| 190 |
+
_PyErr_StackItem exc_state;
|
| 191 |
+
|
| 192 |
+
PyObject *previous_executor;
|
| 193 |
+
|
| 194 |
+
uint64_t dict_global_version;
|
| 195 |
+
|
| 196 |
+
/* Used to store/retrieve `threading.local` keys/values for this thread */
|
| 197 |
+
PyObject *threading_local_key;
|
| 198 |
+
|
| 199 |
+
/* Used by `threading.local`s to be remove keys/values for dying threads.
|
| 200 |
+
The PyThreadObject must hold the only reference to this value.
|
| 201 |
+
*/
|
| 202 |
+
PyObject *threading_local_sentinel;
|
| 203 |
+
};
|
| 204 |
+
|
| 205 |
+
#ifdef Py_DEBUG
|
| 206 |
+
// A debug build is likely built with low optimization level which implies
|
| 207 |
+
// higher stack memory usage than a release build: use a lower limit.
|
| 208 |
+
# define Py_C_RECURSION_LIMIT 500
|
| 209 |
+
#elif defined(__s390x__)
|
| 210 |
+
# define Py_C_RECURSION_LIMIT 800
|
| 211 |
+
#elif defined(_WIN32) && defined(_M_ARM64)
|
| 212 |
+
# define Py_C_RECURSION_LIMIT 1000
|
| 213 |
+
#elif defined(_WIN32)
|
| 214 |
+
# define Py_C_RECURSION_LIMIT 3000
|
| 215 |
+
#elif defined(__ANDROID__)
|
| 216 |
+
// On an ARM64 emulator, API level 34 was OK with 10000, but API level 21
|
| 217 |
+
// crashed in test_compiler_recursion_limit.
|
| 218 |
+
# define Py_C_RECURSION_LIMIT 3000
|
| 219 |
+
#elif defined(_Py_ADDRESS_SANITIZER)
|
| 220 |
+
# define Py_C_RECURSION_LIMIT 4000
|
| 221 |
+
#elif defined(__wasi__)
|
| 222 |
+
// Based on wasmtime 16.
|
| 223 |
+
# define Py_C_RECURSION_LIMIT 5000
|
| 224 |
+
#else
|
| 225 |
+
// This value is duplicated in Lib/test/support/__init__.py
|
| 226 |
+
# define Py_C_RECURSION_LIMIT 10000
|
| 227 |
+
#endif
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
/* other API */
|
| 231 |
+
|
| 232 |
+
/* Similar to PyThreadState_Get(), but don't issue a fatal error
|
| 233 |
+
* if it is NULL. */
|
| 234 |
+
PyAPI_FUNC(PyThreadState *) PyThreadState_GetUnchecked(void);
|
| 235 |
+
|
| 236 |
+
// Alias kept for backward compatibility
|
| 237 |
+
#define _PyThreadState_UncheckedGet PyThreadState_GetUnchecked
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
// Disable tracing and profiling.
|
| 241 |
+
PyAPI_FUNC(void) PyThreadState_EnterTracing(PyThreadState *tstate);
|
| 242 |
+
|
| 243 |
+
// Reset tracing and profiling: enable them if a trace function or a profile
|
| 244 |
+
// function is set, otherwise disable them.
|
| 245 |
+
PyAPI_FUNC(void) PyThreadState_LeaveTracing(PyThreadState *tstate);
|
| 246 |
+
|
| 247 |
+
/* PyGILState */
|
| 248 |
+
|
| 249 |
+
/* Helper/diagnostic function - return 1 if the current thread
|
| 250 |
+
currently holds the GIL, 0 otherwise.
|
| 251 |
+
|
| 252 |
+
The function returns 1 if _PyGILState_check_enabled is non-zero. */
|
| 253 |
+
PyAPI_FUNC(int) PyGILState_Check(void);
|
| 254 |
+
|
| 255 |
+
/* The implementation of sys._current_frames() Returns a dict mapping
|
| 256 |
+
thread id to that thread's current frame.
|
| 257 |
+
*/
|
| 258 |
+
PyAPI_FUNC(PyObject*) _PyThread_CurrentFrames(void);
|
| 259 |
+
|
| 260 |
+
/* Routines for advanced debuggers, requested by David Beazley.
|
| 261 |
+
Don't use unless you know what you are doing! */
|
| 262 |
+
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void);
|
| 263 |
+
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
|
| 264 |
+
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
|
| 265 |
+
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
|
| 266 |
+
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
|
| 267 |
+
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
|
| 268 |
+
|
| 269 |
+
/* Frame evaluation API */
|
| 270 |
+
|
| 271 |
+
typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _PyInterpreterFrame *, int);
|
| 272 |
+
|
| 273 |
+
PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc(
|
| 274 |
+
PyInterpreterState *interp);
|
| 275 |
+
PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc(
|
| 276 |
+
PyInterpreterState *interp,
|
| 277 |
+
_PyFrameEvalFunction eval_frame);
|
data/miniconda3/include/python3.13/cpython/pystats.h
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Statistics on Python performance.
|
| 2 |
+
//
|
| 3 |
+
// API:
|
| 4 |
+
//
|
| 5 |
+
// - _Py_INCREF_STAT_INC() and _Py_DECREF_STAT_INC() used by Py_INCREF()
|
| 6 |
+
// and Py_DECREF().
|
| 7 |
+
// - _Py_stats variable
|
| 8 |
+
//
|
| 9 |
+
// Functions of the sys module:
|
| 10 |
+
//
|
| 11 |
+
// - sys._stats_on()
|
| 12 |
+
// - sys._stats_off()
|
| 13 |
+
// - sys._stats_clear()
|
| 14 |
+
// - sys._stats_dump()
|
| 15 |
+
//
|
| 16 |
+
// Python must be built with ./configure --enable-pystats to define the
|
| 17 |
+
// Py_STATS macro.
|
| 18 |
+
//
|
| 19 |
+
// Define _PY_INTERPRETER macro to increment interpreter_increfs and
|
| 20 |
+
// interpreter_decrefs. Otherwise, increment increfs and decrefs.
|
| 21 |
+
//
|
| 22 |
+
// The number of incref operations counted by `incref` and
|
| 23 |
+
// `interpreter_incref` is the number of increment operations, which is
|
| 24 |
+
// not equal to the total of all reference counts. A single increment
|
| 25 |
+
// operation may increase the reference count of an object by more than
|
| 26 |
+
// one. For example, see `_Py_RefcntAdd`.
|
| 27 |
+
|
| 28 |
+
#ifndef Py_CPYTHON_PYSTATS_H
|
| 29 |
+
# error "this header file must not be included directly"
|
| 30 |
+
#endif
|
| 31 |
+
|
| 32 |
+
#define PYSTATS_MAX_UOP_ID 512
|
| 33 |
+
|
| 34 |
+
#define SPECIALIZATION_FAILURE_KINDS 36
|
| 35 |
+
|
| 36 |
+
/* Stats for determining who is calling PyEval_EvalFrame */
|
| 37 |
+
#define EVAL_CALL_TOTAL 0
|
| 38 |
+
#define EVAL_CALL_VECTOR 1
|
| 39 |
+
#define EVAL_CALL_GENERATOR 2
|
| 40 |
+
#define EVAL_CALL_LEGACY 3
|
| 41 |
+
#define EVAL_CALL_FUNCTION_VECTORCALL 4
|
| 42 |
+
#define EVAL_CALL_BUILD_CLASS 5
|
| 43 |
+
#define EVAL_CALL_SLOT 6
|
| 44 |
+
#define EVAL_CALL_FUNCTION_EX 7
|
| 45 |
+
#define EVAL_CALL_API 8
|
| 46 |
+
#define EVAL_CALL_METHOD 9
|
| 47 |
+
|
| 48 |
+
#define EVAL_CALL_KINDS 10
|
| 49 |
+
|
| 50 |
+
typedef struct _specialization_stats {
|
| 51 |
+
uint64_t success;
|
| 52 |
+
uint64_t failure;
|
| 53 |
+
uint64_t hit;
|
| 54 |
+
uint64_t deferred;
|
| 55 |
+
uint64_t miss;
|
| 56 |
+
uint64_t deopt;
|
| 57 |
+
uint64_t failure_kinds[SPECIALIZATION_FAILURE_KINDS];
|
| 58 |
+
} SpecializationStats;
|
| 59 |
+
|
| 60 |
+
typedef struct _opcode_stats {
|
| 61 |
+
SpecializationStats specialization;
|
| 62 |
+
uint64_t execution_count;
|
| 63 |
+
uint64_t pair_count[256];
|
| 64 |
+
} OpcodeStats;
|
| 65 |
+
|
| 66 |
+
typedef struct _call_stats {
|
| 67 |
+
uint64_t inlined_py_calls;
|
| 68 |
+
uint64_t pyeval_calls;
|
| 69 |
+
uint64_t frames_pushed;
|
| 70 |
+
uint64_t frame_objects_created;
|
| 71 |
+
uint64_t eval_calls[EVAL_CALL_KINDS];
|
| 72 |
+
} CallStats;
|
| 73 |
+
|
| 74 |
+
typedef struct _object_stats {
|
| 75 |
+
uint64_t increfs;
|
| 76 |
+
uint64_t decrefs;
|
| 77 |
+
uint64_t interpreter_increfs;
|
| 78 |
+
uint64_t interpreter_decrefs;
|
| 79 |
+
uint64_t allocations;
|
| 80 |
+
uint64_t allocations512;
|
| 81 |
+
uint64_t allocations4k;
|
| 82 |
+
uint64_t allocations_big;
|
| 83 |
+
uint64_t frees;
|
| 84 |
+
uint64_t to_freelist;
|
| 85 |
+
uint64_t from_freelist;
|
| 86 |
+
uint64_t inline_values;
|
| 87 |
+
uint64_t dict_materialized_on_request;
|
| 88 |
+
uint64_t dict_materialized_new_key;
|
| 89 |
+
uint64_t dict_materialized_too_big;
|
| 90 |
+
uint64_t dict_materialized_str_subclass;
|
| 91 |
+
uint64_t type_cache_hits;
|
| 92 |
+
uint64_t type_cache_misses;
|
| 93 |
+
uint64_t type_cache_dunder_hits;
|
| 94 |
+
uint64_t type_cache_dunder_misses;
|
| 95 |
+
uint64_t type_cache_collisions;
|
| 96 |
+
/* Temporary value used during GC */
|
| 97 |
+
uint64_t object_visits;
|
| 98 |
+
} ObjectStats;
|
| 99 |
+
|
| 100 |
+
typedef struct _gc_stats {
|
| 101 |
+
uint64_t collections;
|
| 102 |
+
uint64_t object_visits;
|
| 103 |
+
uint64_t objects_collected;
|
| 104 |
+
} GCStats;
|
| 105 |
+
|
| 106 |
+
typedef struct _uop_stats {
|
| 107 |
+
uint64_t execution_count;
|
| 108 |
+
uint64_t miss;
|
| 109 |
+
uint64_t pair_count[PYSTATS_MAX_UOP_ID + 1];
|
| 110 |
+
} UOpStats;
|
| 111 |
+
|
| 112 |
+
#define _Py_UOP_HIST_SIZE 32
|
| 113 |
+
|
| 114 |
+
typedef struct _optimization_stats {
|
| 115 |
+
uint64_t attempts;
|
| 116 |
+
uint64_t traces_created;
|
| 117 |
+
uint64_t traces_executed;
|
| 118 |
+
uint64_t uops_executed;
|
| 119 |
+
uint64_t trace_stack_overflow;
|
| 120 |
+
uint64_t trace_stack_underflow;
|
| 121 |
+
uint64_t trace_too_long;
|
| 122 |
+
uint64_t trace_too_short;
|
| 123 |
+
uint64_t inner_loop;
|
| 124 |
+
uint64_t recursive_call;
|
| 125 |
+
uint64_t low_confidence;
|
| 126 |
+
uint64_t executors_invalidated;
|
| 127 |
+
UOpStats opcode[PYSTATS_MAX_UOP_ID + 1];
|
| 128 |
+
uint64_t unsupported_opcode[256];
|
| 129 |
+
uint64_t trace_length_hist[_Py_UOP_HIST_SIZE];
|
| 130 |
+
uint64_t trace_run_length_hist[_Py_UOP_HIST_SIZE];
|
| 131 |
+
uint64_t optimized_trace_length_hist[_Py_UOP_HIST_SIZE];
|
| 132 |
+
uint64_t optimizer_attempts;
|
| 133 |
+
uint64_t optimizer_successes;
|
| 134 |
+
uint64_t optimizer_failure_reason_no_memory;
|
| 135 |
+
uint64_t remove_globals_builtins_changed;
|
| 136 |
+
uint64_t remove_globals_incorrect_keys;
|
| 137 |
+
uint64_t error_in_opcode[PYSTATS_MAX_UOP_ID + 1];
|
| 138 |
+
} OptimizationStats;
|
| 139 |
+
|
| 140 |
+
typedef struct _rare_event_stats {
|
| 141 |
+
/* Setting an object's class, obj.__class__ = ... */
|
| 142 |
+
uint64_t set_class;
|
| 143 |
+
/* Setting the bases of a class, cls.__bases__ = ... */
|
| 144 |
+
uint64_t set_bases;
|
| 145 |
+
/* Setting the PEP 523 frame eval function, _PyInterpreterState_SetFrameEvalFunc() */
|
| 146 |
+
uint64_t set_eval_frame_func;
|
| 147 |
+
/* Modifying the builtins, __builtins__.__dict__[var] = ... */
|
| 148 |
+
uint64_t builtin_dict;
|
| 149 |
+
/* Modifying a function, e.g. func.__defaults__ = ..., etc. */
|
| 150 |
+
uint64_t func_modification;
|
| 151 |
+
/* Modifying a dict that is being watched */
|
| 152 |
+
uint64_t watched_dict_modification;
|
| 153 |
+
uint64_t watched_globals_modification;
|
| 154 |
+
} RareEventStats;
|
| 155 |
+
|
| 156 |
+
typedef struct _stats {
|
| 157 |
+
OpcodeStats opcode_stats[256];
|
| 158 |
+
CallStats call_stats;
|
| 159 |
+
ObjectStats object_stats;
|
| 160 |
+
OptimizationStats optimization_stats;
|
| 161 |
+
RareEventStats rare_event_stats;
|
| 162 |
+
GCStats *gc_stats;
|
| 163 |
+
} PyStats;
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
// Export for shared extensions like 'math'
|
| 167 |
+
PyAPI_DATA(PyStats*) _Py_stats;
|
| 168 |
+
|
| 169 |
+
#ifdef _PY_INTERPRETER
|
| 170 |
+
# define _Py_INCREF_STAT_INC() do { if (_Py_stats) _Py_stats->object_stats.interpreter_increfs++; } while (0)
|
| 171 |
+
# define _Py_DECREF_STAT_INC() do { if (_Py_stats) _Py_stats->object_stats.interpreter_decrefs++; } while (0)
|
| 172 |
+
#else
|
| 173 |
+
# define _Py_INCREF_STAT_INC() do { if (_Py_stats) _Py_stats->object_stats.increfs++; } while (0)
|
| 174 |
+
# define _Py_DECREF_STAT_INC() do { if (_Py_stats) _Py_stats->object_stats.decrefs++; } while (0)
|
| 175 |
+
#endif
|
data/miniconda3/include/python3.13/cpython/pythonrun.h
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_AnyFileExFlags(
|
| 7 |
+
FILE *fp,
|
| 8 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 9 |
+
int closeit,
|
| 10 |
+
PyCompilerFlags *flags);
|
| 11 |
+
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
|
| 12 |
+
FILE *fp,
|
| 13 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 14 |
+
int closeit,
|
| 15 |
+
PyCompilerFlags *flags);
|
| 16 |
+
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
|
| 17 |
+
FILE *fp,
|
| 18 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 19 |
+
PyCompilerFlags *flags);
|
| 20 |
+
PyAPI_FUNC(int) PyRun_InteractiveOneObject(
|
| 21 |
+
FILE *fp,
|
| 22 |
+
PyObject *filename,
|
| 23 |
+
PyCompilerFlags *flags);
|
| 24 |
+
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
|
| 25 |
+
FILE *fp,
|
| 26 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 27 |
+
PyCompilerFlags *flags);
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
|
| 31 |
+
PyObject *, PyCompilerFlags *);
|
| 32 |
+
|
| 33 |
+
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
|
| 34 |
+
FILE *fp,
|
| 35 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 36 |
+
int start,
|
| 37 |
+
PyObject *globals,
|
| 38 |
+
PyObject *locals,
|
| 39 |
+
int closeit,
|
| 40 |
+
PyCompilerFlags *flags);
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
|
| 44 |
+
const char *str,
|
| 45 |
+
const char *filename, /* decoded from the filesystem encoding */
|
| 46 |
+
int start,
|
| 47 |
+
PyCompilerFlags *flags,
|
| 48 |
+
int optimize);
|
| 49 |
+
PyAPI_FUNC(PyObject *) Py_CompileStringObject(
|
| 50 |
+
const char *str,
|
| 51 |
+
PyObject *filename, int start,
|
| 52 |
+
PyCompilerFlags *flags,
|
| 53 |
+
int optimize);
|
| 54 |
+
|
| 55 |
+
#define Py_CompileString(str, p, s) Py_CompileStringExFlags((str), (p), (s), NULL, -1)
|
| 56 |
+
#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags((str), (p), (s), (f), -1)
|
| 57 |
+
|
| 58 |
+
/* A function flavor is also exported by libpython. It is required when
|
| 59 |
+
libpython is accessed directly rather than using header files which defines
|
| 60 |
+
macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
|
| 61 |
+
export functions in pythonXX.dll. */
|
| 62 |
+
PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
|
| 63 |
+
PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
|
| 64 |
+
PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
|
| 65 |
+
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
|
| 66 |
+
PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
|
| 67 |
+
PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
|
| 68 |
+
PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
|
| 69 |
+
PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
|
| 70 |
+
PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
|
| 71 |
+
PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
|
| 72 |
+
PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
|
| 73 |
+
PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
|
| 74 |
+
|
| 75 |
+
/* Use macros for a bunch of old variants */
|
| 76 |
+
#define PyRun_String(str, s, g, l) PyRun_StringFlags((str), (s), (g), (l), NULL)
|
| 77 |
+
#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags((fp), (name), 0, NULL)
|
| 78 |
+
#define PyRun_AnyFileEx(fp, name, closeit) \
|
| 79 |
+
PyRun_AnyFileExFlags((fp), (name), (closeit), NULL)
|
| 80 |
+
#define PyRun_AnyFileFlags(fp, name, flags) \
|
| 81 |
+
PyRun_AnyFileExFlags((fp), (name), 0, (flags))
|
| 82 |
+
#define PyRun_SimpleString(s) PyRun_SimpleStringFlags((s), NULL)
|
| 83 |
+
#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags((f), (p), 0, NULL)
|
| 84 |
+
#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags((f), (p), (c), NULL)
|
| 85 |
+
#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags((f), (p), NULL)
|
| 86 |
+
#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags((f), (p), NULL)
|
| 87 |
+
#define PyRun_File(fp, p, s, g, l) \
|
| 88 |
+
PyRun_FileExFlags((fp), (p), (s), (g), (l), 0, NULL)
|
| 89 |
+
#define PyRun_FileEx(fp, p, s, g, l, c) \
|
| 90 |
+
PyRun_FileExFlags((fp), (p), (s), (g), (l), (c), NULL)
|
| 91 |
+
#define PyRun_FileFlags(fp, p, s, g, l, flags) \
|
| 92 |
+
PyRun_FileExFlags((fp), (p), (s), (g), (l), 0, (flags))
|
| 93 |
+
|
| 94 |
+
/* Stuff with no proper home (yet) */
|
| 95 |
+
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
|
| 96 |
+
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
|
data/miniconda3/include/python3.13/cpython/pythread.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef Py_CPYTHON_PYTHREAD_H
|
| 2 |
+
# error "this header file must not be included directly"
|
| 3 |
+
#endif
|
| 4 |
+
|
| 5 |
+
// PY_TIMEOUT_MAX is the highest usable value (in microseconds) of PY_TIMEOUT_T
|
| 6 |
+
// type, and depends on the system threading API.
|
| 7 |
+
//
|
| 8 |
+
// NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread module
|
| 9 |
+
// exposes a higher-level API, with timeouts expressed in seconds and
|
| 10 |
+
// floating-point numbers allowed.
|
| 11 |
+
PyAPI_DATA(const long long) PY_TIMEOUT_MAX;
|
| 12 |
+
|
| 13 |
+
#define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1)
|
| 14 |
+
|
| 15 |
+
#ifdef HAVE_PTHREAD_H
|
| 16 |
+
/* Darwin needs pthread.h to know type name the pthread_key_t. */
|
| 17 |
+
# include <pthread.h>
|
| 18 |
+
# define NATIVE_TSS_KEY_T pthread_key_t
|
| 19 |
+
#elif defined(NT_THREADS)
|
| 20 |
+
/* In Windows, native TSS key type is DWORD,
|
| 21 |
+
but hardcode the unsigned long to avoid errors for include directive.
|
| 22 |
+
*/
|
| 23 |
+
# define NATIVE_TSS_KEY_T unsigned long
|
| 24 |
+
#elif defined(HAVE_PTHREAD_STUBS)
|
| 25 |
+
# include "pthread_stubs.h"
|
| 26 |
+
# define NATIVE_TSS_KEY_T pthread_key_t
|
| 27 |
+
#else
|
| 28 |
+
# error "Require native threads. See https://bugs.python.org/issue31370"
|
| 29 |
+
#endif
|
| 30 |
+
|
| 31 |
+
/* When Py_LIMITED_API is not defined, the type layout of Py_tss_t is
|
| 32 |
+
exposed to allow static allocation in the API clients. Even in this case,
|
| 33 |
+
you must handle TSS keys through API functions due to compatibility.
|
| 34 |
+
*/
|
| 35 |
+
struct _Py_tss_t {
|
| 36 |
+
int _is_initialized;
|
| 37 |
+
NATIVE_TSS_KEY_T _key;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
#undef NATIVE_TSS_KEY_T
|
| 41 |
+
|
| 42 |
+
/* When static allocation, you must initialize with Py_tss_NEEDS_INIT. */
|
| 43 |
+
#define Py_tss_NEEDS_INIT {0}
|