mirror of
https://github.com/johndoe6345789/typthon.git
synced 2026-04-24 13:45:05 +00:00
Continue fixing Py_ to Ty_ renaming - fix missed patterns
Fixed additional patterns that were missed in the initial renaming: - PyThreadState → TyThreadState (typedef and all uses) - PyMem_RawFree → TyMem_RawFree - Py_buffer → Ty_buffer - Py_CLEANUP_SUPPORTED → Ty_CLEANUP_SUPPORTED - PyStatus → TyStatus and PyStatus_NoMemory → TyStatus_NoMemory - _Py__has_builtin → _Ty__has_builtin - _Py_SINGLETON → _Ty_SINGLETON - _Py_CODEUNIT → _Ty_CODEUNIT - _Py_BackoffCounter → _Ty_BackoffCounter - _Py_slot_* and _Py_type_* patterns Build is progressing with fewer errors. Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -108,16 +108,16 @@ PyAPI_FUNC(TyObject *) TyEval_EvalFrameEx(PyFrameObject *f, int exc);
|
||||
mechanism!
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyThreadState *) TyEval_SaveThread(void);
|
||||
PyAPI_FUNC(void) TyEval_RestoreThread(PyThreadState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyEval_SaveThread(void);
|
||||
PyAPI_FUNC(void) TyEval_RestoreThread(TyThreadState *);
|
||||
|
||||
Ty_DEPRECATED(3.9) PyAPI_FUNC(void) TyEval_InitThreads(void);
|
||||
|
||||
PyAPI_FUNC(void) TyEval_AcquireThread(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) TyEval_ReleaseThread(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) TyEval_AcquireThread(TyThreadState *tstate);
|
||||
PyAPI_FUNC(void) TyEval_ReleaseThread(TyThreadState *tstate);
|
||||
|
||||
#define Ty_BEGIN_ALLOW_THREADS { \
|
||||
PyThreadState *_save; \
|
||||
TyThreadState *_save; \
|
||||
_save = TyEval_SaveThread();
|
||||
#define Ty_BLOCK_THREADS TyEval_RestoreThread(_save);
|
||||
#define Ty_UNBLOCK_THREADS _save = TyEval_SaveThread();
|
||||
|
||||
@@ -12,7 +12,7 @@ PyAPI_FUNC(void) TyEval_SetTraceAllThreads(Ty_tracefunc, TyObject *);
|
||||
flag was set, else return 0. */
|
||||
PyAPI_FUNC(int) TyEval_MergeCompilerFlags(PyCompilerFlags *cf);
|
||||
|
||||
PyAPI_FUNC(TyObject *) _TyEval_EvalFrameDefault(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_EvalFrameDefault(TyThreadState *tstate, struct _PyInterpreterFrame *f, int exc);
|
||||
|
||||
PyAPI_FUNC(Ty_ssize_t) PyUnstable_Eval_RequestCodeExtraIndex(freefunc);
|
||||
// Old name -- remove when this API changes:
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
// the same way as the interaction between multiple locks.
|
||||
//
|
||||
// Each thread's critical sections and their corresponding locks are tracked in
|
||||
// a stack in `PyThreadState.critical_section`. When a thread calls
|
||||
// a stack in `TyThreadState.critical_section`. When a thread calls
|
||||
// `_TyThreadState_Detach()`, such as before a blocking I/O operation or when
|
||||
// waiting to acquire a lock, the thread suspends all of its active critical
|
||||
// sections, temporarily releasing the associated locks. When the thread calls
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
/* Standard object interface */
|
||||
|
||||
PyAPI_FUNC(PyFrameObject *) TyFrame_New(PyThreadState *, PyCodeObject *,
|
||||
PyAPI_FUNC(PyFrameObject *) TyFrame_New(TyThreadState *, PyCodeObject *,
|
||||
TyObject *, TyObject *);
|
||||
|
||||
/* The rest of the interface is specific for frame objects */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* --- PyStatus ----------------------------------------------- */
|
||||
/* --- TyStatus ----------------------------------------------- */
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
@@ -16,15 +16,15 @@ typedef struct {
|
||||
const char *func;
|
||||
const char *err_msg;
|
||||
int exitcode;
|
||||
} PyStatus;
|
||||
} TyStatus;
|
||||
|
||||
PyAPI_FUNC(PyStatus) TyStatus_Ok(void);
|
||||
PyAPI_FUNC(PyStatus) TyStatus_Error(const char *err_msg);
|
||||
PyAPI_FUNC(PyStatus) TyStatus_NoMemory(void);
|
||||
PyAPI_FUNC(PyStatus) TyStatus_Exit(int exitcode);
|
||||
PyAPI_FUNC(int) TyStatus_IsError(PyStatus err);
|
||||
PyAPI_FUNC(int) TyStatus_IsExit(PyStatus err);
|
||||
PyAPI_FUNC(int) TyStatus_Exception(PyStatus err);
|
||||
PyAPI_FUNC(TyStatus) TyStatus_Ok(void);
|
||||
PyAPI_FUNC(TyStatus) TyStatus_Error(const char *err_msg);
|
||||
PyAPI_FUNC(TyStatus) TyStatus_NoMemory(void);
|
||||
PyAPI_FUNC(TyStatus) TyStatus_Exit(int exitcode);
|
||||
PyAPI_FUNC(int) TyStatus_IsError(TyStatus err);
|
||||
PyAPI_FUNC(int) TyStatus_IsExit(TyStatus err);
|
||||
PyAPI_FUNC(int) TyStatus_Exception(TyStatus err);
|
||||
|
||||
/* --- PyWideStringList ------------------------------------------------ */
|
||||
|
||||
@@ -35,9 +35,9 @@ typedef struct {
|
||||
wchar_t **items;
|
||||
} PyWideStringList;
|
||||
|
||||
PyAPI_FUNC(PyStatus) TyWideStringList_Append(PyWideStringList *list,
|
||||
PyAPI_FUNC(TyStatus) TyWideStringList_Append(PyWideStringList *list,
|
||||
const wchar_t *item);
|
||||
PyAPI_FUNC(PyStatus) TyWideStringList_Insert(PyWideStringList *list,
|
||||
PyAPI_FUNC(TyStatus) TyWideStringList_Insert(PyWideStringList *list,
|
||||
Ty_ssize_t index,
|
||||
const wchar_t *item);
|
||||
|
||||
@@ -246,23 +246,23 @@ typedef struct PyConfig {
|
||||
PyAPI_FUNC(void) TyConfig_InitPythonConfig(PyConfig *config);
|
||||
PyAPI_FUNC(void) TyConfig_InitIsolatedConfig(PyConfig *config);
|
||||
PyAPI_FUNC(void) TyConfig_Clear(PyConfig *);
|
||||
PyAPI_FUNC(PyStatus) TyConfig_SetString(
|
||||
PyAPI_FUNC(TyStatus) TyConfig_SetString(
|
||||
PyConfig *config,
|
||||
wchar_t **config_str,
|
||||
const wchar_t *str);
|
||||
PyAPI_FUNC(PyStatus) TyConfig_SetBytesString(
|
||||
PyAPI_FUNC(TyStatus) TyConfig_SetBytesString(
|
||||
PyConfig *config,
|
||||
wchar_t **config_str,
|
||||
const char *str);
|
||||
PyAPI_FUNC(PyStatus) TyConfig_Read(PyConfig *config);
|
||||
PyAPI_FUNC(PyStatus) TyConfig_SetBytesArgv(
|
||||
PyAPI_FUNC(TyStatus) TyConfig_Read(PyConfig *config);
|
||||
PyAPI_FUNC(TyStatus) TyConfig_SetBytesArgv(
|
||||
PyConfig *config,
|
||||
Ty_ssize_t argc,
|
||||
char * const *argv);
|
||||
PyAPI_FUNC(PyStatus) TyConfig_SetArgv(PyConfig *config,
|
||||
PyAPI_FUNC(TyStatus) TyConfig_SetArgv(PyConfig *config,
|
||||
Ty_ssize_t argc,
|
||||
wchar_t * const *argv);
|
||||
PyAPI_FUNC(PyStatus) TyConfig_SetWideStringList(PyConfig *config,
|
||||
PyAPI_FUNC(TyStatus) TyConfig_SetWideStringList(PyConfig *config,
|
||||
PyWideStringList *list,
|
||||
Ty_ssize_t length, wchar_t **items);
|
||||
|
||||
|
||||
@@ -429,10 +429,10 @@ PyAPI_FUNC(void) _Ty_NO_RETURN _TyObject_AssertFailed(
|
||||
const char *function);
|
||||
|
||||
|
||||
PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyThreadState *tstate, TyObject *op);
|
||||
PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) _PyTrash_thread_deposit_object(TyThreadState *tstate, TyObject *op);
|
||||
PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(TyThreadState *tstate);
|
||||
|
||||
PyAPI_FUNC(int) _Ty_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count);
|
||||
PyAPI_FUNC(int) _Ty_ReachedRecursionLimitWithMargin(TyThreadState *tstate, int margin_count);
|
||||
|
||||
/* For backwards compatibility with the old trashcan mechanism */
|
||||
#define Ty_TRASHCAN_BEGIN(op, dealloc)
|
||||
|
||||
@@ -8,13 +8,13 @@ PyAPI_FUNC(int) Ty_FrozenMain(int argc, char **argv);
|
||||
|
||||
/* PEP 432 Multi-phase initialization API (Private while provisional!) */
|
||||
|
||||
PyAPI_FUNC(PyStatus) Ty_PreInitialize(
|
||||
PyAPI_FUNC(TyStatus) Ty_PreInitialize(
|
||||
const PyPreConfig *src_config);
|
||||
PyAPI_FUNC(PyStatus) Ty_PreInitializeFromBytesArgs(
|
||||
PyAPI_FUNC(TyStatus) Ty_PreInitializeFromBytesArgs(
|
||||
const PyPreConfig *src_config,
|
||||
Ty_ssize_t argc,
|
||||
char **argv);
|
||||
PyAPI_FUNC(PyStatus) Ty_PreInitializeFromArgs(
|
||||
PyAPI_FUNC(TyStatus) Ty_PreInitializeFromArgs(
|
||||
const PyPreConfig *src_config,
|
||||
Ty_ssize_t argc,
|
||||
wchar_t **argv);
|
||||
@@ -22,13 +22,13 @@ PyAPI_FUNC(PyStatus) Ty_PreInitializeFromArgs(
|
||||
|
||||
/* Initialization and finalization */
|
||||
|
||||
PyAPI_FUNC(PyStatus) Ty_InitializeFromConfig(
|
||||
PyAPI_FUNC(TyStatus) Ty_InitializeFromConfig(
|
||||
const PyConfig *config);
|
||||
|
||||
PyAPI_FUNC(int) Ty_RunMain(void);
|
||||
|
||||
|
||||
PyAPI_FUNC(void) _Ty_NO_RETURN Ty_ExitStatusException(PyStatus err);
|
||||
PyAPI_FUNC(void) _Ty_NO_RETURN Ty_ExitStatusException(TyStatus err);
|
||||
|
||||
PyAPI_FUNC(int) Ty_FdIsInteractive(FILE *, const char *);
|
||||
|
||||
@@ -80,8 +80,8 @@ typedef struct {
|
||||
.gil = PyInterpreterConfig_SHARED_GIL, \
|
||||
}
|
||||
|
||||
PyAPI_FUNC(PyStatus) Ty_NewInterpreterFromConfig(
|
||||
PyThreadState **tstate_p,
|
||||
PyAPI_FUNC(TyStatus) Ty_NewInterpreterFromConfig(
|
||||
TyThreadState **tstate_p,
|
||||
const PyInterpreterConfig *config);
|
||||
|
||||
typedef void (*atexit_datacallbackfunc)(void *);
|
||||
|
||||
@@ -66,8 +66,8 @@ typedef struct _stack_chunk {
|
||||
struct _ts {
|
||||
/* See Python/ceval.c for comments explaining most fields */
|
||||
|
||||
PyThreadState *prev;
|
||||
PyThreadState *next;
|
||||
TyThreadState *prev;
|
||||
TyThreadState *next;
|
||||
PyInterpreterState *interp;
|
||||
|
||||
/* The global instrumentation version in high bits, plus flags indicating
|
||||
@@ -183,7 +183,7 @@ struct _ts {
|
||||
/* XXX signal handlers should also be here */
|
||||
|
||||
/* The following fields are here to avoid allocation during init.
|
||||
The data is exposed through PyThreadState pointer fields.
|
||||
The data is exposed through TyThreadState pointer fields.
|
||||
These fields should not be accessed directly outside of init.
|
||||
This is indicated by an underscore prefix on the field names.
|
||||
|
||||
@@ -214,21 +214,21 @@ struct _ts {
|
||||
|
||||
/* Similar to TyThreadState_Get(), but don't issue a fatal error
|
||||
* if it is NULL. */
|
||||
PyAPI_FUNC(PyThreadState *) TyThreadState_GetUnchecked(void);
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_GetUnchecked(void);
|
||||
|
||||
// Deprecated alias kept for backward compatibility
|
||||
Ty_DEPRECATED(3.14) static inline PyThreadState*
|
||||
Ty_DEPRECATED(3.14) static inline TyThreadState*
|
||||
_TyThreadState_UncheckedGet(void)
|
||||
{
|
||||
return TyThreadState_GetUnchecked();
|
||||
}
|
||||
|
||||
// Disable tracing and profiling.
|
||||
PyAPI_FUNC(void) TyThreadState_EnterTracing(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) TyThreadState_EnterTracing(TyThreadState *tstate);
|
||||
|
||||
// Reset tracing and profiling: enable them if a trace function or a profile
|
||||
// function is set, otherwise disable them.
|
||||
PyAPI_FUNC(void) TyThreadState_LeaveTracing(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) TyThreadState_LeaveTracing(TyThreadState *tstate);
|
||||
|
||||
/* PyGILState */
|
||||
|
||||
@@ -248,13 +248,13 @@ PyAPI_FUNC(TyObject*) _PyThread_CurrentFrames(void);
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_Main(void);
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_Head(void);
|
||||
PyAPI_FUNC(PyInterpreterState *) TyInterpreterState_Next(PyInterpreterState *);
|
||||
PyAPI_FUNC(PyThreadState *) TyInterpreterState_ThreadHead(PyInterpreterState *);
|
||||
PyAPI_FUNC(PyThreadState *) TyThreadState_Next(PyThreadState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyInterpreterState_ThreadHead(PyInterpreterState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_Next(TyThreadState *);
|
||||
PyAPI_FUNC(void) TyThreadState_DeleteCurrent(void);
|
||||
|
||||
/* Frame evaluation API */
|
||||
|
||||
typedef TyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _PyInterpreterFrame *, int);
|
||||
typedef TyObject* (*_PyFrameEvalFunction)(TyThreadState *tstate, struct _PyInterpreterFrame *, int);
|
||||
|
||||
PyAPI_FUNC(_PyFrameEvalFunction) _TyInterpreterState_GetEvalFrameFunc(
|
||||
PyInterpreterState *interp);
|
||||
|
||||
@@ -19,14 +19,14 @@ typedef struct _Ty_AuditHookEntry {
|
||||
|
||||
|
||||
extern int _TySys_Audit(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
const char *event,
|
||||
const char *argFormat,
|
||||
...);
|
||||
|
||||
// _TySys_ClearAuditHooks() must not be exported: use extern rather than
|
||||
// PyAPI_FUNC(). We want minimal exposure of this function.
|
||||
extern void _TySys_ClearAuditHooks(PyThreadState *tstate);
|
||||
extern void _TySys_ClearAuditHooks(TyThreadState *tstate);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
static inline uint16_t
|
||||
_Py_bswap16(uint16_t word)
|
||||
{
|
||||
#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap16)
|
||||
#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Ty__has_builtin(__builtin_bswap16)
|
||||
return __builtin_bswap16(word);
|
||||
#elif defined(_MSC_VER)
|
||||
Ty_BUILD_ASSERT(sizeof(word) == sizeof(unsigned short));
|
||||
@@ -48,7 +48,7 @@ _Py_bswap16(uint16_t word)
|
||||
static inline uint32_t
|
||||
_Py_bswap32(uint32_t word)
|
||||
{
|
||||
#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap32)
|
||||
#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Ty__has_builtin(__builtin_bswap32)
|
||||
return __builtin_bswap32(word);
|
||||
#elif defined(_MSC_VER)
|
||||
Ty_BUILD_ASSERT(sizeof(word) == sizeof(unsigned long));
|
||||
@@ -65,7 +65,7 @@ _Py_bswap32(uint32_t word)
|
||||
static inline uint64_t
|
||||
_Py_bswap64(uint64_t word)
|
||||
{
|
||||
#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap64)
|
||||
#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Ty__has_builtin(__builtin_bswap64)
|
||||
return __builtin_bswap64(word);
|
||||
#elif defined(_MSC_VER)
|
||||
return _byteswap_uint64(word);
|
||||
|
||||
@@ -50,8 +50,8 @@ struct _brc_thread_state {
|
||||
};
|
||||
|
||||
// Initialize/finalize the per-thread biased reference counting state
|
||||
void _Ty_brc_init_thread(PyThreadState *tstate);
|
||||
void _Ty_brc_remove_thread(PyThreadState *tstate);
|
||||
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);
|
||||
@@ -63,7 +63,7 @@ void _Ty_brc_after_fork(PyInterpreterState *interp);
|
||||
void _Ty_brc_queue_object(TyObject *ob);
|
||||
|
||||
// Merge the refcounts of queued objects for the current thread.
|
||||
void _Ty_brc_merge_refcounts(PyThreadState *tstate);
|
||||
void _Ty_brc_merge_refcounts(TyThreadState *tstate);
|
||||
|
||||
#endif /* Ty_GIL_DISABLED */
|
||||
|
||||
|
||||
@@ -27,33 +27,33 @@ extern "C" {
|
||||
// Export for 'math' shared extension, used via _TyObject_VectorcallTstate()
|
||||
// static inline function.
|
||||
PyAPI_FUNC(TyObject*) _Ty_CheckFunctionResult(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *callable,
|
||||
TyObject *result,
|
||||
const char *where);
|
||||
|
||||
extern TyObject* _TyObject_Call_Prepend(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *callable,
|
||||
TyObject *obj,
|
||||
TyObject *args,
|
||||
TyObject *kwargs);
|
||||
|
||||
extern TyObject* _TyObject_VectorcallDictTstate(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *callable,
|
||||
TyObject *const *args,
|
||||
size_t nargsf,
|
||||
TyObject *kwargs);
|
||||
|
||||
extern TyObject* _TyObject_Call(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *callable,
|
||||
TyObject *args,
|
||||
TyObject *kwargs);
|
||||
|
||||
extern TyObject * _TyObject_CallMethodFormat(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *callable,
|
||||
const char *format,
|
||||
...);
|
||||
@@ -106,7 +106,7 @@ _TyObject_CallMethodIdOneArg(TyObject *self, _Ty_Identifier *name, TyObject *arg
|
||||
// Export for 'math' shared extension, used via _TyObject_VectorcallTstate()
|
||||
// static inline function.
|
||||
PyAPI_FUNC(TyObject*) _TyObject_MakeTpCall(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *callable,
|
||||
TyObject *const *args, Ty_ssize_t nargs,
|
||||
TyObject *keywords);
|
||||
@@ -151,7 +151,7 @@ _PyVectorcall_FunctionInline(TyObject *callable)
|
||||
Return the result on success. Raise an exception and return NULL on
|
||||
error. */
|
||||
static inline TyObject *
|
||||
_TyObject_VectorcallTstate(PyThreadState *tstate, TyObject *callable,
|
||||
_TyObject_VectorcallTstate(TyThreadState *tstate, TyObject *callable,
|
||||
TyObject *const *args, size_t nargsf,
|
||||
TyObject *kwnames)
|
||||
{
|
||||
@@ -172,7 +172,7 @@ _TyObject_VectorcallTstate(PyThreadState *tstate, TyObject *callable,
|
||||
|
||||
|
||||
static inline TyObject *
|
||||
_TyObject_CallNoArgsTstate(PyThreadState *tstate, TyObject *func) {
|
||||
_TyObject_CallNoArgsTstate(TyThreadState *tstate, TyObject *func) {
|
||||
return _TyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
@@ -181,13 +181,13 @@ _TyObject_CallNoArgsTstate(PyThreadState *tstate, TyObject *func) {
|
||||
static inline TyObject *
|
||||
_TyObject_CallNoArgs(TyObject *func) {
|
||||
EVAL_CALL_STAT_INC_IF_FUNCTION(EVAL_CALL_API, func);
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
return _TyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
extern TyObject *const *
|
||||
_PyStack_UnpackDict(PyThreadState *tstate,
|
||||
_PyStack_UnpackDict(TyThreadState *tstate,
|
||||
TyObject *const *args, Ty_ssize_t nargs,
|
||||
TyObject *kwargs, TyObject **p_kwnames);
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ extern "C" {
|
||||
struct _ceval_runtime_state;
|
||||
|
||||
// Export for '_lsprof' shared extension
|
||||
PyAPI_FUNC(int) _TyEval_SetProfile(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg);
|
||||
PyAPI_FUNC(int) _TyEval_SetProfile(TyThreadState *tstate, Ty_tracefunc func, TyObject *arg);
|
||||
|
||||
extern int _TyEval_SetTrace(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg);
|
||||
extern int _TyEval_SetTrace(TyThreadState *tstate, Ty_tracefunc func, TyObject *arg);
|
||||
|
||||
extern int _TyEval_SetOpcodeTrace(PyFrameObject *f, bool enable);
|
||||
|
||||
@@ -37,13 +37,13 @@ extern void _TyEval_SetSwitchInterval(unsigned long microseconds);
|
||||
extern unsigned long _TyEval_GetSwitchInterval(void);
|
||||
|
||||
// Export for '_queue' shared extension
|
||||
PyAPI_FUNC(int) _TyEval_MakePendingCalls(PyThreadState *);
|
||||
PyAPI_FUNC(int) _TyEval_MakePendingCalls(TyThreadState *);
|
||||
|
||||
#ifndef Ty_DEFAULT_RECURSION_LIMIT
|
||||
# define Ty_DEFAULT_RECURSION_LIMIT 1000
|
||||
#endif
|
||||
|
||||
extern void _Ty_FinishPendingCalls(PyThreadState *tstate);
|
||||
extern void _Ty_FinishPendingCalls(TyThreadState *tstate);
|
||||
extern void _TyEval_InitState(PyInterpreterState *);
|
||||
extern void _TyEval_SignalReceived(void);
|
||||
|
||||
@@ -63,7 +63,7 @@ PyAPI_FUNC(_Ty_add_pending_call_result) _TyEval_AddPendingCall(
|
||||
int flags);
|
||||
|
||||
#ifdef HAVE_FORK
|
||||
extern PyStatus _TyEval_ReInitThreads(PyThreadState *tstate);
|
||||
extern TyStatus _TyEval_ReInitThreads(TyThreadState *tstate);
|
||||
#endif
|
||||
|
||||
// Used by sys.call_tracing()
|
||||
@@ -85,7 +85,7 @@ extern int _TyEval_SetCoroutineOriginTrackingDepth(int depth);
|
||||
extern void _TyEval_Fini(void);
|
||||
|
||||
|
||||
extern TyObject* _TyEval_GetBuiltins(PyThreadState *tstate);
|
||||
extern TyObject* _TyEval_GetBuiltins(TyThreadState *tstate);
|
||||
|
||||
// Trampoline API
|
||||
|
||||
@@ -105,14 +105,14 @@ extern int _PyPerfTrampoline_Init(int activate);
|
||||
extern int _PyPerfTrampoline_Fini(void);
|
||||
extern void _PyPerfTrampoline_FreeArenas(void);
|
||||
extern int _PyIsPerfTrampolineActive(void);
|
||||
extern PyStatus _PyPerfTrampoline_AfterFork_Child(void);
|
||||
extern TyStatus _PyPerfTrampoline_AfterFork_Child(void);
|
||||
#ifdef PY_HAVE_PERF_TRAMPOLINE
|
||||
extern _PyPerf_Callbacks _Ty_perfmap_callbacks;
|
||||
extern _PyPerf_Callbacks _Ty_perfmap_jit_callbacks;
|
||||
#endif
|
||||
|
||||
static inline TyObject*
|
||||
_TyEval_EvalFrame(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
|
||||
_TyEval_EvalFrame(TyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
|
||||
{
|
||||
EVAL_CALL_STAT_INC(EVAL_CALL_TOTAL);
|
||||
if (tstate->interp->eval_frame == NULL) {
|
||||
@@ -122,18 +122,18 @@ _TyEval_EvalFrame(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwfl
|
||||
}
|
||||
|
||||
extern TyObject*
|
||||
_TyEval_Vector(PyThreadState *tstate,
|
||||
_TyEval_Vector(TyThreadState *tstate,
|
||||
PyFunctionObject *func, TyObject *locals,
|
||||
TyObject* const* args, size_t argcount,
|
||||
TyObject *kwnames);
|
||||
|
||||
extern int _TyEval_ThreadsInitialized(void);
|
||||
extern void _TyEval_InitGIL(PyThreadState *tstate, int own_gil);
|
||||
extern void _TyEval_InitGIL(TyThreadState *tstate, int own_gil);
|
||||
extern void _TyEval_FiniGIL(PyInterpreterState *interp);
|
||||
|
||||
extern void _TyEval_AcquireLock(PyThreadState *tstate);
|
||||
extern void _TyEval_AcquireLock(TyThreadState *tstate);
|
||||
|
||||
extern void _TyEval_ReleaseLock(PyInterpreterState *, PyThreadState *,
|
||||
extern void _TyEval_ReleaseLock(PyInterpreterState *, TyThreadState *,
|
||||
int final_release);
|
||||
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
@@ -143,7 +143,7 @@ extern void _TyEval_ReleaseLock(PyInterpreterState *, PyThreadState *,
|
||||
// The enabled state of the GIL will not change while one or more threads are
|
||||
// attached.
|
||||
static inline int
|
||||
_TyEval_IsGILEnabled(PyThreadState *tstate)
|
||||
_TyEval_IsGILEnabled(TyThreadState *tstate)
|
||||
{
|
||||
struct _gil_runtime_state *gil = tstate->interp->ceval.gil;
|
||||
return _Ty_atomic_load_int_relaxed(&gil->enabled) != 0;
|
||||
@@ -174,13 +174,13 @@ _TyEval_IsGILEnabled(PyThreadState *tstate)
|
||||
//
|
||||
// All three functions must be called by an attached thread (this implies that
|
||||
// if the GIL is enabled, the current thread must hold it).
|
||||
extern int _TyEval_EnableGILTransient(PyThreadState *tstate);
|
||||
extern int _TyEval_EnableGILPermanent(PyThreadState *tstate);
|
||||
extern int _TyEval_DisableGIL(PyThreadState *state);
|
||||
extern int _TyEval_EnableGILTransient(TyThreadState *tstate);
|
||||
extern int _TyEval_EnableGILPermanent(TyThreadState *tstate);
|
||||
extern int _TyEval_DisableGIL(TyThreadState *state);
|
||||
|
||||
|
||||
static inline _Ty_CODEUNIT *
|
||||
_TyEval_GetExecutableCode(PyThreadState *tstate, PyCodeObject *co)
|
||||
_TyEval_GetExecutableCode(TyThreadState *tstate, PyCodeObject *co)
|
||||
{
|
||||
_Ty_CODEUNIT *bc = _TyCode_GetTLBCFast(tstate, co);
|
||||
if (bc != NULL) {
|
||||
@@ -196,7 +196,7 @@ extern void _TyEval_DeactivateOpCache(void);
|
||||
|
||||
/* --- _Ty_EnterRecursiveCall() ----------------------------------------- */
|
||||
|
||||
static inline int _Ty_MakeRecCheck(PyThreadState *tstate) {
|
||||
static inline int _Ty_MakeRecCheck(TyThreadState *tstate) {
|
||||
uintptr_t here_addr = _Ty_get_machine_stack_pointer();
|
||||
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
|
||||
return here_addr < _tstate->c_stack_soft_limit;
|
||||
@@ -205,29 +205,29 @@ static inline int _Ty_MakeRecCheck(PyThreadState *tstate) {
|
||||
// Export for '_json' shared extension, used via _Ty_EnterRecursiveCall()
|
||||
// static inline function.
|
||||
PyAPI_FUNC(int) _Ty_CheckRecursiveCall(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
const char *where);
|
||||
|
||||
int _Ty_CheckRecursiveCallPy(
|
||||
PyThreadState *tstate);
|
||||
TyThreadState *tstate);
|
||||
|
||||
static inline int _Ty_EnterRecursiveCallTstate(PyThreadState *tstate,
|
||||
static inline int _Ty_EnterRecursiveCallTstate(TyThreadState *tstate,
|
||||
const char *where) {
|
||||
return (_Ty_MakeRecCheck(tstate) && _Ty_CheckRecursiveCall(tstate, where));
|
||||
}
|
||||
|
||||
static inline int _Ty_EnterRecursiveCall(const char *where) {
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
return _Ty_EnterRecursiveCallTstate(tstate, where);
|
||||
}
|
||||
|
||||
static inline void _Ty_LeaveRecursiveCallTstate(PyThreadState *tstate) {
|
||||
static inline void _Ty_LeaveRecursiveCallTstate(TyThreadState *tstate) {
|
||||
(void)tstate;
|
||||
}
|
||||
|
||||
PyAPI_FUNC(void) _Ty_InitializeRecursionLimits(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) _Ty_InitializeRecursionLimits(TyThreadState *tstate);
|
||||
|
||||
static inline int _Ty_ReachedRecursionLimit(PyThreadState *tstate) {
|
||||
static inline int _Ty_ReachedRecursionLimit(TyThreadState *tstate) {
|
||||
uintptr_t here_addr = _Ty_get_machine_stack_pointer();
|
||||
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
|
||||
assert(_tstate->c_stack_hard_limit != 0);
|
||||
@@ -239,13 +239,13 @@ static inline void _Ty_LeaveRecursiveCall(void) {
|
||||
|
||||
extern _PyInterpreterFrame* _TyEval_GetFrame(void);
|
||||
|
||||
extern TyObject * _TyEval_GetGlobalsFromRunningMain(PyThreadState *);
|
||||
extern TyObject * _TyEval_GetGlobalsFromRunningMain(TyThreadState *);
|
||||
extern int _TyEval_EnsureBuiltins(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
TyObject **p_builtins);
|
||||
extern int _TyEval_EnsureBuiltinsWithModule(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
TyObject **p_builtins);
|
||||
|
||||
@@ -253,7 +253,7 @@ PyAPI_FUNC(TyObject *)_Ty_MakeCoro(PyFunctionObject *func);
|
||||
|
||||
/* Handle signals, pending calls, GIL drop request
|
||||
and asynchronous exception */
|
||||
PyAPI_FUNC(int) _Ty_HandlePending(PyThreadState *tstate);
|
||||
PyAPI_FUNC(int) _Ty_HandlePending(TyThreadState *tstate);
|
||||
|
||||
extern TyObject * _TyEval_GetFrameLocals(void);
|
||||
|
||||
@@ -271,20 +271,20 @@ typedef struct _special_method {
|
||||
PyAPI_DATA(const _Ty_SpecialMethod) _Ty_SpecialMethods[];
|
||||
PyAPI_DATA(const size_t) _Ty_FunctionAttributeOffsets[];
|
||||
|
||||
PyAPI_FUNC(int) _TyEval_CheckExceptStarTypeValid(PyThreadState *tstate, TyObject* right);
|
||||
PyAPI_FUNC(int) _TyEval_CheckExceptTypeValid(PyThreadState *tstate, TyObject* right);
|
||||
PyAPI_FUNC(int) _TyEval_CheckExceptStarTypeValid(TyThreadState *tstate, TyObject* right);
|
||||
PyAPI_FUNC(int) _TyEval_CheckExceptTypeValid(TyThreadState *tstate, TyObject* right);
|
||||
PyAPI_FUNC(int) _TyEval_ExceptionGroupMatch(_PyInterpreterFrame *, TyObject* exc_value, TyObject *match_type, TyObject **match, TyObject **rest);
|
||||
PyAPI_FUNC(void) _TyEval_FormatAwaitableError(PyThreadState *tstate, TyTypeObject *type, int oparg);
|
||||
PyAPI_FUNC(void) _TyEval_FormatExcCheckArg(PyThreadState *tstate, TyObject *exc, const char *format_str, TyObject *obj);
|
||||
PyAPI_FUNC(void) _TyEval_FormatExcUnbound(PyThreadState *tstate, PyCodeObject *co, int oparg);
|
||||
PyAPI_FUNC(void) _TyEval_FormatKwargsError(PyThreadState *tstate, TyObject *func, TyObject *kwargs);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_ImportFrom(PyThreadState *, TyObject *, TyObject *);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_ImportName(PyThreadState *, _PyInterpreterFrame *, TyObject *, TyObject *, TyObject *);
|
||||
PyAPI_FUNC(TyObject *)_TyEval_MatchClass(PyThreadState *tstate, TyObject *subject, TyObject *type, Ty_ssize_t nargs, TyObject *kwargs);
|
||||
PyAPI_FUNC(TyObject *)_TyEval_MatchKeys(PyThreadState *tstate, TyObject *map, TyObject *keys);
|
||||
PyAPI_FUNC(void) _TyEval_MonitorRaise(PyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr);
|
||||
PyAPI_FUNC(int) _TyEval_UnpackIterableStackRef(PyThreadState *tstate, TyObject *v, int argcnt, int argcntafter, _PyStackRef *sp);
|
||||
PyAPI_FUNC(void) _TyEval_FrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame *frame);
|
||||
PyAPI_FUNC(void) _TyEval_FormatAwaitableError(TyThreadState *tstate, TyTypeObject *type, int oparg);
|
||||
PyAPI_FUNC(void) _TyEval_FormatExcCheckArg(TyThreadState *tstate, TyObject *exc, const char *format_str, TyObject *obj);
|
||||
PyAPI_FUNC(void) _TyEval_FormatExcUnbound(TyThreadState *tstate, PyCodeObject *co, int oparg);
|
||||
PyAPI_FUNC(void) _TyEval_FormatKwargsError(TyThreadState *tstate, TyObject *func, TyObject *kwargs);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_ImportFrom(TyThreadState *, TyObject *, TyObject *);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_ImportName(TyThreadState *, _PyInterpreterFrame *, TyObject *, TyObject *, TyObject *);
|
||||
PyAPI_FUNC(TyObject *)_TyEval_MatchClass(TyThreadState *tstate, TyObject *subject, TyObject *type, Ty_ssize_t nargs, TyObject *kwargs);
|
||||
PyAPI_FUNC(TyObject *)_TyEval_MatchKeys(TyThreadState *tstate, TyObject *map, TyObject *keys);
|
||||
PyAPI_FUNC(void) _TyEval_MonitorRaise(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr);
|
||||
PyAPI_FUNC(int) _TyEval_UnpackIterableStackRef(TyThreadState *tstate, TyObject *v, int argcnt, int argcntafter, _PyStackRef *sp);
|
||||
PyAPI_FUNC(void) _TyEval_FrameClearAndPop(TyThreadState *tstate, _PyInterpreterFrame *frame);
|
||||
PyAPI_FUNC(TyObject **) _PyObjectArray_FromStackRefArray(_PyStackRef *input, Ty_ssize_t nargs, TyObject **scratch);
|
||||
|
||||
PyAPI_FUNC(void) _PyObjectArray_Free(TyObject **array, TyObject **scratch);
|
||||
@@ -292,9 +292,9 @@ PyAPI_FUNC(void) _PyObjectArray_Free(TyObject **array, TyObject **scratch);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_GetANext(TyObject *aiter);
|
||||
PyAPI_FUNC(void) _TyEval_LoadGlobalStackRef(TyObject *globals, TyObject *builtins, TyObject *name, _PyStackRef *writeto);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_GetAwaitable(TyObject *iterable, int oparg);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_LoadName(PyThreadState *tstate, _PyInterpreterFrame *frame, TyObject *name);
|
||||
PyAPI_FUNC(TyObject *) _TyEval_LoadName(TyThreadState *tstate, _PyInterpreterFrame *frame, TyObject *name);
|
||||
PyAPI_FUNC(int)
|
||||
_Ty_Check_ArgsIterable(PyThreadState *tstate, TyObject *func, TyObject *args);
|
||||
_Ty_Check_ArgsIterable(TyThreadState *tstate, TyObject *func, TyObject *args);
|
||||
|
||||
/*
|
||||
* Indicate whether a special method of given 'oparg' can use the (improved)
|
||||
@@ -306,7 +306,7 @@ _Ty_Check_ArgsIterable(PyThreadState *tstate, TyObject *func, TyObject *args);
|
||||
PyAPI_FUNC(int)
|
||||
_TyEval_SpecialMethodCanSuggest(TyObject *self, int oparg);
|
||||
|
||||
/* Bits that can be set in PyThreadState.eval_breaker */
|
||||
/* Bits that can be set in TyThreadState.eval_breaker */
|
||||
#define _PY_GIL_DROP_REQUEST_BIT (1U << 0)
|
||||
#define _PY_SIGNALS_PENDING_BIT (1U << 1)
|
||||
#define _PY_CALLS_TO_DO_BIT (1U << 2)
|
||||
@@ -321,19 +321,19 @@ _TyEval_SpecialMethodCanSuggest(TyObject *self, int oparg);
|
||||
#define _PY_EVAL_EVENTS_MASK ((1 << _PY_EVAL_EVENTS_BITS)-1)
|
||||
|
||||
static inline void
|
||||
_Ty_set_eval_breaker_bit(PyThreadState *tstate, uintptr_t bit)
|
||||
_Ty_set_eval_breaker_bit(TyThreadState *tstate, uintptr_t bit)
|
||||
{
|
||||
_Ty_atomic_or_uintptr(&tstate->eval_breaker, bit);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_Ty_unset_eval_breaker_bit(PyThreadState *tstate, uintptr_t bit)
|
||||
_Ty_unset_eval_breaker_bit(TyThreadState *tstate, uintptr_t bit)
|
||||
{
|
||||
_Ty_atomic_and_uintptr(&tstate->eval_breaker, ~bit);
|
||||
}
|
||||
|
||||
static inline int
|
||||
_Ty_eval_breaker_bit_is_set(PyThreadState *tstate, uintptr_t bit)
|
||||
_Ty_eval_breaker_bit_is_set(TyThreadState *tstate, uintptr_t bit)
|
||||
{
|
||||
uintptr_t b = _Ty_atomic_load_uintptr_relaxed(&tstate->eval_breaker);
|
||||
return (b & bit) != 0;
|
||||
@@ -360,7 +360,7 @@ PyAPI_FUNC(_PyStackRef) _TyFloat_FromDouble_ConsumeInputs(_PyStackRef left, _PyS
|
||||
#endif
|
||||
|
||||
#if defined(Ty_REMOTE_DEBUG) && defined(Ty_SUPPORTS_REMOTE_DEBUG)
|
||||
extern int _PyRunRemoteDebugger(PyThreadState *tstate);
|
||||
extern int _PyRunRemoteDebugger(TyThreadState *tstate);
|
||||
#endif
|
||||
|
||||
/* Special methods used by LOAD_SPECIAL */
|
||||
|
||||
@@ -49,7 +49,7 @@ _py_set_opcode(_Ty_CODEUNIT *word, uint8_t opcode)
|
||||
(CODE->_co_instrumentation_version > 0)
|
||||
|
||||
|
||||
extern PyStatus _TyCode_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _TyCode_Init(PyInterpreterState *interp);
|
||||
extern void _TyCode_Fini(PyInterpreterState *interp);
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@ _TyCode_GetTLBCArray(PyCodeObject *co)
|
||||
// Return a pointer to the thread-local bytecode for the current thread, if it
|
||||
// exists.
|
||||
static inline _Ty_CODEUNIT *
|
||||
_TyCode_GetTLBCFast(PyThreadState *tstate, PyCodeObject *co)
|
||||
_TyCode_GetTLBCFast(TyThreadState *tstate, PyCodeObject *co)
|
||||
{
|
||||
_PyCodeArray *code = _TyCode_GetTLBCArray(co);
|
||||
int32_t idx = ((_PyThreadStateImpl*) tstate)->tlbc_index;
|
||||
@@ -606,7 +606,7 @@ PyAPI_FUNC(void) _TyCode_GetVarCounts(
|
||||
PyCodeObject *,
|
||||
_TyCode_var_counts_t *);
|
||||
PyAPI_FUNC(int) _TyCode_SetUnboundVarCounts(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
PyCodeObject *,
|
||||
_TyCode_var_counts_t *,
|
||||
TyObject *globalnames,
|
||||
@@ -648,7 +648,7 @@ PyAPI_FUNC(int) _TyCode_CheckNoExternalState(
|
||||
_TyCode_var_counts_t *,
|
||||
const char **);
|
||||
PyAPI_FUNC(int) _TyCode_VerifyStateless(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
PyCodeObject *,
|
||||
TyObject *globalnames,
|
||||
TyObject *globalsns,
|
||||
|
||||
@@ -13,7 +13,7 @@ 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 PyStatus _PyCodec_InitRegistry(PyInterpreterState *interp);
|
||||
extern TyStatus _PyCodec_InitRegistry(PyInterpreterState *interp);
|
||||
|
||||
/* Finalize codecs-related state for the given interpreter. No PyCodec-related
|
||||
functions other than PyCodec_Unregister() may be called after this. */
|
||||
|
||||
@@ -11,7 +11,7 @@ extern TyTypeObject _PyContextTokenMissing_Type;
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
PyStatus _TyContext_Init(PyInterpreterState *);
|
||||
TyStatus _TyContext_Init(PyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
|
||||
@@ -85,7 +85,7 @@ extern "C" {
|
||||
|
||||
// Resumes the top-most critical section.
|
||||
PyAPI_FUNC(void)
|
||||
_PyCriticalSection_Resume(PyThreadState *tstate);
|
||||
_PyCriticalSection_Resume(TyThreadState *tstate);
|
||||
|
||||
// (private) slow path for locking the mutex
|
||||
PyAPI_FUNC(void)
|
||||
@@ -96,7 +96,7 @@ _PyCriticalSection2_BeginSlow(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2,
|
||||
int is_m1_locked);
|
||||
|
||||
PyAPI_FUNC(void)
|
||||
_PyCriticalSection_SuspendAll(PyThreadState *tstate);
|
||||
_PyCriticalSection_SuspendAll(TyThreadState *tstate);
|
||||
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
|
||||
@@ -110,7 +110,7 @@ static inline void
|
||||
_PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *m)
|
||||
{
|
||||
if (PyMutex_LockFast(m)) {
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
c->_cs_mutex = m;
|
||||
c->_cs_prev = tstate->critical_section;
|
||||
tstate->critical_section = (uintptr_t)c;
|
||||
@@ -133,7 +133,7 @@ _PyCriticalSection_Begin(PyCriticalSection *c, TyObject *op)
|
||||
static inline void
|
||||
_PyCriticalSection_Pop(PyCriticalSection *c)
|
||||
{
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
uintptr_t prev = c->_cs_prev;
|
||||
tstate->critical_section = prev;
|
||||
|
||||
@@ -178,7 +178,7 @@ _PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2)
|
||||
|
||||
if (PyMutex_LockFast(m1)) {
|
||||
if (PyMutex_LockFast(m2)) {
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
c->_cs_base._cs_mutex = m1;
|
||||
c->_cs_mutex2 = m2;
|
||||
c->_cs_base._cs_prev = tstate->critical_section;
|
||||
@@ -225,7 +225,7 @@ static inline void
|
||||
_PyCriticalSection_AssertHeld(PyMutex *mutex)
|
||||
{
|
||||
#ifdef Ty_DEBUG
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
uintptr_t prev = tstate->critical_section;
|
||||
if (prev & _Ty_CRITICAL_SECTION_TWO_MUTEXES) {
|
||||
PyCriticalSection2 *cs = (PyCriticalSection2 *)(prev & ~_Ty_CRITICAL_SECTION_MASK);
|
||||
|
||||
@@ -141,34 +141,34 @@ typedef int xidata_fallback_t;
|
||||
// a bit unfortunate. It's also nice to be able to clearly distinguish
|
||||
// between types that might call _TyObject_GetXIData() and those that won't.
|
||||
//
|
||||
typedef int (*xidatafunc)(PyThreadState *, TyObject *, _PyXIData_t *);
|
||||
typedef int (*xidatafunc)(TyThreadState *, TyObject *, _PyXIData_t *);
|
||||
typedef int (*xidatafbfunc)(
|
||||
PyThreadState *, TyObject *, xidata_fallback_t, _PyXIData_t *);
|
||||
TyThreadState *, TyObject *, xidata_fallback_t, _PyXIData_t *);
|
||||
typedef struct {
|
||||
xidatafunc basic;
|
||||
xidatafbfunc fallback;
|
||||
} _PyXIData_getdata_t;
|
||||
|
||||
PyAPI_FUNC(TyObject *) _PyXIData_GetNotShareableErrorType(PyThreadState *);
|
||||
PyAPI_FUNC(void) _PyXIData_SetNotShareableError(PyThreadState *, const char *);
|
||||
PyAPI_FUNC(TyObject *) _PyXIData_GetNotShareableErrorType(TyThreadState *);
|
||||
PyAPI_FUNC(void) _PyXIData_SetNotShareableError(TyThreadState *, const char *);
|
||||
PyAPI_FUNC(void) _PyXIData_FormatNotShareableError(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
const char *,
|
||||
...);
|
||||
|
||||
PyAPI_FUNC(_PyXIData_getdata_t) _PyXIData_Lookup(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *);
|
||||
PyAPI_FUNC(int) _TyObject_CheckXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *);
|
||||
|
||||
PyAPI_FUNC(int) _TyObject_GetXIDataNoFallback(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _TyObject_GetXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
xidata_fallback_t,
|
||||
_PyXIData_t *);
|
||||
@@ -182,11 +182,11 @@ PyAPI_FUNC(int) _TyBytes_GetData(TyObject *, _TyBytes_data_t *);
|
||||
PyAPI_FUNC(TyObject *) _TyBytes_FromData(_TyBytes_data_t *);
|
||||
PyAPI_FUNC(TyObject *) _TyBytes_FromXIData(_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _TyBytes_GetXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
PyAPI_FUNC(_TyBytes_data_t *) _TyBytes_GetXIDataWrapped(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
size_t,
|
||||
xid_newobjfunc,
|
||||
@@ -195,36 +195,36 @@ PyAPI_FUNC(_TyBytes_data_t *) _TyBytes_GetXIDataWrapped(
|
||||
// _TyObject_GetXIData() for pickle
|
||||
PyAPI_DATA(TyObject *) _PyPickle_LoadFromXIData(_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _PyPickle_GetXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
|
||||
// _TyObject_GetXIData() for marshal
|
||||
PyAPI_FUNC(TyObject *) _TyMarshal_ReadObjectFromXIData(_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _TyMarshal_GetXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
|
||||
// _TyObject_GetXIData() for code objects
|
||||
PyAPI_FUNC(TyObject *) _TyCode_FromXIData(_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _TyCode_GetXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _TyCode_GetScriptXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _TyCode_GetPureScriptXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
|
||||
// _TyObject_GetXIData() for functions
|
||||
PyAPI_FUNC(TyObject *) _PyFunction_FromXIData(_PyXIData_t *);
|
||||
PyAPI_FUNC(int) _PyFunction_GetXIData(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyObject *,
|
||||
_PyXIData_t *);
|
||||
|
||||
@@ -271,9 +271,9 @@ typedef struct {
|
||||
#define _PyXI_GET_STATE(interp) (&(interp)->xi)
|
||||
|
||||
#ifndef Ty_BUILD_CORE_MODULE
|
||||
extern PyStatus _PyXI_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _PyXI_Init(PyInterpreterState *interp);
|
||||
extern void _PyXI_Fini(PyInterpreterState *interp);
|
||||
extern PyStatus _PyXI_InitTypes(PyInterpreterState *interp);
|
||||
extern TyStatus _PyXI_InitTypes(PyInterpreterState *interp);
|
||||
extern void _PyXI_FiniTypes(PyInterpreterState *interp);
|
||||
#endif // Ty_BUILD_CORE_MODULE
|
||||
|
||||
@@ -334,7 +334,7 @@ PyAPI_FUNC(void) _PyXI_InitFailureUTF8(
|
||||
const char *);
|
||||
|
||||
PyAPI_FUNC(int) _PyXI_UnwrapNotShareableError(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
_PyXI_failure *);
|
||||
|
||||
|
||||
@@ -392,12 +392,12 @@ PyAPI_FUNC(TyObject *) _PyXI_GetPreserved(
|
||||
PyAPI_FUNC(PyInterpreterState *) _PyXI_NewInterpreter(
|
||||
PyInterpreterConfig *config,
|
||||
long *maybe_whence,
|
||||
PyThreadState **p_tstate,
|
||||
PyThreadState **p_save_tstate);
|
||||
TyThreadState **p_tstate,
|
||||
TyThreadState **p_save_tstate);
|
||||
PyAPI_FUNC(void) _PyXI_EndInterpreter(
|
||||
PyInterpreterState *interp,
|
||||
PyThreadState *tstate,
|
||||
PyThreadState **p_save_tstate);
|
||||
TyThreadState *tstate,
|
||||
TyThreadState **p_save_tstate);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -28,11 +28,11 @@ typedef struct {
|
||||
} _PyXIData_registry_t;
|
||||
|
||||
PyAPI_FUNC(int) _PyXIData_RegisterClass(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyTypeObject *,
|
||||
_PyXIData_getdata_t);
|
||||
PyAPI_FUNC(int) _PyXIData_UnregisterClass(
|
||||
PyThreadState *,
|
||||
TyThreadState *,
|
||||
TyTypeObject *);
|
||||
|
||||
struct _xid_lookup_state {
|
||||
|
||||
@@ -264,15 +264,15 @@ typedef struct _Ty_DebugOffsets {
|
||||
.tlbc_generation = _Ty_Debug_interpreter_state_tlbc_generation, \
|
||||
}, \
|
||||
.thread_state = { \
|
||||
.size = sizeof(PyThreadState), \
|
||||
.prev = offsetof(PyThreadState, prev), \
|
||||
.next = offsetof(PyThreadState, next), \
|
||||
.interp = offsetof(PyThreadState, interp), \
|
||||
.current_frame = offsetof(PyThreadState, current_frame), \
|
||||
.thread_id = offsetof(PyThreadState, thread_id), \
|
||||
.native_thread_id = offsetof(PyThreadState, native_thread_id), \
|
||||
.datastack_chunk = offsetof(PyThreadState, datastack_chunk), \
|
||||
.status = offsetof(PyThreadState, _status), \
|
||||
.size = sizeof(TyThreadState), \
|
||||
.prev = offsetof(TyThreadState, prev), \
|
||||
.next = offsetof(TyThreadState, next), \
|
||||
.interp = offsetof(TyThreadState, interp), \
|
||||
.current_frame = offsetof(TyThreadState, current_frame), \
|
||||
.thread_id = offsetof(TyThreadState, thread_id), \
|
||||
.native_thread_id = offsetof(TyThreadState, native_thread_id), \
|
||||
.datastack_chunk = offsetof(TyThreadState, datastack_chunk), \
|
||||
.status = offsetof(TyThreadState, _status), \
|
||||
}, \
|
||||
.interpreter_frame = { \
|
||||
.size = sizeof(_PyInterpreterFrame), \
|
||||
@@ -363,8 +363,8 @@ typedef struct _Ty_DebugOffsets {
|
||||
.prev = offsetof(struct llist_node, prev), \
|
||||
}, \
|
||||
.debugger_support = { \
|
||||
.eval_breaker = offsetof(PyThreadState, eval_breaker), \
|
||||
.remote_debugger_support = offsetof(PyThreadState, remote_debugger_support), \
|
||||
.eval_breaker = offsetof(TyThreadState, eval_breaker), \
|
||||
.remote_debugger_support = offsetof(TyThreadState, remote_debugger_support), \
|
||||
.remote_debugging_enabled = offsetof(PyInterpreterState, config.remote_debug), \
|
||||
.debugger_pending_call = offsetof(_PyRemoteDebuggerSupport, debugger_pending_call), \
|
||||
.debugger_script_path = offsetof(_PyRemoteDebuggerSupport, debugger_script_path), \
|
||||
|
||||
@@ -30,7 +30,7 @@ extern char* _Ty_dg_dtoa(double d, int mode, int ndigits,
|
||||
extern void _Ty_dg_freedtoa(char *s);
|
||||
|
||||
|
||||
extern PyStatus _PyDtoa_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _PyDtoa_Init(PyInterpreterState *interp);
|
||||
extern void _PyDtoa_Fini(PyInterpreterState *interp);
|
||||
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern PyStatus _PyExc_InitState(PyInterpreterState *);
|
||||
extern PyStatus _PyExc_InitGlobalObjects(PyInterpreterState *);
|
||||
extern TyStatus _PyExc_InitState(PyInterpreterState *);
|
||||
extern TyStatus _PyExc_InitGlobalObjects(PyInterpreterState *);
|
||||
extern int _PyExc_InitTypes(PyInterpreterState *);
|
||||
extern void _PyExc_Fini(PyInterpreterState *);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern void _TyFloat_InitState(PyInterpreterState *);
|
||||
extern PyStatus _TyFloat_InitTypes(PyInterpreterState *);
|
||||
extern TyStatus _TyFloat_InitTypes(PyInterpreterState *);
|
||||
extern void _TyFloat_FiniType(PyInterpreterState *);
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ extern "C" {
|
||||
static inline struct _Ty_freelists *
|
||||
_Ty_freelists_GET(void)
|
||||
{
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
#ifdef Ty_DEBUG
|
||||
_Ty_EnsureTstateNotNULL(tstate);
|
||||
#endif
|
||||
|
||||
@@ -33,13 +33,13 @@ void _PyFunction_ClearCodeByVersion(uint32_t version);
|
||||
PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, TyObject **p_code);
|
||||
|
||||
extern TyObject *_Ty_set_function_type_params(
|
||||
PyThreadState* unused, TyObject *func, TyObject *type_params);
|
||||
TyThreadState* unused, TyObject *func, TyObject *type_params);
|
||||
|
||||
|
||||
/* See pycore_code.h for explanation about what "stateless" means. */
|
||||
|
||||
PyAPI_FUNC(int)
|
||||
_PyFunction_VerifyStateless(PyThreadState *, TyObject *);
|
||||
_PyFunction_VerifyStateless(TyThreadState *, TyObject *);
|
||||
|
||||
static inline TyObject* _PyFunction_GET_BUILTINS(TyObject *func) {
|
||||
return _PyFunction_CAST(func)->func_builtins;
|
||||
|
||||
@@ -328,8 +328,8 @@ static inline void _TyObject_GC_UNTRACK(
|
||||
|
||||
extern void _TyGC_InitState(struct _gc_runtime_state *);
|
||||
|
||||
extern Ty_ssize_t _TyGC_Collect(PyThreadState *tstate, int generation, _TyGC_Reason reason);
|
||||
extern void _TyGC_CollectNoFail(PyThreadState *tstate);
|
||||
extern Ty_ssize_t _TyGC_Collect(TyThreadState *tstate, int generation, _TyGC_Reason reason);
|
||||
extern void _TyGC_CollectNoFail(TyThreadState *tstate);
|
||||
|
||||
/* Freeze objects tracked by the GC and ignore them in future collections. */
|
||||
extern void _TyGC_Freeze(PyInterpreterState *interp);
|
||||
@@ -343,8 +343,8 @@ extern TyObject *_TyGC_GetReferrers(PyInterpreterState *interp, TyObject *objs);
|
||||
|
||||
// Functions to clear types free lists
|
||||
extern void _TyGC_ClearAllFreeLists(PyInterpreterState *interp);
|
||||
extern void _Ty_ScheduleGC(PyThreadState *tstate);
|
||||
extern void _Ty_RunGC(PyThreadState *tstate);
|
||||
extern void _Ty_ScheduleGC(TyThreadState *tstate);
|
||||
extern void _Ty_RunGC(TyThreadState *tstate);
|
||||
|
||||
union _PyStackRef;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ PyAPI_FUNC(int) _TyGen_SetStopIterationValue(TyObject *);
|
||||
PyAPI_FUNC(int) _TyGen_FetchStopIterationValue(TyObject **);
|
||||
|
||||
PyAPI_FUNC(TyObject *)_PyCoro_GetAwaitableIter(TyObject *o);
|
||||
extern TyObject *_PyAsyncGenValueWrapperNew(PyThreadState *state, TyObject *);
|
||||
extern TyObject *_PyAsyncGenValueWrapperNew(TyThreadState *state, TyObject *);
|
||||
|
||||
extern TyTypeObject _PyCoroWrapper_Type;
|
||||
extern TyTypeObject _PyAsyncGenWrappedValue_Type;
|
||||
|
||||
@@ -39,9 +39,9 @@ struct _gil_runtime_state {
|
||||
#endif
|
||||
/* microseconds (the Python API uses seconds, though) */
|
||||
unsigned long interval;
|
||||
/* Last PyThreadState holding / having held the GIL. This helps us
|
||||
/* Last TyThreadState holding / having held the GIL. This helps us
|
||||
know whether anyone else was scheduled after we dropped the GIL. */
|
||||
PyThreadState* last_holder;
|
||||
TyThreadState* last_holder;
|
||||
/* Whether the GIL is already taken (-1 if uninitialized). This is
|
||||
atomic because it can be read without any lock taken in ceval.c. */
|
||||
int locked;
|
||||
|
||||
@@ -25,7 +25,7 @@ extern void _TyImport_ReInitLock(PyInterpreterState *interp);
|
||||
|
||||
// This is used exclusively for the sys and builtins modules:
|
||||
extern int _TyImport_FixupBuiltin(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *mod,
|
||||
const char *name, /* UTF-8 encoded string */
|
||||
TyObject *modules
|
||||
@@ -87,15 +87,15 @@ extern TyObject * _TyImport_ImportlibModuleRepr(
|
||||
TyObject *module);
|
||||
|
||||
|
||||
extern PyStatus _TyImport_Init(void);
|
||||
extern TyStatus _TyImport_Init(void);
|
||||
extern void _TyImport_Fini(void);
|
||||
extern void _TyImport_Fini2(void);
|
||||
|
||||
extern PyStatus _TyImport_InitCore(
|
||||
PyThreadState *tstate,
|
||||
extern TyStatus _TyImport_InitCore(
|
||||
TyThreadState *tstate,
|
||||
TyObject *sysmod,
|
||||
int importlib);
|
||||
extern PyStatus _TyImport_InitExternal(PyThreadState *tstate);
|
||||
extern TyStatus _TyImport_InitExternal(TyThreadState *tstate);
|
||||
extern void _TyImport_FiniCore(PyInterpreterState *interp);
|
||||
extern void _TyImport_FiniExternal(PyInterpreterState *interp);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
#include "pycore_typedefs.h" // _PyRuntimeState
|
||||
|
||||
/* --- PyStatus ----------------------------------------------- */
|
||||
/* --- TyStatus ----------------------------------------------- */
|
||||
|
||||
/* Almost all errors causing Python initialization to fail */
|
||||
#ifdef _MSC_VER
|
||||
@@ -21,10 +21,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define _TyStatus_OK() \
|
||||
(PyStatus){._type = _TyStatus_TYPE_OK}
|
||||
(TyStatus){._type = _TyStatus_TYPE_OK}
|
||||
/* other fields are set to 0 */
|
||||
#define _TyStatus_ERR(ERR_MSG) \
|
||||
(PyStatus){ \
|
||||
(TyStatus){ \
|
||||
._type = _TyStatus_TYPE_ERROR, \
|
||||
.func = _TyStatus_GET_FUNC(), \
|
||||
.err_msg = (ERR_MSG)}
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
#define _TyStatus_NO_MEMORY_ERRMSG "memory allocation failed"
|
||||
#define _TyStatus_NO_MEMORY() _TyStatus_ERR(_TyStatus_NO_MEMORY_ERRMSG)
|
||||
#define _TyStatus_EXIT(EXITCODE) \
|
||||
(PyStatus){ \
|
||||
(TyStatus){ \
|
||||
._type = _TyStatus_TYPE_EXIT, \
|
||||
.exitcode = (EXITCODE)}
|
||||
#define _TyStatus_IS_ERROR(err) \
|
||||
@@ -45,7 +45,7 @@ extern "C" {
|
||||
do { (err).func = _TyStatus_GET_FUNC(); } while (0)
|
||||
|
||||
// Export for '_testinternalcapi' shared extension
|
||||
PyAPI_FUNC(void) _TyErr_SetFromPyStatus(PyStatus status);
|
||||
PyAPI_FUNC(void) _TyErr_SetFromPyStatus(TyStatus status);
|
||||
|
||||
|
||||
/* --- PyWideStringList ------------------------------------------------ */
|
||||
@@ -58,7 +58,7 @@ extern int _TyWideStringList_CheckConsistency(const PyWideStringList *list);
|
||||
extern void _TyWideStringList_Clear(PyWideStringList *list);
|
||||
extern int _TyWideStringList_Copy(PyWideStringList *list,
|
||||
const PyWideStringList *list2);
|
||||
extern PyStatus _TyWideStringList_Extend(PyWideStringList *list,
|
||||
extern TyStatus _TyWideStringList_Extend(PyWideStringList *list,
|
||||
const PyWideStringList *list2);
|
||||
extern TyObject* _TyWideStringList_AsList(const PyWideStringList *list);
|
||||
|
||||
@@ -72,7 +72,7 @@ typedef struct _PyArgv {
|
||||
wchar_t * const *wchar_argv;
|
||||
} _PyArgv;
|
||||
|
||||
extern PyStatus _PyArgv_AsWstrList(const _PyArgv *args,
|
||||
extern TyStatus _PyArgv_AsWstrList(const _PyArgv *args,
|
||||
PyWideStringList *list);
|
||||
|
||||
|
||||
@@ -115,12 +115,12 @@ typedef struct {
|
||||
/* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */
|
||||
|
||||
extern void _PyPreCmdline_Clear(_PyPreCmdline *cmdline);
|
||||
extern PyStatus _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline,
|
||||
extern TyStatus _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline,
|
||||
const _PyArgv *args);
|
||||
extern PyStatus _PyPreCmdline_SetConfig(
|
||||
extern TyStatus _PyPreCmdline_SetConfig(
|
||||
const _PyPreCmdline *cmdline,
|
||||
PyConfig *config);
|
||||
extern PyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline,
|
||||
extern TyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline,
|
||||
const PyPreConfig *preconfig);
|
||||
|
||||
|
||||
@@ -132,15 +132,15 @@ PyAPI_FUNC(void) _TyPreConfig_InitCompatConfig(PyPreConfig *preconfig);
|
||||
extern void _TyPreConfig_InitFromConfig(
|
||||
PyPreConfig *preconfig,
|
||||
const PyConfig *config);
|
||||
extern PyStatus _TyPreConfig_InitFromPreConfig(
|
||||
extern TyStatus _TyPreConfig_InitFromPreConfig(
|
||||
PyPreConfig *preconfig,
|
||||
const PyPreConfig *config2);
|
||||
extern TyObject* _TyPreConfig_AsDict(const PyPreConfig *preconfig);
|
||||
extern void _TyPreConfig_GetConfig(PyPreConfig *preconfig,
|
||||
const PyConfig *config);
|
||||
extern PyStatus _TyPreConfig_Read(PyPreConfig *preconfig,
|
||||
extern TyStatus _TyPreConfig_Read(PyPreConfig *preconfig,
|
||||
const _PyArgv *args);
|
||||
extern PyStatus _TyPreConfig_Write(const PyPreConfig *preconfig);
|
||||
extern TyStatus _TyPreConfig_Write(const PyPreConfig *preconfig);
|
||||
|
||||
|
||||
/* --- PyConfig ---------------------------------------------- */
|
||||
@@ -167,22 +167,22 @@ typedef enum {
|
||||
// Export for '_testembed' program
|
||||
PyAPI_FUNC(void) _TyConfig_InitCompatConfig(PyConfig *config);
|
||||
|
||||
extern PyStatus _TyConfig_Copy(
|
||||
extern TyStatus _TyConfig_Copy(
|
||||
PyConfig *config,
|
||||
const PyConfig *config2);
|
||||
extern PyStatus _TyConfig_InitPathConfig(
|
||||
extern TyStatus _TyConfig_InitPathConfig(
|
||||
PyConfig *config,
|
||||
int compute_path_config);
|
||||
extern PyStatus _TyConfig_InitImportConfig(PyConfig *config);
|
||||
extern PyStatus _TyConfig_Read(PyConfig *config, int compute_path_config);
|
||||
extern PyStatus _TyConfig_Write(const PyConfig *config,
|
||||
extern TyStatus _TyConfig_InitImportConfig(PyConfig *config);
|
||||
extern TyStatus _TyConfig_Read(PyConfig *config, int compute_path_config);
|
||||
extern TyStatus _TyConfig_Write(const PyConfig *config,
|
||||
_PyRuntimeState *runtime);
|
||||
extern PyStatus _TyConfig_SetPyArgv(
|
||||
extern TyStatus _TyConfig_SetPyArgv(
|
||||
PyConfig *config,
|
||||
const _PyArgv *args);
|
||||
extern TyObject* _TyConfig_CreateXOptionsDict(const PyConfig *config);
|
||||
|
||||
extern void _Ty_DumpPathConfig(PyThreadState *tstate);
|
||||
extern void _Ty_DumpPathConfig(TyThreadState *tstate);
|
||||
|
||||
|
||||
/* --- Function used for testing ---------------------------------- */
|
||||
|
||||
@@ -34,32 +34,32 @@ int _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringE
|
||||
int _PyMonitoring_GetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEventSet *events);
|
||||
|
||||
extern int
|
||||
_Ty_call_instrumentation(PyThreadState *tstate, int event,
|
||||
_Ty_call_instrumentation(TyThreadState *tstate, int event,
|
||||
_PyInterpreterFrame *frame, _Ty_CODEUNIT *instr);
|
||||
|
||||
extern int
|
||||
_Ty_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame,
|
||||
_Ty_call_instrumentation_line(TyThreadState *tstate, _PyInterpreterFrame* frame,
|
||||
_Ty_CODEUNIT *instr, _Ty_CODEUNIT *prev);
|
||||
|
||||
extern int
|
||||
_Ty_call_instrumentation_instruction(
|
||||
PyThreadState *tstate, _PyInterpreterFrame* frame, _Ty_CODEUNIT *instr);
|
||||
TyThreadState *tstate, _PyInterpreterFrame* frame, _Ty_CODEUNIT *instr);
|
||||
|
||||
_Ty_CODEUNIT *
|
||||
_Ty_call_instrumentation_jump(
|
||||
_Ty_CODEUNIT *instr, PyThreadState *tstate, int event,
|
||||
_Ty_CODEUNIT *instr, TyThreadState *tstate, int event,
|
||||
_PyInterpreterFrame *frame, _Ty_CODEUNIT *src, _Ty_CODEUNIT *dest);
|
||||
|
||||
extern int
|
||||
_Ty_call_instrumentation_arg(PyThreadState *tstate, int event,
|
||||
_Ty_call_instrumentation_arg(TyThreadState *tstate, int event,
|
||||
_PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *arg);
|
||||
|
||||
extern int
|
||||
_Ty_call_instrumentation_2args(PyThreadState *tstate, int event,
|
||||
_Ty_call_instrumentation_2args(TyThreadState *tstate, int event,
|
||||
_PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *arg0, TyObject *arg1);
|
||||
|
||||
extern void
|
||||
_Ty_call_instrumentation_exc2(PyThreadState *tstate, int event,
|
||||
_Ty_call_instrumentation_exc2(TyThreadState *tstate, int event,
|
||||
_PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *arg0, TyObject *arg1);
|
||||
|
||||
extern int
|
||||
|
||||
@@ -25,11 +25,11 @@ extern "C" {
|
||||
|
||||
/* other API */
|
||||
|
||||
extern void _TyInterpreterState_Clear(PyThreadState *tstate);
|
||||
extern void _TyInterpreterState_Clear(TyThreadState *tstate);
|
||||
|
||||
static inline PyThreadState*
|
||||
static inline TyThreadState*
|
||||
_TyInterpreterState_GetFinalizing(PyInterpreterState *interp) {
|
||||
return (PyThreadState*)_Ty_atomic_load_ptr_relaxed(&interp->_finalizing);
|
||||
return (TyThreadState*)_Ty_atomic_load_ptr_relaxed(&interp->_finalizing);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
@@ -38,7 +38,7 @@ _TyInterpreterState_GetFinalizingID(PyInterpreterState *interp) {
|
||||
}
|
||||
|
||||
static inline void
|
||||
_TyInterpreterState_SetFinalizing(PyInterpreterState *interp, PyThreadState *tstate) {
|
||||
_TyInterpreterState_SetFinalizing(PyInterpreterState *interp, TyThreadState *tstate) {
|
||||
_Ty_atomic_store_ptr_relaxed(&interp->_finalizing, tstate);
|
||||
if (tstate == NULL) {
|
||||
_Ty_atomic_store_ulong_relaxed(&interp->_finalizing_id, 0);
|
||||
@@ -96,8 +96,8 @@ might not be allowed in the current interpreter (i.e. os.fork() would fail).
|
||||
extern int _TyInterpreterState_HasFeature(PyInterpreterState *interp,
|
||||
unsigned long feature);
|
||||
|
||||
PyAPI_FUNC(PyStatus) _TyInterpreterState_New(
|
||||
PyThreadState *tstate,
|
||||
PyAPI_FUNC(TyStatus) _TyInterpreterState_New(
|
||||
TyThreadState *tstate,
|
||||
PyInterpreterState **pinterp);
|
||||
|
||||
extern const PyConfig* _TyInterpreterState_GetConfig(
|
||||
|
||||
@@ -39,7 +39,7 @@ struct _pending_call {
|
||||
#define PENDINGCALLSARRAYSIZE 300
|
||||
|
||||
struct _pending_calls {
|
||||
PyThreadState *handling_thread;
|
||||
TyThreadState *handling_thread;
|
||||
PyMutex mutex;
|
||||
/* Request for running pending calls. */
|
||||
int32_t npending;
|
||||
@@ -103,7 +103,7 @@ struct _ceval_runtime_state {
|
||||
|
||||
struct _ceval_state {
|
||||
/* This variable holds the global instrumentation version. When a thread is
|
||||
running, this value is overlaid onto PyThreadState.eval_breaker so that
|
||||
running, this value is overlaid onto TyThreadState.eval_breaker so that
|
||||
changes in the instrumentation version will trigger the eval breaker. */
|
||||
uintptr_t instrumentation_version;
|
||||
int recursion_limit;
|
||||
@@ -374,7 +374,7 @@ struct _stoptheworld_state {
|
||||
PyEvent stop_event; // Set when thread_countdown reaches zero.
|
||||
Ty_ssize_t thread_countdown; // Number of threads that must pause.
|
||||
|
||||
PyThreadState *requester; // Thread that requested the pause (may be NULL).
|
||||
TyThreadState *requester; // Thread that requested the pause (may be NULL).
|
||||
};
|
||||
|
||||
/* Tracks some rare events per-interpreter, used by the optimizer to turn on/off
|
||||
@@ -795,10 +795,10 @@ struct _is {
|
||||
struct pythreads {
|
||||
uint64_t next_unique_id;
|
||||
/* The linked list of threads, newest first. */
|
||||
PyThreadState *head;
|
||||
TyThreadState *head;
|
||||
_PyThreadStateImpl *preallocated;
|
||||
/* The thread currently executing in the __main__ module, if any. */
|
||||
PyThreadState *main;
|
||||
TyThreadState *main;
|
||||
/* Used in Modules/_threadmodule.c. */
|
||||
Ty_ssize_t count;
|
||||
/* Support for runtime thread stack size tuning.
|
||||
@@ -818,7 +818,7 @@ struct _is {
|
||||
Use _TyInterpreterState_GetFinalizing()
|
||||
and _TyInterpreterState_SetFinalizing()
|
||||
to access it, don't access it directly. */
|
||||
PyThreadState* _finalizing;
|
||||
TyThreadState* _finalizing;
|
||||
/* The ID of the OS thread in which we are finalizing. */
|
||||
unsigned long _finalizing_id;
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ static inline void _TyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *
|
||||
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
static inline void
|
||||
_TyFrame_InitializeTLBC(PyThreadState *tstate, _PyInterpreterFrame *frame,
|
||||
_TyFrame_InitializeTLBC(TyThreadState *tstate, _PyInterpreterFrame *frame,
|
||||
PyCodeObject *code)
|
||||
{
|
||||
_Ty_CODEUNIT *tlbc = _TyCode_GetTLBCFast(tstate, code);
|
||||
@@ -125,7 +125,7 @@ _TyFrame_InitializeTLBC(PyThreadState *tstate, _PyInterpreterFrame *frame,
|
||||
*/
|
||||
static inline void
|
||||
_TyFrame_Initialize(
|
||||
PyThreadState *tstate, _PyInterpreterFrame *frame, _PyStackRef func,
|
||||
TyThreadState *tstate, _PyInterpreterFrame *frame, _PyStackRef func,
|
||||
TyObject *locals, PyCodeObject *code, int null_locals_from, _PyInterpreterFrame *previous)
|
||||
{
|
||||
frame->previous = previous;
|
||||
@@ -217,7 +217,7 @@ _TyFrame_GetFirstComplete(_PyInterpreterFrame *frame)
|
||||
}
|
||||
|
||||
static inline _PyInterpreterFrame *
|
||||
_TyThreadState_GetFrame(PyThreadState *tstate)
|
||||
_TyThreadState_GetFrame(TyThreadState *tstate)
|
||||
{
|
||||
return _TyFrame_GetFirstComplete(tstate->current_frame);
|
||||
}
|
||||
@@ -267,7 +267,7 @@ TyObject *
|
||||
_TyFrame_GetLocals(_PyInterpreterFrame *frame);
|
||||
|
||||
static inline bool
|
||||
_TyThreadState_HasStackSpace(PyThreadState *tstate, int size)
|
||||
_TyThreadState_HasStackSpace(TyThreadState *tstate, int size)
|
||||
{
|
||||
assert(
|
||||
(tstate->datastack_top == NULL && tstate->datastack_limit == NULL)
|
||||
@@ -279,15 +279,15 @@ _TyThreadState_HasStackSpace(PyThreadState *tstate, int size)
|
||||
}
|
||||
|
||||
extern _PyInterpreterFrame *
|
||||
_TyThreadState_PushFrame(PyThreadState *tstate, size_t size);
|
||||
_TyThreadState_PushFrame(TyThreadState *tstate, size_t size);
|
||||
|
||||
PyAPI_FUNC(void) _TyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame *frame);
|
||||
PyAPI_FUNC(void) _TyThreadState_PopFrame(TyThreadState *tstate, _PyInterpreterFrame *frame);
|
||||
|
||||
/* Pushes a frame without checking for space.
|
||||
* Must be guarded by _TyThreadState_HasStackSpace()
|
||||
* Consumes reference to func. */
|
||||
static inline _PyInterpreterFrame *
|
||||
_TyFrame_PushUnchecked(PyThreadState *tstate, _PyStackRef func, int null_locals_from, _PyInterpreterFrame * previous)
|
||||
_TyFrame_PushUnchecked(TyThreadState *tstate, _PyStackRef func, int null_locals_from, _PyInterpreterFrame * previous)
|
||||
{
|
||||
CALL_STAT_INC(frames_pushed);
|
||||
PyFunctionObject *func_obj = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(func);
|
||||
@@ -303,7 +303,7 @@ _TyFrame_PushUnchecked(PyThreadState *tstate, _PyStackRef func, int null_locals_
|
||||
/* Pushes a trampoline frame without checking for space.
|
||||
* Must be guarded by _TyThreadState_HasStackSpace() */
|
||||
static inline _PyInterpreterFrame *
|
||||
_TyFrame_PushTrampolineUnchecked(PyThreadState *tstate, PyCodeObject *code, int stackdepth, _PyInterpreterFrame * previous)
|
||||
_TyFrame_PushTrampolineUnchecked(TyThreadState *tstate, PyCodeObject *code, int stackdepth, _PyInterpreterFrame * previous)
|
||||
{
|
||||
CALL_STAT_INC(frames_pushed);
|
||||
_PyInterpreterFrame *frame = (_PyInterpreterFrame *)tstate->datastack_top;
|
||||
@@ -335,7 +335,7 @@ _TyFrame_PushTrampolineUnchecked(PyThreadState *tstate, PyCodeObject *code, int
|
||||
}
|
||||
|
||||
PyAPI_FUNC(_PyInterpreterFrame *)
|
||||
_PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,
|
||||
_PyEvalFramePushAndInit(TyThreadState *tstate, _PyStackRef func,
|
||||
TyObject *locals, _PyStackRef const *args,
|
||||
size_t argcount, TyObject *kwnames,
|
||||
_PyInterpreterFrame *previous);
|
||||
|
||||
@@ -16,7 +16,7 @@ extern TyTypeObject _PyInterpolation_Type;
|
||||
PyAPI_FUNC(TyObject *) _PyInterpolation_Build(TyObject *value, TyObject *str,
|
||||
int conversion, TyObject *format_spec);
|
||||
|
||||
extern PyStatus _PyInterpolation_InitTypes(PyInterpreterState *interp);
|
||||
extern TyStatus _PyInterpolation_InitTypes(PyInterpreterState *interp);
|
||||
extern TyObject *_PyInterpolation_GetValueRef(TyObject *interpolation);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
#define MAX_INTRINSIC_2 5
|
||||
|
||||
typedef TyObject *(*intrinsic_func1)(PyThreadState* tstate, TyObject *value);
|
||||
typedef TyObject *(*intrinsic_func2)(PyThreadState* tstate, TyObject *value1, TyObject *value2);
|
||||
typedef TyObject *(*intrinsic_func1)(TyThreadState* tstate, TyObject *value);
|
||||
typedef TyObject *(*intrinsic_func2)(TyThreadState* tstate, TyObject *value1, TyObject *value2);
|
||||
|
||||
typedef struct {
|
||||
intrinsic_func1 func;
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
#ifdef _Ty_JIT
|
||||
|
||||
typedef _Ty_CODEUNIT *(*jit_func)(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate);
|
||||
typedef _Ty_CODEUNIT *(*jit_func)(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, TyThreadState *tstate);
|
||||
|
||||
int _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction *trace, size_t length);
|
||||
void _PyJIT_Free(_PyExecutorObject *executor);
|
||||
|
||||
@@ -48,7 +48,7 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern PyStatus _TyLong_InitTypes(PyInterpreterState *);
|
||||
extern TyStatus _TyLong_InitTypes(PyInterpreterState *);
|
||||
extern void _TyLong_FiniTypes(PyInterpreterState *interp);
|
||||
|
||||
|
||||
|
||||
@@ -122,9 +122,9 @@ PyAPI_FUNC(void) _Ty_NO_RETURN _Ty_FatalRefcountErrorFunc(
|
||||
built against the pre-3.12 stable ABI. */
|
||||
PyAPI_DATA(Ty_ssize_t) _Ty_RefTotal;
|
||||
|
||||
extern void _Ty_AddRefTotal(PyThreadState *, Ty_ssize_t);
|
||||
extern PyAPI_FUNC(void) _Ty_IncRefTotal(PyThreadState *);
|
||||
extern PyAPI_FUNC(void) _Ty_DecRefTotal(PyThreadState *);
|
||||
extern void _Ty_AddRefTotal(TyThreadState *, Ty_ssize_t);
|
||||
extern PyAPI_FUNC(void) _Ty_IncRefTotal(TyThreadState *);
|
||||
extern PyAPI_FUNC(void) _Ty_DecRefTotal(TyThreadState *);
|
||||
|
||||
# define _Ty_DEC_REFTOTAL(interp) \
|
||||
interp->object_state.reftotal--
|
||||
@@ -318,7 +318,7 @@ _TyType_HasFeature(TyTypeObject *type, unsigned long feature) {
|
||||
|
||||
extern void _TyType_InitCache(PyInterpreterState *interp);
|
||||
|
||||
extern PyStatus _TyObject_InitState(PyInterpreterState *interp);
|
||||
extern TyStatus _TyObject_InitState(PyInterpreterState *interp);
|
||||
extern void _TyObject_FiniState(PyInterpreterState *interp);
|
||||
extern bool _PyRefchain_IsTraced(PyInterpreterState *interp, TyObject *obj);
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ extern "C" {
|
||||
// Export for '_testinternalcapi' shared extension
|
||||
PyAPI_FUNC(void) _TyPathConfig_ClearGlobal(void);
|
||||
|
||||
extern PyStatus _TyPathConfig_ReadGlobal(PyConfig *config);
|
||||
extern PyStatus _TyPathConfig_UpdateGlobal(const PyConfig *config);
|
||||
extern TyStatus _TyPathConfig_ReadGlobal(PyConfig *config);
|
||||
extern TyStatus _TyPathConfig_UpdateGlobal(const PyConfig *config);
|
||||
extern const wchar_t * _TyPathConfig_GetGlobalModuleSearchPath(void);
|
||||
|
||||
extern int _TyPathConfig_ComputeSysPath0(
|
||||
|
||||
@@ -11,10 +11,10 @@ extern "C" {
|
||||
|
||||
/* Error handling definitions */
|
||||
|
||||
extern _TyErr_StackItem* _TyErr_GetTopmostException(PyThreadState *tstate);
|
||||
extern TyObject* _TyErr_GetHandledException(PyThreadState *);
|
||||
extern void _TyErr_SetHandledException(PyThreadState *, TyObject *);
|
||||
extern void _TyErr_GetExcInfo(PyThreadState *, TyObject **, TyObject **, TyObject **);
|
||||
extern _TyErr_StackItem* _TyErr_GetTopmostException(TyThreadState *tstate);
|
||||
extern TyObject* _TyErr_GetHandledException(TyThreadState *);
|
||||
extern void _TyErr_SetHandledException(TyThreadState *, TyObject *);
|
||||
extern void _TyErr_GetExcInfo(TyThreadState *, TyObject **, TyObject **, TyObject **);
|
||||
|
||||
// Export for '_testinternalcapi' shared extension
|
||||
PyAPI_FUNC(void) _TyErr_SetKeyError(TyObject *);
|
||||
@@ -65,13 +65,13 @@ extern int _TyErr_SetModuleNotFoundError(TyObject *name);
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern PyStatus _TyErr_InitTypes(PyInterpreterState *);
|
||||
extern TyStatus _TyErr_InitTypes(PyInterpreterState *);
|
||||
extern void _TyErr_FiniTypes(PyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
|
||||
static inline TyObject* _TyErr_Occurred(PyThreadState *tstate)
|
||||
static inline TyObject* _TyErr_Occurred(TyThreadState *tstate)
|
||||
{
|
||||
assert(tstate != NULL);
|
||||
if (tstate->current_exception == NULL) {
|
||||
@@ -89,38 +89,38 @@ extern TyObject* _TyErr_StackItemToExcInfoTuple(
|
||||
_TyErr_StackItem *err_info);
|
||||
|
||||
extern void _TyErr_Fetch(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject **type,
|
||||
TyObject **value,
|
||||
TyObject **traceback);
|
||||
|
||||
PyAPI_FUNC(TyObject*) _TyErr_GetRaisedException(PyThreadState *tstate);
|
||||
PyAPI_FUNC(TyObject*) _TyErr_GetRaisedException(TyThreadState *tstate);
|
||||
|
||||
PyAPI_FUNC(int) _TyErr_ExceptionMatches(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *exc);
|
||||
|
||||
PyAPI_FUNC(void) _TyErr_SetRaisedException(PyThreadState *tstate, TyObject *exc);
|
||||
PyAPI_FUNC(void) _TyErr_SetRaisedException(TyThreadState *tstate, TyObject *exc);
|
||||
|
||||
extern void _TyErr_Restore(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *type,
|
||||
TyObject *value,
|
||||
TyObject *traceback);
|
||||
|
||||
extern void _TyErr_SetObject(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *type,
|
||||
TyObject *value);
|
||||
|
||||
extern void _TyErr_ChainStackItem(void);
|
||||
extern void _TyErr_ChainExceptions1Tstate(PyThreadState *, TyObject *);
|
||||
extern void _TyErr_ChainExceptions1Tstate(TyThreadState *, TyObject *);
|
||||
|
||||
PyAPI_FUNC(void) _TyErr_Clear(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) _TyErr_Clear(TyThreadState *tstate);
|
||||
|
||||
extern void _TyErr_SetNone(PyThreadState *tstate, TyObject *exception);
|
||||
extern void _TyErr_SetNone(TyThreadState *tstate, TyObject *exception);
|
||||
|
||||
extern TyObject* _TyErr_NoMemory(PyThreadState *tstate);
|
||||
extern TyObject* _TyErr_NoMemory(TyThreadState *tstate);
|
||||
|
||||
extern int _TyErr_EmitSyntaxWarning(TyObject *msg, TyObject *filename, int lineno, int col_offset,
|
||||
int end_lineno, int end_col_offset);
|
||||
@@ -128,7 +128,7 @@ extern void _TyErr_RaiseSyntaxError(TyObject *msg, TyObject *filename, int linen
|
||||
int end_lineno, int end_col_offset);
|
||||
|
||||
PyAPI_FUNC(void) _TyErr_SetString(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *exception,
|
||||
const char *string);
|
||||
|
||||
@@ -145,25 +145,25 @@ PyAPI_FUNC(void) _TyErr_SetLocaleString(
|
||||
const char *string);
|
||||
|
||||
PyAPI_FUNC(TyObject*) _TyErr_Format(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *exception,
|
||||
const char *format,
|
||||
...);
|
||||
|
||||
PyAPI_FUNC(TyObject*) _TyErr_FormatV(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *exception,
|
||||
const char *format,
|
||||
va_list vargs);
|
||||
|
||||
extern void _TyErr_NormalizeException(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject **exc,
|
||||
TyObject **val,
|
||||
TyObject **tb);
|
||||
|
||||
extern TyObject* _TyErr_FormatFromCauseTstate(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject *exception,
|
||||
const char *format,
|
||||
...);
|
||||
@@ -176,7 +176,7 @@ extern TyObject* _PyExc_PrepReraiseStar(
|
||||
TyObject *orig,
|
||||
TyObject *excs);
|
||||
|
||||
extern int _TyErr_CheckSignalsTstate(PyThreadState *tstate);
|
||||
extern int _TyErr_CheckSignalsTstate(TyThreadState *tstate);
|
||||
|
||||
extern void _Ty_DumpExtensionModules(int fd, PyInterpreterState *interp);
|
||||
extern TyObject* _Ty_CalculateSuggestions(TyObject *dir, TyObject *name);
|
||||
|
||||
@@ -17,7 +17,7 @@ extern int _Ty_SetFileSystemEncoding(
|
||||
const char *encoding,
|
||||
const char *errors);
|
||||
extern void _Ty_ClearFileSystemEncoding(void);
|
||||
extern PyStatus _TyUnicode_InitEncodings(PyThreadState *tstate);
|
||||
extern TyStatus _TyUnicode_InitEncodings(TyThreadState *tstate);
|
||||
#ifdef MS_WINDOWS
|
||||
extern int _TyUnicode_EnableLegacyWindowsFSEncoding(void);
|
||||
#endif
|
||||
@@ -27,21 +27,21 @@ extern int _Ty_IsLocaleCoercionTarget(const char *ctype_loc);
|
||||
/* Various one-time initializers */
|
||||
|
||||
extern void _Ty_InitVersion(void);
|
||||
extern PyStatus _PyFaulthandler_Init(int enable);
|
||||
extern TyStatus _PyFaulthandler_Init(int enable);
|
||||
extern TyObject * _PyBuiltin_Init(PyInterpreterState *interp);
|
||||
extern PyStatus _TySys_Create(
|
||||
PyThreadState *tstate,
|
||||
extern TyStatus _TySys_Create(
|
||||
TyThreadState *tstate,
|
||||
TyObject **sysmod_p);
|
||||
extern PyStatus _TySys_ReadPreinitWarnOptions(PyWideStringList *options);
|
||||
extern PyStatus _TySys_ReadPreinitXOptions(PyConfig *config);
|
||||
extern int _TySys_UpdateConfig(PyThreadState *tstate);
|
||||
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 int _PyBuiltins_AddExceptions(TyObject * bltinmod);
|
||||
extern PyStatus _Ty_HashRandomization_Init(const PyConfig *);
|
||||
extern TyStatus _Ty_HashRandomization_Init(const PyConfig *);
|
||||
|
||||
extern PyStatus _TyGC_Init(PyInterpreterState *interp);
|
||||
extern PyStatus _PyAtExit_Init(PyInterpreterState *interp);
|
||||
extern PyStatus _PyDateTime_InitTypes(PyInterpreterState *interp);
|
||||
extern TyStatus _TyGC_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _PyAtExit_Init(PyInterpreterState *interp);
|
||||
extern TyStatus _PyDateTime_InitTypes(PyInterpreterState *interp);
|
||||
|
||||
/* Various internal finalizers */
|
||||
|
||||
@@ -60,16 +60,16 @@ extern void _PyThread_FiniType(PyInterpreterState *interp);
|
||||
extern void _TyArg_Fini(void);
|
||||
extern void _Ty_FinalizeAllocatedBlocks(_PyRuntimeState *);
|
||||
|
||||
extern PyStatus _TyGILState_Init(PyInterpreterState *interp);
|
||||
extern void _TyGILState_SetTstate(PyThreadState *tstate);
|
||||
extern TyStatus _TyGILState_Init(PyInterpreterState *interp);
|
||||
extern void _TyGILState_SetTstate(TyThreadState *tstate);
|
||||
extern void _TyGILState_Fini(PyInterpreterState *interp);
|
||||
|
||||
extern void _TyGC_DumpShutdownStats(PyInterpreterState *interp);
|
||||
|
||||
extern PyStatus _Ty_PreInitializeFromPyArgv(
|
||||
extern TyStatus _Ty_PreInitializeFromPyArgv(
|
||||
const PyPreConfig *src_config,
|
||||
const struct _PyArgv *args);
|
||||
extern PyStatus _Ty_PreInitializeFromConfig(
|
||||
extern TyStatus _Ty_PreInitializeFromConfig(
|
||||
const PyConfig *config,
|
||||
const struct _PyArgv *args);
|
||||
|
||||
@@ -79,12 +79,12 @@ extern int _Ty_HandleSystemExitAndKeyboardInterrupt(int *exitcode_p);
|
||||
|
||||
extern TyObject* _TyErr_WriteUnraisableDefaultHook(TyObject *unraisable);
|
||||
|
||||
extern void _TyErr_Print(PyThreadState *tstate);
|
||||
extern void _TyErr_Print(TyThreadState *tstate);
|
||||
extern void _TyErr_Display(TyObject *file, TyObject *exception,
|
||||
TyObject *value, TyObject *tb);
|
||||
extern void _TyErr_DisplayException(TyObject *file, TyObject *exc);
|
||||
|
||||
extern void _TyThreadState_DeleteCurrent(PyThreadState *tstate);
|
||||
extern void _TyThreadState_DeleteCurrent(TyThreadState *tstate);
|
||||
|
||||
extern void _PyAtExit_Call(PyInterpreterState *interp);
|
||||
|
||||
|
||||
@@ -101,17 +101,17 @@ static inline void _TyObject_XDecRefDelayed(TyObject *obj)
|
||||
#endif
|
||||
|
||||
// Periodically process delayed free requests.
|
||||
extern void _TyMem_ProcessDelayed(PyThreadState *tstate);
|
||||
extern void _TyMem_ProcessDelayed(TyThreadState *tstate);
|
||||
|
||||
// Periodically process delayed free requests when the world is stopped.
|
||||
// Notify of any objects whic should be freeed.
|
||||
typedef void (*delayed_dealloc_cb)(TyObject *, void *);
|
||||
extern void _TyMem_ProcessDelayedNoDealloc(PyThreadState *tstate,
|
||||
extern void _TyMem_ProcessDelayedNoDealloc(TyThreadState *tstate,
|
||||
delayed_dealloc_cb cb, void *state);
|
||||
|
||||
// Abandon all thread-local delayed free requests and push them to the
|
||||
// interpreter's queue.
|
||||
extern void _TyMem_AbandonDelayed(PyThreadState *tstate);
|
||||
extern void _TyMem_AbandonDelayed(TyThreadState *tstate);
|
||||
|
||||
// On interpreter shutdown, frees all delayed free requests.
|
||||
extern void _TyMem_FiniDelayed(PyInterpreterState *interp);
|
||||
|
||||
@@ -13,13 +13,13 @@ extern "C" {
|
||||
#include "pycore_tstate.h"
|
||||
|
||||
|
||||
// Values for PyThreadState.state. A thread must be in the "attached" state
|
||||
// Values for TyThreadState.state. A thread must be in the "attached" state
|
||||
// before calling most Python APIs. If the GIL is enabled, then "attached"
|
||||
// implies that the thread holds the GIL and "detached" implies that the
|
||||
// thread does not hold the GIL (or is in the process of releasing it). In
|
||||
// `--disable-gil` builds, multiple threads may be "attached" to the same
|
||||
// interpreter at the same time. Only the "bound" thread may perform the
|
||||
// transitions between "attached" and "detached" on its own PyThreadState.
|
||||
// transitions between "attached" and "detached" on its own TyThreadState.
|
||||
//
|
||||
// The "suspended" state is used to implement stop-the-world pauses, such as
|
||||
// for cyclic garbage collection. It is only used in `--disable-gil` builds.
|
||||
@@ -73,8 +73,8 @@ PyAPI_FUNC(void) _TyInterpreterState_SetNotRunningMain(PyInterpreterState *);
|
||||
PyAPI_FUNC(int) _TyInterpreterState_IsRunningMain(PyInterpreterState *);
|
||||
PyAPI_FUNC(void) _TyErr_SetInterpreterAlreadyRunning(void);
|
||||
|
||||
extern int _TyThreadState_IsRunningMain(PyThreadState *);
|
||||
extern void _TyInterpreterState_ReinitRunningMain(PyThreadState *);
|
||||
extern int _TyThreadState_IsRunningMain(TyThreadState *);
|
||||
extern void _TyInterpreterState_ReinitRunningMain(TyThreadState *);
|
||||
extern const PyConfig* _Ty_GetMainConfig(void);
|
||||
|
||||
|
||||
@@ -90,19 +90,19 @@ _Ty_ThreadCanHandleSignals(PyInterpreterState *interp)
|
||||
and interpreter state */
|
||||
|
||||
#if defined(HAVE_THREAD_LOCAL) && !defined(Ty_BUILD_CORE_MODULE)
|
||||
extern _Ty_thread_local PyThreadState *_Ty_tss_tstate;
|
||||
extern _Ty_thread_local TyThreadState *_Ty_tss_tstate;
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
extern int _TyThreadState_CheckConsistency(PyThreadState *tstate);
|
||||
extern int _TyThreadState_CheckConsistency(TyThreadState *tstate);
|
||||
#endif
|
||||
|
||||
extern int _TyThreadState_MustExit(PyThreadState *tstate);
|
||||
extern void _TyThreadState_HangThread(PyThreadState *tstate);
|
||||
extern int _TyThreadState_MustExit(TyThreadState *tstate);
|
||||
extern void _TyThreadState_HangThread(TyThreadState *tstate);
|
||||
|
||||
// Export for most shared extensions, used via _TyThreadState_GET() static
|
||||
// inline function.
|
||||
PyAPI_FUNC(PyThreadState *) _TyThreadState_GetCurrent(void);
|
||||
PyAPI_FUNC(TyThreadState *) _TyThreadState_GetCurrent(void);
|
||||
|
||||
/* Get the current Python thread state.
|
||||
|
||||
@@ -111,7 +111,7 @@ PyAPI_FUNC(PyThreadState *) _TyThreadState_GetCurrent(void);
|
||||
The caller must hold the GIL.
|
||||
|
||||
See also TyThreadState_Get() and TyThreadState_GetUnchecked(). */
|
||||
static inline PyThreadState*
|
||||
static inline TyThreadState*
|
||||
_TyThreadState_GET(void)
|
||||
{
|
||||
#if defined(HAVE_THREAD_LOCAL) && !defined(Ty_BUILD_CORE_MODULE)
|
||||
@@ -122,7 +122,7 @@ _TyThreadState_GET(void)
|
||||
}
|
||||
|
||||
static inline int
|
||||
_TyThreadState_IsAttached(PyThreadState *tstate)
|
||||
_TyThreadState_IsAttached(TyThreadState *tstate)
|
||||
{
|
||||
return (_Ty_atomic_load_int_relaxed(&tstate->state) == _Ty_THREAD_ATTACHED);
|
||||
}
|
||||
@@ -134,25 +134,25 @@ _TyThreadState_IsAttached(PyThreadState *tstate)
|
||||
//
|
||||
// High-level code should generally call TyEval_RestoreThread() instead, which
|
||||
// calls this function.
|
||||
extern void _TyThreadState_Attach(PyThreadState *tstate);
|
||||
extern void _TyThreadState_Attach(TyThreadState *tstate);
|
||||
|
||||
// Detaches the current thread from the interpreter.
|
||||
//
|
||||
// High-level code should generally call TyEval_SaveThread() instead, which
|
||||
// calls this function.
|
||||
extern void _TyThreadState_Detach(PyThreadState *tstate);
|
||||
extern void _TyThreadState_Detach(TyThreadState *tstate);
|
||||
|
||||
// Detaches the current thread to the "suspended" state if a stop-the-world
|
||||
// pause is in progress.
|
||||
//
|
||||
// If there is no stop-the-world pause in progress, then the thread switches
|
||||
// to the "detached" state.
|
||||
extern void _TyThreadState_Suspend(PyThreadState *tstate);
|
||||
extern void _TyThreadState_Suspend(TyThreadState *tstate);
|
||||
|
||||
// Mark the thread state as "shutting down". This is used during interpreter
|
||||
// and runtime finalization. The thread may no longer attach to the
|
||||
// interpreter and will instead block via _TyThreadState_HangThread().
|
||||
extern void _TyThreadState_SetShuttingDown(PyThreadState *tstate);
|
||||
extern void _TyThreadState_SetShuttingDown(TyThreadState *tstate);
|
||||
|
||||
// Perform a stop-the-world pause for all threads in the all interpreters.
|
||||
//
|
||||
@@ -172,7 +172,7 @@ extern PyAPI_FUNC(void) _TyEval_StartTheWorld(PyInterpreterState *interp);
|
||||
|
||||
|
||||
static inline void
|
||||
_Ty_EnsureFuncTstateNotNULL(const char *func, PyThreadState *tstate)
|
||||
_Ty_EnsureFuncTstateNotNULL(const char *func, TyThreadState *tstate)
|
||||
{
|
||||
if (tstate == NULL) {
|
||||
#ifndef Ty_GIL_DISABLED
|
||||
@@ -204,7 +204,7 @@ _Ty_EnsureFuncTstateNotNULL(const char *func, PyThreadState *tstate)
|
||||
See also TyInterpreterState_Get()
|
||||
and _TyGILState_GetInterpreterStateUnsafe(). */
|
||||
static inline PyInterpreterState* _TyInterpreterState_GET(void) {
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
#ifdef Ty_DEBUG
|
||||
_Ty_EnsureTstateNotNULL(tstate);
|
||||
#endif
|
||||
@@ -212,22 +212,22 @@ static inline PyInterpreterState* _TyInterpreterState_GET(void) {
|
||||
}
|
||||
|
||||
|
||||
// PyThreadState functions
|
||||
// TyThreadState functions
|
||||
|
||||
// Export for _testinternalcapi
|
||||
PyAPI_FUNC(PyThreadState *) _TyThreadState_New(
|
||||
PyAPI_FUNC(TyThreadState *) _TyThreadState_New(
|
||||
PyInterpreterState *interp,
|
||||
int whence);
|
||||
extern void _TyThreadState_Bind(PyThreadState *tstate);
|
||||
PyAPI_FUNC(PyThreadState *) _TyThreadState_NewBound(
|
||||
extern void _TyThreadState_Bind(TyThreadState *tstate);
|
||||
PyAPI_FUNC(TyThreadState *) _TyThreadState_NewBound(
|
||||
PyInterpreterState *interp,
|
||||
int whence);
|
||||
extern PyThreadState * _TyThreadState_RemoveExcept(PyThreadState *tstate);
|
||||
extern void _TyThreadState_DeleteList(PyThreadState *list, int is_after_fork);
|
||||
extern void _TyThreadState_ClearMimallocHeaps(PyThreadState *tstate);
|
||||
extern TyThreadState * _TyThreadState_RemoveExcept(TyThreadState *tstate);
|
||||
extern void _TyThreadState_DeleteList(TyThreadState *list, int is_after_fork);
|
||||
extern void _TyThreadState_ClearMimallocHeaps(TyThreadState *tstate);
|
||||
|
||||
// Export for '_testinternalcapi' shared extension
|
||||
PyAPI_FUNC(TyObject*) _TyThreadState_GetDict(PyThreadState *tstate);
|
||||
PyAPI_FUNC(TyObject*) _TyThreadState_GetDict(TyThreadState *tstate);
|
||||
|
||||
/* The implementation of sys._current_exceptions() Returns a dict mapping
|
||||
thread id to that thread's current exception.
|
||||
@@ -237,25 +237,25 @@ extern TyObject* _PyThread_CurrentExceptions(void);
|
||||
|
||||
/* Other */
|
||||
|
||||
extern PyThreadState * _TyThreadState_Swap(
|
||||
extern TyThreadState * _TyThreadState_Swap(
|
||||
_PyRuntimeState *runtime,
|
||||
PyThreadState *newts);
|
||||
TyThreadState *newts);
|
||||
|
||||
extern PyStatus _TyInterpreterState_Enable(_PyRuntimeState *runtime);
|
||||
extern TyStatus _TyInterpreterState_Enable(_PyRuntimeState *runtime);
|
||||
|
||||
#ifdef HAVE_FORK
|
||||
extern PyStatus _TyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);
|
||||
extern TyStatus _TyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);
|
||||
extern void _PySignal_AfterFork(void);
|
||||
#endif
|
||||
|
||||
// Export for the stable ABI
|
||||
PyAPI_FUNC(int) _PyState_AddModule(
|
||||
PyThreadState *tstate,
|
||||
TyThreadState *tstate,
|
||||
TyObject* module,
|
||||
TyModuleDef* def);
|
||||
|
||||
|
||||
extern int _TyOS_InterruptOccurred(PyThreadState *tstate);
|
||||
extern int _TyOS_InterruptOccurred(TyThreadState *tstate);
|
||||
|
||||
#define HEAD_LOCK(runtime) \
|
||||
PyMutex_LockFlags(&(runtime)->interpreters.mutex, _Ty_LOCK_DONT_DETACH)
|
||||
@@ -263,7 +263,7 @@ extern int _TyOS_InterruptOccurred(PyThreadState *tstate);
|
||||
PyMutex_Unlock(&(runtime)->interpreters.mutex)
|
||||
|
||||
#define _Ty_FOR_EACH_TSTATE_UNLOCKED(interp, t) \
|
||||
for (PyThreadState *t = interp->threads.head; t; t = t->next)
|
||||
for (TyThreadState *t = interp->threads.head; t; t = t->next)
|
||||
#define _Ty_FOR_EACH_TSTATE_BEGIN(interp, t) \
|
||||
HEAD_LOCK(interp->runtime); \
|
||||
_Ty_FOR_EACH_TSTATE_UNLOCKED(interp, t)
|
||||
@@ -285,7 +285,7 @@ PyAPI_FUNC(const PyConfig*) _Ty_GetConfig(void);
|
||||
// See also TyInterpreterState_Get() and _TyInterpreterState_GET().
|
||||
extern PyInterpreterState* _TyGILState_GetInterpreterStateUnsafe(void);
|
||||
|
||||
extern TyObject * _Ty_GetMainModule(PyThreadState *);
|
||||
extern TyObject * _Ty_GetMainModule(TyThreadState *);
|
||||
extern int _Ty_CheckMainModule(TyObject *module);
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -293,7 +293,7 @@ extern int _Ty_CheckMainModule(TyObject *module);
|
||||
static inline void
|
||||
_Ty_AssertHoldsTstateFunc(const char *func)
|
||||
{
|
||||
PyThreadState *tstate = _TyThreadState_GET();
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
_Ty_EnsureFuncTstateNotNULL(func, tstate);
|
||||
}
|
||||
#define _Ty_AssertHoldsTstate() _Ty_AssertHoldsTstateFunc(__func__)
|
||||
@@ -321,7 +321,7 @@ _Ty_get_machine_stack_pointer(void) {
|
||||
}
|
||||
|
||||
static inline intptr_t
|
||||
_Ty_RecursionLimit_GetMargin(PyThreadState *tstate)
|
||||
_Ty_RecursionLimit_GetMargin(TyThreadState *tstate)
|
||||
{
|
||||
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
|
||||
assert(_tstate->c_stack_hard_limit != 0);
|
||||
|
||||
@@ -46,7 +46,7 @@ struct _qsbr_thread_state {
|
||||
struct _qsbr_shared *shared;
|
||||
|
||||
// Thread state (or NULL)
|
||||
PyThreadState *tstate;
|
||||
TyThreadState *tstate;
|
||||
|
||||
// Number of held items added by this thread since the last write sequence
|
||||
// advance
|
||||
@@ -151,14 +151,14 @@ _Ty_qsbr_detach(struct _qsbr_thread_state *qsbr);
|
||||
extern Ty_ssize_t
|
||||
_Ty_qsbr_reserve(PyInterpreterState *interp);
|
||||
|
||||
// Associates a PyThreadState with the QSBR state at the given index
|
||||
// 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);
|
||||
|
||||
// Disassociates a PyThreadState from the QSBR state and frees the QSBR state.
|
||||
// Disassociates a TyThreadState from the QSBR state and frees the QSBR state.
|
||||
extern void
|
||||
_Ty_qsbr_unregister(PyThreadState *tstate);
|
||||
_Ty_qsbr_unregister(TyThreadState *tstate);
|
||||
|
||||
extern void
|
||||
_Ty_qsbr_fini(PyInterpreterState *interp);
|
||||
|
||||
@@ -18,23 +18,23 @@ extern "C" {
|
||||
// It's also made accessible for debuggers and profilers.
|
||||
PyAPI_DATA(_PyRuntimeState) _PyRuntime;
|
||||
|
||||
extern PyStatus _PyRuntimeState_Init(_PyRuntimeState *runtime);
|
||||
extern TyStatus _PyRuntimeState_Init(_PyRuntimeState *runtime);
|
||||
extern void _PyRuntimeState_Fini(_PyRuntimeState *runtime);
|
||||
|
||||
#ifdef HAVE_FORK
|
||||
extern PyStatus _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime);
|
||||
extern TyStatus _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime);
|
||||
#endif
|
||||
|
||||
/* Initialize _PyRuntimeState.
|
||||
Return NULL on success, or return an error message on failure. */
|
||||
extern PyStatus _PyRuntime_Initialize(void);
|
||||
extern TyStatus _PyRuntime_Initialize(void);
|
||||
|
||||
extern void _PyRuntime_Finalize(void);
|
||||
|
||||
|
||||
static inline PyThreadState*
|
||||
static inline TyThreadState*
|
||||
_PyRuntimeState_GetFinalizing(_PyRuntimeState *runtime) {
|
||||
return (PyThreadState*)_Ty_atomic_load_ptr_relaxed(&runtime->_finalizing);
|
||||
return (TyThreadState*)_Ty_atomic_load_ptr_relaxed(&runtime->_finalizing);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
@@ -43,7 +43,7 @@ _PyRuntimeState_GetFinalizingID(_PyRuntimeState *runtime) {
|
||||
}
|
||||
|
||||
static inline void
|
||||
_PyRuntimeState_SetFinalizing(_PyRuntimeState *runtime, PyThreadState *tstate) {
|
||||
_PyRuntimeState_SetFinalizing(_PyRuntimeState *runtime, TyThreadState *tstate) {
|
||||
_Ty_atomic_store_ptr_relaxed(&runtime->_finalizing, tstate);
|
||||
if (tstate == NULL) {
|
||||
_Ty_atomic_store_ulong_relaxed(&runtime->_finalizing_id, 0);
|
||||
|
||||
@@ -181,7 +181,7 @@ struct pyruntimestate {
|
||||
|
||||
Use _PyRuntimeState_GetFinalizing() and _PyRuntimeState_SetFinalizing()
|
||||
to access it, don't access it directly. */
|
||||
PyThreadState *_finalizing;
|
||||
TyThreadState *_finalizing;
|
||||
/* The ID of the OS thread in which we are finalizing. */
|
||||
unsigned long _finalizing_id;
|
||||
|
||||
@@ -204,10 +204,10 @@ struct pyruntimestate {
|
||||
int64_t next_id;
|
||||
} interpreters;
|
||||
|
||||
/* Platform-specific identifier and PyThreadState, respectively, for the
|
||||
/* Platform-specific identifier and TyThreadState, respectively, for the
|
||||
main thread in the main interpreter. */
|
||||
unsigned long main_thread;
|
||||
PyThreadState *main_tstate;
|
||||
TyThreadState *main_tstate;
|
||||
|
||||
/* ---------- IMPORTANT ---------------------------
|
||||
The fields above this line are declared as early as
|
||||
@@ -226,7 +226,7 @@ struct pyruntimestate {
|
||||
/* Used for the thread state bound to the current thread. */
|
||||
Ty_tss_t autoTSSkey;
|
||||
|
||||
/* Used instead of PyThreadState.trash when there is not current tstate. */
|
||||
/* Used instead of TyThreadState.trash when there is not current tstate. */
|
||||
Ty_tss_t trashTSSkey;
|
||||
|
||||
PyWideStringList orig_argv;
|
||||
|
||||
@@ -725,7 +725,7 @@ PyStackRef_FunctionCheck(_PyStackRef stackref)
|
||||
}
|
||||
|
||||
static inline void
|
||||
_TyThreadState_PushCStackRef(PyThreadState *tstate, _PyCStackRef *ref)
|
||||
_TyThreadState_PushCStackRef(TyThreadState *tstate, _PyCStackRef *ref)
|
||||
{
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
_PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate;
|
||||
@@ -736,7 +736,7 @@ _TyThreadState_PushCStackRef(PyThreadState *tstate, _PyCStackRef *ref)
|
||||
}
|
||||
|
||||
static inline void
|
||||
_TyThreadState_PopCStackRef(PyThreadState *tstate, _PyCStackRef *ref)
|
||||
_TyThreadState_PopCStackRef(TyThreadState *tstate, _PyCStackRef *ref)
|
||||
{
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
_PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate;
|
||||
|
||||
@@ -326,7 +326,7 @@ extern PyTime_t _PyTimeFraction_Mul(
|
||||
extern double _PyTimeFraction_Resolution(
|
||||
const _PyTimeFraction *frac);
|
||||
|
||||
extern PyStatus _TyTime_Init(struct _Ty_time_runtime_state *state);
|
||||
extern TyStatus _TyTime_Init(struct _Ty_time_runtime_state *state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ PyAPI_FUNC(void) _TyTraceback_Add(const char *, const char *, int);
|
||||
|
||||
extern void _Ty_DumpTraceback(
|
||||
int fd,
|
||||
PyThreadState *tstate);
|
||||
TyThreadState *tstate);
|
||||
|
||||
/* Write the traceback of all threads into the file 'fd'. current_thread can be
|
||||
NULL.
|
||||
@@ -61,7 +61,7 @@ extern void _Ty_DumpTraceback(
|
||||
extern const char* _Ty_DumpTracebackThreads(
|
||||
int fd,
|
||||
PyInterpreterState *interp,
|
||||
PyThreadState *current_tstate);
|
||||
TyThreadState *current_tstate);
|
||||
|
||||
/* Write a Unicode object into the file descriptor fd. Encode the string to
|
||||
ASCII using the backslashreplace error handler.
|
||||
|
||||
@@ -138,7 +138,7 @@ extern TyObject* _PyTraceMalloc_GetTraces(void);
|
||||
extern TyObject* _PyTraceMalloc_GetObjectTraceback(TyObject *obj);
|
||||
|
||||
/* Initialize tracemalloc */
|
||||
extern PyStatus _PyTraceMalloc_Init(void);
|
||||
extern TyStatus _PyTraceMalloc_Init(void);
|
||||
|
||||
/* Start tracemalloc */
|
||||
extern int _PyTraceMalloc_Start(int max_nframe);
|
||||
|
||||
@@ -21,12 +21,12 @@ struct _gc_thread_state {
|
||||
};
|
||||
#endif
|
||||
|
||||
// Every PyThreadState is actually allocated as a _PyThreadStateImpl. The
|
||||
// PyThreadState fields are exposed as part of the C API, although most fields
|
||||
// Every TyThreadState is actually allocated as a _PyThreadStateImpl. The
|
||||
// TyThreadState fields are exposed as part of the C API, although most fields
|
||||
// are intended to be private. The _PyThreadStateImpl fields not exposed.
|
||||
typedef struct _PyThreadStateImpl {
|
||||
// semi-public fields are in PyThreadState.
|
||||
PyThreadState base;
|
||||
// semi-public fields are in TyThreadState.
|
||||
TyThreadState base;
|
||||
|
||||
// The reference count field is used to synchronize deallocation of the
|
||||
// thread state during runtime finalization.
|
||||
|
||||
@@ -16,7 +16,7 @@ extern void _TyTuple_DebugMallocStats(FILE *out);
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern PyStatus _TyTuple_InitGlobalObjects(PyInterpreterState *);
|
||||
extern TyStatus _TyTuple_InitGlobalObjects(PyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
|
||||
@@ -35,7 +35,7 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern PyStatus _PyTypes_InitTypes(PyInterpreterState *);
|
||||
extern TyStatus _PyTypes_InitTypes(PyInterpreterState *);
|
||||
extern void _PyTypes_FiniTypes(PyInterpreterState *);
|
||||
extern void _PyTypes_FiniExtTypes(PyInterpreterState *interp);
|
||||
extern void _PyTypes_Fini(PyInterpreterState *);
|
||||
|
||||
@@ -9,11 +9,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
extern TyObject *_Ty_make_typevar(TyObject *, TyObject *, TyObject *);
|
||||
extern TyObject *_Ty_make_paramspec(PyThreadState *, TyObject *);
|
||||
extern TyObject *_Ty_make_typevartuple(PyThreadState *, TyObject *);
|
||||
extern TyObject *_Ty_make_typealias(PyThreadState *, TyObject *);
|
||||
extern TyObject *_Ty_subscript_generic(PyThreadState *, TyObject *);
|
||||
extern TyObject *_Ty_set_typeparam_default(PyThreadState *, TyObject *, TyObject *);
|
||||
extern TyObject *_Ty_make_paramspec(TyThreadState *, TyObject *);
|
||||
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_typing_type_repr(PyUnicodeWriter *, TyObject *);
|
||||
|
||||
@@ -274,8 +274,8 @@ PyAPI_FUNC(Ty_ssize_t) _TyUnicode_ScanIdentifier(TyObject *);
|
||||
/* --- Runtime lifecycle -------------------------------------------------- */
|
||||
|
||||
extern void _TyUnicode_InitState(PyInterpreterState *);
|
||||
extern PyStatus _TyUnicode_InitGlobalObjects(PyInterpreterState *);
|
||||
extern PyStatus _TyUnicode_InitTypes(PyInterpreterState *);
|
||||
extern TyStatus _TyUnicode_InitGlobalObjects(PyInterpreterState *);
|
||||
extern TyStatus _TyUnicode_InitTypes(PyInterpreterState *);
|
||||
extern void _TyUnicode_Fini(PyInterpreterState *);
|
||||
extern void _TyUnicode_FiniTypes(PyInterpreterState *);
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ PyAPI_FUNC(int) Ty_FinalizeEx(void);
|
||||
PyAPI_FUNC(int) Ty_IsInitialized(void);
|
||||
|
||||
/* Subinterpreter support */
|
||||
PyAPI_FUNC(PyThreadState *) Ty_NewInterpreter(void);
|
||||
PyAPI_FUNC(void) Ty_EndInterpreter(PyThreadState *);
|
||||
PyAPI_FUNC(TyThreadState *) Ty_NewInterpreter(void);
|
||||
PyAPI_FUNC(void) Ty_EndInterpreter(TyThreadState *);
|
||||
|
||||
|
||||
/* Ty_PyAtExit is for the atexit module, Ty_AtExit is for low-level
|
||||
|
||||
@@ -45,9 +45,9 @@ PyAPI_FUNC(int) PyState_RemoveModule(TyModuleDef*);
|
||||
#endif
|
||||
PyAPI_FUNC(TyObject*) PyState_FindModule(TyModuleDef*);
|
||||
|
||||
PyAPI_FUNC(PyThreadState *) TyThreadState_New(PyInterpreterState *);
|
||||
PyAPI_FUNC(void) TyThreadState_Clear(PyThreadState *);
|
||||
PyAPI_FUNC(void) TyThreadState_Delete(PyThreadState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_New(PyInterpreterState *);
|
||||
PyAPI_FUNC(void) TyThreadState_Clear(TyThreadState *);
|
||||
PyAPI_FUNC(void) TyThreadState_Delete(TyThreadState *);
|
||||
|
||||
/* Get the current thread state.
|
||||
|
||||
@@ -57,20 +57,20 @@ PyAPI_FUNC(void) TyThreadState_Delete(PyThreadState *);
|
||||
The caller must hold the GIL.
|
||||
|
||||
See also TyThreadState_GetUnchecked() and _TyThreadState_GET(). */
|
||||
PyAPI_FUNC(PyThreadState *) TyThreadState_Get(void);
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_Get(void);
|
||||
|
||||
// Alias to TyThreadState_Get()
|
||||
#define TyThreadState_GET() TyThreadState_Get()
|
||||
|
||||
PyAPI_FUNC(PyThreadState *) TyThreadState_Swap(PyThreadState *);
|
||||
PyAPI_FUNC(TyThreadState *) TyThreadState_Swap(TyThreadState *);
|
||||
PyAPI_FUNC(TyObject *) TyThreadState_GetDict(void);
|
||||
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(PyThreadState *tstate);
|
||||
PyAPI_FUNC(PyFrameObject*) TyThreadState_GetFrame(PyThreadState *tstate);
|
||||
PyAPI_FUNC(uint64_t) TyThreadState_GetID(PyThreadState *tstate);
|
||||
PyAPI_FUNC(PyInterpreterState*) TyThreadState_GetInterpreter(TyThreadState *tstate);
|
||||
PyAPI_FUNC(PyFrameObject*) TyThreadState_GetFrame(TyThreadState *tstate);
|
||||
PyAPI_FUNC(uint64_t) TyThreadState_GetID(TyThreadState *tstate);
|
||||
#endif
|
||||
|
||||
typedef
|
||||
@@ -117,7 +117,7 @@ PyAPI_FUNC(void) TyGILState_Release(TyGILState_STATE);
|
||||
thread-state, even if no auto-thread-state call has been made
|
||||
on the main thread.
|
||||
*/
|
||||
PyAPI_FUNC(PyThreadState *) TyGILState_GetThisThreadState(void);
|
||||
PyAPI_FUNC(TyThreadState *) TyGILState_GetThisThreadState(void);
|
||||
|
||||
|
||||
#ifndef Ty_LIMITED_API
|
||||
|
||||
@@ -21,7 +21,7 @@ typedef struct _typeobject TyTypeObject;
|
||||
typedef struct PyCodeObject PyCodeObject;
|
||||
typedef struct _frame PyFrameObject;
|
||||
|
||||
typedef struct _ts PyThreadState;
|
||||
typedef struct _ts TyThreadState;
|
||||
typedef struct _is PyInterpreterState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user