mirror of
https://github.com/johndoe6345789/typthon.git
synced 2026-04-24 13:45:05 +00:00
Fix more missed Py_ patterns - opcode, thread, exception
Fixed additional patterns: - _PyOpcode_* → _TyOpcode_* (all opcode metadata) - _PyUOpName → _TyUOpName - _PyFunction_* → _TyFunction_* - _PyListIterObject → _TyListIterObject - _Py_T_OBJECT → _Ty_T_OBJECT - Py_BEGIN_ALLOW_THREADS, Py_END_ALLOW_THREADS → Ty_* - PyDoc_STRVAR, PyDoc_STR → TyDoc_* - PyInterpreterState, PyThread_*, PyTime_t → Ty* - PyStructSequence_* → TyStructSequence_* - PyLockStatus → TyLockStatus - PyVarObject_HEAD_INIT → TyVarObject_HEAD_INIT - PyBaseExceptionObject → TyBaseExceptionObject - Fixed _PyExc_ → _TyExc_ in exception macros Build is progressing further. Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -29,7 +29,7 @@ PyAPI_FUNC(int) _TyEval_SliceIndexNotNone(TyObject *, Ty_ssize_t *);
|
||||
|
||||
typedef struct {
|
||||
FILE* perf_map;
|
||||
PyThread_type_lock map_lock;
|
||||
TyThread_type_lock map_lock;
|
||||
} PerfMapState;
|
||||
|
||||
PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void);
|
||||
|
||||
@@ -82,43 +82,43 @@ PyAPI_FUNC(int) TyFunction_SetClosure(TyObject *, TyObject *);
|
||||
PyAPI_FUNC(TyObject *) TyFunction_GetAnnotations(TyObject *);
|
||||
PyAPI_FUNC(int) TyFunction_SetAnnotations(TyObject *, TyObject *);
|
||||
|
||||
#define _PyFunction_CAST(func) \
|
||||
#define _TyFunction_CAST(func) \
|
||||
(assert(TyFunction_Check(func)), _Py_CAST(PyFunctionObject*, func))
|
||||
|
||||
/* Static inline functions for direct access to these values.
|
||||
Type checks are *not* done, so use with care. */
|
||||
static inline TyObject* TyFunction_GET_CODE(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_code;
|
||||
return _TyFunction_CAST(func)->func_code;
|
||||
}
|
||||
#define TyFunction_GET_CODE(func) TyFunction_GET_CODE(_TyObject_CAST(func))
|
||||
|
||||
static inline TyObject* TyFunction_GET_GLOBALS(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_globals;
|
||||
return _TyFunction_CAST(func)->func_globals;
|
||||
}
|
||||
#define TyFunction_GET_GLOBALS(func) TyFunction_GET_GLOBALS(_TyObject_CAST(func))
|
||||
|
||||
static inline TyObject* TyFunction_GET_MODULE(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_module;
|
||||
return _TyFunction_CAST(func)->func_module;
|
||||
}
|
||||
#define TyFunction_GET_MODULE(func) TyFunction_GET_MODULE(_TyObject_CAST(func))
|
||||
|
||||
static inline TyObject* TyFunction_GET_DEFAULTS(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_defaults;
|
||||
return _TyFunction_CAST(func)->func_defaults;
|
||||
}
|
||||
#define TyFunction_GET_DEFAULTS(func) TyFunction_GET_DEFAULTS(_TyObject_CAST(func))
|
||||
|
||||
static inline TyObject* TyFunction_GET_KW_DEFAULTS(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_kwdefaults;
|
||||
return _TyFunction_CAST(func)->func_kwdefaults;
|
||||
}
|
||||
#define TyFunction_GET_KW_DEFAULTS(func) TyFunction_GET_KW_DEFAULTS(_TyObject_CAST(func))
|
||||
|
||||
static inline TyObject* TyFunction_GET_CLOSURE(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_closure;
|
||||
return _TyFunction_CAST(func)->func_closure;
|
||||
}
|
||||
#define TyFunction_GET_CLOSURE(func) TyFunction_GET_CLOSURE(_TyObject_CAST(func))
|
||||
|
||||
static inline TyObject* TyFunction_GET_ANNOTATIONS(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_annotations;
|
||||
return _TyFunction_CAST(func)->func_annotations;
|
||||
}
|
||||
#define TyFunction_GET_ANNOTATIONS(func) TyFunction_GET_ANNOTATIONS(_TyObject_CAST(func))
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ PyAPI_FUNC(void) _Ty_ForgetReference(TyObject *op);
|
||||
PyAPI_FUNC(Ty_ssize_t) _Ty_GetGlobalRefTotal(void);
|
||||
# define _Ty_GetRefTotal() _Ty_GetGlobalRefTotal()
|
||||
PyAPI_FUNC(Ty_ssize_t) _Ty_GetLegacyRefTotal(void);
|
||||
PyAPI_FUNC(Ty_ssize_t) _TyInterpreterState_GetRefTotal(PyInterpreterState *);
|
||||
PyAPI_FUNC(Ty_ssize_t) _TyInterpreterState_GetRefTotal(TyInterpreterState *);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ PyAPI_FUNC(Ty_ssize_t) _TyInterpreterState_GetRefTotal(PyInterpreterState *);
|
||||
*/
|
||||
typedef struct _Ty_Identifier {
|
||||
const char* string;
|
||||
// Index in PyInterpreterState.unicode.ids.array. It is process-wide
|
||||
// Index in TyInterpreterState.unicode.ids.array. It is process-wide
|
||||
// unique and must be initialized to -1.
|
||||
Ty_ssize_t index;
|
||||
// Hidden PyMutex struct for non free-threaded build.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
typedef struct {
|
||||
PyException_HEAD
|
||||
} PyBaseExceptionObject;
|
||||
} TyBaseExceptionObject;
|
||||
|
||||
typedef struct {
|
||||
PyException_HEAD
|
||||
|
||||
@@ -86,4 +86,4 @@ PyAPI_FUNC(TyStatus) Ty_NewInterpreterFromConfig(
|
||||
|
||||
typedef void (*atexit_datacallbackfunc)(void *);
|
||||
PyAPI_FUNC(int) PyUnstable_AtExit(
|
||||
PyInterpreterState *, atexit_datacallbackfunc, void *);
|
||||
TyInterpreterState *, atexit_datacallbackfunc, void *);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
/* private interpreter helpers */
|
||||
|
||||
PyAPI_FUNC(int) _TyInterpreterState_RequiresIDRef(PyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_RequireIDRef(PyInterpreterState *, int);
|
||||
PyAPI_FUNC(int) _TyInterpreterState_RequiresIDRef(TyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_RequireIDRef(TyInterpreterState *, int);
|
||||
|
||||
/* State unique per thread */
|
||||
|
||||
@@ -68,7 +68,7 @@ struct _ts {
|
||||
|
||||
TyThreadState *prev;
|
||||
TyThreadState *next;
|
||||
PyInterpreterState *interp;
|
||||
TyInterpreterState *interp;
|
||||
|
||||
/* The global instrumentation version in high bits, plus flags indicating
|
||||
when to break out of the interpreter loop in lower bits. See details in
|
||||
@@ -187,7 +187,7 @@ struct _ts {
|
||||
These fields should not be accessed directly outside of init.
|
||||
This is indicated by an underscore prefix on the field names.
|
||||
|
||||
All other PyInterpreterState pointer fields are populated when
|
||||
All other TyInterpreterState pointer fields are populated when
|
||||
needed and default to NULL.
|
||||
*/
|
||||
// Note some fields do not have a leading underscore for backward
|
||||
@@ -245,10 +245,10 @@ PyAPI_FUNC(TyObject*) _PyThread_CurrentFrames(void);
|
||||
|
||||
/* Routines for advanced debuggers, requested by David Beazley.
|
||||
Don't use unless you know what you are doing! */
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_Main(void);
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_Head(void);
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_Next(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyInterpreterState_ThreadHead(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyInterpreterState *) TyInterpreterState_Main(void);
|
||||
PyAPI_FUNC(TyInterpreterState *) TyInterpreterState_Head(void);
|
||||
PyAPI_FUNC(TyInterpreterState *) TyInterpreterState_Next(TyInterpreterState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyInterpreterState_ThreadHead(TyInterpreterState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_Next(TyThreadState *);
|
||||
PyAPI_FUNC(void) TyThreadState_DeleteCurrent(void);
|
||||
|
||||
@@ -257,7 +257,7 @@ PyAPI_FUNC(void) TyThreadState_DeleteCurrent(void);
|
||||
typedef TyObject* (*_PyFrameEvalFunction)(TyThreadState *tstate, struct _PyInterpreterFrame *, int);
|
||||
|
||||
PyAPI_FUNC(_PyFrameEvalFunction) _TyInterpreterState_GetEvalFrameFunc(
|
||||
PyInterpreterState *interp);
|
||||
TyInterpreterState *interp);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_SetEvalFrameFunc(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
_PyFrameEvalFunction eval_frame);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// PyTime_t C API: see Doc/c-api/time.rst for the documentation.
|
||||
// TyTime_t C API: see Doc/c-api/time.rst for the documentation.
|
||||
|
||||
#ifndef Ty_LIMITED_API
|
||||
#ifndef Ty_PYTIME_H
|
||||
@@ -7,18 +7,18 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int64_t PyTime_t;
|
||||
typedef int64_t TyTime_t;
|
||||
#define PyTime_MIN INT64_MIN
|
||||
#define PyTime_MAX INT64_MAX
|
||||
|
||||
PyAPI_FUNC(double) PyTime_AsSecondsDouble(PyTime_t t);
|
||||
PyAPI_FUNC(int) PyTime_Monotonic(PyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_PerfCounter(PyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_Time(PyTime_t *result);
|
||||
PyAPI_FUNC(double) PyTime_AsSecondsDouble(TyTime_t t);
|
||||
PyAPI_FUNC(int) PyTime_Monotonic(TyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_PerfCounter(TyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_Time(TyTime_t *result);
|
||||
|
||||
PyAPI_FUNC(int) PyTime_MonotonicRaw(PyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_PerfCounterRaw(PyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_TimeRaw(PyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_MonotonicRaw(TyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_PerfCounterRaw(TyTime_t *result);
|
||||
PyAPI_FUNC(int) PyTime_TimeRaw(TyTime_t *result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ extern "C" {
|
||||
|
||||
// Export for '_interpchannels' shared extension
|
||||
PyAPI_FUNC(int) _Py_AtExit(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
atexit_datacallbackfunc func,
|
||||
void *data);
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ void _Ty_brc_init_thread(TyThreadState *tstate);
|
||||
void _Ty_brc_remove_thread(TyThreadState *tstate);
|
||||
|
||||
// Initialize per-interpreter state
|
||||
void _Ty_brc_init_state(PyInterpreterState *interp);
|
||||
void _Ty_brc_init_state(TyInterpreterState *interp);
|
||||
|
||||
void _Ty_brc_after_fork(PyInterpreterState *interp);
|
||||
void _Ty_brc_after_fork(TyInterpreterState *interp);
|
||||
|
||||
// Enqueues an object to be merged by it's owning thread (tid). This
|
||||
// steals a reference to the object.
|
||||
|
||||
@@ -76,7 +76,7 @@ extern const char _Ty_center__doc__[];
|
||||
extern const char _Ty_zfill__doc__[];
|
||||
|
||||
/* this is needed because some docs are shared from the .o, not static */
|
||||
#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
|
||||
#define PyDoc_STRVAR_shared(name,str) const char name[] = TyDoc_STR(str)
|
||||
|
||||
#endif /* !Ty_BYTES_CTYPE_H */
|
||||
#endif /* !Ty_LIMITED_API */
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
#include "dynamic_annotations.h" // _Ty_ANNOTATE_RWLOCK_CREATE
|
||||
|
||||
#include "pycore_code.h" // _TyCode_GetTLBCFast()
|
||||
#include "pycore_interp.h" // PyInterpreterState.eval_frame
|
||||
#include "pycore_interp.h" // TyInterpreterState.eval_frame
|
||||
#include "pycore_pystate.h" // _TyThreadState_GET()
|
||||
#include "pycore_stats.h" // EVAL_CALL_STAT_INC()
|
||||
#include "pycore_typedefs.h" // _PyInterpreterFrame
|
||||
@@ -44,7 +44,7 @@ PyAPI_FUNC(int) _TyEval_MakePendingCalls(TyThreadState *);
|
||||
#endif
|
||||
|
||||
extern void _Ty_FinishPendingCalls(TyThreadState *tstate);
|
||||
extern void _TyEval_InitState(PyInterpreterState *);
|
||||
extern void _TyEval_InitState(TyInterpreterState *);
|
||||
extern void _TyEval_SignalReceived(void);
|
||||
|
||||
// bitwise flags:
|
||||
@@ -57,7 +57,7 @@ typedef int _Ty_add_pending_call_result;
|
||||
|
||||
// Export for '_testinternalcapi' shared extension
|
||||
PyAPI_FUNC(_Ty_add_pending_call_result) _TyEval_AddPendingCall(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
_Ty_pending_call_func func,
|
||||
void *arg,
|
||||
int flags);
|
||||
@@ -129,11 +129,11 @@ _TyEval_Vector(TyThreadState *tstate,
|
||||
|
||||
extern int _TyEval_ThreadsInitialized(void);
|
||||
extern void _TyEval_InitGIL(TyThreadState *tstate, int own_gil);
|
||||
extern void _TyEval_FiniGIL(PyInterpreterState *interp);
|
||||
extern void _TyEval_FiniGIL(TyInterpreterState *interp);
|
||||
|
||||
extern void _TyEval_AcquireLock(TyThreadState *tstate);
|
||||
|
||||
extern void _TyEval_ReleaseLock(PyInterpreterState *, TyThreadState *,
|
||||
extern void _TyEval_ReleaseLock(TyInterpreterState *, TyThreadState *,
|
||||
int final_release);
|
||||
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
@@ -341,8 +341,8 @@ _Ty_eval_breaker_bit_is_set(TyThreadState *tstate, uintptr_t bit)
|
||||
|
||||
// Free-threaded builds use these functions to set or unset a bit on all
|
||||
// threads in the given interpreter.
|
||||
void _Ty_set_eval_breaker_bit_all(PyInterpreterState *interp, uintptr_t bit);
|
||||
void _Ty_unset_eval_breaker_bit_all(PyInterpreterState *interp, uintptr_t bit);
|
||||
void _Ty_set_eval_breaker_bit_all(TyInterpreterState *interp, uintptr_t bit);
|
||||
void _Ty_unset_eval_breaker_bit_all(TyInterpreterState *interp, uintptr_t bit);
|
||||
|
||||
PyAPI_FUNC(_PyStackRef) _TyFloat_FromDouble_ConsumeInputs(_PyStackRef left, _PyStackRef right, double value);
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ _py_set_opcode(_Ty_CODEUNIT *word, uint8_t opcode)
|
||||
(CODE->_co_instrumentation_version > 0)
|
||||
|
||||
|
||||
extern TyStatus _TyCode_Init(PyInterpreterState *interp);
|
||||
extern void _TyCode_Fini(PyInterpreterState *interp);
|
||||
extern TyStatus _TyCode_Init(TyInterpreterState *interp);
|
||||
extern void _TyCode_Fini(TyInterpreterState *interp);
|
||||
|
||||
|
||||
/* PEP 659
|
||||
@@ -509,7 +509,7 @@ typedef struct {
|
||||
|
||||
#define COMPARISON_NOT_EQUALS (COMPARISON_UNORDERED | COMPARISON_LESS_THAN | COMPARISON_GREATER_THAN)
|
||||
|
||||
extern int _Ty_Instrument(PyCodeObject *co, PyInterpreterState *interp);
|
||||
extern int _Ty_Instrument(PyCodeObject *co, TyInterpreterState *interp);
|
||||
|
||||
extern _Ty_CODEUNIT _Ty_GetBaseCodeUnit(PyCodeObject *code, int offset);
|
||||
|
||||
@@ -551,7 +551,7 @@ extern _Ty_CODEUNIT *_TyCode_GetTLBC(PyCodeObject *co);
|
||||
// arrays
|
||||
//
|
||||
// Returns the reserved index or -1 on error.
|
||||
extern int32_t _Ty_ReserveTLBCIndex(PyInterpreterState *interp);
|
||||
extern int32_t _Ty_ReserveTLBCIndex(TyInterpreterState *interp);
|
||||
|
||||
// Release the current thread's index into thread-local bytecode arrays
|
||||
extern void _Ty_ClearTLBCIndex(_PyThreadStateImpl *tstate);
|
||||
@@ -559,7 +559,7 @@ extern void _Ty_ClearTLBCIndex(_PyThreadStateImpl *tstate);
|
||||
// Free all TLBC copies not associated with live threads.
|
||||
//
|
||||
// Returns 0 on success or -1 on error.
|
||||
extern int _Ty_ClearUnusedTLBC(PyInterpreterState *interp);
|
||||
extern int _Ty_ClearUnusedTLBC(TyInterpreterState *interp);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ extern "C" {
|
||||
/* Initialize codecs-related state for the given interpreter, including
|
||||
registering the first codec search function. Must be called before any other
|
||||
PyCodec-related functions, and while only one thread is active. */
|
||||
extern TyStatus _PyCodec_InitRegistry(PyInterpreterState *interp);
|
||||
extern TyStatus _PyCodec_InitRegistry(TyInterpreterState *interp);
|
||||
|
||||
/* Finalize codecs-related state for the given interpreter. No PyCodec-related
|
||||
functions other than PyCodec_Unregister() may be called after this. */
|
||||
extern void _PyCodec_Fini(PyInterpreterState *interp);
|
||||
extern void _PyCodec_Fini(TyInterpreterState *interp);
|
||||
|
||||
extern TyObject* _PyCodec_Lookup(const char *encoding);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ extern TyTypeObject _PyContextTokenMissing_Type;
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
TyStatus _TyContext_Init(PyInterpreterState *);
|
||||
TyStatus _TyContext_Init(TyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
|
||||
@@ -25,11 +25,11 @@ PyAPI_DATA(TyObject *) TyExc_InterpreterNotFoundError;
|
||||
|
||||
typedef int (*_Ty_simple_func)(void *);
|
||||
extern int _Ty_CallInInterpreter(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
_Ty_simple_func func,
|
||||
void *arg);
|
||||
extern int _Ty_CallInInterpreterAndRawFree(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
_Ty_simple_func func,
|
||||
void *arg);
|
||||
|
||||
@@ -62,7 +62,7 @@ struct _xidata {
|
||||
// _TyObject_GetXIData() was called. This should only
|
||||
// be set by the cross-interpreter machinery.
|
||||
//
|
||||
// We use the ID rather than the PyInterpreterState to avoid issues
|
||||
// We use the ID rather than the TyInterpreterState to avoid issues
|
||||
// with deleted interpreters. Note that IDs are never re-used, so
|
||||
// each one will always correspond to a specific interpreter
|
||||
// (whether still alive or not).
|
||||
@@ -97,13 +97,13 @@ PyAPI_FUNC(void) _PyXIData_Free(_PyXIData_t *data);
|
||||
|
||||
PyAPI_FUNC(void) _PyXIData_Init(
|
||||
_PyXIData_t *data,
|
||||
PyInterpreterState *interp, void *shared, TyObject *obj,
|
||||
TyInterpreterState *interp, void *shared, TyObject *obj,
|
||||
xid_newobjfunc new_object);
|
||||
PyAPI_FUNC(int) _PyXIData_InitWithSize(
|
||||
_PyXIData_t *,
|
||||
PyInterpreterState *interp, const size_t, TyObject *,
|
||||
TyInterpreterState *interp, const size_t, TyObject *,
|
||||
xid_newobjfunc);
|
||||
PyAPI_FUNC(void) _PyXIData_Clear(PyInterpreterState *, _PyXIData_t *);
|
||||
PyAPI_FUNC(void) _PyXIData_Clear(TyInterpreterState *, _PyXIData_t *);
|
||||
|
||||
// Normally the Init* functions are sufficient. The only time
|
||||
// additional initialization might be needed is to set the "free" func,
|
||||
@@ -222,8 +222,8 @@ PyAPI_FUNC(int) _TyCode_GetPureScriptXIData(
|
||||
_PyXIData_t *);
|
||||
|
||||
// _TyObject_GetXIData() for functions
|
||||
PyAPI_FUNC(TyObject *) _PyFunction_FromXIData(_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _PyFunction_GetXIData(
|
||||
PyAPI_FUNC(TyObject *) _TyFunction_FromXIData(_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _TyFunction_GetXIData(
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
@@ -271,16 +271,16 @@ typedef struct {
|
||||
#define _PyXI_GET_STATE(interp) (&(interp)->xi)
|
||||
|
||||
#ifndef Ty_BUILD_CORE_MODULE
|
||||
extern TyStatus _PyXI_Init(PyInterpreterState *interp);
|
||||
extern void _PyXI_Fini(PyInterpreterState *interp);
|
||||
extern TyStatus _PyXI_InitTypes(PyInterpreterState *interp);
|
||||
extern void _PyXI_FiniTypes(PyInterpreterState *interp);
|
||||
extern TyStatus _PyXI_Init(TyInterpreterState *interp);
|
||||
extern void _PyXI_Fini(TyInterpreterState *interp);
|
||||
extern TyStatus _PyXI_InitTypes(TyInterpreterState *interp);
|
||||
extern void _PyXI_FiniTypes(TyInterpreterState *interp);
|
||||
#endif // Ty_BUILD_CORE_MODULE
|
||||
|
||||
int _Ty_xi_global_state_init(_PyXI_global_state_t *);
|
||||
void _Ty_xi_global_state_fini(_PyXI_global_state_t *);
|
||||
int _Ty_xi_state_init(_PyXI_state_t *, PyInterpreterState *);
|
||||
void _Ty_xi_state_fini(_PyXI_state_t *, PyInterpreterState *);
|
||||
int _Ty_xi_state_init(_PyXI_state_t *, TyInterpreterState *);
|
||||
void _Ty_xi_state_fini(_PyXI_state_t *, TyInterpreterState *);
|
||||
|
||||
|
||||
/***************************/
|
||||
@@ -362,7 +362,7 @@ PyAPI_FUNC(void) _PyXI_ClearResult(_PyXI_session_result *);
|
||||
|
||||
PyAPI_FUNC(int) _PyXI_Enter(
|
||||
_PyXI_session *session,
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyObject *nsupdates,
|
||||
_PyXI_session_result *);
|
||||
PyAPI_FUNC(int) _PyXI_Exit(
|
||||
@@ -389,13 +389,13 @@ PyAPI_FUNC(TyObject *) _PyXI_GetPreserved(
|
||||
/*************/
|
||||
|
||||
// Export for _testinternalcapi shared extension
|
||||
PyAPI_FUNC(PyInterpreterState *) _PyXI_NewInterpreter(
|
||||
PyAPI_FUNC(TyInterpreterState *) _PyXI_NewInterpreter(
|
||||
PyInterpreterConfig *config,
|
||||
long *maybe_whence,
|
||||
TyThreadState **p_tstate,
|
||||
TyThreadState **p_save_tstate);
|
||||
PyAPI_FUNC(void) _PyXI_EndInterpreter(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyThreadState *tstate,
|
||||
TyThreadState **p_save_tstate);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ extern "C" {
|
||||
# define _Ty_Debug_Free_Threaded 1
|
||||
# define _Ty_Debug_code_object_co_tlbc offsetof(PyCodeObject, co_tlbc)
|
||||
# define _Ty_Debug_interpreter_frame_tlbc_index offsetof(_PyInterpreterFrame, tlbc_index)
|
||||
# define _Ty_Debug_interpreter_state_tlbc_generation offsetof(PyInterpreterState, tlbc_indices.tlbc_generation)
|
||||
# define _Ty_Debug_interpreter_state_tlbc_generation offsetof(TyInterpreterState, tlbc_indices.tlbc_generation)
|
||||
#else
|
||||
# define _Ty_Debug_gilruntimestate_enabled 0
|
||||
# define _Ty_Debug_Free_Threaded 0
|
||||
@@ -246,21 +246,21 @@ typedef struct _Ty_DebugOffsets {
|
||||
.interpreters_head = offsetof(_PyRuntimeState, interpreters.head), \
|
||||
}, \
|
||||
.interpreter_state = { \
|
||||
.size = sizeof(PyInterpreterState), \
|
||||
.id = offsetof(PyInterpreterState, id), \
|
||||
.next = offsetof(PyInterpreterState, next), \
|
||||
.threads_head = offsetof(PyInterpreterState, threads.head), \
|
||||
.threads_main = offsetof(PyInterpreterState, threads.main), \
|
||||
.gc = offsetof(PyInterpreterState, gc), \
|
||||
.imports_modules = offsetof(PyInterpreterState, imports.modules), \
|
||||
.sysdict = offsetof(PyInterpreterState, sysdict), \
|
||||
.builtins = offsetof(PyInterpreterState, builtins), \
|
||||
.ceval_gil = offsetof(PyInterpreterState, ceval.gil), \
|
||||
.gil_runtime_state = offsetof(PyInterpreterState, _gil), \
|
||||
.size = sizeof(TyInterpreterState), \
|
||||
.id = offsetof(TyInterpreterState, id), \
|
||||
.next = offsetof(TyInterpreterState, next), \
|
||||
.threads_head = offsetof(TyInterpreterState, threads.head), \
|
||||
.threads_main = offsetof(TyInterpreterState, threads.main), \
|
||||
.gc = offsetof(TyInterpreterState, gc), \
|
||||
.imports_modules = offsetof(TyInterpreterState, imports.modules), \
|
||||
.sysdict = offsetof(TyInterpreterState, sysdict), \
|
||||
.builtins = offsetof(TyInterpreterState, builtins), \
|
||||
.ceval_gil = offsetof(TyInterpreterState, ceval.gil), \
|
||||
.gil_runtime_state = offsetof(TyInterpreterState, _gil), \
|
||||
.gil_runtime_state_enabled = _Ty_Debug_gilruntimestate_enabled, \
|
||||
.gil_runtime_state_locked = offsetof(PyInterpreterState, _gil.locked), \
|
||||
.gil_runtime_state_holder = offsetof(PyInterpreterState, _gil.last_holder), \
|
||||
.code_object_generation = offsetof(PyInterpreterState, _code_object_generation), \
|
||||
.gil_runtime_state_locked = offsetof(TyInterpreterState, _gil.locked), \
|
||||
.gil_runtime_state_holder = offsetof(TyInterpreterState, _gil.last_holder), \
|
||||
.code_object_generation = offsetof(TyInterpreterState, _code_object_generation), \
|
||||
.tlbc_generation = _Ty_Debug_interpreter_state_tlbc_generation, \
|
||||
}, \
|
||||
.thread_state = { \
|
||||
@@ -365,7 +365,7 @@ typedef struct _Ty_DebugOffsets {
|
||||
.debugger_support = { \
|
||||
.eval_breaker = offsetof(TyThreadState, eval_breaker), \
|
||||
.remote_debugger_support = offsetof(TyThreadState, remote_debugger_support), \
|
||||
.remote_debugging_enabled = offsetof(PyInterpreterState, config.remote_debug), \
|
||||
.remote_debugging_enabled = offsetof(TyInterpreterState, config.remote_debug), \
|
||||
.debugger_pending_call = offsetof(_PyRemoteDebuggerSupport, debugger_pending_call), \
|
||||
.debugger_script_path = offsetof(_PyRemoteDebuggerSupport, debugger_script_path), \
|
||||
.debugger_script_path_size = Ty_MAX_SCRIPT_PATH_SIZE, \
|
||||
|
||||
@@ -89,7 +89,7 @@ extern TyObject *_TyDict_FromKeys(TyObject *, TyObject *, TyObject *);
|
||||
/* Gets a version number unique to the current state of the keys of dict, if possible.
|
||||
* Returns the version number, or zero if it was not possible to get a version number. */
|
||||
extern uint32_t _PyDictKeys_GetVersionForCurrentState(
|
||||
PyInterpreterState *interp, PyDictKeysObject *dictkeys);
|
||||
TyInterpreterState *interp, PyDictKeysObject *dictkeys);
|
||||
|
||||
/* Gets a version number unique to the current state of the keys of dict, if possible.
|
||||
*
|
||||
@@ -100,7 +100,7 @@ extern uint32_t _PyDictKeys_GetVersionForCurrentState(
|
||||
*
|
||||
* Returns the version number, or zero if it was not possible to get a version number. */
|
||||
extern uint32_t _TyDict_GetKeysVersionForCurrentState(
|
||||
PyInterpreterState *interp, PyDictObject *dict);
|
||||
TyInterpreterState *interp, PyDictObject *dict);
|
||||
|
||||
extern size_t _TyDict_KeysSize(PyDictKeysObject *keys);
|
||||
|
||||
@@ -271,7 +271,7 @@ _TyDict_SendEvent(int watcher_bits,
|
||||
TyObject *value);
|
||||
|
||||
static inline void
|
||||
_TyDict_NotifyEvent(PyInterpreterState *interp,
|
||||
_TyDict_NotifyEvent(TyInterpreterState *interp,
|
||||
TyDict_WatchEvent event,
|
||||
PyDictObject *mp,
|
||||
TyObject *key,
|
||||
|
||||
@@ -30,8 +30,8 @@ extern char* _Ty_dg_dtoa(double d, int mode, int ndigits,
|
||||
extern void _Ty_dg_freedtoa(char *s);
|
||||
|
||||
|
||||
extern TyStatus _PyDtoa_Init(PyInterpreterState *interp);
|
||||
extern void _PyDtoa_Fini(PyInterpreterState *interp);
|
||||
extern TyStatus _PyDtoa_Init(TyInterpreterState *interp);
|
||||
extern void _PyDtoa_Fini(TyInterpreterState *interp);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -11,10 +11,10 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern TyStatus _PyExc_InitState(PyInterpreterState *);
|
||||
extern TyStatus _PyExc_InitGlobalObjects(PyInterpreterState *);
|
||||
extern int _PyExc_InitTypes(PyInterpreterState *);
|
||||
extern void _PyExc_Fini(PyInterpreterState *);
|
||||
extern TyStatus _PyExc_InitState(TyInterpreterState *);
|
||||
extern TyStatus _PyExc_InitGlobalObjects(TyInterpreterState *);
|
||||
extern int _PyExc_InitTypes(TyInterpreterState *);
|
||||
extern void _PyExc_Fini(TyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
@@ -22,7 +22,7 @@ extern void _PyExc_Fini(PyInterpreterState *);
|
||||
struct _Py_exc_state {
|
||||
// The dict mapping from errno codes to OSError subclasses
|
||||
TyObject *errnomap;
|
||||
PyBaseExceptionObject *memerrors_freelist;
|
||||
TyBaseExceptionObject *memerrors_freelist;
|
||||
int memerrors_numfree;
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
PyMutex memerrors_lock;
|
||||
@@ -31,7 +31,7 @@ struct _Py_exc_state {
|
||||
TyObject *TyExc_ExceptionGroup;
|
||||
};
|
||||
|
||||
extern void _PyExc_ClearExceptionGroupType(PyInterpreterState *);
|
||||
extern void _PyExc_ClearExceptionGroupType(TyInterpreterState *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -41,7 +41,7 @@ struct faulthandler_user_signal {
|
||||
int all_threads;
|
||||
int chain;
|
||||
_Ty_sighandler_t previous;
|
||||
PyInterpreterState *interp;
|
||||
TyInterpreterState *interp;
|
||||
};
|
||||
#endif /* FAULTHANDLER_USER */
|
||||
|
||||
@@ -52,7 +52,7 @@ struct _faulthandler_runtime_state {
|
||||
TyObject *file;
|
||||
int fd;
|
||||
int all_threads;
|
||||
PyInterpreterState *interp;
|
||||
TyInterpreterState *interp;
|
||||
#ifdef MS_WINDOWS
|
||||
void *exc_handler;
|
||||
#endif
|
||||
@@ -64,16 +64,16 @@ struct _faulthandler_runtime_state {
|
||||
int fd;
|
||||
PY_TIMEOUT_T timeout_us; /* timeout in microseconds */
|
||||
int repeat;
|
||||
PyInterpreterState *interp;
|
||||
TyInterpreterState *interp;
|
||||
int exit;
|
||||
char *header;
|
||||
size_t header_len;
|
||||
/* The main thread always holds this lock. It is only released when
|
||||
faulthandler_thread() is interrupted before this thread exits, or at
|
||||
Python exit. */
|
||||
PyThread_type_lock cancel_event;
|
||||
TyThread_type_lock cancel_event;
|
||||
/* released by child thread when joined */
|
||||
PyThread_type_lock running;
|
||||
TyThread_type_lock running;
|
||||
} thread;
|
||||
|
||||
#ifdef FAULTHANDLER_USER
|
||||
|
||||
@@ -12,9 +12,9 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern void _TyFloat_InitState(PyInterpreterState *);
|
||||
extern TyStatus _TyFloat_InitTypes(PyInterpreterState *);
|
||||
extern void _TyFloat_FiniType(PyInterpreterState *);
|
||||
extern void _TyFloat_InitState(TyInterpreterState *);
|
||||
extern TyStatus _TyFloat_InitTypes(TyInterpreterState *);
|
||||
extern void _TyFloat_FiniType(TyInterpreterState *);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "pycore_freelist_state.h" // struct _Ty_freelists
|
||||
#include "pycore_interp_structs.h" // PyInterpreterState
|
||||
#include "pycore_interp_structs.h" // TyInterpreterState
|
||||
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_STORE_PTR_RELAXED()
|
||||
#include "pycore_pystate.h" // _TyThreadState_GET
|
||||
#include "pycore_stats.h" // OBJECT_STAT_INC
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
# error "this header requires Ty_BUILD_CORE define"
|
||||
#endif
|
||||
|
||||
extern TyObject* _PyFunction_Vectorcall(
|
||||
extern TyObject* _TyFunction_Vectorcall(
|
||||
TyObject *func,
|
||||
TyObject *const *stack,
|
||||
size_t nargsf,
|
||||
@@ -19,18 +19,18 @@ extern TyObject* _PyFunction_Vectorcall(
|
||||
#define FUNC_VERSION_CLEARED 1
|
||||
#define FUNC_VERSION_FIRST_VALID 2
|
||||
|
||||
extern PyFunctionObject* _PyFunction_FromConstructor(PyFrameConstructor *constr);
|
||||
extern PyFunctionObject* _TyFunction_FromConstructor(PyFrameConstructor *constr);
|
||||
|
||||
static inline int
|
||||
_PyFunction_IsVersionValid(uint32_t version)
|
||||
_TyFunction_IsVersionValid(uint32_t version)
|
||||
{
|
||||
return version >= FUNC_VERSION_FIRST_VALID;
|
||||
}
|
||||
|
||||
extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
|
||||
PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
|
||||
void _PyFunction_ClearCodeByVersion(uint32_t version);
|
||||
PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, TyObject **p_code);
|
||||
extern uint32_t _TyFunction_GetVersionForCurrentState(PyFunctionObject *func);
|
||||
PyAPI_FUNC(void) _TyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
|
||||
void _TyFunction_ClearCodeByVersion(uint32_t version);
|
||||
PyFunctionObject *_TyFunction_LookupByVersion(uint32_t version, TyObject **p_code);
|
||||
|
||||
extern TyObject *_Ty_set_function_type_params(
|
||||
TyThreadState* unused, TyObject *func, TyObject *type_params);
|
||||
@@ -39,12 +39,12 @@ extern TyObject *_Ty_set_function_type_params(
|
||||
/* See pycore_code.h for explanation about what "stateless" means. */
|
||||
|
||||
PyAPI_FUNC(int)
|
||||
_PyFunction_VerifyStateless(TyThreadState *, TyObject *);
|
||||
_TyFunction_VerifyStateless(TyThreadState *, TyObject *);
|
||||
|
||||
static inline TyObject* _PyFunction_GET_BUILTINS(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_builtins;
|
||||
static inline TyObject* _TyFunction_GET_BUILTINS(TyObject *func) {
|
||||
return _TyFunction_CAST(func)->func_builtins;
|
||||
}
|
||||
#define _PyFunction_GET_BUILTINS(func) _PyFunction_GET_BUILTINS(_TyObject_CAST(func))
|
||||
#define _TyFunction_GET_BUILTINS(func) _TyFunction_GET_BUILTINS(_TyObject_CAST(func))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -238,7 +238,7 @@ static inline void _TyObject_GC_TRACK(
|
||||
"object is in generation which is garbage collected",
|
||||
filename, lineno, __func__);
|
||||
|
||||
PyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
TyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
TyGC_Head *generation0 = &interp->gc.young.head;
|
||||
TyGC_Head *last = (TyGC_Head*)(generation0->_gc_prev);
|
||||
_PyGCHead_SET_NEXT(last, gc);
|
||||
@@ -332,17 +332,17 @@ extern Ty_ssize_t _TyGC_Collect(TyThreadState *tstate, int generation, _TyGC_Rea
|
||||
extern void _TyGC_CollectNoFail(TyThreadState *tstate);
|
||||
|
||||
/* Freeze objects tracked by the GC and ignore them in future collections. */
|
||||
extern void _TyGC_Freeze(PyInterpreterState *interp);
|
||||
extern void _TyGC_Freeze(TyInterpreterState *interp);
|
||||
/* Unfreezes objects placing them in the oldest generation */
|
||||
extern void _TyGC_Unfreeze(PyInterpreterState *interp);
|
||||
extern void _TyGC_Unfreeze(TyInterpreterState *interp);
|
||||
/* Number of frozen objects */
|
||||
extern Ty_ssize_t _TyGC_GetFreezeCount(PyInterpreterState *interp);
|
||||
extern Ty_ssize_t _TyGC_GetFreezeCount(TyInterpreterState *interp);
|
||||
|
||||
extern TyObject *_TyGC_GetObjects(PyInterpreterState *interp, int generation);
|
||||
extern TyObject *_TyGC_GetReferrers(PyInterpreterState *interp, TyObject *objs);
|
||||
extern TyObject *_TyGC_GetObjects(TyInterpreterState *interp, int generation);
|
||||
extern TyObject *_TyGC_GetReferrers(TyInterpreterState *interp, TyObject *objs);
|
||||
|
||||
// Functions to clear types free lists
|
||||
extern void _TyGC_ClearAllFreeLists(PyInterpreterState *interp);
|
||||
extern void _TyGC_ClearAllFreeLists(TyInterpreterState *interp);
|
||||
extern void _Ty_ScheduleGC(TyThreadState *tstate);
|
||||
extern void _Ty_RunGC(TyThreadState *tstate);
|
||||
|
||||
@@ -353,7 +353,7 @@ extern int _TyGC_VisitFrameStack(_PyInterpreterFrame *frame, visitproc visit, vo
|
||||
extern int _TyGC_VisitStackRef(union _PyStackRef *ref, visitproc visit, void *arg);
|
||||
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
extern void _TyGC_VisitObjectsWorldStopped(PyInterpreterState *interp,
|
||||
extern void _TyGC_VisitObjectsWorldStopped(TyInterpreterState *interp,
|
||||
gcvisitobjects_t callback, void *arg);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ _PyStaticObject_CheckRefcnt(TyObject *obj) {
|
||||
/* The following is auto-generated by Tools/build/generate_global_objects.py. */
|
||||
#ifdef Ty_DEBUG
|
||||
static inline void
|
||||
_PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {
|
||||
_PyStaticObjects_CheckRefcnt(TyInterpreterState *interp) {
|
||||
/* generated runtime-global */
|
||||
// (see pycore_runtime_init_generated.h)
|
||||
_PyStaticObject_CheckRefcnt((TyObject *)&_Ty_SINGLETON(small_ints)[_PY_NSMALLNEGINTS + -5]);
|
||||
|
||||
@@ -12,16 +12,16 @@ extern "C" {
|
||||
#include "pycore_hashtable.h" // _Ty_hashtable_t
|
||||
#include "pycore_interp_structs.h" // _import_state
|
||||
|
||||
extern int _TyImport_IsInitialized(PyInterpreterState *);
|
||||
extern int _TyImport_IsInitialized(TyInterpreterState *);
|
||||
|
||||
// Export for 'pyexpat' shared extension
|
||||
PyAPI_FUNC(int) _TyImport_SetModule(TyObject *name, TyObject *module);
|
||||
|
||||
extern int _TyImport_SetModuleString(const char *name, TyObject* module);
|
||||
|
||||
extern void _TyImport_AcquireLock(PyInterpreterState *interp);
|
||||
extern void _TyImport_ReleaseLock(PyInterpreterState *interp);
|
||||
extern void _TyImport_ReInitLock(PyInterpreterState *interp);
|
||||
extern void _TyImport_AcquireLock(TyInterpreterState *interp);
|
||||
extern void _TyImport_ReleaseLock(TyInterpreterState *interp);
|
||||
extern void _TyImport_ReInitLock(TyInterpreterState *interp);
|
||||
|
||||
// This is used exclusively for the sys and builtins modules:
|
||||
extern int _TyImport_FixupBuiltin(
|
||||
@@ -52,38 +52,38 @@ extern int _TyImport_FixupBuiltin(
|
||||
}, \
|
||||
}
|
||||
|
||||
extern void _TyImport_ClearCore(PyInterpreterState *interp);
|
||||
extern void _TyImport_ClearCore(TyInterpreterState *interp);
|
||||
|
||||
extern Ty_ssize_t _TyImport_GetNextModuleIndex(void);
|
||||
extern const char * _TyImport_ResolveNameWithPackageContext(const char *name);
|
||||
extern const char * _TyImport_SwapPackageContext(const char *newcontext);
|
||||
|
||||
extern int _TyImport_GetDLOpenFlags(PyInterpreterState *interp);
|
||||
extern void _TyImport_SetDLOpenFlags(PyInterpreterState *interp, int new_val);
|
||||
extern int _TyImport_GetDLOpenFlags(TyInterpreterState *interp);
|
||||
extern void _TyImport_SetDLOpenFlags(TyInterpreterState *interp, int new_val);
|
||||
|
||||
extern TyObject * _TyImport_InitModules(PyInterpreterState *interp);
|
||||
extern TyObject * _TyImport_GetModules(PyInterpreterState *interp);
|
||||
extern TyObject * _TyImport_GetModulesRef(PyInterpreterState *interp);
|
||||
extern void _TyImport_ClearModules(PyInterpreterState *interp);
|
||||
extern TyObject * _TyImport_InitModules(TyInterpreterState *interp);
|
||||
extern TyObject * _TyImport_GetModules(TyInterpreterState *interp);
|
||||
extern TyObject * _TyImport_GetModulesRef(TyInterpreterState *interp);
|
||||
extern void _TyImport_ClearModules(TyInterpreterState *interp);
|
||||
|
||||
extern void _TyImport_ClearModulesByIndex(PyInterpreterState *interp);
|
||||
extern void _TyImport_ClearModulesByIndex(TyInterpreterState *interp);
|
||||
|
||||
extern int _TyImport_InitDefaultImportFunc(PyInterpreterState *interp);
|
||||
extern int _TyImport_InitDefaultImportFunc(TyInterpreterState *interp);
|
||||
extern int _TyImport_IsDefaultImportFunc(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyObject *func);
|
||||
|
||||
extern TyObject * _TyImport_GetImportlibLoader(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
const char *loader_name);
|
||||
extern TyObject * _TyImport_GetImportlibExternalLoader(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
const char *loader_name);
|
||||
extern TyObject * _TyImport_BlessMyLoader(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyObject *module_globals);
|
||||
extern TyObject * _TyImport_ImportlibModuleRepr(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyObject *module);
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ extern TyStatus _TyImport_InitCore(
|
||||
TyObject *sysmod,
|
||||
int importlib);
|
||||
extern TyStatus _TyImport_InitExternal(TyThreadState *tstate);
|
||||
extern void _TyImport_FiniCore(PyInterpreterState *interp);
|
||||
extern void _TyImport_FiniExternal(PyInterpreterState *interp);
|
||||
extern void _TyImport_FiniCore(TyInterpreterState *interp);
|
||||
extern void _TyImport_FiniExternal(TyInterpreterState *interp);
|
||||
|
||||
|
||||
extern TyObject* _TyImport_GetBuiltinModuleNames(void);
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
# error "this header requires Ty_BUILD_CORE define"
|
||||
#endif
|
||||
|
||||
#include "pycore_interp_structs.h" // PyInterpreterState
|
||||
#include "pycore_interp_structs.h" // TyInterpreterState
|
||||
|
||||
|
||||
/* interpreter state */
|
||||
@@ -28,24 +28,24 @@ extern "C" {
|
||||
extern void _TyInterpreterState_Clear(TyThreadState *tstate);
|
||||
|
||||
static inline TyThreadState*
|
||||
_TyInterpreterState_GetFinalizing(PyInterpreterState *interp) {
|
||||
_TyInterpreterState_GetFinalizing(TyInterpreterState *interp) {
|
||||
return (TyThreadState*)_Ty_atomic_load_ptr_relaxed(&interp->_finalizing);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
_TyInterpreterState_GetFinalizingID(PyInterpreterState *interp) {
|
||||
_TyInterpreterState_GetFinalizingID(TyInterpreterState *interp) {
|
||||
return _Ty_atomic_load_ulong_relaxed(&interp->_finalizing_id);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_TyInterpreterState_SetFinalizing(PyInterpreterState *interp, TyThreadState *tstate) {
|
||||
_TyInterpreterState_SetFinalizing(TyInterpreterState *interp, TyThreadState *tstate) {
|
||||
_Ty_atomic_store_ptr_relaxed(&interp->_finalizing, tstate);
|
||||
if (tstate == NULL) {
|
||||
_Ty_atomic_store_ulong_relaxed(&interp->_finalizing_id, 0);
|
||||
}
|
||||
else {
|
||||
// XXX Re-enable this assert once gh-109860 is fixed.
|
||||
//assert(tstate->thread_id == PyThread_get_thread_ident());
|
||||
//assert(tstate->thread_id == TyThread_get_thread_ident());
|
||||
_Ty_atomic_store_ulong_relaxed(&interp->_finalizing_id,
|
||||
tstate->thread_id);
|
||||
}
|
||||
@@ -54,16 +54,16 @@ _TyInterpreterState_SetFinalizing(PyInterpreterState *interp, TyThreadState *tst
|
||||
|
||||
// Exports for the _testinternalcapi module.
|
||||
PyAPI_FUNC(int64_t) _TyInterpreterState_ObjectToID(TyObject *);
|
||||
PyAPI_FUNC(PyInterpreterState *) _TyInterpreterState_LookUpID(int64_t);
|
||||
PyAPI_FUNC(PyInterpreterState *) _TyInterpreterState_LookUpIDObject(TyObject *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_IDIncref(PyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_IDDecref(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyInterpreterState *) _TyInterpreterState_LookUpID(int64_t);
|
||||
PyAPI_FUNC(TyInterpreterState *) _TyInterpreterState_LookUpIDObject(TyObject *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_IDIncref(TyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_IDDecref(TyInterpreterState *);
|
||||
|
||||
PyAPI_FUNC(int) _TyInterpreterState_IsReady(PyInterpreterState *interp);
|
||||
PyAPI_FUNC(int) _TyInterpreterState_IsReady(TyInterpreterState *interp);
|
||||
|
||||
PyAPI_FUNC(long) _TyInterpreterState_GetWhence(PyInterpreterState *interp);
|
||||
PyAPI_FUNC(long) _TyInterpreterState_GetWhence(TyInterpreterState *interp);
|
||||
extern void _TyInterpreterState_SetWhence(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
long whence);
|
||||
|
||||
/*
|
||||
@@ -93,15 +93,15 @@ might not be allowed in the current interpreter (i.e. os.fork() would fail).
|
||||
/* Set if os.exec*() is allowed. */
|
||||
#define Ty_RTFLAGS_EXEC (1UL << 16)
|
||||
|
||||
extern int _TyInterpreterState_HasFeature(PyInterpreterState *interp,
|
||||
extern int _TyInterpreterState_HasFeature(TyInterpreterState *interp,
|
||||
unsigned long feature);
|
||||
|
||||
PyAPI_FUNC(TyStatus) _TyInterpreterState_New(
|
||||
TyThreadState *tstate,
|
||||
PyInterpreterState **pinterp);
|
||||
TyInterpreterState **pinterp);
|
||||
|
||||
extern const PyConfig* _TyInterpreterState_GetConfig(
|
||||
PyInterpreterState *interp);
|
||||
TyInterpreterState *interp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ struct _import_runtime_state {
|
||||
/* The most recent value assigned to a TyModuleDef.m_base.m_index.
|
||||
This is incremented each time PyModuleDef_Init() is called,
|
||||
which is just about every time an extension module is imported.
|
||||
See PyInterpreterState.modules_by_index for more info. */
|
||||
See TyInterpreterState.modules_by_index for more info. */
|
||||
Ty_ssize_t last_module_index;
|
||||
struct {
|
||||
/* A lock to guard the cache. */
|
||||
@@ -323,7 +323,7 @@ struct _import_state {
|
||||
/* diagnostic info in TyImport_ImportModuleLevelObject() */
|
||||
struct {
|
||||
int import_level;
|
||||
PyTime_t accumulated;
|
||||
TyTime_t accumulated;
|
||||
int header;
|
||||
} find_and_load;
|
||||
};
|
||||
@@ -361,7 +361,7 @@ struct codecs_state {
|
||||
};
|
||||
|
||||
// Support for stop-the-world events. This exists in both the PyRuntime struct
|
||||
// for global pauses and in each PyInterpreterState for per-interpreter pauses.
|
||||
// for global pauses and in each TyInterpreterState for per-interpreter pauses.
|
||||
struct _stoptheworld_state {
|
||||
PyMutex mutex; // Serializes stop-the-world attempts.
|
||||
|
||||
@@ -537,7 +537,7 @@ struct types_state {
|
||||
The first time a static builtin type is initialized, all the
|
||||
normal TyType_Ready() stuff happens. The only difference from
|
||||
normal is that there are three TyTypeObject fields holding
|
||||
objects which are stored here (on PyInterpreterState) rather
|
||||
objects which are stored here (on TyInterpreterState) rather
|
||||
than in the corresponding TyTypeObject fields. Those are:
|
||||
tp_dict (cls.__dict__), tp_subclasses (cls.__subclasses__),
|
||||
and tp_weaklist.
|
||||
@@ -546,7 +546,7 @@ struct types_state {
|
||||
is still initialized, but only the interpreter-specific portion,
|
||||
namely those three objects.
|
||||
|
||||
Those objects are stored in the PyInterpreterState.types.builtins
|
||||
Those objects are stored in the TyInterpreterState.types.builtins
|
||||
array, at the index corresponding to each specific static builtin
|
||||
type. That index (a size_t value) is stored in the tp_subclasses
|
||||
field. For static builtin types, we re-purposed the now-unused
|
||||
@@ -696,7 +696,7 @@ struct _Ty_interp_static_objects {
|
||||
// hamt_empty is here instead of global because of its weakreflist.
|
||||
_TyGC_Head_UNUSED _hamt_empty_gc_not_used;
|
||||
PyHamtObject hamt_empty;
|
||||
PyBaseExceptionObject last_resort_memory_error;
|
||||
TyBaseExceptionObject last_resort_memory_error;
|
||||
} singletons;
|
||||
};
|
||||
|
||||
@@ -756,10 +756,10 @@ struct _Ty_unique_id_pool {
|
||||
#endif
|
||||
|
||||
|
||||
/* PyInterpreterState holds the global state for one of the runtime's
|
||||
/* TyInterpreterState holds the global state for one of the runtime's
|
||||
interpreters. Typically the initial (main) interpreter is the only one.
|
||||
|
||||
The PyInterpreterState typedef is in Include/pytypedefs.h.
|
||||
The TyInterpreterState typedef is in Include/pytypedefs.h.
|
||||
*/
|
||||
struct _is {
|
||||
|
||||
@@ -774,7 +774,7 @@ struct _is {
|
||||
*/
|
||||
void *_malloced;
|
||||
|
||||
PyInterpreterState *next;
|
||||
TyInterpreterState *next;
|
||||
|
||||
int64_t id;
|
||||
Ty_ssize_t id_refcount;
|
||||
@@ -825,10 +825,10 @@ struct _is {
|
||||
struct _gc_runtime_state gc;
|
||||
|
||||
/* The following fields are here to avoid allocation during init.
|
||||
The data is exposed through PyInterpreterState pointer fields.
|
||||
The data is exposed through TyInterpreterState pointer fields.
|
||||
These fields should not be accessed directly outside of init.
|
||||
|
||||
All other PyInterpreterState pointer fields are populated when
|
||||
All other TyInterpreterState pointer fields are populated when
|
||||
needed and default to NULL.
|
||||
|
||||
For now there are some exceptions to that rule, which require
|
||||
@@ -967,9 +967,9 @@ struct _is {
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* the initial PyInterpreterState.threads.head */
|
||||
/* the initial TyInterpreterState.threads.head */
|
||||
_PyThreadStateImpl _initial_thread;
|
||||
// _initial_thread should be the last field of PyInterpreterState.
|
||||
// _initial_thread should be the last field of TyInterpreterState.
|
||||
// See https://github.com/python/cpython/issues/127117.
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ extern TyTypeObject _PyInterpolation_Type;
|
||||
PyAPI_FUNC(TyObject *) _PyInterpolation_Build(TyObject *value, TyObject *str,
|
||||
int conversion, TyObject *format_spec);
|
||||
|
||||
extern TyStatus _PyInterpolation_InitTypes(PyInterpreterState *interp);
|
||||
extern TyStatus _PyInterpolation_InitTypes(TyInterpreterState *interp);
|
||||
extern TyObject *_PyInterpolation_GetValueRef(TyObject *interpolation);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -68,7 +68,7 @@ typedef struct {
|
||||
PyObject_HEAD
|
||||
Ty_ssize_t it_index;
|
||||
PyListObject *it_seq; /* Set to NULL when iterator is exhausted */
|
||||
} _PyListIterObject;
|
||||
} _TyListIterObject;
|
||||
|
||||
union _PyStackRef;
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ typedef enum _PyLockFlags {
|
||||
|
||||
// Lock a mutex with an optional timeout and additional options. See
|
||||
// _PyLockFlags for details.
|
||||
extern PyAPI_FUNC(PyLockStatus)
|
||||
_PyMutex_LockTimed(PyMutex *m, PyTime_t timeout_ns, _PyLockFlags flags);
|
||||
extern PyAPI_FUNC(TyLockStatus)
|
||||
_PyMutex_LockTimed(PyMutex *m, TyTime_t timeout_ns, _PyLockFlags flags);
|
||||
|
||||
// Lock a mutex with additional options. See _PyLockFlags for details.
|
||||
static inline void
|
||||
@@ -92,7 +92,7 @@ PyAPI_FUNC(void) PyEvent_Wait(PyEvent *evt);
|
||||
// and 0 if the timeout expired or thread was interrupted. If `detach` is
|
||||
// true, then the thread will detach/release the GIL while waiting.
|
||||
PyAPI_FUNC(int)
|
||||
PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns, int detach);
|
||||
PyEvent_WaitTimed(PyEvent *evt, TyTime_t timeout_ns, int detach);
|
||||
|
||||
// _PyRawMutex implements a word-sized mutex that that does not depend on the
|
||||
// parking lot API, and therefore can be used in the parking lot
|
||||
@@ -155,13 +155,13 @@ _PyOnceFlag_CallOnce(_PyOnceFlag *flag, _Ty_once_fn_t *fn, void *arg)
|
||||
// A recursive mutex. The mutex should zero-initialized.
|
||||
typedef struct {
|
||||
PyMutex mutex;
|
||||
unsigned long long thread; // i.e., PyThread_get_thread_ident_ex()
|
||||
unsigned long long thread; // i.e., TyThread_get_thread_ident_ex()
|
||||
size_t level;
|
||||
} _PyRecursiveMutex;
|
||||
|
||||
PyAPI_FUNC(int) _PyRecursiveMutex_IsLockedByCurrentThread(_PyRecursiveMutex *m);
|
||||
PyAPI_FUNC(void) _PyRecursiveMutex_Lock(_PyRecursiveMutex *m);
|
||||
extern PyLockStatus _PyRecursiveMutex_LockTimed(_PyRecursiveMutex *m, PyTime_t timeout, _PyLockFlags flags);
|
||||
extern TyLockStatus _PyRecursiveMutex_LockTimed(_PyRecursiveMutex *m, TyTime_t timeout, _PyLockFlags flags);
|
||||
PyAPI_FUNC(void) _PyRecursiveMutex_Unlock(_PyRecursiveMutex *m);
|
||||
extern int _PyRecursiveMutex_TryUnlock(_PyRecursiveMutex *m);
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern TyStatus _TyLong_InitTypes(PyInterpreterState *);
|
||||
extern void _TyLong_FiniTypes(PyInterpreterState *interp);
|
||||
extern TyStatus _TyLong_InitTypes(TyInterpreterState *);
|
||||
extern void _TyLong_FiniTypes(TyInterpreterState *interp);
|
||||
|
||||
|
||||
/* other API */
|
||||
|
||||
@@ -316,11 +316,11 @@ _TyType_HasFeature(TyTypeObject *type, unsigned long feature) {
|
||||
return ((FT_ATOMIC_LOAD_ULONG_RELAXED(type->tp_flags) & feature) != 0);
|
||||
}
|
||||
|
||||
extern void _TyType_InitCache(PyInterpreterState *interp);
|
||||
extern void _TyType_InitCache(TyInterpreterState *interp);
|
||||
|
||||
extern TyStatus _TyObject_InitState(PyInterpreterState *interp);
|
||||
extern void _TyObject_FiniState(PyInterpreterState *interp);
|
||||
extern bool _PyRefchain_IsTraced(PyInterpreterState *interp, TyObject *obj);
|
||||
extern TyStatus _TyObject_InitState(TyInterpreterState *interp);
|
||||
extern void _TyObject_FiniState(TyInterpreterState *interp);
|
||||
extern bool _PyRefchain_IsTraced(TyInterpreterState *interp, TyObject *obj);
|
||||
|
||||
// Macros used for per-thread reference counting in the free threading build.
|
||||
// They resolve to normal Ty_INCREF/DECREF calls in the default build.
|
||||
@@ -768,15 +768,15 @@ _Ty_TryIncref(TyObject *op)
|
||||
}
|
||||
|
||||
#ifdef Ty_REF_DEBUG
|
||||
extern void _TyInterpreterState_FinalizeRefTotal(PyInterpreterState *);
|
||||
extern void _TyInterpreterState_FinalizeRefTotal(TyInterpreterState *);
|
||||
extern void _Ty_FinalizeRefTotal(_PyRuntimeState *);
|
||||
extern void _PyDebug_PrintTotalRefs(void);
|
||||
#endif
|
||||
|
||||
#ifdef Ty_TRACE_REFS
|
||||
extern void _Ty_AddToAllObjects(TyObject *op);
|
||||
extern void _Ty_PrintReferences(PyInterpreterState *, FILE *);
|
||||
extern void _Ty_PrintReferenceAddresses(PyInterpreterState *, FILE *);
|
||||
extern void _Ty_PrintReferences(TyInterpreterState *, FILE *);
|
||||
extern void _Ty_PrintReferenceAddresses(TyInterpreterState *, FILE *);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -794,7 +794,7 @@ _TyObject_GET_WEAKREFS_LISTPTR(TyObject *op)
|
||||
{
|
||||
if (TyType_Check(op) &&
|
||||
((TyTypeObject *)op)->tp_flags & _Ty_TPFLAGS_STATIC_BUILTIN) {
|
||||
PyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
TyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
managed_static_type_state *state = _PyStaticType_GetState(
|
||||
interp, (TyTypeObject *)op);
|
||||
return _PyStaticType_GET_WEAKREFS_LISTPTR(state);
|
||||
|
||||
@@ -684,10 +684,10 @@ void _TyObject_VirtualFree(void *, size_t size);
|
||||
extern Ty_ssize_t _Ty_GetGlobalAllocatedBlocks(void);
|
||||
#define _Ty_GetAllocatedBlocks() \
|
||||
_Ty_GetGlobalAllocatedBlocks()
|
||||
extern Ty_ssize_t _TyInterpreterState_GetAllocatedBlocks(PyInterpreterState *);
|
||||
extern void _TyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *);
|
||||
extern int _TyMem_init_obmalloc(PyInterpreterState *interp);
|
||||
extern bool _TyMem_obmalloc_state_on_heap(PyInterpreterState *interp);
|
||||
extern Ty_ssize_t _TyInterpreterState_GetAllocatedBlocks(TyInterpreterState *);
|
||||
extern void _TyInterpreterState_FinalizeAllocatedBlocks(TyInterpreterState *);
|
||||
extern int _TyMem_init_obmalloc(TyInterpreterState *interp);
|
||||
extern bool _TyMem_obmalloc_state_on_heap(TyInterpreterState *interp);
|
||||
|
||||
|
||||
#ifdef WITH_PYMALLOC
|
||||
|
||||
70
Include/internal/pycore_opcode_metadata.h
generated
70
Include/internal/pycore_opcode_metadata.h
generated
@@ -32,9 +32,9 @@ extern "C" {
|
||||
0)
|
||||
|
||||
#include "pycore_uop_ids.h"
|
||||
extern int _PyOpcode_num_popped(int opcode, int oparg);
|
||||
extern int _TyOpcode_num_popped(int opcode, int oparg);
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
int _PyOpcode_num_popped(int opcode, int oparg) {
|
||||
int _TyOpcode_num_popped(int opcode, int oparg) {
|
||||
switch(opcode) {
|
||||
case ANNOTATIONS_PLACEHOLDER:
|
||||
return 0;
|
||||
@@ -519,9 +519,9 @@ int _PyOpcode_num_popped(int opcode, int oparg) {
|
||||
|
||||
#endif
|
||||
|
||||
extern int _PyOpcode_num_pushed(int opcode, int oparg);
|
||||
extern int _TyOpcode_num_pushed(int opcode, int oparg);
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
int _PyOpcode_num_pushed(int opcode, int oparg) {
|
||||
int _TyOpcode_num_pushed(int opcode, int oparg) {
|
||||
switch(opcode) {
|
||||
case ANNOTATIONS_PLACEHOLDER:
|
||||
return 0;
|
||||
@@ -1022,7 +1022,7 @@ enum InstructionFormat {
|
||||
|
||||
#define IS_VALID_OPCODE(OP) \
|
||||
(((OP) >= 0) && ((OP) < 267) && \
|
||||
(_PyOpcode_opcode_metadata[(OP)].valid_entry))
|
||||
(_TyOpcode_opcode_metadata[(OP)].valid_entry))
|
||||
|
||||
#define HAS_ARG_FLAG (1)
|
||||
#define HAS_CONST_FLAG (2)
|
||||
@@ -1040,22 +1040,22 @@ enum InstructionFormat {
|
||||
#define HAS_OPARG_AND_1_FLAG (8192)
|
||||
#define HAS_ERROR_NO_POP_FLAG (16384)
|
||||
#define HAS_NO_SAVE_IP_FLAG (32768)
|
||||
#define OPCODE_HAS_ARG(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_ARG_FLAG))
|
||||
#define OPCODE_HAS_CONST(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_CONST_FLAG))
|
||||
#define OPCODE_HAS_NAME(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_NAME_FLAG))
|
||||
#define OPCODE_HAS_JUMP(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_JUMP_FLAG))
|
||||
#define OPCODE_HAS_FREE(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_FREE_FLAG))
|
||||
#define OPCODE_HAS_LOCAL(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_LOCAL_FLAG))
|
||||
#define OPCODE_HAS_EVAL_BREAK(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_EVAL_BREAK_FLAG))
|
||||
#define OPCODE_HAS_DEOPT(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_DEOPT_FLAG))
|
||||
#define OPCODE_HAS_ERROR(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_ERROR_FLAG))
|
||||
#define OPCODE_HAS_ESCAPES(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_ESCAPES_FLAG))
|
||||
#define OPCODE_HAS_EXIT(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_EXIT_FLAG))
|
||||
#define OPCODE_HAS_PURE(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_PURE_FLAG))
|
||||
#define OPCODE_HAS_PASSTHROUGH(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_PASSTHROUGH_FLAG))
|
||||
#define OPCODE_HAS_OPARG_AND_1(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_OPARG_AND_1_FLAG))
|
||||
#define OPCODE_HAS_ERROR_NO_POP(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_ERROR_NO_POP_FLAG))
|
||||
#define OPCODE_HAS_NO_SAVE_IP(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_NO_SAVE_IP_FLAG))
|
||||
#define OPCODE_HAS_ARG(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_ARG_FLAG))
|
||||
#define OPCODE_HAS_CONST(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_CONST_FLAG))
|
||||
#define OPCODE_HAS_NAME(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_NAME_FLAG))
|
||||
#define OPCODE_HAS_JUMP(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_JUMP_FLAG))
|
||||
#define OPCODE_HAS_FREE(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_FREE_FLAG))
|
||||
#define OPCODE_HAS_LOCAL(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_LOCAL_FLAG))
|
||||
#define OPCODE_HAS_EVAL_BREAK(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_EVAL_BREAK_FLAG))
|
||||
#define OPCODE_HAS_DEOPT(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_DEOPT_FLAG))
|
||||
#define OPCODE_HAS_ERROR(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_ERROR_FLAG))
|
||||
#define OPCODE_HAS_ESCAPES(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_ESCAPES_FLAG))
|
||||
#define OPCODE_HAS_EXIT(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_EXIT_FLAG))
|
||||
#define OPCODE_HAS_PURE(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_PURE_FLAG))
|
||||
#define OPCODE_HAS_PASSTHROUGH(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_PASSTHROUGH_FLAG))
|
||||
#define OPCODE_HAS_OPARG_AND_1(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_OPARG_AND_1_FLAG))
|
||||
#define OPCODE_HAS_ERROR_NO_POP(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_ERROR_NO_POP_FLAG))
|
||||
#define OPCODE_HAS_NO_SAVE_IP(OP) (_TyOpcode_opcode_metadata[OP].flags & (HAS_NO_SAVE_IP_FLAG))
|
||||
|
||||
#define OPARG_SIMPLE 0
|
||||
#define OPARG_CACHE_1 1
|
||||
@@ -1075,9 +1075,9 @@ struct opcode_metadata {
|
||||
uint16_t flags;
|
||||
};
|
||||
|
||||
extern const struct opcode_metadata _PyOpcode_opcode_metadata[267];
|
||||
extern const struct opcode_metadata _TyOpcode_opcode_metadata[267];
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
const struct opcode_metadata _PyOpcode_opcode_metadata[267] = {
|
||||
const struct opcode_metadata _TyOpcode_opcode_metadata[267] = {
|
||||
[BINARY_OP] = { true, INSTR_FMT_IBC0000, HAS_ARG_FLAG | HAS_ERROR_FLAG | HAS_ERROR_NO_POP_FLAG | HAS_ESCAPES_FLAG },
|
||||
[BINARY_OP_ADD_FLOAT] = { true, INSTR_FMT_IXC0000, HAS_EXIT_FLAG | HAS_ERROR_FLAG },
|
||||
[BINARY_OP_ADD_INT] = { true, INSTR_FMT_IXC0000, HAS_EXIT_FLAG | HAS_ERROR_FLAG | HAS_ESCAPES_FLAG },
|
||||
@@ -1324,11 +1324,11 @@ struct opcode_macro_expansion {
|
||||
int nuops;
|
||||
struct { int16_t uop; int8_t size; int8_t offset; } uops[MAX_UOP_PER_EXPANSION];
|
||||
};
|
||||
extern const struct opcode_macro_expansion _PyOpcode_macro_expansion[256];
|
||||
extern const struct opcode_macro_expansion _TyOpcode_macro_expansion[256];
|
||||
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
const struct opcode_macro_expansion
|
||||
_PyOpcode_macro_expansion[256] = {
|
||||
_TyOpcode_macro_expansion[256] = {
|
||||
[BINARY_OP] = { .nuops = 1, .uops = { { _BINARY_OP, OPARG_SIMPLE, 4 } } },
|
||||
[BINARY_OP_ADD_FLOAT] = { .nuops = 3, .uops = { { _GUARD_TOS_FLOAT, OPARG_SIMPLE, 0 }, { _GUARD_NOS_FLOAT, OPARG_SIMPLE, 0 }, { _BINARY_OP_ADD_FLOAT, OPARG_SIMPLE, 5 } } },
|
||||
[BINARY_OP_ADD_INT] = { .nuops = 3, .uops = { { _GUARD_TOS_INT, OPARG_SIMPLE, 0 }, { _GUARD_NOS_INT, OPARG_SIMPLE, 0 }, { _BINARY_OP_ADD_INT, OPARG_SIMPLE, 5 } } },
|
||||
@@ -1515,9 +1515,9 @@ _PyOpcode_macro_expansion[256] = {
|
||||
};
|
||||
#endif // NEED_OPCODE_METADATA
|
||||
|
||||
extern const char *_PyOpcode_OpName[267];
|
||||
extern const char *_TyOpcode_OpName[267];
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
const char *_PyOpcode_OpName[267] = {
|
||||
const char *_TyOpcode_OpName[267] = {
|
||||
[ANNOTATIONS_PLACEHOLDER] = "ANNOTATIONS_PLACEHOLDER",
|
||||
[BINARY_OP] = "BINARY_OP",
|
||||
[BINARY_OP_ADD_FLOAT] = "BINARY_OP_ADD_FLOAT",
|
||||
@@ -1759,9 +1759,9 @@ const char *_PyOpcode_OpName[267] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
extern const uint8_t _PyOpcode_Caches[256];
|
||||
extern const uint8_t _TyOpcode_Caches[256];
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
const uint8_t _PyOpcode_Caches[256] = {
|
||||
const uint8_t _TyOpcode_Caches[256] = {
|
||||
[TO_BOOL] = 3,
|
||||
[STORE_SUBSCR] = 1,
|
||||
[SEND] = 1,
|
||||
@@ -1784,9 +1784,9 @@ const uint8_t _PyOpcode_Caches[256] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
extern const uint8_t _PyOpcode_Deopt[256];
|
||||
extern const uint8_t _TyOpcode_Deopt[256];
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
const uint8_t _PyOpcode_Deopt[256] = {
|
||||
const uint8_t _TyOpcode_Deopt[256] = {
|
||||
[121] = 121,
|
||||
[122] = 122,
|
||||
[123] = 123,
|
||||
@@ -2082,9 +2082,9 @@ struct pseudo_targets {
|
||||
uint8_t as_sequence;
|
||||
uint8_t targets[4];
|
||||
};
|
||||
extern const struct pseudo_targets _PyOpcode_PseudoTargets[11];
|
||||
extern const struct pseudo_targets _TyOpcode_PseudoTargets[11];
|
||||
#ifdef NEED_OPCODE_METADATA
|
||||
const struct pseudo_targets _PyOpcode_PseudoTargets[11] = {
|
||||
const struct pseudo_targets _TyOpcode_PseudoTargets[11] = {
|
||||
[LOAD_CLOSURE-256] = { 0, { LOAD_FAST, 0, 0, 0 } },
|
||||
[STORE_FAST_MAYBE_NULL-256] = { 0, { STORE_FAST, 0, 0, 0 } },
|
||||
[ANNOTATIONS_PLACEHOLDER-256] = { 0, { NOP, 0, 0, 0 } },
|
||||
@@ -2104,8 +2104,8 @@ is_pseudo_target(int pseudo, int target) {
|
||||
if (pseudo < 256 || pseudo >= 267) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; _PyOpcode_PseudoTargets[pseudo-256].targets[i]; i++) {
|
||||
if (_PyOpcode_PseudoTargets[pseudo-256].targets[i] == target) return true;
|
||||
for (int i = 0; _TyOpcode_PseudoTargets[pseudo-256].targets[i]; i++) {
|
||||
if (_TyOpcode_PseudoTargets[pseudo-256].targets[i] == target) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -102,9 +102,9 @@ PyAPI_FUNC(void) _Ty_Executor_DependsOn(_PyExecutorObject *executor, void *obj);
|
||||
#define _Ty_MAX_ALLOWED_GLOBALS_MODIFICATIONS 6
|
||||
|
||||
#ifdef _Ty_TIER2
|
||||
PyAPI_FUNC(void) _Ty_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is_invalidation);
|
||||
PyAPI_FUNC(void) _Ty_Executors_InvalidateAll(PyInterpreterState *interp, int is_invalidation);
|
||||
PyAPI_FUNC(void) _Ty_Executors_InvalidateCold(PyInterpreterState *interp);
|
||||
PyAPI_FUNC(void) _Ty_Executors_InvalidateDependency(TyInterpreterState *interp, void *obj, int is_invalidation);
|
||||
PyAPI_FUNC(void) _Ty_Executors_InvalidateAll(TyInterpreterState *interp, int is_invalidation);
|
||||
PyAPI_FUNC(void) _Ty_Executors_InvalidateCold(TyInterpreterState *interp);
|
||||
|
||||
#else
|
||||
# define _Ty_Executors_InvalidateDependency(A, B, C) ((void)0)
|
||||
@@ -309,7 +309,7 @@ static inline int is_terminator(const _PyUOpInstruction *uop)
|
||||
|
||||
PyAPI_FUNC(int) _PyDumpExecutors(FILE *out);
|
||||
#ifdef _Ty_TIER2
|
||||
extern void _Ty_ClearExecutorDeletionList(PyInterpreterState *interp);
|
||||
extern void _Ty_ClearExecutorDeletionList(TyInterpreterState *interp);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -59,7 +59,7 @@ enum {
|
||||
// }
|
||||
PyAPI_FUNC(int)
|
||||
_PyParkingLot_Park(const void *address, const void *expected,
|
||||
size_t address_size, PyTime_t timeout_ns,
|
||||
size_t address_size, TyTime_t timeout_ns,
|
||||
void *park_arg, int detach);
|
||||
|
||||
// Callback for _PyParkingLot_Unpark:
|
||||
|
||||
@@ -11,9 +11,9 @@ extern "C" {
|
||||
|
||||
// Exported for the _interpchannels module.
|
||||
PyAPI_FUNC(int) _PyBuffer_ReleaseInInterpreter(
|
||||
PyInterpreterState *interp, Ty_buffer *view);
|
||||
TyInterpreterState *interp, Ty_buffer *view);
|
||||
PyAPI_FUNC(int) _PyBuffer_ReleaseInInterpreterAndRawFree(
|
||||
PyInterpreterState *interp, Ty_buffer *view);
|
||||
TyInterpreterState *interp, Ty_buffer *view);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ extern int _TyErr_SetModuleNotFoundError(TyObject *name);
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern TyStatus _TyErr_InitTypes(PyInterpreterState *);
|
||||
extern void _TyErr_FiniTypes(PyInterpreterState *);
|
||||
extern TyStatus _TyErr_InitTypes(TyInterpreterState *);
|
||||
extern void _TyErr_FiniTypes(TyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
@@ -178,7 +178,7 @@ extern TyObject* _PyExc_PrepReraiseStar(
|
||||
|
||||
extern int _TyErr_CheckSignalsTstate(TyThreadState *tstate);
|
||||
|
||||
extern void _Ty_DumpExtensionModules(int fd, PyInterpreterState *interp);
|
||||
extern void _Ty_DumpExtensionModules(int fd, TyInterpreterState *interp);
|
||||
extern TyObject* _Ty_CalculateSuggestions(TyObject *dir, TyObject *name);
|
||||
extern TyObject* _Ty_Offer_Suggestions(TyObject* exception);
|
||||
|
||||
|
||||
@@ -28,43 +28,43 @@ extern int _Ty_IsLocaleCoercionTarget(const char *ctype_loc);
|
||||
|
||||
extern void _Ty_InitVersion(void);
|
||||
extern TyStatus _PyFaulthandler_Init(int enable);
|
||||
extern TyObject * _PyBuiltin_Init(PyInterpreterState *interp);
|
||||
extern TyObject * _PyBuiltin_Init(TyInterpreterState *interp);
|
||||
extern TyStatus _TySys_Create(
|
||||
TyThreadState *tstate,
|
||||
TyObject **sysmod_p);
|
||||
extern TyStatus _TySys_ReadPreinitWarnOptions(PyWideStringList *options);
|
||||
extern TyStatus _TySys_ReadPreinitXOptions(PyConfig *config);
|
||||
extern int _TySys_UpdateConfig(TyThreadState *tstate);
|
||||
extern void _TySys_FiniTypes(PyInterpreterState *interp);
|
||||
extern void _TySys_FiniTypes(TyInterpreterState *interp);
|
||||
extern int _PyBuiltins_AddExceptions(TyObject * bltinmod);
|
||||
extern TyStatus _Ty_HashRandomization_Init(const PyConfig *);
|
||||
|
||||
extern TyStatus _TyGC_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _PyAtExit_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _PyDateTime_InitTypes(PyInterpreterState *interp);
|
||||
extern TyStatus _TyGC_Init(TyInterpreterState *interp);
|
||||
extern TyStatus _PyAtExit_Init(TyInterpreterState *interp);
|
||||
extern TyStatus _PyDateTime_InitTypes(TyInterpreterState *interp);
|
||||
|
||||
/* Various internal finalizers */
|
||||
|
||||
extern int _PySignal_Init(int install_signal_handlers);
|
||||
extern void _PySignal_Fini(void);
|
||||
|
||||
extern void _TyGC_Fini(PyInterpreterState *interp);
|
||||
extern void _TyGC_Fini(TyInterpreterState *interp);
|
||||
extern void _Ty_HashRandomization_Fini(void);
|
||||
extern void _PyFaulthandler_Fini(void);
|
||||
extern void _PyHash_Fini(void);
|
||||
extern void _PyTraceMalloc_Fini(void);
|
||||
extern void _TyWarnings_Fini(PyInterpreterState *interp);
|
||||
extern void _TyAST_Fini(PyInterpreterState *interp);
|
||||
extern void _PyAtExit_Fini(PyInterpreterState *interp);
|
||||
extern void _PyThread_FiniType(PyInterpreterState *interp);
|
||||
extern void _TyWarnings_Fini(TyInterpreterState *interp);
|
||||
extern void _TyAST_Fini(TyInterpreterState *interp);
|
||||
extern void _PyAtExit_Fini(TyInterpreterState *interp);
|
||||
extern void _PyThread_FiniType(TyInterpreterState *interp);
|
||||
extern void _TyArg_Fini(void);
|
||||
extern void _Ty_FinalizeAllocatedBlocks(_PyRuntimeState *);
|
||||
|
||||
extern TyStatus _TyGILState_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _TyGILState_Init(TyInterpreterState *interp);
|
||||
extern void _TyGILState_SetTstate(TyThreadState *tstate);
|
||||
extern void _TyGILState_Fini(PyInterpreterState *interp);
|
||||
extern void _TyGILState_Fini(TyInterpreterState *interp);
|
||||
|
||||
extern void _TyGC_DumpShutdownStats(PyInterpreterState *interp);
|
||||
extern void _TyGC_DumpShutdownStats(TyInterpreterState *interp);
|
||||
|
||||
extern TyStatus _Ty_PreInitializeFromPyArgv(
|
||||
const PyPreConfig *src_config,
|
||||
@@ -86,7 +86,7 @@ extern void _TyErr_DisplayException(TyObject *file, TyObject *exc);
|
||||
|
||||
extern void _TyThreadState_DeleteCurrent(TyThreadState *tstate);
|
||||
|
||||
extern void _PyAtExit_Call(PyInterpreterState *interp);
|
||||
extern void _PyAtExit_Call(TyInterpreterState *interp);
|
||||
|
||||
extern int _Ty_IsCoreInitialized(void);
|
||||
|
||||
@@ -96,7 +96,7 @@ extern const char* _Ty_gitidentifier(void);
|
||||
extern const char* _Ty_gitversion(void);
|
||||
|
||||
// Export for '_asyncio' shared extension
|
||||
PyAPI_FUNC(int) _Ty_IsInterpreterFinalizing(PyInterpreterState *interp);
|
||||
PyAPI_FUNC(int) _Ty_IsInterpreterFinalizing(TyInterpreterState *interp);
|
||||
|
||||
/* Random */
|
||||
extern int _TyOS_URandom(void *buffer, Ty_ssize_t size);
|
||||
@@ -120,7 +120,7 @@ int _PyRun_SimpleStringFlagsWithName(const char *command, const char* name, PyCo
|
||||
// Export for _testinternalcapi shared extension
|
||||
PyAPI_FUNC(int) _PyInterpreterConfig_InitFromState(
|
||||
PyInterpreterConfig *,
|
||||
PyInterpreterState *);
|
||||
TyInterpreterState *);
|
||||
PyAPI_FUNC(TyObject *) _PyInterpreterConfig_AsDict(PyInterpreterConfig *);
|
||||
PyAPI_FUNC(int) _PyInterpreterConfig_InitFromDict(
|
||||
PyInterpreterConfig *,
|
||||
|
||||
@@ -114,7 +114,7 @@ extern void _TyMem_ProcessDelayedNoDealloc(TyThreadState *tstate,
|
||||
extern void _TyMem_AbandonDelayed(TyThreadState *tstate);
|
||||
|
||||
// On interpreter shutdown, frees all delayed free requests.
|
||||
extern void _TyMem_FiniDelayed(PyInterpreterState *interp);
|
||||
extern void _TyMem_FiniDelayed(TyInterpreterState *interp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -54,23 +54,23 @@ extern "C" {
|
||||
extern int _Ty_IsMainThread(void);
|
||||
|
||||
// Export for '_testinternalcapi' shared extension
|
||||
PyAPI_FUNC(PyInterpreterState*) _TyInterpreterState_Main(void);
|
||||
PyAPI_FUNC(TyInterpreterState*) _TyInterpreterState_Main(void);
|
||||
|
||||
static inline int
|
||||
_Ty_IsMainInterpreter(PyInterpreterState *interp)
|
||||
_Ty_IsMainInterpreter(TyInterpreterState *interp)
|
||||
{
|
||||
return (interp == _TyInterpreterState_Main());
|
||||
}
|
||||
|
||||
extern int _Ty_IsMainInterpreterFinalizing(PyInterpreterState *interp);
|
||||
extern int _Ty_IsMainInterpreterFinalizing(TyInterpreterState *interp);
|
||||
|
||||
// Export for _interpreters module.
|
||||
PyAPI_FUNC(TyObject *) _TyInterpreterState_GetIDObject(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyObject *) _TyInterpreterState_GetIDObject(TyInterpreterState *);
|
||||
|
||||
// Export for _interpreters module.
|
||||
PyAPI_FUNC(int) _TyInterpreterState_SetRunningMain(PyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_SetNotRunningMain(PyInterpreterState *);
|
||||
PyAPI_FUNC(int) _TyInterpreterState_IsRunningMain(PyInterpreterState *);
|
||||
PyAPI_FUNC(int) _TyInterpreterState_SetRunningMain(TyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyInterpreterState_SetNotRunningMain(TyInterpreterState *);
|
||||
PyAPI_FUNC(int) _TyInterpreterState_IsRunningMain(TyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyErr_SetInterpreterAlreadyRunning(void);
|
||||
|
||||
extern int _TyThreadState_IsRunningMain(TyThreadState *);
|
||||
@@ -80,7 +80,7 @@ extern const PyConfig* _Ty_GetMainConfig(void);
|
||||
|
||||
/* Only handle signals on the main thread of the main interpreter. */
|
||||
static inline int
|
||||
_Ty_ThreadCanHandleSignals(PyInterpreterState *interp)
|
||||
_Ty_ThreadCanHandleSignals(TyInterpreterState *interp)
|
||||
{
|
||||
return (_Ty_IsMainThread() && _Ty_IsMainInterpreter(interp));
|
||||
}
|
||||
@@ -167,8 +167,8 @@ extern void _TyEval_StartTheWorldAll(_PyRuntimeState *runtime);
|
||||
// Perform a stop-the-world pause for threads in the specified interpreter.
|
||||
//
|
||||
// NOTE: This is a no-op outside of Ty_GIL_DISABLED builds.
|
||||
extern PyAPI_FUNC(void) _TyEval_StopTheWorld(PyInterpreterState *interp);
|
||||
extern PyAPI_FUNC(void) _TyEval_StartTheWorld(PyInterpreterState *interp);
|
||||
extern PyAPI_FUNC(void) _TyEval_StopTheWorld(TyInterpreterState *interp);
|
||||
extern PyAPI_FUNC(void) _TyEval_StartTheWorld(TyInterpreterState *interp);
|
||||
|
||||
|
||||
static inline void
|
||||
@@ -203,7 +203,7 @@ _Ty_EnsureFuncTstateNotNULL(const char *func, TyThreadState *tstate)
|
||||
|
||||
See also TyInterpreterState_Get()
|
||||
and _TyGILState_GetInterpreterStateUnsafe(). */
|
||||
static inline PyInterpreterState* _TyInterpreterState_GET(void) {
|
||||
static inline TyInterpreterState* _TyInterpreterState_GET(void) {
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
#ifdef Ty_DEBUG
|
||||
_Ty_EnsureTstateNotNULL(tstate);
|
||||
@@ -216,11 +216,11 @@ static inline PyInterpreterState* _TyInterpreterState_GET(void) {
|
||||
|
||||
// Export for _testinternalcapi
|
||||
PyAPI_FUNC(TyThreadState *) _TyThreadState_New(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
int whence);
|
||||
extern void _TyThreadState_Bind(TyThreadState *tstate);
|
||||
PyAPI_FUNC(TyThreadState *) _TyThreadState_NewBound(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
int whence);
|
||||
extern TyThreadState * _TyThreadState_RemoveExcept(TyThreadState *tstate);
|
||||
extern void _TyThreadState_DeleteList(TyThreadState *list, int is_after_fork);
|
||||
@@ -276,14 +276,14 @@ extern int _TyOS_InterruptOccurred(TyThreadState *tstate);
|
||||
// Export for test_peg_generator.
|
||||
PyAPI_FUNC(const PyConfig*) _Ty_GetConfig(void);
|
||||
|
||||
// Get the single PyInterpreterState used by this process' GILState
|
||||
// Get the single TyInterpreterState used by this process' GILState
|
||||
// implementation.
|
||||
//
|
||||
// This function doesn't check for error. Return NULL before _TyGILState_Init()
|
||||
// is called and after _TyGILState_Fini() is called.
|
||||
//
|
||||
// See also TyInterpreterState_Get() and _TyInterpreterState_GET().
|
||||
extern PyInterpreterState* _TyGILState_GetInterpreterStateUnsafe(void);
|
||||
extern TyInterpreterState* _TyGILState_GetInterpreterStateUnsafe(void);
|
||||
|
||||
extern TyObject * _Ty_GetMainModule(TyThreadState *);
|
||||
extern int _Ty_CheckMainModule(TyObject *module);
|
||||
|
||||
@@ -91,16 +91,16 @@ struct _pythread_runtime_state {
|
||||
/* Private function to reinitialize a lock at fork in the child process.
|
||||
Reset the lock to the unlocked state.
|
||||
Return 0 on success, return -1 on error. */
|
||||
extern int _PyThread_at_fork_reinit(PyThread_type_lock *lock);
|
||||
extern int _PyThread_at_fork_reinit(TyThread_type_lock *lock);
|
||||
extern void _PyThread_AfterFork(struct _pythread_runtime_state *state);
|
||||
#endif /* HAVE_FORK */
|
||||
|
||||
|
||||
// unset: -1 seconds, in nanoseconds
|
||||
#define PyThread_UNSET_TIMEOUT ((PyTime_t)(-1 * 1000 * 1000 * 1000))
|
||||
#define TyThread_UNSET_TIMEOUT ((TyTime_t)(-1 * 1000 * 1000 * 1000))
|
||||
|
||||
// Exported for the _interpchannels module.
|
||||
PyAPI_FUNC(int) PyThread_ParseTimeoutArg(
|
||||
PyAPI_FUNC(int) TyThread_ParseTimeoutArg(
|
||||
TyObject *arg,
|
||||
int blocking,
|
||||
PY_TIMEOUT_T *timeout);
|
||||
@@ -112,46 +112,46 @@ PyAPI_FUNC(int) PyThread_ParseTimeoutArg(
|
||||
* timeout.
|
||||
*/
|
||||
// Exported for the _interpchannels module.
|
||||
PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed_with_retries(
|
||||
PyThread_type_lock,
|
||||
PyAPI_FUNC(TyLockStatus) TyThread_acquire_lock_timed_with_retries(
|
||||
TyThread_type_lock,
|
||||
PY_TIMEOUT_T microseconds);
|
||||
|
||||
typedef unsigned long long PyThread_ident_t;
|
||||
typedef Ty_uintptr_t PyThread_handle_t;
|
||||
typedef unsigned long long TyThread_ident_t;
|
||||
typedef Ty_uintptr_t TyThread_handle_t;
|
||||
|
||||
#define PY_FORMAT_THREAD_IDENT_T "llu"
|
||||
#define Ty_PARSE_THREAD_IDENT_T "K"
|
||||
|
||||
PyAPI_FUNC(PyThread_ident_t) PyThread_get_thread_ident_ex(void);
|
||||
PyAPI_FUNC(TyThread_ident_t) TyThread_get_thread_ident_ex(void);
|
||||
|
||||
/* Thread joining APIs.
|
||||
*
|
||||
* These APIs have a strict contract:
|
||||
* - Either PyThread_join_thread or PyThread_detach_thread must be called
|
||||
* - Either TyThread_join_thread or TyThread_detach_thread must be called
|
||||
* exactly once with the given handle.
|
||||
* - Calling neither PyThread_join_thread nor PyThread_detach_thread results
|
||||
* - Calling neither TyThread_join_thread nor TyThread_detach_thread results
|
||||
* in a resource leak until the end of the process.
|
||||
* - Any other usage, such as calling both PyThread_join_thread and
|
||||
* PyThread_detach_thread, or calling them more than once (including
|
||||
* - Any other usage, such as calling both TyThread_join_thread and
|
||||
* TyThread_detach_thread, or calling them more than once (including
|
||||
* simultaneously), results in undefined behavior.
|
||||
*/
|
||||
PyAPI_FUNC(int) PyThread_start_joinable_thread(void (*func)(void *),
|
||||
PyAPI_FUNC(int) TyThread_start_joinable_thread(void (*func)(void *),
|
||||
void *arg,
|
||||
PyThread_ident_t* ident,
|
||||
PyThread_handle_t* handle);
|
||||
TyThread_ident_t* ident,
|
||||
TyThread_handle_t* handle);
|
||||
/*
|
||||
* Join a thread started with `PyThread_start_joinable_thread`.
|
||||
* Join a thread started with `TyThread_start_joinable_thread`.
|
||||
* This function cannot be interrupted. It returns 0 on success,
|
||||
* a non-zero value on failure.
|
||||
*/
|
||||
PyAPI_FUNC(int) PyThread_join_thread(PyThread_handle_t);
|
||||
PyAPI_FUNC(int) TyThread_join_thread(TyThread_handle_t);
|
||||
/*
|
||||
* Detach a thread started with `PyThread_start_joinable_thread`, such
|
||||
* Detach a thread started with `TyThread_start_joinable_thread`, such
|
||||
* that its resources are released as soon as it exits.
|
||||
* This function cannot be interrupted. It returns 0 on success,
|
||||
* a non-zero value on failure.
|
||||
*/
|
||||
PyAPI_FUNC(int) PyThread_detach_thread(PyThread_handle_t);
|
||||
PyAPI_FUNC(int) TyThread_detach_thread(TyThread_handle_t);
|
||||
/*
|
||||
* Hangs the thread indefinitely without exiting it.
|
||||
*
|
||||
@@ -164,7 +164,7 @@ PyAPI_FUNC(int) PyThread_detach_thread(PyThread_handle_t);
|
||||
* when they're done with the interpreter, but our C API design does not allow
|
||||
* for safely exiting threads attempting to re-enter Python post finalization.
|
||||
*/
|
||||
void _Ty_NO_RETURN PyThread_hang_thread(void);
|
||||
void _Ty_NO_RETURN TyThread_hang_thread(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -149,19 +149,19 @@ _Ty_qsbr_detach(struct _qsbr_thread_state *qsbr);
|
||||
|
||||
// Reserves (allocates) a QSBR state and returns its index.
|
||||
extern Ty_ssize_t
|
||||
_Ty_qsbr_reserve(PyInterpreterState *interp);
|
||||
_Ty_qsbr_reserve(TyInterpreterState *interp);
|
||||
|
||||
// Associates a TyThreadState with the QSBR state at the given index
|
||||
extern void
|
||||
_Ty_qsbr_register(struct _PyThreadStateImpl *tstate,
|
||||
PyInterpreterState *interp, Ty_ssize_t index);
|
||||
TyInterpreterState *interp, Ty_ssize_t index);
|
||||
|
||||
// Disassociates a TyThreadState from the QSBR state and frees the QSBR state.
|
||||
extern void
|
||||
_Ty_qsbr_unregister(TyThreadState *tstate);
|
||||
|
||||
extern void
|
||||
_Ty_qsbr_fini(PyInterpreterState *interp);
|
||||
_Ty_qsbr_fini(TyInterpreterState *interp);
|
||||
|
||||
extern void
|
||||
_Ty_qsbr_after_fork(struct _PyThreadStateImpl *tstate);
|
||||
|
||||
@@ -50,7 +50,7 @@ _PyRuntimeState_SetFinalizing(_PyRuntimeState *runtime, TyThreadState *tstate) {
|
||||
}
|
||||
else {
|
||||
// XXX Re-enable this assert once gh-109860 is fixed.
|
||||
//assert(tstate->thread_id == PyThread_get_thread_ident());
|
||||
//assert(tstate->thread_id == TyThread_get_thread_ident());
|
||||
_Ty_atomic_store_ulong_relaxed(&runtime->_finalizing_id,
|
||||
tstate->thread_id);
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ struct _parser_runtime_state {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
PyTime_t numer;
|
||||
PyTime_t denom;
|
||||
TyTime_t numer;
|
||||
TyTime_t denom;
|
||||
} _PyTimeFraction;
|
||||
|
||||
struct _Ty_time_runtime_state {
|
||||
@@ -188,11 +188,11 @@ struct pyruntimestate {
|
||||
struct pyinterpreters {
|
||||
PyMutex mutex;
|
||||
/* The linked list of interpreters, newest first. */
|
||||
PyInterpreterState *head;
|
||||
TyInterpreterState *head;
|
||||
/* The runtime's initial interpreter, which has a special role
|
||||
in the operation of the runtime. It is also often the only
|
||||
interpreter. */
|
||||
PyInterpreterState *main;
|
||||
TyInterpreterState *main;
|
||||
/* next_id is an auto-numbered sequence of small
|
||||
integers. It gets initialized in _TyInterpreterState_Enable(),
|
||||
which is called in Ty_Initialize(), and used in
|
||||
@@ -241,11 +241,11 @@ struct pyruntimestate {
|
||||
/* bpo-26558: Flag to disable TyGILState_Check().
|
||||
If set to non-zero, TyGILState_Check() always return 1. */
|
||||
int check_enabled;
|
||||
/* The single PyInterpreterState used by this process'
|
||||
/* The single TyInterpreterState used by this process'
|
||||
GILState implementation
|
||||
*/
|
||||
/* TODO: Given interp_main, it may be possible to kill this ref */
|
||||
PyInterpreterState *autoInterpreterState;
|
||||
TyInterpreterState *autoInterpreterState;
|
||||
} gilstate;
|
||||
struct _getargs_runtime_state {
|
||||
struct _TyArg_Parser *static_parsers;
|
||||
@@ -299,12 +299,12 @@ struct pyruntimestate {
|
||||
For now there are some exceptions to that rule, which require
|
||||
allocation during init. These will be addressed on a case-by-case
|
||||
basis. Most notably, we don't pre-allocated the several mutex
|
||||
(PyThread_type_lock) fields, because on Windows we only ever get
|
||||
(TyThread_type_lock) fields, because on Windows we only ever get
|
||||
a pointer type.
|
||||
*/
|
||||
|
||||
/* _PyRuntimeState.interpreters.main */
|
||||
PyInterpreterState _main_interpreter;
|
||||
TyInterpreterState _main_interpreter;
|
||||
// _main_interpreter should be the last field of _PyRuntimeState.
|
||||
// See https://github.com/python/cpython/issues/127117.
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct _PySemaphore {
|
||||
// If `detach` is true, then the thread will detach/release the GIL while
|
||||
// sleeping.
|
||||
PyAPI_FUNC(int)
|
||||
_PySemaphore_Wait(_PySemaphore *sema, PyTime_t timeout_ns, int detach);
|
||||
_PySemaphore_Wait(_PySemaphore *sema, TyTime_t timeout_ns, int detach);
|
||||
|
||||
// Wakes up a single thread waiting on sema. Note that _PySemaphore_Wakeup()
|
||||
// can be called before _PySemaphore_Wait().
|
||||
|
||||
@@ -59,7 +59,7 @@ PyAPI_FUNC(TyObject *) _Ty_stackref_get_object(_PyStackRef ref);
|
||||
PyAPI_FUNC(TyObject *) _Ty_stackref_close(_PyStackRef ref, const char *filename, int linenumber);
|
||||
PyAPI_FUNC(_PyStackRef) _Ty_stackref_create(TyObject *obj, const char *filename, int linenumber);
|
||||
PyAPI_FUNC(void) _Ty_stackref_record_borrow(_PyStackRef ref, const char *filename, int linenumber);
|
||||
extern void _Ty_stackref_associate(PyInterpreterState *interp, TyObject *obj, _PyStackRef ref);
|
||||
extern void _Ty_stackref_associate(TyInterpreterState *interp, TyObject *obj, _PyStackRef ref);
|
||||
|
||||
static const _PyStackRef PyStackRef_NULL = { .index = 0 };
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ PyAPI_FUNC(TyObject*) _Ty_GetSpecializationStats(void);
|
||||
|
||||
#define RARE_EVENT_INC(name) \
|
||||
do { \
|
||||
PyInterpreterState *interp = TyInterpreterState_Get(); \
|
||||
TyInterpreterState *interp = TyInterpreterState_Get(); \
|
||||
RARE_EVENT_INTERP_INC(interp, name); \
|
||||
} while (0); \
|
||||
|
||||
|
||||
@@ -13,25 +13,25 @@ extern "C" {
|
||||
|
||||
// Export for '_curses' shared extension
|
||||
PyAPI_FUNC(TyTypeObject*) _PyStructSequence_NewType(
|
||||
PyStructSequence_Desc *desc,
|
||||
TyStructSequence_Desc *desc,
|
||||
unsigned long tp_flags);
|
||||
|
||||
extern int _PyStructSequence_InitBuiltinWithFlags(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyTypeObject *type,
|
||||
PyStructSequence_Desc *desc,
|
||||
TyStructSequence_Desc *desc,
|
||||
unsigned long tp_flags);
|
||||
|
||||
static inline int
|
||||
_PyStructSequence_InitBuiltin(PyInterpreterState *interp,
|
||||
_PyStructSequence_InitBuiltin(TyInterpreterState *interp,
|
||||
TyTypeObject *type,
|
||||
PyStructSequence_Desc *desc)
|
||||
TyStructSequence_Desc *desc)
|
||||
{
|
||||
return _PyStructSequence_InitBuiltinWithFlags(interp, type, desc, 0);
|
||||
}
|
||||
|
||||
extern void _PyStructSequence_FiniBuiltin(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyTypeObject *type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -18,7 +18,7 @@ PyAPI_FUNC(size_t) _TySys_GetSizeOf(TyObject *);
|
||||
|
||||
extern int _TySys_SetAttr(TyObject *, TyObject *);
|
||||
|
||||
extern int _TySys_ClearAttrString(PyInterpreterState *interp,
|
||||
extern int _TySys_ClearAttrString(TyInterpreterState *interp,
|
||||
const char *name, int verbose);
|
||||
|
||||
extern int _TySys_SetFlagObj(Ty_ssize_t pos, TyObject *new_value);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Internal PyTime_t C API: see Doc/c-api/time.rst for the documentation.
|
||||
// Internal TyTime_t C API: see Doc/c-api/time.rst for the documentation.
|
||||
//
|
||||
// The PyTime_t type is an integer to support directly common arithmetic
|
||||
// The TyTime_t type is an integer to support directly common arithmetic
|
||||
// operations such as t1 + t2.
|
||||
//
|
||||
// Time formats:
|
||||
@@ -14,9 +14,9 @@
|
||||
// * timeval structure, 1 microsecond (10^-6 seconds).
|
||||
// * timespec structure, 1 nanosecond (10^-9 seconds).
|
||||
//
|
||||
// Note that PyTime_t is now specified as int64_t, in nanoseconds.
|
||||
// Note that TyTime_t is now specified as int64_t, in nanoseconds.
|
||||
// (If we need to change this, we'll need new public API with new names.)
|
||||
// Previously, PyTime_t was configurable (in theory); some comments and code
|
||||
// Previously, TyTime_t was configurable (in theory); some comments and code
|
||||
// might still allude to that.
|
||||
//
|
||||
// Integer overflows are detected and raise OverflowError. Conversion to a
|
||||
@@ -43,7 +43,7 @@
|
||||
//
|
||||
// Internally, operations like (t * k / q) with integers are implemented in a
|
||||
// way to reduce the risk of integer overflow. Such operation is used to convert a
|
||||
// clock value expressed in ticks with a frequency to PyTime_t, like
|
||||
// clock value expressed in ticks with a frequency to TyTime_t, like
|
||||
// QueryPerformanceCounter() with QueryPerformanceFrequency() on Windows.
|
||||
|
||||
|
||||
@@ -130,66 +130,66 @@ PyAPI_FUNC(int) _TyTime_ObjectToTimespec(
|
||||
|
||||
// Create a timestamp from a number of seconds.
|
||||
// Export for '_socket' shared extension.
|
||||
PyAPI_FUNC(PyTime_t) _TyTime_FromSeconds(int seconds);
|
||||
PyAPI_FUNC(TyTime_t) _TyTime_FromSeconds(int seconds);
|
||||
|
||||
// Create a timestamp from a number of seconds in double.
|
||||
extern int _TyTime_FromSecondsDouble(
|
||||
double seconds,
|
||||
_TyTime_round_t round,
|
||||
PyTime_t *result);
|
||||
TyTime_t *result);
|
||||
|
||||
// Macro to create a timestamp from a number of seconds, no integer overflow.
|
||||
// Only use the macro for small values, prefer _TyTime_FromSeconds().
|
||||
#define _PYTIME_FROMSECONDS(seconds) \
|
||||
((PyTime_t)(seconds) * (1000 * 1000 * 1000))
|
||||
((TyTime_t)(seconds) * (1000 * 1000 * 1000))
|
||||
|
||||
// Create a timestamp from a number of microseconds.
|
||||
// Clamp to [PyTime_MIN; PyTime_MAX] on overflow.
|
||||
extern PyTime_t _TyTime_FromMicrosecondsClamp(PyTime_t us);
|
||||
extern TyTime_t _TyTime_FromMicrosecondsClamp(TyTime_t us);
|
||||
|
||||
// Create a timestamp from a Python int object (number of nanoseconds).
|
||||
// Export for '_lsprof' shared extension.
|
||||
PyAPI_FUNC(int) _TyTime_FromLong(PyTime_t *t,
|
||||
PyAPI_FUNC(int) _TyTime_FromLong(TyTime_t *t,
|
||||
TyObject *obj);
|
||||
|
||||
// Convert a number of seconds (Python float or int) to a timestamp.
|
||||
// Raise an exception and return -1 on error, return 0 on success.
|
||||
// Export for '_socket' shared extension.
|
||||
PyAPI_FUNC(int) _TyTime_FromSecondsObject(PyTime_t *t,
|
||||
PyAPI_FUNC(int) _TyTime_FromSecondsObject(TyTime_t *t,
|
||||
TyObject *obj,
|
||||
_TyTime_round_t round);
|
||||
|
||||
// Convert a number of milliseconds (Python float or int, 10^-3) to a timestamp.
|
||||
// Raise an exception and return -1 on error, return 0 on success.
|
||||
// Export for 'select' shared extension.
|
||||
PyAPI_FUNC(int) _TyTime_FromMillisecondsObject(PyTime_t *t,
|
||||
PyAPI_FUNC(int) _TyTime_FromMillisecondsObject(TyTime_t *t,
|
||||
TyObject *obj,
|
||||
_TyTime_round_t round);
|
||||
|
||||
// Convert timestamp to a number of milliseconds (10^-3 seconds).
|
||||
// Export for '_ssl' shared extension.
|
||||
PyAPI_FUNC(PyTime_t) _TyTime_AsMilliseconds(PyTime_t t,
|
||||
PyAPI_FUNC(TyTime_t) _TyTime_AsMilliseconds(TyTime_t t,
|
||||
_TyTime_round_t round);
|
||||
|
||||
// Convert timestamp to a number of microseconds (10^-6 seconds).
|
||||
// Export for '_queue' shared extension.
|
||||
PyAPI_FUNC(PyTime_t) _TyTime_AsMicroseconds(PyTime_t t,
|
||||
PyAPI_FUNC(TyTime_t) _TyTime_AsMicroseconds(TyTime_t t,
|
||||
_TyTime_round_t round);
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
// Convert timestamp to a number of 100 nanoseconds (10^-7 seconds).
|
||||
extern PyTime_t _TyTime_As100Nanoseconds(PyTime_t t,
|
||||
extern TyTime_t _TyTime_As100Nanoseconds(TyTime_t t,
|
||||
_TyTime_round_t round);
|
||||
#endif
|
||||
|
||||
// Convert a timestamp (number of nanoseconds) as a Python int object.
|
||||
// Export for '_testinternalcapi' shared extension.
|
||||
PyAPI_FUNC(TyObject*) _TyTime_AsLong(PyTime_t t);
|
||||
PyAPI_FUNC(TyObject*) _TyTime_AsLong(TyTime_t t);
|
||||
|
||||
#ifndef MS_WINDOWS
|
||||
// Create a timestamp from a timeval structure.
|
||||
// Raise an exception and return -1 on overflow, return 0 on success.
|
||||
extern int _TyTime_FromTimeval(PyTime_t *tp, struct timeval *tv);
|
||||
extern int _TyTime_FromTimeval(TyTime_t *tp, struct timeval *tv);
|
||||
#endif
|
||||
|
||||
// Convert a timestamp to a timeval structure (microsecond resolution).
|
||||
@@ -197,14 +197,14 @@ extern int _TyTime_FromTimeval(PyTime_t *tp, struct timeval *tv);
|
||||
// Raise an exception and return -1 if the conversion overflowed,
|
||||
// return 0 on success.
|
||||
// Export for 'select' shared extension.
|
||||
PyAPI_FUNC(int) _TyTime_AsTimeval(PyTime_t t,
|
||||
PyAPI_FUNC(int) _TyTime_AsTimeval(TyTime_t t,
|
||||
struct timeval *tv,
|
||||
_TyTime_round_t round);
|
||||
|
||||
// Similar to _TyTime_AsTimeval() but don't raise an exception on overflow.
|
||||
// On overflow, clamp tv_sec to PyTime_t min/max.
|
||||
// On overflow, clamp tv_sec to TyTime_t min/max.
|
||||
// Export for 'select' shared extension.
|
||||
PyAPI_FUNC(void) _TyTime_AsTimeval_clamp(PyTime_t t,
|
||||
PyAPI_FUNC(void) _TyTime_AsTimeval_clamp(TyTime_t t,
|
||||
struct timeval *tv,
|
||||
_TyTime_round_t round);
|
||||
|
||||
@@ -216,7 +216,7 @@ PyAPI_FUNC(void) _TyTime_AsTimeval_clamp(PyTime_t t,
|
||||
// return 0 on success.
|
||||
// Export for '_datetime' shared extension.
|
||||
PyAPI_FUNC(int) _TyTime_AsTimevalTime_t(
|
||||
PyTime_t t,
|
||||
TyTime_t t,
|
||||
time_t *secs,
|
||||
int *us,
|
||||
_TyTime_round_t round);
|
||||
@@ -224,23 +224,23 @@ PyAPI_FUNC(int) _TyTime_AsTimevalTime_t(
|
||||
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE)
|
||||
// Create a timestamp from a timespec structure.
|
||||
// Raise an exception and return -1 on overflow, return 0 on success.
|
||||
extern int _TyTime_FromTimespec(PyTime_t *tp, const struct timespec *ts);
|
||||
extern int _TyTime_FromTimespec(TyTime_t *tp, const struct timespec *ts);
|
||||
|
||||
// Convert a timestamp to a timespec structure (nanosecond resolution).
|
||||
// tv_nsec is always positive.
|
||||
// Raise an exception and return -1 on error, return 0 on success.
|
||||
// Export for '_testinternalcapi' shared extension.
|
||||
PyAPI_FUNC(int) _TyTime_AsTimespec(PyTime_t t, struct timespec *ts);
|
||||
PyAPI_FUNC(int) _TyTime_AsTimespec(TyTime_t t, struct timespec *ts);
|
||||
|
||||
// Similar to _TyTime_AsTimespec() but don't raise an exception on overflow.
|
||||
// On overflow, clamp tv_sec to PyTime_t min/max.
|
||||
// On overflow, clamp tv_sec to TyTime_t min/max.
|
||||
// Export for '_testinternalcapi' shared extension.
|
||||
PyAPI_FUNC(void) _TyTime_AsTimespec_clamp(PyTime_t t, struct timespec *ts);
|
||||
PyAPI_FUNC(void) _TyTime_AsTimespec_clamp(TyTime_t t, struct timespec *ts);
|
||||
#endif
|
||||
|
||||
|
||||
// Compute t1 + t2. Clamp to [PyTime_MIN; PyTime_MAX] on overflow.
|
||||
extern PyTime_t _TyTime_Add(PyTime_t t1, PyTime_t t2);
|
||||
extern TyTime_t _TyTime_Add(TyTime_t t1, TyTime_t t2);
|
||||
|
||||
// Structure used by time.get_clock_info()
|
||||
typedef struct {
|
||||
@@ -254,7 +254,7 @@ typedef struct {
|
||||
// On success, set *t and *info (if not NULL), and return 0.
|
||||
// On error, raise an exception and return -1.
|
||||
extern int _TyTime_TimeWithInfo(
|
||||
PyTime_t *t,
|
||||
TyTime_t *t,
|
||||
_Ty_clock_info_t *info);
|
||||
|
||||
// Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
|
||||
@@ -267,7 +267,7 @@ extern int _TyTime_TimeWithInfo(
|
||||
// Return 0 on success, raise an exception and return -1 on error.
|
||||
// Export for '_testsinglephase' shared extension.
|
||||
PyAPI_FUNC(int) _TyTime_MonotonicWithInfo(
|
||||
PyTime_t *t,
|
||||
TyTime_t *t,
|
||||
_Ty_clock_info_t *info);
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ PyAPI_FUNC(int) _TyTime_gmtime(time_t t, struct tm *tm);
|
||||
//
|
||||
// Return 0 on success, raise an exception and return -1 on error.
|
||||
extern int _TyTime_PerfCounterWithInfo(
|
||||
PyTime_t *t,
|
||||
TyTime_t *t,
|
||||
_Ty_clock_info_t *info);
|
||||
|
||||
|
||||
@@ -298,12 +298,12 @@ extern int _TyTime_PerfCounterWithInfo(
|
||||
// Create a deadline.
|
||||
// Pseudo code: return PyTime_MonotonicRaw() + timeout
|
||||
// Export for '_ssl' shared extension.
|
||||
PyAPI_FUNC(PyTime_t) _PyDeadline_Init(PyTime_t timeout);
|
||||
PyAPI_FUNC(TyTime_t) _PyDeadline_Init(TyTime_t timeout);
|
||||
|
||||
// Get remaining time from a deadline.
|
||||
// Pseudo code: return deadline - PyTime_MonotonicRaw()
|
||||
// Export for '_ssl' shared extension.
|
||||
PyAPI_FUNC(PyTime_t) _PyDeadline_Get(PyTime_t deadline);
|
||||
PyAPI_FUNC(TyTime_t) _PyDeadline_Get(TyTime_t deadline);
|
||||
|
||||
|
||||
// --- _PyTimeFraction -------------------------------------------------------
|
||||
@@ -313,13 +313,13 @@ PyAPI_FUNC(PyTime_t) _PyDeadline_Get(PyTime_t deadline);
|
||||
// Return -1 if the fraction is invalid.
|
||||
extern int _PyTimeFraction_Set(
|
||||
_PyTimeFraction *frac,
|
||||
PyTime_t numer,
|
||||
PyTime_t denom);
|
||||
TyTime_t numer,
|
||||
TyTime_t denom);
|
||||
|
||||
// Compute ticks * frac.numer / frac.denom.
|
||||
// Clamp to [PyTime_MIN; PyTime_MAX] on overflow.
|
||||
extern PyTime_t _PyTimeFraction_Mul(
|
||||
PyTime_t ticks,
|
||||
extern TyTime_t _PyTimeFraction_Mul(
|
||||
TyTime_t ticks,
|
||||
const _PyTimeFraction *frac);
|
||||
|
||||
// Compute a clock resolution: frac.numer / frac.denom / 1e9.
|
||||
|
||||
@@ -60,7 +60,7 @@ extern void _Ty_DumpTraceback(
|
||||
|
||||
extern const char* _Ty_DumpTracebackThreads(
|
||||
int fd,
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyThreadState *current_tstate);
|
||||
|
||||
/* Write a Unicode object into the file descriptor fd. Encode the string to
|
||||
|
||||
@@ -16,7 +16,7 @@ extern void _TyTuple_DebugMallocStats(FILE *out);
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern TyStatus _TyTuple_InitGlobalObjects(PyInterpreterState *);
|
||||
extern TyStatus _TyTuple_InitGlobalObjects(TyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
|
||||
@@ -35,10 +35,10 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern TyStatus _PyTypes_InitTypes(PyInterpreterState *);
|
||||
extern void _PyTypes_FiniTypes(PyInterpreterState *);
|
||||
extern void _PyTypes_FiniExtTypes(PyInterpreterState *interp);
|
||||
extern void _PyTypes_Fini(PyInterpreterState *);
|
||||
extern TyStatus _PyTypes_InitTypes(TyInterpreterState *);
|
||||
extern void _PyTypes_FiniTypes(TyInterpreterState *);
|
||||
extern void _PyTypes_FiniExtTypes(TyInterpreterState *interp);
|
||||
extern void _PyTypes_Fini(TyInterpreterState *);
|
||||
extern void _PyTypes_AfterFork(void);
|
||||
|
||||
static inline TyObject **
|
||||
@@ -49,21 +49,21 @@ _PyStaticType_GET_WEAKREFS_LISTPTR(managed_static_type_state *state)
|
||||
}
|
||||
|
||||
extern int _PyStaticType_InitBuiltin(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyTypeObject *type);
|
||||
extern void _PyStaticType_FiniBuiltin(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyTypeObject *type);
|
||||
extern void _PyStaticType_ClearWeakRefs(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyTypeObject *type);
|
||||
extern managed_static_type_state * _PyStaticType_GetState(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyTypeObject *type);
|
||||
|
||||
// Export for '_datetime' shared extension.
|
||||
PyAPI_FUNC(int) _PyStaticType_InitForExtension(
|
||||
PyInterpreterState *interp,
|
||||
TyInterpreterState *interp,
|
||||
TyTypeObject *self);
|
||||
|
||||
// Export for _testinternalcapi extension.
|
||||
|
||||
@@ -14,8 +14,8 @@ extern TyObject *_Ty_make_typevartuple(TyThreadState *, TyObject *);
|
||||
extern TyObject *_Ty_make_typealias(TyThreadState *, TyObject *);
|
||||
extern TyObject *_Ty_subscript_generic(TyThreadState *, TyObject *);
|
||||
extern TyObject *_Ty_set_typeparam_default(TyThreadState *, TyObject *, TyObject *);
|
||||
extern int _Ty_initialize_generic(PyInterpreterState *);
|
||||
extern void _Ty_clear_generic_types(PyInterpreterState *);
|
||||
extern int _Ty_initialize_generic(TyInterpreterState *);
|
||||
extern void _Ty_clear_generic_types(TyInterpreterState *);
|
||||
extern int _Ty_typing_type_repr(PyUnicodeWriter *, TyObject *);
|
||||
|
||||
extern TyTypeObject _PyTypeAlias_Type;
|
||||
|
||||
@@ -273,11 +273,11 @@ PyAPI_FUNC(Ty_ssize_t) _TyUnicode_ScanIdentifier(TyObject *);
|
||||
|
||||
/* --- Runtime lifecycle -------------------------------------------------- */
|
||||
|
||||
extern void _TyUnicode_InitState(PyInterpreterState *);
|
||||
extern TyStatus _TyUnicode_InitGlobalObjects(PyInterpreterState *);
|
||||
extern TyStatus _TyUnicode_InitTypes(PyInterpreterState *);
|
||||
extern void _TyUnicode_Fini(PyInterpreterState *);
|
||||
extern void _TyUnicode_FiniTypes(PyInterpreterState *);
|
||||
extern void _TyUnicode_InitState(TyInterpreterState *);
|
||||
extern TyStatus _TyUnicode_InitGlobalObjects(TyInterpreterState *);
|
||||
extern TyStatus _TyUnicode_InitTypes(TyInterpreterState *);
|
||||
extern void _TyUnicode_Fini(TyInterpreterState *);
|
||||
extern void _TyUnicode_FiniTypes(TyInterpreterState *);
|
||||
|
||||
extern TyTypeObject _PyUnicodeASCIIIter_Type;
|
||||
|
||||
@@ -286,16 +286,16 @@ extern TyTypeObject _PyUnicodeASCIIIter_Type;
|
||||
// All these are "ref-neutral", like the public TyUnicode_InternInPlace.
|
||||
|
||||
// Explicit interning routines:
|
||||
PyAPI_FUNC(void) _TyUnicode_InternMortal(PyInterpreterState *interp, TyObject **);
|
||||
PyAPI_FUNC(void) _TyUnicode_InternImmortal(PyInterpreterState *interp, TyObject **);
|
||||
PyAPI_FUNC(void) _TyUnicode_InternMortal(TyInterpreterState *interp, TyObject **);
|
||||
PyAPI_FUNC(void) _TyUnicode_InternImmortal(TyInterpreterState *interp, TyObject **);
|
||||
// Left here to help backporting:
|
||||
PyAPI_FUNC(void) _TyUnicode_InternInPlace(PyInterpreterState *interp, TyObject **p);
|
||||
PyAPI_FUNC(void) _TyUnicode_InternInPlace(TyInterpreterState *interp, TyObject **p);
|
||||
// Only for singletons in the _PyRuntime struct:
|
||||
extern void _TyUnicode_InternStatic(PyInterpreterState *interp, TyObject **);
|
||||
extern void _TyUnicode_InternStatic(TyInterpreterState *interp, TyObject **);
|
||||
|
||||
/* --- Other API ---------------------------------------------------------- */
|
||||
|
||||
extern void _TyUnicode_ClearInterned(PyInterpreterState *interp);
|
||||
extern void _TyUnicode_ClearInterned(TyInterpreterState *interp);
|
||||
|
||||
// Like TyUnicode_AsUTF8(), but check for embedded null characters.
|
||||
// Export for '_sqlite3' shared extension.
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
/* The following is auto-generated by Tools/build/generate_global_objects.py. */
|
||||
static inline void
|
||||
_TyUnicode_InitStaticStrings(PyInterpreterState *interp) {
|
||||
_TyUnicode_InitStaticStrings(TyInterpreterState *interp) {
|
||||
TyObject *string;
|
||||
string = &_Ty_ID(CANCELLED);
|
||||
_TyUnicode_InternStatic(interp, &string);
|
||||
|
||||
@@ -44,7 +44,7 @@ extern void _TyObject_MergePerThreadRefcounts(_PyThreadStateImpl *tstate);
|
||||
extern void _TyObject_FinalizePerThreadRefcounts(_PyThreadStateImpl *tstate);
|
||||
|
||||
// Frees the interpreter's pool of type ids.
|
||||
extern void _TyObject_FinalizeUniqueIdPool(PyInterpreterState *interp);
|
||||
extern void _TyObject_FinalizeUniqueIdPool(TyInterpreterState *interp);
|
||||
|
||||
// Increfs the object, resizing the thread-local refcount array if necessary.
|
||||
PyAPI_FUNC(void) _TyObject_ThreadIncrefSlow(TyObject *obj, size_t idx);
|
||||
|
||||
4
Include/internal/pycore_uop_metadata.h
generated
4
Include/internal/pycore_uop_metadata.h
generated
@@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "pycore_uop_ids.h"
|
||||
extern const uint16_t _PyUop_Flags[MAX_UOP_ID+1];
|
||||
extern const uint8_t _PyUop_Replication[MAX_UOP_ID+1];
|
||||
extern const char * const _PyOpcode_uop_name[MAX_UOP_ID+1];
|
||||
extern const char * const _TyOpcode_uop_name[MAX_UOP_ID+1];
|
||||
|
||||
extern int _PyUop_num_popped(int opcode, int oparg);
|
||||
|
||||
@@ -318,7 +318,7 @@ const uint8_t _PyUop_Replication[MAX_UOP_ID+1] = {
|
||||
[_INIT_CALL_PY_EXACT_ARGS] = 5,
|
||||
};
|
||||
|
||||
const char *const _PyOpcode_uop_name[MAX_UOP_ID+1] = {
|
||||
const char *const _TyOpcode_uop_name[MAX_UOP_ID+1] = {
|
||||
[_BINARY_OP] = "_BINARY_OP",
|
||||
[_BINARY_OP_ADD_FLOAT] = "_BINARY_OP_ADD_FLOAT",
|
||||
[_BINARY_OP_ADD_INT] = "_BINARY_OP_ADD_INT",
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
# error "this header requires Ty_BUILD_CORE define"
|
||||
#endif
|
||||
|
||||
extern int _TyWarnings_InitState(PyInterpreterState *interp);
|
||||
extern int _TyWarnings_InitState(TyInterpreterState *interp);
|
||||
|
||||
extern TyObject* _TyWarnings_Init(void);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct PyModuleDef_Base {
|
||||
TyObject* (*m_init)(void);
|
||||
/* The module's index into its interpreter's modules_by_index cache.
|
||||
This is set for all extension modules but only used for legacy ones.
|
||||
(See PyInterpreterState.modules_by_index for more info.)
|
||||
(See TyInterpreterState.modules_by_index for more info.)
|
||||
It is set by PyModuleDef_Init(). */
|
||||
Ty_ssize_t m_index;
|
||||
/* A copy of the module's __dict__ after the first time it was loaded.
|
||||
|
||||
@@ -86,7 +86,7 @@ whose size is determined when the object is allocated.
|
||||
},
|
||||
#endif
|
||||
|
||||
#define PyVarObject_HEAD_INIT(type, size) \
|
||||
#define TyVarObject_HEAD_INIT(type, size) \
|
||||
{ \
|
||||
PyObject_HEAD_INIT(type) \
|
||||
(size) \
|
||||
|
||||
@@ -149,11 +149,11 @@
|
||||
|
||||
/* Define macros for inline documentation. */
|
||||
#define PyDoc_VAR(name) static const char name[]
|
||||
#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
|
||||
#define TyDoc_STRVAR(name,str) PyDoc_VAR(name) = TyDoc_STR(str)
|
||||
#ifdef WITH_DOC_STRINGS
|
||||
#define PyDoc_STR(str) str
|
||||
#define TyDoc_STR(str) str
|
||||
#else
|
||||
#define PyDoc_STR(str) ""
|
||||
#define TyDoc_STR(str) ""
|
||||
#endif
|
||||
|
||||
/* Below "a" is a power of 2. */
|
||||
|
||||
@@ -522,7 +522,7 @@ extern "C" {
|
||||
# elif defined(__GNUC__) /* includes clang */
|
||||
# define _Ty_thread_local __thread
|
||||
# else
|
||||
// fall back to the PyThread_tss_*() API, or ignore.
|
||||
// fall back to the TyThread_tss_*() API, or ignore.
|
||||
# undef HAVE_THREAD_LOCAL
|
||||
# endif
|
||||
# endif
|
||||
@@ -543,7 +543,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Mark a function which cannot return. Example:
|
||||
PyAPI_FUNC(void) _Ty_NO_RETURN PyThread_exit_thread(void);
|
||||
PyAPI_FUNC(void) _Ty_NO_RETURN TyThread_exit_thread(void);
|
||||
|
||||
XLC support is intentionally omitted due to bpo-40244 */
|
||||
#ifndef _Ty_NO_RETURN
|
||||
|
||||
@@ -11,9 +11,9 @@ extern "C" {
|
||||
removed (with effort). */
|
||||
#define MAX_CO_EXTRA_USERS 255
|
||||
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_New(void);
|
||||
PyAPI_FUNC(void) TyInterpreterState_Clear(PyInterpreterState *);
|
||||
PyAPI_FUNC(void) TyInterpreterState_Delete(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyInterpreterState *) TyInterpreterState_New(void);
|
||||
PyAPI_FUNC(void) TyInterpreterState_Clear(TyInterpreterState *);
|
||||
PyAPI_FUNC(void) TyInterpreterState_Delete(TyInterpreterState *);
|
||||
|
||||
#if !defined(Ty_LIMITED_API) || Ty_LIMITED_API+0 >= 0x03090000
|
||||
/* New in 3.9 */
|
||||
@@ -23,17 +23,17 @@ PyAPI_FUNC(void) TyInterpreterState_Delete(PyInterpreterState *);
|
||||
interpreter. It cannot return NULL.
|
||||
|
||||
The caller must hold the GIL. */
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_Get(void);
|
||||
PyAPI_FUNC(TyInterpreterState *) TyInterpreterState_Get(void);
|
||||
#endif
|
||||
|
||||
#if !defined(Ty_LIMITED_API) || Ty_LIMITED_API+0 >= 0x03080000
|
||||
/* New in 3.8 */
|
||||
PyAPI_FUNC(TyObject *) TyInterpreterState_GetDict(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyObject *) TyInterpreterState_GetDict(TyInterpreterState *);
|
||||
#endif
|
||||
|
||||
#if !defined(Ty_LIMITED_API) || Ty_LIMITED_API+0 >= 0x03070000
|
||||
/* New in 3.7 */
|
||||
PyAPI_FUNC(int64_t) TyInterpreterState_GetID(PyInterpreterState *);
|
||||
PyAPI_FUNC(int64_t) TyInterpreterState_GetID(TyInterpreterState *);
|
||||
#endif
|
||||
#if !defined(Ty_LIMITED_API) || Ty_LIMITED_API+0 >= 0x03030000
|
||||
|
||||
@@ -45,7 +45,7 @@ PyAPI_FUNC(int) PyState_RemoveModule(TyModuleDef*);
|
||||
#endif
|
||||
PyAPI_FUNC(TyObject*) PyState_FindModule(TyModuleDef*);
|
||||
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_New(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_New(TyInterpreterState *);
|
||||
PyAPI_FUNC(void) TyThreadState_Clear(TyThreadState *);
|
||||
PyAPI_FUNC(void) TyThreadState_Delete(TyThreadState *);
|
||||
|
||||
@@ -68,7 +68,7 @@ PyAPI_FUNC(int) TyThreadState_SetAsyncExc(unsigned long, TyObject *);
|
||||
|
||||
#if !defined(Ty_LIMITED_API) || Ty_LIMITED_API+0 >= 0x03090000
|
||||
/* New in 3.9 */
|
||||
PyAPI_FUNC(PyInterpreterState*) TyThreadState_GetInterpreter(TyThreadState *tstate);
|
||||
PyAPI_FUNC(TyInterpreterState*) TyThreadState_GetInterpreter(TyThreadState *tstate);
|
||||
PyAPI_FUNC(PyFrameObject*) TyThreadState_GetFrame(TyThreadState *tstate);
|
||||
PyAPI_FUNC(uint64_t) TyThreadState_GetID(TyThreadState *tstate);
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Ty_PYTHREAD_H
|
||||
#define Ty_PYTHREAD_H
|
||||
|
||||
typedef void *PyThread_type_lock;
|
||||
typedef void *TyThread_type_lock;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -9,14 +9,14 @@ extern "C" {
|
||||
|
||||
/* Return status codes for Python lock acquisition. Chosen for maximum
|
||||
* backwards compatibility, ie failure -> 0, success -> 1. */
|
||||
typedef enum PyLockStatus {
|
||||
typedef enum TyLockStatus {
|
||||
PY_LOCK_FAILURE = 0,
|
||||
PY_LOCK_ACQUIRED = 1,
|
||||
PY_LOCK_INTR
|
||||
} PyLockStatus;
|
||||
} TyLockStatus;
|
||||
|
||||
PyAPI_FUNC(void) PyThread_init_thread(void);
|
||||
PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *);
|
||||
PyAPI_FUNC(void) TyThread_init_thread(void);
|
||||
PyAPI_FUNC(unsigned long) TyThread_start_new_thread(void (*)(void *), void *);
|
||||
/* Terminates the current thread. Considered unsafe.
|
||||
*
|
||||
* WARNING: This function is only safe to call if all functions in the full call
|
||||
@@ -35,26 +35,26 @@ PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *);
|
||||
* In either case there is a risk of invalid references remaining to data on the
|
||||
* thread stack.
|
||||
*/
|
||||
Ty_DEPRECATED(3.14) PyAPI_FUNC(void) _Ty_NO_RETURN PyThread_exit_thread(void);
|
||||
Ty_DEPRECATED(3.14) PyAPI_FUNC(void) _Ty_NO_RETURN TyThread_exit_thread(void);
|
||||
|
||||
PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void);
|
||||
PyAPI_FUNC(unsigned long) TyThread_get_thread_ident(void);
|
||||
|
||||
#if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32) \
|
||||
|| defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|
||||
|| defined(__OpenBSD__) || defined(__NetBSD__) \
|
||||
|| defined(__DragonFly__) || defined(_AIX))
|
||||
#define PY_HAVE_THREAD_NATIVE_ID
|
||||
PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void);
|
||||
PyAPI_FUNC(unsigned long) TyThread_get_thread_native_id(void);
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void);
|
||||
PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock);
|
||||
PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
|
||||
PyAPI_FUNC(TyThread_type_lock) TyThread_allocate_lock(void);
|
||||
PyAPI_FUNC(void) TyThread_free_lock(TyThread_type_lock);
|
||||
PyAPI_FUNC(int) TyThread_acquire_lock(TyThread_type_lock, int);
|
||||
#define WAIT_LOCK 1
|
||||
#define NOWAIT_LOCK 0
|
||||
|
||||
// PY_TIMEOUT_T is the integral type used to specify timeouts when waiting
|
||||
// on a lock (see PyThread_acquire_lock_timed() below).
|
||||
// on a lock (see TyThread_acquire_lock_timed() below).
|
||||
#define PY_TIMEOUT_T long long
|
||||
|
||||
|
||||
@@ -70,17 +70,17 @@ PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
|
||||
call will return PY_LOCK_INTR. The caller may reattempt to acquire the
|
||||
lock.
|
||||
*/
|
||||
PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed(PyThread_type_lock,
|
||||
PyAPI_FUNC(TyLockStatus) TyThread_acquire_lock_timed(TyThread_type_lock,
|
||||
PY_TIMEOUT_T microseconds,
|
||||
int intr_flag);
|
||||
|
||||
PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock);
|
||||
PyAPI_FUNC(void) TyThread_release_lock(TyThread_type_lock);
|
||||
|
||||
PyAPI_FUNC(size_t) PyThread_get_stacksize(void);
|
||||
PyAPI_FUNC(int) PyThread_set_stacksize(size_t);
|
||||
PyAPI_FUNC(size_t) TyThread_get_stacksize(void);
|
||||
PyAPI_FUNC(int) TyThread_set_stacksize(size_t);
|
||||
|
||||
#if !defined(Ty_LIMITED_API) || Ty_LIMITED_API+0 >= 0x03030000
|
||||
PyAPI_FUNC(TyObject*) PyThread_GetInfo(void);
|
||||
PyAPI_FUNC(TyObject*) TyThread_GetInfo(void);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -91,15 +91,15 @@ PyAPI_FUNC(TyObject*) PyThread_GetInfo(void);
|
||||
platforms, but it is not POSIX-compliant. Therefore, the new TSS API uses
|
||||
opaque data type to represent TSS keys to be compatible (see PEP 539).
|
||||
*/
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key(int key);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key,
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(int) TyThread_create_key(void);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void) TyThread_delete_key(int key);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(int) TyThread_set_key_value(int key,
|
||||
void *value);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void *) PyThread_get_key_value(int key);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key_value(int key);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void *) TyThread_get_key_value(int key);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void) TyThread_delete_key_value(int key);
|
||||
|
||||
/* Cleanup after a fork */
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_ReInitTLS(void);
|
||||
Ty_DEPRECATED(3.7) PyAPI_FUNC(void) TyThread_ReInitTLS(void);
|
||||
|
||||
|
||||
#if !defined(Ty_LIMITED_API) || Ty_LIMITED_API+0 >= 0x03070000
|
||||
@@ -108,15 +108,15 @@ Ty_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_ReInitTLS(void);
|
||||
|
||||
typedef struct _Ty_tss_t Ty_tss_t; /* opaque */
|
||||
|
||||
PyAPI_FUNC(Ty_tss_t *) PyThread_tss_alloc(void);
|
||||
PyAPI_FUNC(void) PyThread_tss_free(Ty_tss_t *key);
|
||||
PyAPI_FUNC(Ty_tss_t *) TyThread_tss_alloc(void);
|
||||
PyAPI_FUNC(void) TyThread_tss_free(Ty_tss_t *key);
|
||||
|
||||
/* The parameter key must not be NULL. */
|
||||
PyAPI_FUNC(int) PyThread_tss_is_created(Ty_tss_t *key);
|
||||
PyAPI_FUNC(int) PyThread_tss_create(Ty_tss_t *key);
|
||||
PyAPI_FUNC(void) PyThread_tss_delete(Ty_tss_t *key);
|
||||
PyAPI_FUNC(int) PyThread_tss_set(Ty_tss_t *key, void *value);
|
||||
PyAPI_FUNC(void *) PyThread_tss_get(Ty_tss_t *key);
|
||||
PyAPI_FUNC(int) TyThread_tss_is_created(Ty_tss_t *key);
|
||||
PyAPI_FUNC(int) TyThread_tss_create(Ty_tss_t *key);
|
||||
PyAPI_FUNC(void) TyThread_tss_delete(Ty_tss_t *key);
|
||||
PyAPI_FUNC(int) TyThread_tss_set(Ty_tss_t *key, void *value);
|
||||
PyAPI_FUNC(void *) TyThread_tss_get(Ty_tss_t *key);
|
||||
#endif /* New in 3.7 */
|
||||
|
||||
#ifndef Ty_LIMITED_API
|
||||
|
||||
@@ -22,7 +22,7 @@ typedef struct PyCodeObject PyCodeObject;
|
||||
typedef struct _frame PyFrameObject;
|
||||
|
||||
typedef struct _ts TyThreadState;
|
||||
typedef struct _is PyInterpreterState;
|
||||
typedef struct _is TyInterpreterState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -7,37 +7,37 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct PyStructSequence_Field {
|
||||
typedef struct TyStructSequence_Field {
|
||||
const char *name;
|
||||
const char *doc;
|
||||
} PyStructSequence_Field;
|
||||
} TyStructSequence_Field;
|
||||
|
||||
typedef struct PyStructSequence_Desc {
|
||||
typedef struct TyStructSequence_Desc {
|
||||
const char *name;
|
||||
const char *doc;
|
||||
PyStructSequence_Field *fields;
|
||||
TyStructSequence_Field *fields;
|
||||
int n_in_sequence;
|
||||
} PyStructSequence_Desc;
|
||||
} TyStructSequence_Desc;
|
||||
|
||||
PyAPI_DATA(const char * const) PyStructSequence_UnnamedField;
|
||||
PyAPI_DATA(const char * const) TyStructSequence_UnnamedField;
|
||||
|
||||
#ifndef Ty_LIMITED_API
|
||||
PyAPI_FUNC(void) PyStructSequence_InitType(TyTypeObject *type,
|
||||
PyStructSequence_Desc *desc);
|
||||
PyAPI_FUNC(int) PyStructSequence_InitType2(TyTypeObject *type,
|
||||
PyStructSequence_Desc *desc);
|
||||
PyAPI_FUNC(void) TyStructSequence_InitType(TyTypeObject *type,
|
||||
TyStructSequence_Desc *desc);
|
||||
PyAPI_FUNC(int) TyStructSequence_InitType2(TyTypeObject *type,
|
||||
TyStructSequence_Desc *desc);
|
||||
#endif
|
||||
PyAPI_FUNC(TyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc);
|
||||
PyAPI_FUNC(TyTypeObject*) TyStructSequence_NewType(TyStructSequence_Desc *desc);
|
||||
|
||||
PyAPI_FUNC(TyObject *) PyStructSequence_New(TyTypeObject* type);
|
||||
PyAPI_FUNC(TyObject *) TyStructSequence_New(TyTypeObject* type);
|
||||
|
||||
PyAPI_FUNC(void) PyStructSequence_SetItem(TyObject*, Ty_ssize_t, TyObject*);
|
||||
PyAPI_FUNC(TyObject*) PyStructSequence_GetItem(TyObject*, Ty_ssize_t);
|
||||
PyAPI_FUNC(void) TyStructSequence_SetItem(TyObject*, Ty_ssize_t, TyObject*);
|
||||
PyAPI_FUNC(TyObject*) TyStructSequence_GetItem(TyObject*, Ty_ssize_t);
|
||||
|
||||
#ifndef Ty_LIMITED_API
|
||||
typedef PyTupleObject PyStructSequence;
|
||||
#define PyStructSequence_SET_ITEM PyStructSequence_SetItem
|
||||
#define PyStructSequence_GET_ITEM PyStructSequence_GetItem
|
||||
#define TyStructSequence_SET_ITEM TyStructSequence_SetItem
|
||||
#define TyStructSequence_GET_ITEM TyStructSequence_GetItem
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user