From 3ce4b26be2a1da9602c0fc43792163c52e940daf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:23:23 +0000 Subject: [PATCH] Continue fixing Py_ to Ty_ renaming - fix missed patterns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- Include/ceval.h | 10 +- Include/cpython/ceval.h | 2 +- Include/cpython/critical_section.h | 2 +- Include/cpython/frameobject.h | 2 +- Include/cpython/initconfig.h | 34 +-- Include/cpython/object.h | 6 +- Include/cpython/pylifecycle.h | 14 +- Include/cpython/pystate.h | 20 +- Include/internal/pycore_audit.h | 4 +- Include/internal/pycore_bitutils.h | 6 +- Include/internal/pycore_brc.h | 6 +- Include/internal/pycore_call.h | 20 +- Include/internal/pycore_ceval.h | 98 +++---- Include/internal/pycore_code.h | 8 +- Include/internal/pycore_codecs.h | 2 +- Include/internal/pycore_context.h | 2 +- Include/internal/pycore_critical_section.h | 12 +- Include/internal/pycore_crossinterp.h | 48 ++-- .../pycore_crossinterp_data_registry.h | 4 +- Include/internal/pycore_debug_offsets.h | 22 +- Include/internal/pycore_dtoa.h | 2 +- Include/internal/pycore_exceptions.h | 4 +- Include/internal/pycore_floatobject.h | 2 +- Include/internal/pycore_freelist.h | 2 +- Include/internal/pycore_function.h | 4 +- Include/internal/pycore_gc.h | 8 +- Include/internal/pycore_genobject.h | 2 +- Include/internal/pycore_gil.h | 4 +- Include/internal/pycore_import.h | 10 +- Include/internal/pycore_initconfig.h | 40 +-- Include/internal/pycore_instruments.h | 14 +- Include/internal/pycore_interp.h | 12 +- Include/internal/pycore_interp_structs.h | 12 +- Include/internal/pycore_interpframe.h | 18 +- Include/internal/pycore_interpolation.h | 2 +- Include/internal/pycore_intrinsics.h | 4 +- Include/internal/pycore_jit.h | 2 +- Include/internal/pycore_long.h | 2 +- Include/internal/pycore_object.h | 8 +- Include/internal/pycore_pathconfig.h | 4 +- Include/internal/pycore_pyerrors.h | 44 ++-- Include/internal/pycore_pylifecycle.h | 34 +-- Include/internal/pycore_pymem.h | 6 +- Include/internal/pycore_pystate.h | 70 ++--- Include/internal/pycore_qsbr.h | 8 +- Include/internal/pycore_runtime.h | 12 +- Include/internal/pycore_runtime_structs.h | 8 +- Include/internal/pycore_stackref.h | 4 +- Include/internal/pycore_time.h | 2 +- Include/internal/pycore_traceback.h | 4 +- Include/internal/pycore_tracemalloc.h | 2 +- Include/internal/pycore_tstate.h | 8 +- Include/internal/pycore_tuple.h | 2 +- Include/internal/pycore_typeobject.h | 2 +- Include/internal/pycore_typevarobject.h | 10 +- Include/internal/pycore_unicodeobject.h | 4 +- Include/pylifecycle.h | 4 +- Include/pystate.h | 18 +- Include/pytypedefs.h | 2 +- Modules/_asynciomodule.c | 2 +- Modules/_ctypes/callproc.c | 2 +- Modules/_datetimemodule.c | 2 +- Modules/_decimal/_decimal.c | 6 +- Modules/_functoolsmodule.c | 4 +- Modules/_interpchannelsmodule.c | 6 +- Modules/_interpqueuesmodule.c | 6 +- Modules/_interpreters_common.h | 4 +- Modules/_interpretersmodule.c | 28 +- Modules/_lsprof.c | 2 +- Modules/_multiprocessing/semaphore.c | 2 +- Modules/_posixsubprocess.c | 2 +- Modules/_remote_debugging_module.c | 10 +- Modules/_ssl.c | 26 +- Modules/_testcapi/frame.c | 2 +- Modules/_testcapi/watchers.c | 2 +- Modules/_testcapimodule.c | 22 +- Modules/_testinternalcapi.c | 46 ++-- Modules/_threadmodule.c | 18 +- Modules/_tkinter.c | 16 +- Modules/_xxtestfuzz/fuzzer.c | 2 +- Modules/atexitmodule.c | 4 +- Modules/clinic/_asynciomodule.c.h | 6 +- Modules/clinic/_codecsmodule.c.h | 80 +++--- Modules/faulthandler.c | 18 +- Modules/gcmodule.c | 2 +- Modules/getpath.c | 4 +- Modules/getpath_noop.c | 2 +- Modules/main.c | 8 +- Modules/overlapped.c | 36 +-- Modules/posixmodule.c | 46 ++-- Modules/readline.c | 2 +- Modules/signalmodule.c | 16 +- Modules/socketmodule.c | 54 ++-- Objects/abstract.c | 26 +- Objects/call.c | 70 ++--- Objects/classobject.c | 2 +- Objects/codeobject.c | 12 +- Objects/descrobject.c | 16 +- Objects/dictobject.c | 2 +- Objects/exceptions.c | 6 +- Objects/floatobject.c | 2 +- Objects/frameobject.c | 6 +- Objects/funcobject.c | 4 +- Objects/genobject.c | 12 +- Objects/interpolationobject.c | 2 +- Objects/longobject.c | 4 +- Objects/methodobject.c | 16 +- Objects/object.c | 34 +-- Objects/obmalloc.c | 10 +- Objects/stringlib/join.h | 2 +- Objects/typeobject.c | 32 +-- Objects/typevarobject.c | 14 +- Objects/unicodeobject.c | 20 +- Parser/myreadline.c | 12 +- Parser/pegen.c | 2 +- Programs/_bootstrap_python.c | 2 +- Programs/_freeze_module.c | 2 +- Programs/_testembed.c | 40 +-- Python/_warnings.c | 20 +- Python/bltinmodule.c | 16 +- Python/bootstrap_hash.c | 2 +- Python/brc.c | 6 +- Python/bytecodes.c | 2 +- Python/ceval.c | 164 ++++++------ Python/ceval_gil.c | 72 ++--- Python/ceval_macros.h | 8 +- Python/codecs.c | 2 +- Python/context.c | 22 +- Python/critical_section.c | 8 +- Python/crossinterp.c | 140 +++++----- Python/crossinterp_data_lookup.h | 40 +-- Python/crossinterp_exceptions.h | 12 +- Python/dtoa.c | 2 +- Python/errors.c | 120 ++++----- Python/executor_cases.c.h | 10 +- Python/frozen_stubs.c | 2 +- Python/frozenmain.c | 2 +- Python/gc.c | 34 +-- Python/gc_free_threading.c | 26 +- Python/getargs.c | 24 +- Python/import.c | 108 ++++---- Python/initconfig.c | 164 ++++++------ Python/instrumentation.c | 32 +-- Python/intrinsics.c | 24 +- Python/legacy_tracing.c | 26 +- Python/optimizer.c | 2 +- Python/parking_lot.c | 2 +- Python/pathconfig.c | 6 +- Python/perf_trampoline.c | 14 +- Python/preconfig.c | 34 +-- Python/pylifecycle.c | 208 +++++++-------- Python/pystate.c | 248 +++++++++--------- Python/pythonrun.c | 20 +- Python/pytime.c | 6 +- Python/qsbr.c | 6 +- Python/remote_debug.h | 2 +- Python/remote_debugging.c | 2 +- Python/specialize.c | 112 ++++---- Python/symtable.c | 2 +- Python/sysmodule.c | 102 +++---- Python/thread.c | 2 +- Python/thread_nt.h | 2 +- Python/thread_pthread.h | 2 +- Python/traceback.c | 16 +- Python/tracemalloc.c | 4 +- Python/uniqueid.c | 2 +- Tools/jit/shim.c | 2 +- Tools/jit/template.c | 2 +- 168 files changed, 1723 insertions(+), 1723 deletions(-) diff --git a/Include/ceval.h b/Include/ceval.h index 0283a38..83bd1dc 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -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(); diff --git a/Include/cpython/ceval.h b/Include/cpython/ceval.h index fa03df0..62fc748 100644 --- a/Include/cpython/ceval.h +++ b/Include/cpython/ceval.h @@ -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: diff --git a/Include/cpython/critical_section.h b/Include/cpython/critical_section.h index d597743..5d9f788 100644 --- a/Include/cpython/critical_section.h +++ b/Include/cpython/critical_section.h @@ -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 diff --git a/Include/cpython/frameobject.h b/Include/cpython/frameobject.h index e1a087a..a47e231 100644 --- a/Include/cpython/frameobject.h +++ b/Include/cpython/frameobject.h @@ -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 */ diff --git a/Include/cpython/initconfig.h b/Include/cpython/initconfig.h index c8a1ec4..7e7f3ce 100644 --- a/Include/cpython/initconfig.h +++ b/Include/cpython/initconfig.h @@ -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); diff --git a/Include/cpython/object.h b/Include/cpython/object.h index c7cc0fa..eaca70f 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -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) diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h index 98abdee..90bde21 100644 --- a/Include/cpython/pylifecycle.h +++ b/Include/cpython/pylifecycle.h @@ -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 *); diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index 93daccd..be4b9d0 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -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); diff --git a/Include/internal/pycore_audit.h b/Include/internal/pycore_audit.h index 1d21ea3..76a6eb3 100644 --- a/Include/internal/pycore_audit.h +++ b/Include/internal/pycore_audit.h @@ -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 diff --git a/Include/internal/pycore_bitutils.h b/Include/internal/pycore_bitutils.h index 30b574d..d78bc89 100644 --- a/Include/internal/pycore_bitutils.h +++ b/Include/internal/pycore_bitutils.h @@ -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); diff --git a/Include/internal/pycore_brc.h b/Include/internal/pycore_brc.h index 87008dd..737faab 100644 --- a/Include/internal/pycore_brc.h +++ b/Include/internal/pycore_brc.h @@ -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 */ diff --git a/Include/internal/pycore_call.h b/Include/internal/pycore_call.h index 374204c..81297a0 100644 --- a/Include/internal/pycore_call.h +++ b/Include/internal/pycore_call.h @@ -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); diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index e3051bc..7812932 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -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 */ diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 78771c3..84ea1ce 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -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, diff --git a/Include/internal/pycore_codecs.h b/Include/internal/pycore_codecs.h index 27f2caf..e33c898 100644 --- a/Include/internal/pycore_codecs.h +++ b/Include/internal/pycore_codecs.h @@ -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. */ diff --git a/Include/internal/pycore_context.h b/Include/internal/pycore_context.h index 8404bbe..5150e76 100644 --- a/Include/internal/pycore_context.h +++ b/Include/internal/pycore_context.h @@ -11,7 +11,7 @@ extern TyTypeObject _PyContextTokenMissing_Type; /* runtime lifecycle */ -PyStatus _TyContext_Init(PyInterpreterState *); +TyStatus _TyContext_Init(PyInterpreterState *); /* other API */ diff --git a/Include/internal/pycore_critical_section.h b/Include/internal/pycore_critical_section.h index 5ba8fd9..9bab066 100644 --- a/Include/internal/pycore_critical_section.h +++ b/Include/internal/pycore_critical_section.h @@ -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); diff --git a/Include/internal/pycore_crossinterp.h b/Include/internal/pycore_crossinterp.h index 7cda1e0..7bf193f 100644 --- a/Include/internal/pycore_crossinterp.h +++ b/Include/internal/pycore_crossinterp.h @@ -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 diff --git a/Include/internal/pycore_crossinterp_data_registry.h b/Include/internal/pycore_crossinterp_data_registry.h index c894ba8..67dc0fd 100644 --- a/Include/internal/pycore_crossinterp_data_registry.h +++ b/Include/internal/pycore_crossinterp_data_registry.h @@ -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 { diff --git a/Include/internal/pycore_debug_offsets.h b/Include/internal/pycore_debug_offsets.h index e02cd1f..fad66b3 100644 --- a/Include/internal/pycore_debug_offsets.h +++ b/Include/internal/pycore_debug_offsets.h @@ -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), \ diff --git a/Include/internal/pycore_dtoa.h b/Include/internal/pycore_dtoa.h index b2914d9..5893679 100644 --- a/Include/internal/pycore_dtoa.h +++ b/Include/internal/pycore_dtoa.h @@ -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); diff --git a/Include/internal/pycore_exceptions.h b/Include/internal/pycore_exceptions.h index f64c767..b5e35de 100644 --- a/Include/internal/pycore_exceptions.h +++ b/Include/internal/pycore_exceptions.h @@ -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 *); diff --git a/Include/internal/pycore_floatobject.h b/Include/internal/pycore_floatobject.h index 4e64d33..6fd0b8f 100644 --- a/Include/internal/pycore_floatobject.h +++ b/Include/internal/pycore_floatobject.h @@ -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 *); diff --git a/Include/internal/pycore_freelist.h b/Include/internal/pycore_freelist.h index 40e3160..149e609 100644 --- a/Include/internal/pycore_freelist.h +++ b/Include/internal/pycore_freelist.h @@ -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 diff --git a/Include/internal/pycore_function.h b/Include/internal/pycore_function.h index a47e218..a645022 100644 --- a/Include/internal/pycore_function.h +++ b/Include/internal/pycore_function.h @@ -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; diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h index e23e016..4fbf7f3 100644 --- a/Include/internal/pycore_gc.h +++ b/Include/internal/pycore_gc.h @@ -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; diff --git a/Include/internal/pycore_genobject.h b/Include/internal/pycore_genobject.h index 134af6d..40af18c 100644 --- a/Include/internal/pycore_genobject.h +++ b/Include/internal/pycore_genobject.h @@ -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; diff --git a/Include/internal/pycore_gil.h b/Include/internal/pycore_gil.h index 5860645..89bf757 100644 --- a/Include/internal/pycore_gil.h +++ b/Include/internal/pycore_gil.h @@ -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; diff --git a/Include/internal/pycore_import.h b/Include/internal/pycore_import.h index fb27aff..95d5170 100644 --- a/Include/internal/pycore_import.h +++ b/Include/internal/pycore_import.h @@ -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); diff --git a/Include/internal/pycore_initconfig.h b/Include/internal/pycore_initconfig.h index be84a47..ddec329 100644 --- a/Include/internal/pycore_initconfig.h +++ b/Include/internal/pycore_initconfig.h @@ -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 ---------------------------------- */ diff --git a/Include/internal/pycore_instruments.h b/Include/internal/pycore_instruments.h index 92d595f..56b7b25 100644 --- a/Include/internal/pycore_instruments.h +++ b/Include/internal/pycore_instruments.h @@ -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 diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 57d52fb..4ce7cd8 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -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( diff --git a/Include/internal/pycore_interp_structs.h b/Include/internal/pycore_interp_structs.h index a96979f..5ed3d3f 100644 --- a/Include/internal/pycore_interp_structs.h +++ b/Include/internal/pycore_interp_structs.h @@ -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; diff --git a/Include/internal/pycore_interpframe.h b/Include/internal/pycore_interpframe.h index b696cd9..a659d09 100644 --- a/Include/internal/pycore_interpframe.h +++ b/Include/internal/pycore_interpframe.h @@ -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); diff --git a/Include/internal/pycore_interpolation.h b/Include/internal/pycore_interpolation.h index 3181f63..58cccdb 100644 --- a/Include/internal/pycore_interpolation.h +++ b/Include/internal/pycore_interpolation.h @@ -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 diff --git a/Include/internal/pycore_intrinsics.h b/Include/internal/pycore_intrinsics.h index ea7ace6..354824c 100644 --- a/Include/internal/pycore_intrinsics.h +++ b/Include/internal/pycore_intrinsics.h @@ -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; diff --git a/Include/internal/pycore_jit.h b/Include/internal/pycore_jit.h index e086915..7f73b70 100644 --- a/Include/internal/pycore_jit.h +++ b/Include/internal/pycore_jit.h @@ -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); diff --git a/Include/internal/pycore_long.h b/Include/internal/pycore_long.h index f888390..022e7c4 100644 --- a/Include/internal/pycore_long.h +++ b/Include/internal/pycore_long.h @@ -48,7 +48,7 @@ extern "C" { /* runtime lifecycle */ -extern PyStatus _TyLong_InitTypes(PyInterpreterState *); +extern TyStatus _TyLong_InitTypes(PyInterpreterState *); extern void _TyLong_FiniTypes(PyInterpreterState *interp); diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 0d783a1..01ba33d 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -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); diff --git a/Include/internal/pycore_pathconfig.h b/Include/internal/pycore_pathconfig.h index 09e5a59..5872762 100644 --- a/Include/internal/pycore_pathconfig.h +++ b/Include/internal/pycore_pathconfig.h @@ -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( diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h index 8332c3c..8bcf7f1 100644 --- a/Include/internal/pycore_pyerrors.h +++ b/Include/internal/pycore_pyerrors.h @@ -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); diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index 48b4e17..a919e84 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -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); diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h index 8c41b06..7ede594 100644 --- a/Include/internal/pycore_pymem.h +++ b/Include/internal/pycore_pymem.h @@ -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); diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index 2d18399..8777d93 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -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); diff --git a/Include/internal/pycore_qsbr.h b/Include/internal/pycore_qsbr.h index bafffdb..4de9608 100644 --- a/Include/internal/pycore_qsbr.h +++ b/Include/internal/pycore_qsbr.h @@ -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); diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index d75e856..5b361f9 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -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); diff --git a/Include/internal/pycore_runtime_structs.h b/Include/internal/pycore_runtime_structs.h index 731dca0..6f13546 100644 --- a/Include/internal/pycore_runtime_structs.h +++ b/Include/internal/pycore_runtime_structs.h @@ -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; diff --git a/Include/internal/pycore_stackref.h b/Include/internal/pycore_stackref.h index fb5cde3..b79e84b 100644 --- a/Include/internal/pycore_stackref.h +++ b/Include/internal/pycore_stackref.h @@ -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; diff --git a/Include/internal/pycore_time.h b/Include/internal/pycore_time.h index 5f4d60c..740d581 100644 --- a/Include/internal/pycore_time.h +++ b/Include/internal/pycore_time.h @@ -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 } diff --git a/Include/internal/pycore_traceback.h b/Include/internal/pycore_traceback.h index b29e2f1..dbc46e4 100644 --- a/Include/internal/pycore_traceback.h +++ b/Include/internal/pycore_traceback.h @@ -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. diff --git a/Include/internal/pycore_tracemalloc.h b/Include/internal/pycore_tracemalloc.h index 2b31c4e..1c144e3 100644 --- a/Include/internal/pycore_tracemalloc.h +++ b/Include/internal/pycore_tracemalloc.h @@ -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); diff --git a/Include/internal/pycore_tstate.h b/Include/internal/pycore_tstate.h index 95e0f14..5398d14 100644 --- a/Include/internal/pycore_tstate.h +++ b/Include/internal/pycore_tstate.h @@ -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. diff --git a/Include/internal/pycore_tuple.h b/Include/internal/pycore_tuple.h index 88d8582..be290f5 100644 --- a/Include/internal/pycore_tuple.h +++ b/Include/internal/pycore_tuple.h @@ -16,7 +16,7 @@ extern void _TyTuple_DebugMallocStats(FILE *out); /* runtime lifecycle */ -extern PyStatus _TyTuple_InitGlobalObjects(PyInterpreterState *); +extern TyStatus _TyTuple_InitGlobalObjects(PyInterpreterState *); /* other API */ diff --git a/Include/internal/pycore_typeobject.h b/Include/internal/pycore_typeobject.h index 33a28f9..40e7d7e 100644 --- a/Include/internal/pycore_typeobject.h +++ b/Include/internal/pycore_typeobject.h @@ -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 *); diff --git a/Include/internal/pycore_typevarobject.h b/Include/internal/pycore_typevarobject.h index d4cb36a..a53ccd5 100644 --- a/Include/internal/pycore_typevarobject.h +++ b/Include/internal/pycore_typevarobject.h @@ -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 *); diff --git a/Include/internal/pycore_unicodeobject.h b/Include/internal/pycore_unicodeobject.h index ee26655..3ee8172 100644 --- a/Include/internal/pycore_unicodeobject.h +++ b/Include/internal/pycore_unicodeobject.h @@ -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 *); diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 9c8591c..7cb5d28 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -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 diff --git a/Include/pystate.h b/Include/pystate.h index 2719b98..28553c2 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -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 diff --git a/Include/pytypedefs.h b/Include/pytypedefs.h index 3e084aa..19935ba 100644 --- a/Include/pytypedefs.h +++ b/Include/pytypedefs.h @@ -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 diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 35660d4..8b9ccea 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -2230,7 +2230,7 @@ unregister_task(TaskObj *task) else { // we are in a different thread // stop the world then check and remove the task - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyEval_StopTheWorld(tstate->interp); unregister_task_safe(task); _TyEval_StartTheWorld(tstate->interp); diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 1fe58db..808efe3 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -837,7 +837,7 @@ static int _call_function_pointer(ctypes_state *st, int argcount, int argtypecount) { - PyThreadState *_save = NULL; /* For Ty_BLOCK_THREADS and Ty_UNBLOCK_THREADS */ + TyThreadState *_save = NULL; /* For Ty_BLOCK_THREADS and Ty_UNBLOCK_THREADS */ TyObject *error_object = NULL; int *space; ffi_cif cif; diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 2540484..91ec3e9 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -7308,7 +7308,7 @@ clear_state(datetime_state *st) } -PyStatus +TyStatus _PyDateTime_InitTypes(PyInterpreterState *interp) { /* Bases classes must be initialized before subclasses, diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index 708ee96..c816f71 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -211,7 +211,7 @@ typedef struct PyDecContextObject { TyObject *traps; TyObject *flags; int capitals; - PyThreadState *tstate; + TyThreadState *tstate; decimal_state *modstate; } PyDecContextObject; @@ -1696,7 +1696,7 @@ static TyGetSetDef context_getsets [] = static TyObject * current_context_from_dict(decimal_state *modstate) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); #ifdef Ty_DEBUG // The caller must hold the GIL _Ty_EnsureTstateNotNULL(tstate); @@ -1748,7 +1748,7 @@ current_context_from_dict(decimal_state *modstate) static TyObject * current_context(decimal_state *modstate) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (modstate->cached_context && modstate->cached_context->tstate == tstate) { return (TyObject *)(modstate->cached_context); } diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 3f1a030..94c1b1f 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -371,7 +371,7 @@ partial_descr_get(TyObject *self, TyObject *obj, TyObject *type) * if we would need to do that, we stop using vectorcall and fall back * to using partial_call() instead. */ Ty_NO_INLINE static TyObject * -partial_vectorcall_fallback(PyThreadState *tstate, partialobject *pto, +partial_vectorcall_fallback(TyThreadState *tstate, partialobject *pto, TyObject *const *args, size_t nargsf, TyObject *kwnames) { @@ -385,7 +385,7 @@ partial_vectorcall(TyObject *self, TyObject *const *args, size_t nargsf, TyObject *kwnames) { partialobject *pto = partialobject_CAST(self);; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); /* pto->kw is mutable, so need to check every time */ diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c index 2bb7b4c..1ce3822 100644 --- a/Modules/_interpchannelsmodule.c +++ b/Modules/_interpchannelsmodule.c @@ -1774,7 +1774,7 @@ static int channel_send(_channels *channels, int64_t cid, TyObject *obj, _waiting_t *waiting, unboundop_t unboundop, xidata_fallback_t fallback) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); PyInterpreterState *interp = tstate->interp; int64_t interpid = TyInterpreterState_GetID(interp); @@ -2629,7 +2629,7 @@ done: } static int -_channelid_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *data) +_channelid_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *data) { if (_PyXIData_InitWithSize( data, tstate->interp, sizeof(struct _channelid_xid), obj, @@ -2790,7 +2790,7 @@ _channelend_from_xid(_PyXIData_t *data) } static int -_channelend_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *data) +_channelend_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *data) { TyObject *cidobj = PyObject_GetAttrString(obj, "_id"); if (cidobj == NULL) { diff --git a/Modules/_interpqueuesmodule.c b/Modules/_interpqueuesmodule.c index 5568f23..8225b67 100644 --- a/Modules/_interpqueuesmodule.c +++ b/Modules/_interpqueuesmodule.c @@ -1121,7 +1121,7 @@ static int queue_put(_queues *queues, int64_t qid, TyObject *obj, unboundop_t unboundop, xidata_fallback_t fallback) { - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); // Look up the queue. _queue *queue = NULL; @@ -1266,7 +1266,7 @@ queue_get_count(_queues *queues, int64_t qid, Ty_ssize_t *p_count) /* external Queue objects ***************************************************/ -static int _queueobj_shared(PyThreadState *, TyObject *, _PyXIData_t *); +static int _queueobj_shared(TyThreadState *, TyObject *, _PyXIData_t *); static int set_external_queue_type(module_state *state, TyTypeObject *queue_type) @@ -1374,7 +1374,7 @@ _queueobj_from_xid(_PyXIData_t *data) } static int -_queueobj_shared(PyThreadState *tstate, TyObject *queueobj, _PyXIData_t *data) +_queueobj_shared(TyThreadState *tstate, TyObject *queueobj, _PyXIData_t *data) { TyObject *qidobj = PyObject_GetAttrString(queueobj, "_id"); if (qidobj == NULL) { diff --git a/Modules/_interpreters_common.h b/Modules/_interpreters_common.h index a3ef09c..3a036f8 100644 --- a/Modules/_interpreters_common.h +++ b/Modules/_interpreters_common.h @@ -10,7 +10,7 @@ static int ensure_xid_class(TyTypeObject *cls, _PyXIData_getdata_t getdata) { - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); return _PyXIData_RegisterClass(tstate, cls, getdata); } @@ -18,7 +18,7 @@ ensure_xid_class(TyTypeObject *cls, _PyXIData_getdata_t getdata) static int clear_xid_class(TyTypeObject *cls) { - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); return _PyXIData_UnregisterClass(tstate, cls); } #endif diff --git a/Modules/_interpretersmodule.c b/Modules/_interpretersmodule.c index 6be9a7f..b28a831 100644 --- a/Modules/_interpretersmodule.c +++ b/Modules/_interpretersmodule.c @@ -73,14 +73,14 @@ is_running_main(PyInterpreterState *interp) static inline int -is_notshareable_raised(PyThreadState *tstate) +is_notshareable_raised(TyThreadState *tstate) { TyObject *exctype = _PyXIData_GetNotShareableErrorType(tstate); return _TyErr_ExceptionMatches(tstate, exctype); } static void -unwrap_not_shareable(PyThreadState *tstate, _PyXI_failure *failure) +unwrap_not_shareable(TyThreadState *tstate, _PyXI_failure *failure) { if (_PyXI_UnwrapNotShareableError(tstate, failure) < 0) { _TyErr_Clear(tstate); @@ -266,7 +266,7 @@ _pybuffer_shared_free(void* data) } static int -_pybuffer_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *data) +_pybuffer_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *data) { struct xibuffer *view = TyMem_RawMalloc(sizeof(struct xibuffer)); if (view == NULL) { @@ -465,7 +465,7 @@ _interp_call_clear(struct interp_call *call) } static int -_interp_call_pack(PyThreadState *tstate, struct interp_call *call, +_interp_call_pack(TyThreadState *tstate, struct interp_call *call, TyObject *func, TyObject *args, TyObject *kwargs) { xidata_fallback_t fallback = _PyXIDATA_FULL_FALLBACK; @@ -523,7 +523,7 @@ _interp_call_pack(PyThreadState *tstate, struct interp_call *call, } static void -wrap_notshareable(PyThreadState *tstate, const char *label) +wrap_notshareable(TyThreadState *tstate, const char *label) { if (!is_notshareable_raised(tstate)) { return; @@ -540,7 +540,7 @@ static int _interp_call_unpack(struct interp_call *call, TyObject **p_func, TyObject **p_args, TyObject **p_kwargs) { - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); // Unpack the func. TyObject *func = _PyXIData_NewObject(call->func); @@ -589,7 +589,7 @@ _make_call(struct interp_call *call, TyObject **p_result, _PyXI_failure *failure) { assert(call != NULL && call->func != NULL); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); // Get the func and args. TyObject *func = NULL, *args = NULL, *kwargs = NULL; @@ -647,7 +647,7 @@ _run_result_clear(struct run_result *runres) } static int -_run_in_interpreter(PyThreadState *tstate, PyInterpreterState *interp, +_run_in_interpreter(TyThreadState *tstate, PyInterpreterState *interp, _PyXIData_t *script, struct interp_call *call, TyObject *shareables, struct run_result *runres) { @@ -1113,7 +1113,7 @@ static TyObject * interp_exec(TyObject *self, TyObject *args, TyObject *kwds) { #define FUNCNAME MODULE_NAME_STR ".exec" - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); static char *kwlist[] = {"id", "code", "shared", "restrict", NULL}; TyObject *id, *code; TyObject *shared = NULL; @@ -1174,7 +1174,7 @@ static TyObject * interp_run_string(TyObject *self, TyObject *args, TyObject *kwds) { #define FUNCNAME MODULE_NAME_STR ".run_string" - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); static char *kwlist[] = {"id", "script", "shared", "restrict", NULL}; TyObject *id, *script; TyObject *shared = NULL; @@ -1228,7 +1228,7 @@ static TyObject * interp_run_func(TyObject *self, TyObject *args, TyObject *kwds) { #define FUNCNAME MODULE_NAME_STR ".run_func" - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); static char *kwlist[] = {"id", "func", "shared", "restrict", NULL}; TyObject *id, *func; TyObject *shared = NULL; @@ -1293,7 +1293,7 @@ static TyObject * interp_call(TyObject *self, TyObject *args, TyObject *kwds) { #define FUNCNAME MODULE_NAME_STR ".call" - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); static char *kwlist[] = {"id", "callable", "args", "kwargs", "preserve_exc", "restrict", NULL}; TyObject *id, *callable; @@ -1361,7 +1361,7 @@ object_is_shareable(TyObject *self, TyObject *args, TyObject *kwds) return NULL; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TyObject_CheckXIData(tstate, obj) == 0) { Py_RETURN_TRUE; } @@ -1655,7 +1655,7 @@ The 'interpreters' module provides a more convenient interface."); static int module_exec(TyObject *mod) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); module_state *state = get_module_state(mod); #define ADD_WHENCE(NAME) \ diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 6d525f5..972989b 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -961,7 +961,7 @@ profiler_dealloc(TyObject *op) ProfilerObject *self = ProfilerObject_CAST(op); PyObject_GC_UnTrack(self); if (self->flags & POF_ENABLED) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TyEval_SetProfile(tstate, NULL, NULL) < 0) { TyErr_FormatUnraisable("Exception ignored while " "destroying _lsprof profiler"); diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index 0da3a95..fcb3407 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -242,7 +242,7 @@ _multiprocessing_SemLock_release_impl(SemLockObject *self) # define sem_timedwait(sem,deadline) sem_timedwait_save(sem,deadline,_save) static int -sem_timedwait_save(sem_t *sem, struct timespec *deadline, PyThreadState *_save) +sem_timedwait_save(sem_t *sem, struct timespec *deadline, TyThreadState *_save) { int res; unsigned long delay, difference; diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index c5e7a7f..e60b431 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -889,7 +889,7 @@ do_fork_exec(char *const exec_array[], pid_t pid; #ifdef VFORK_USABLE - PyThreadState *vfork_tstate_save; + TyThreadState *vfork_tstate_save; if (child_sigmask) { /* These are checked by our caller; verify them in debug builds. */ assert(uid == (uid_t)-1); diff --git a/Modules/_remote_debugging_module.c b/Modules/_remote_debugging_module.c index 5266aaa..89d5e93 100644 --- a/Modules/_remote_debugging_module.c +++ b/Modules/_remote_debugging_module.c @@ -52,7 +52,7 @@ #define SIZEOF_PYOBJECT sizeof(TyObject) #define SIZEOF_SET_OBJ sizeof(PySetObject) #define SIZEOF_TASK_OBJ 4096 -#define SIZEOF_THREAD_STATE sizeof(PyThreadState) +#define SIZEOF_THREAD_STATE sizeof(TyThreadState) #define SIZEOF_TYPE_OBJ sizeof(TyTypeObject) #define SIZEOF_UNICODE_OBJ sizeof(PyUnicodeObject) #define SIZEOF_LONG_OBJ sizeof(PyLongObject) @@ -67,11 +67,11 @@ #define INTERP_STATE_MIN_SIZE MAX(MAX(MAX(offsetof(PyInterpreterState, _code_object_generation) + sizeof(uint64_t), \ offsetof(PyInterpreterState, tlbc_indices.tlbc_generation) + sizeof(uint32_t)), \ offsetof(PyInterpreterState, threads.head) + sizeof(void*)), \ - offsetof(PyInterpreterState, _gil.last_holder) + sizeof(PyThreadState*)) + offsetof(PyInterpreterState, _gil.last_holder) + sizeof(TyThreadState*)) #else #define INTERP_STATE_MIN_SIZE MAX(MAX(offsetof(PyInterpreterState, _code_object_generation) + sizeof(uint64_t), \ offsetof(PyInterpreterState, threads.head) + sizeof(void*)), \ - offsetof(PyInterpreterState, _gil.last_holder) + sizeof(PyThreadState*)) + offsetof(PyInterpreterState, _gil.last_holder) + sizeof(TyThreadState*)) #endif #define INTERP_STATE_BUFFER_SIZE MAX(INTERP_STATE_MIN_SIZE, 256) @@ -2683,7 +2683,7 @@ _remote_debugging_RemoteUnwinder_get_stack_trace_impl(RemoteUnwinderObject *self } // If only_active_thread is true, we need to determine which thread holds the GIL - PyThreadState* gil_holder = NULL; + TyThreadState* gil_holder = NULL; if (self->only_active_thread) { // The GIL state is already in interp_state_buffer, just read from there // Check if GIL is locked @@ -2692,7 +2692,7 @@ _remote_debugging_RemoteUnwinder_get_stack_trace_impl(RemoteUnwinderObject *self if (gil_locked) { // Get the last holder (current holder when GIL is locked) - gil_holder = GET_MEMBER(PyThreadState*, interp_state_buffer, + gil_holder = GET_MEMBER(TyThreadState*, interp_state_buffer, self->debug_offsets.interpreter_state.gil_runtime_state_holder); } else { // GIL is not locked, return empty list diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 2a8bc90..42707d6 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -48,7 +48,7 @@ #define PySSL_END_ALLOW_THREADS_S(save) \ do { TyEval_RestoreThread(save); _PySSL_FIX_ERRNO; } while(0) #define PySSL_BEGIN_ALLOW_THREADS { \ - PyThreadState *_save = NULL; \ + TyThreadState *_save = NULL; \ PySSL_BEGIN_ALLOW_THREADS_S(_save); #define PySSL_END_ALLOW_THREADS PySSL_END_ALLOW_THREADS_S(_save); } @@ -2445,7 +2445,7 @@ PySSL_select(PySocketSockObject *s, int writing, PyTime_t timeout) /*[clinic input] @critical_section _ssl._SSLSocket.write - b: Py_buffer + b: Ty_buffer / Writes the bytes-like object b into the SSL object. @@ -2454,7 +2454,7 @@ Returns the number of bytes written. [clinic start generated code]*/ static TyObject * -_ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b) +_ssl__SSLSocket_write_impl(PySSLSocket *self, Ty_buffer *b) /*[clinic end generated code: output=aa7a6be5527358d8 input=967b5feeae641a26]*/ { size_t count = 0; @@ -2583,7 +2583,7 @@ _ssl__SSLSocket_pending_impl(PySSLSocket *self) _ssl._SSLSocket.read size as len: Ty_ssize_t [ - buffer: Py_buffer(accept={rwbuffer}) + buffer: Ty_buffer(accept={rwbuffer}) ] / @@ -2592,7 +2592,7 @@ Read up to size bytes from the SSL socket. static TyObject * _ssl__SSLSocket_read_impl(PySSLSocket *self, Ty_ssize_t len, - int group_right_1, Py_buffer *buffer) + int group_right_1, Ty_buffer *buffer) /*[clinic end generated code: output=49b16e6406023734 input=80ed30436df01a71]*/ { TyObject *dest = NULL; @@ -3442,13 +3442,13 @@ _selectALPN_cb(SSL *s, /*[clinic input] @critical_section _ssl._SSLContext._set_alpn_protocols - protos: Py_buffer + protos: Ty_buffer / [clinic start generated code]*/ static TyObject * _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self, - Py_buffer *protos) + Ty_buffer *protos) /*[clinic end generated code: output=87599a7f76651a9b input=b5096b186e49287d]*/ { if ((size_t)protos->len > UINT_MAX) { @@ -3970,7 +3970,7 @@ _ssl__SSLContext_protocol_get_impl(PySSLContext *self) } typedef struct { - PyThreadState *thread_state; + TyThreadState *thread_state; TyObject *callable; char *password; int size; @@ -4351,7 +4351,7 @@ _ssl__SSLContext_load_verify_locations_impl(PySSLContext *self, } } else if (PyObject_CheckBuffer(cadata)) { - Py_buffer buf; + Ty_buffer buf; if (PyObject_GetBuffer(cadata, &buf, PyBUF_SIMPLE)) { goto error; } @@ -5422,7 +5422,7 @@ _ssl_MemoryBIO_read_impl(PySSLMemoryBIO *self, int len) /*[clinic input] @critical_section _ssl.MemoryBIO.write - b: Py_buffer + b: Ty_buffer / Writes the bytes b into the memory BIO. @@ -5431,7 +5431,7 @@ Returns the number of bytes written. [clinic start generated code]*/ static TyObject * -_ssl_MemoryBIO_write_impl(PySSLMemoryBIO *self, Py_buffer *b) +_ssl_MemoryBIO_write_impl(PySSLMemoryBIO *self, Ty_buffer *b) /*[clinic end generated code: output=156ec59110d75935 input=107da3f5fba26b37]*/ { int nbytes; @@ -5727,7 +5727,7 @@ static TyType_Spec PySSLSession_spec = { /*[clinic input] @critical_section _ssl.RAND_add - string as view: Py_buffer(accept={str, buffer}) + string as view: Ty_buffer(accept={str, buffer}) entropy: double / @@ -5738,7 +5738,7 @@ string. See RFC 4086. [clinic start generated code]*/ static TyObject * -_ssl_RAND_add_impl(TyObject *module, Py_buffer *view, double entropy) +_ssl_RAND_add_impl(TyObject *module, Ty_buffer *view, double entropy) /*[clinic end generated code: output=e6dd48df9c9024e9 input=313cb73b34db31d5]*/ { const char *buf; diff --git a/Modules/_testcapi/frame.c b/Modules/_testcapi/frame.c index b9a8720..f9d60a2 100644 --- a/Modules/_testcapi/frame.c +++ b/Modules/_testcapi/frame.c @@ -75,7 +75,7 @@ frame_new(TyObject *self, TyObject *args) TyErr_SetString(TyExc_TypeError, "argument must be a code object"); return NULL; } - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); return (TyObject *)TyFrame_New(tstate, (PyCodeObject *)code, globals, locals); } diff --git a/Modules/_testcapi/watchers.c b/Modules/_testcapi/watchers.c index 36bc339..b97080f 100644 --- a/Modules/_testcapi/watchers.c +++ b/Modules/_testcapi/watchers.c @@ -713,7 +713,7 @@ clear_context_watcher(TyObject *self, TyObject *watcher_id) static TyObject * clear_context_stack(TyObject *Py_UNUSED(self), TyObject *Py_UNUSED(args)) { - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); if (tstate->context == NULL) { Py_RETURN_NONE; } diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 2cfe5c9..c7049cb 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -637,7 +637,7 @@ pending_threadfunc(TyObject *self, TyObject *arg, TyObject *kwargs) Ty_INCREF(callable); } - PyThreadState *save_tstate = NULL; + TyThreadState *save_tstate = NULL; if (!blocking) { save_tstate = TyEval_SaveThread(); } @@ -1162,7 +1162,7 @@ crash_no_current_thread(TyObject *self, TyObject *Py_UNUSED(ignored)) static TyObject * test_current_tstate_matches(TyObject *self, TyObject *Py_UNUSED(ignored)) { - PyThreadState *orig_tstate = TyThreadState_Get(); + TyThreadState *orig_tstate = TyThreadState_Get(); if (orig_tstate != TyGILState_GetThisThreadState()) { TyErr_SetString(TyExc_RuntimeError, @@ -1172,7 +1172,7 @@ test_current_tstate_matches(TyObject *self, TyObject *Py_UNUSED(ignored)) const char *err = NULL; TyThreadState_Swap(NULL); - PyThreadState *substate = Ty_NewInterpreter(); + TyThreadState *substate = Ty_NewInterpreter(); if (substate != TyThreadState_Get()) { err = "subinterpreter thread state not current"; @@ -1200,7 +1200,7 @@ run_in_subinterp(TyObject *self, TyObject *args) { const char *code; int r; - PyThreadState *substate, *mainstate; + TyThreadState *substate, *mainstate; /* only initialise 'cflags.cf_flags' to test backwards compatibility */ PyCompilerFlags cflags = {0}; @@ -1856,20 +1856,20 @@ get_basic_static_type(TyObject *self, TyObject *args) } -// Test PyThreadState C API +// Test TyThreadState C API static TyObject * test_tstate_capi(TyObject *self, TyObject *Py_UNUSED(args)) { // TyThreadState_Get() - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); assert(tstate != NULL); // TyThreadState_GET() - PyThreadState *tstate2 = TyThreadState_Get(); + TyThreadState *tstate2 = TyThreadState_Get(); assert(tstate2 == tstate); // TyThreadState_GetUnchecked() - PyThreadState *tstate3 = TyThreadState_GetUnchecked(); + TyThreadState *tstate3 = TyThreadState_GetUnchecked(); assert(tstate3 == tstate); // TyThreadState_EnterTracing(), TyThreadState_LeaveTracing() @@ -2454,7 +2454,7 @@ finalize_thread_hang(TyObject *self, TyObject *callback) struct atexit_data { int called; - PyThreadState *tstate; + TyThreadState *tstate; PyInterpreterState *interp; }; @@ -2471,8 +2471,8 @@ atexit_callback(void *data) static TyObject * test_atexit(TyObject *self, TyObject *Py_UNUSED(args)) { - PyThreadState *oldts = TyThreadState_Swap(NULL); - PyThreadState *tstate = Ty_NewInterpreter(); + TyThreadState *oldts = TyThreadState_Swap(NULL); + TyThreadState *tstate = Ty_NewInterpreter(); struct atexit_data data = {0}; data.tstate = TyThreadState_Get(); diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index 9d34bed..15d36a2 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -109,7 +109,7 @@ get_configs(TyObject *self, TyObject *Py_UNUSED(args)) static TyObject* get_recursion_depth(TyObject *self, TyObject *Py_UNUSED(args)) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return TyLong_FromLong(tstate->py_recursion_limit - tstate->py_recursion_remaining); } @@ -118,7 +118,7 @@ get_recursion_depth(TyObject *self, TyObject *Py_UNUSED(args)) static TyObject* get_c_recursion_remaining(TyObject *self, TyObject *Py_UNUSED(args)) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); uintptr_t here_addr = _Ty_get_machine_stack_pointer(); _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; int remaining = (int)((here_addr - _tstate->c_stack_soft_limit) / _TyOS_STACK_MARGIN_BYTES * 50); @@ -650,7 +650,7 @@ set_eval_frame_default(TyObject *self, TyObject *Py_UNUSED(args)) } static TyObject * -record_eval(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc) +record_eval(TyThreadState *tstate, struct _PyInterpreterFrame *f, int exc) { if (PyStackRef_FunctionCheck(f->f_funcobj)) { PyFunctionObject *func = _TyFrame_GetFunction(f); @@ -828,7 +828,7 @@ get_interp_settings(TyObject *self, TyObject *args) PyInterpreterState *interp = NULL; if (interpid < 0) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); interp = tstate ? tstate->interp : _TyInterpreterState_Main(); } else if (interpid == 0) { @@ -1003,7 +1003,7 @@ get_co_localskinds(TyObject *self, TyObject *arg) static TyObject * get_code_var_counts(TyObject *self, TyObject *_args, TyObject *_kwargs) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *codearg; TyObject *globalnames = NULL; TyObject *attrnames = NULL; @@ -1172,7 +1172,7 @@ error: static TyObject * verify_stateless_code(TyObject *self, TyObject *args, TyObject *kwargs) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *codearg; TyObject *globalnames = NULL; TyObject *globalsns = NULL; @@ -1269,7 +1269,7 @@ pending_threadfunc(TyObject *self, TyObject *args, TyObject *kwargs) Ty_INCREF(callable); } - PyThreadState *save_tstate = NULL; + TyThreadState *save_tstate = NULL; if (!blocking) { save_tstate = TyEval_SaveThread(); } @@ -1313,7 +1313,7 @@ _pending_identify_callback(void *arg) { PyThread_type_lock mutex = (PyThread_type_lock)arg; assert(pending_identify_result.interpid == -1); - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); pending_identify_result.interpid = TyInterpreterState_GetID(tstate->interp); PyThread_release_lock(mutex); return 0; @@ -1385,12 +1385,12 @@ tracemalloc_get_traceback(TyObject *self, TyObject *args) } -// Test PyThreadState C API +// Test TyThreadState C API static TyObject * test_tstate_capi(TyObject *self, TyObject *Py_UNUSED(args)) { // TyThreadState_Get() - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); assert(tstate != NULL); // test _TyThreadState_GetDict() @@ -1596,15 +1596,15 @@ _new_interpreter(PyInterpreterConfig *config, long whence) else if (whence == _TyInterpreterState_WHENCE_CAPI || whence == _TyInterpreterState_WHENCE_LEGACY_CAPI) { - PyThreadState *tstate = NULL; - PyThreadState *save_tstate = TyThreadState_Swap(NULL); + TyThreadState *tstate = NULL; + TyThreadState *save_tstate = TyThreadState_Swap(NULL); if (whence == _TyInterpreterState_WHENCE_LEGACY_CAPI) { assert(config == NULL); tstate = Ty_NewInterpreter(); TyThreadState_Swap(save_tstate); } else { - PyStatus status = Ty_NewInterpreterFromConfig(&tstate, config); + TyStatus status = Ty_NewInterpreterFromConfig(&tstate, config); TyThreadState_Swap(save_tstate); if (TyStatus_Exception(status)) { assert(tstate == NULL); @@ -1712,8 +1712,8 @@ destroy_interpreter(TyObject *self, TyObject *args, TyObject *kwargs) if (basic) { // Test the basic Ty_EndInterpreter with weird out of order thread states - PyThreadState *t1, *t2; - PyThreadState *prev; + TyThreadState *t1, *t2; + TyThreadState *prev; t1 = interp->threads.head; if (t1 == NULL) { t1 = TyThreadState_New(interp); @@ -1755,10 +1755,10 @@ exec_interpreter(TyObject *self, TyObject *args, TyObject *kwargs) } TyObject *res = NULL; - PyThreadState *tstate = + TyThreadState *tstate = _TyThreadState_NewBound(interp, _TyThreadState_WHENCE_EXEC); - PyThreadState *save_tstate = TyThreadState_Swap(tstate); + TyThreadState *save_tstate = TyThreadState_Swap(tstate); if (runningmain) { if (_TyInterpreterState_SetRunningMain(interp) < 0) { @@ -1817,8 +1817,8 @@ run_in_subinterp_with_config(TyObject *self, TyObject *args, TyObject *kwargs) int r; if (xi) { - PyThreadState *save_tstate; - PyThreadState *tstate; + TyThreadState *save_tstate; + TyThreadState *tstate; /* Create an interpreter, staying switched to it. */ PyInterpreterState *interp = \ @@ -1834,11 +1834,11 @@ run_in_subinterp_with_config(TyObject *self, TyObject *args, TyObject *kwargs) _PyXI_EndInterpreter(interp, tstate, &save_tstate); } else { - PyThreadState *substate; - PyThreadState *mainstate = TyThreadState_Swap(NULL); + TyThreadState *substate; + TyThreadState *mainstate = TyThreadState_Swap(NULL); /* Create an interpreter, staying switched to it. */ - PyStatus status = Ty_NewInterpreterFromConfig(&substate, &config); + TyStatus status = Ty_NewInterpreterFromConfig(&substate, &config); if (TyStatus_Exception(status)) { /* Since no new thread state was created, there is no exception to propagate; raise a fresh one after swapping in the old thread @@ -1989,7 +1989,7 @@ get_crossinterp_data(TyObject *self, TyObject *args, TyObject *kwargs) } } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyXIData_t *xidata = _PyXIData_New(); if (xidata == NULL) { return NULL; diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index eef9cc9..e94d398 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -93,7 +93,7 @@ typedef enum { // complete immediately. // // This must be separately reference counted because it may be destroyed -// in `thread_run()` after the PyThreadState has been destroyed. +// in `thread_run()` after the TyThreadState has been destroyed. typedef struct { struct llist_node node; // linked list node (see _pythread_runtime_state) @@ -235,8 +235,8 @@ detach_thread(ThreadHandle *self) return 0; } -// NB: This may be called after the PyThreadState in `thread_run` has been -// deleted; it cannot call anything that relies on a valid PyThreadState +// NB: This may be called after the TyThreadState in `thread_run` has been +// deleted; it cannot call anything that relies on a valid TyThreadState // existing. static void ThreadHandle_decref(ThreadHandle *self) @@ -303,7 +303,7 @@ _PyThread_AfterFork(struct _pythread_runtime_state *state) // `thread_run()`, which can only take a single argument due to platform // limitations, are contained in bootstate. struct bootstate { - PyThreadState *tstate; + TyThreadState *tstate; TyObject *func; TyObject *args; TyObject *kwargs; @@ -327,7 +327,7 @@ static void thread_run(void *boot_raw) { struct bootstate *boot = (struct bootstate *) boot_raw; - PyThreadState *tstate = boot->tstate; + TyThreadState *tstate = boot->tstate; // Wait until the handle is marked as running PyEvent_Wait(&boot->handle_ready); @@ -1416,7 +1416,7 @@ create_sentinel_wr(localobject *self) "clear_locals", clear_locals, METH_O }; - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); /* We use a weak reference to self in the callback closure in order to avoid spurious reference cycles */ @@ -1547,7 +1547,7 @@ local_dealloc(TyObject *op) static int create_localdummies(thread_module_state *state) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate->threading_local_key != NULL) { return 0; @@ -1575,7 +1575,7 @@ static int create_localsdict(localobject *self, thread_module_state *state, TyObject **localsdict, TyObject **sentinel_wr) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *ldict = NULL; TyObject *wr = NULL; @@ -1642,7 +1642,7 @@ _ldict(localobject *self, thread_module_state *state) /* Check if a localsdict already exists */ TyObject *ldict; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (TyDict_GetItemRef(self->localdicts, tstate->threading_local_key, &ldict) < 0) { return NULL; diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index e4b483f..0bdb7be 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -259,15 +259,15 @@ static PyThread_type_lock tcl_lock = 0; #ifdef TCL_THREADS static Tcl_ThreadDataKey state_key; -typedef PyThreadState *ThreadSpecificData; +typedef TyThreadState *ThreadSpecificData; #define tcl_tstate \ - (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*))) + (*(TyThreadState**)Tcl_GetThreadData(&state_key, sizeof(TyThreadState*))) #else -static PyThreadState *tcl_tstate = NULL; +static TyThreadState *tcl_tstate = NULL; #endif #define ENTER_TCL \ - { PyThreadState *tstate = TyThreadState_Get(); \ + { TyThreadState *tstate = TyThreadState_Get(); \ Ty_BEGIN_ALLOW_THREADS \ if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); \ tcl_tstate = tstate; @@ -284,13 +284,13 @@ static PyThreadState *tcl_tstate = NULL; tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); } #define ENTER_PYTHON \ - { PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \ + { TyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \ if(tcl_lock) \ PyThread_release_lock(tcl_lock); \ TyEval_RestoreThread((tstate)); } #define LEAVE_PYTHON \ - { PyThreadState *tstate = TyEval_SaveThread(); \ + { TyThreadState *tstate = TyEval_SaveThread(); \ if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); \ tcl_tstate = tstate; } @@ -2857,7 +2857,7 @@ static TyObject * _tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold) /*[clinic end generated code: output=0ba8eabbe57841b0 input=036bcdcf03d5eca0]*/ { - PyThreadState *tstate = TyThreadState_Get(); + TyThreadState *tstate = TyThreadState_Get(); CHECK_TCL_APPARTMENT(self); self->dispatching = 1; @@ -3349,7 +3349,7 @@ MyFileProc(void *clientData, int mask) } #endif -static PyThreadState *event_tstate = NULL; +static TyThreadState *event_tstate = NULL; static int EventHook(void) diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c index 703d250..0d36141 100644 --- a/Modules/_xxtestfuzz/fuzzer.c +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -588,7 +588,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) { /* Raise the limit above the default allows exercising larger things * now that we fall back to the _pylong module for large values. */ config.int_max_str_digits = 8086; - PyStatus status; + TyStatus status; status = TyConfig_SetBytesString(&config, &config.program_name, *argv[0]); if (TyStatus_Exception(status)) { goto fail; diff --git a/Modules/atexitmodule.c b/Modules/atexitmodule.c index 529dcee..c65d22a 100644 --- a/Modules/atexitmodule.c +++ b/Modules/atexitmodule.c @@ -27,7 +27,7 @@ int PyUnstable_AtExit(PyInterpreterState *interp, atexit_datacallbackfunc func, void *data) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _Ty_EnsureTstateNotNULL(tstate); assert(tstate->interp == interp); @@ -63,7 +63,7 @@ atexit_cleanup(struct atexit_state *state) } -PyStatus +TyStatus _PyAtExit_Init(PyInterpreterState *interp) { struct atexit_state *state = &interp->atexit; diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h index 224cbed..0a7693b 100644 --- a/Modules/clinic/_asynciomodule.c.h +++ b/Modules/clinic/_asynciomodule.c.h @@ -165,7 +165,7 @@ _asyncio_Future_set_result(TyObject *self, TyTypeObject *cls, TyObject *const *a { TyObject *return_value = NULL; #if defined(Ty_BUILD_CORE) && !defined(Ty_BUILD_CORE_MODULE) - # define KWTUPLE (TyObject *)&_Py_SINGLETON(tuple_empty) + # define KWTUPLE (TyObject *)&_Ty_SINGLETON(tuple_empty) #else # define KWTUPLE NULL #endif @@ -215,7 +215,7 @@ _asyncio_Future_set_exception(TyObject *self, TyTypeObject *cls, TyObject *const { TyObject *return_value = NULL; #if defined(Ty_BUILD_CORE) && !defined(Ty_BUILD_CORE_MODULE) - # define KWTUPLE (TyObject *)&_Py_SINGLETON(tuple_empty) + # define KWTUPLE (TyObject *)&_Ty_SINGLETON(tuple_empty) #else # define KWTUPLE NULL #endif @@ -336,7 +336,7 @@ _asyncio_Future_remove_done_callback(TyObject *self, TyTypeObject *cls, TyObject { TyObject *return_value = NULL; #if defined(Ty_BUILD_CORE) && !defined(Ty_BUILD_CORE_MODULE) - # define KWTUPLE (TyObject *)&_Py_SINGLETON(tuple_empty) + # define KWTUPLE (TyObject *)&_Ty_SINGLETON(tuple_empty) #else # define KWTUPLE NULL #endif diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h index b39a6cb..25f3505 100644 --- a/Modules/clinic/_codecsmodule.c.h +++ b/Modules/clinic/_codecsmodule.c.h @@ -284,14 +284,14 @@ PyDoc_STRVAR(_codecs_escape_decode__doc__, {"escape_decode", _PyCFunction_CAST(_codecs_escape_decode), METH_FASTCALL, _codecs_escape_decode__doc__}, static TyObject * -_codecs_escape_decode_impl(TyObject *module, Py_buffer *data, +_codecs_escape_decode_impl(TyObject *module, Ty_buffer *data, const char *errors); static TyObject * _codecs_escape_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; if (!_TyArg_CheckPositional("escape_decode", nargs, 1, 2)) { @@ -409,14 +409,14 @@ PyDoc_STRVAR(_codecs_utf_7_decode__doc__, {"utf_7_decode", _PyCFunction_CAST(_codecs_utf_7_decode), METH_FASTCALL, _codecs_utf_7_decode__doc__}, static TyObject * -_codecs_utf_7_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_7_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_7_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -475,14 +475,14 @@ PyDoc_STRVAR(_codecs_utf_8_decode__doc__, {"utf_8_decode", _PyCFunction_CAST(_codecs_utf_8_decode), METH_FASTCALL, _codecs_utf_8_decode__doc__}, static TyObject * -_codecs_utf_8_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_8_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_8_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -541,14 +541,14 @@ PyDoc_STRVAR(_codecs_utf_16_decode__doc__, {"utf_16_decode", _PyCFunction_CAST(_codecs_utf_16_decode), METH_FASTCALL, _codecs_utf_16_decode__doc__}, static TyObject * -_codecs_utf_16_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_16_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_16_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -607,14 +607,14 @@ PyDoc_STRVAR(_codecs_utf_16_le_decode__doc__, {"utf_16_le_decode", _PyCFunction_CAST(_codecs_utf_16_le_decode), METH_FASTCALL, _codecs_utf_16_le_decode__doc__}, static TyObject * -_codecs_utf_16_le_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_16_le_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_16_le_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -673,14 +673,14 @@ PyDoc_STRVAR(_codecs_utf_16_be_decode__doc__, {"utf_16_be_decode", _PyCFunction_CAST(_codecs_utf_16_be_decode), METH_FASTCALL, _codecs_utf_16_be_decode__doc__}, static TyObject * -_codecs_utf_16_be_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_16_be_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_16_be_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -740,14 +740,14 @@ PyDoc_STRVAR(_codecs_utf_16_ex_decode__doc__, {"utf_16_ex_decode", _PyCFunction_CAST(_codecs_utf_16_ex_decode), METH_FASTCALL, _codecs_utf_16_ex_decode__doc__}, static TyObject * -_codecs_utf_16_ex_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_16_ex_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int byteorder, int final); static TyObject * _codecs_utf_16_ex_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int byteorder = 0; int final = 0; @@ -814,14 +814,14 @@ PyDoc_STRVAR(_codecs_utf_32_decode__doc__, {"utf_32_decode", _PyCFunction_CAST(_codecs_utf_32_decode), METH_FASTCALL, _codecs_utf_32_decode__doc__}, static TyObject * -_codecs_utf_32_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_32_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_32_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -880,14 +880,14 @@ PyDoc_STRVAR(_codecs_utf_32_le_decode__doc__, {"utf_32_le_decode", _PyCFunction_CAST(_codecs_utf_32_le_decode), METH_FASTCALL, _codecs_utf_32_le_decode__doc__}, static TyObject * -_codecs_utf_32_le_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_32_le_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_32_le_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -946,14 +946,14 @@ PyDoc_STRVAR(_codecs_utf_32_be_decode__doc__, {"utf_32_be_decode", _PyCFunction_CAST(_codecs_utf_32_be_decode), METH_FASTCALL, _codecs_utf_32_be_decode__doc__}, static TyObject * -_codecs_utf_32_be_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_32_be_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_utf_32_be_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -1013,14 +1013,14 @@ PyDoc_STRVAR(_codecs_utf_32_ex_decode__doc__, {"utf_32_ex_decode", _PyCFunction_CAST(_codecs_utf_32_ex_decode), METH_FASTCALL, _codecs_utf_32_ex_decode__doc__}, static TyObject * -_codecs_utf_32_ex_decode_impl(TyObject *module, Py_buffer *data, +_codecs_utf_32_ex_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int byteorder, int final); static TyObject * _codecs_utf_32_ex_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int byteorder = 0; int final = 0; @@ -1087,14 +1087,14 @@ PyDoc_STRVAR(_codecs_unicode_escape_decode__doc__, {"unicode_escape_decode", _PyCFunction_CAST(_codecs_unicode_escape_decode), METH_FASTCALL, _codecs_unicode_escape_decode__doc__}, static TyObject * -_codecs_unicode_escape_decode_impl(TyObject *module, Py_buffer *data, +_codecs_unicode_escape_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_unicode_escape_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 1; @@ -1165,14 +1165,14 @@ PyDoc_STRVAR(_codecs_raw_unicode_escape_decode__doc__, {"raw_unicode_escape_decode", _PyCFunction_CAST(_codecs_raw_unicode_escape_decode), METH_FASTCALL, _codecs_raw_unicode_escape_decode__doc__}, static TyObject * -_codecs_raw_unicode_escape_decode_impl(TyObject *module, Py_buffer *data, +_codecs_raw_unicode_escape_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_raw_unicode_escape_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 1; @@ -1243,14 +1243,14 @@ PyDoc_STRVAR(_codecs_latin_1_decode__doc__, {"latin_1_decode", _PyCFunction_CAST(_codecs_latin_1_decode), METH_FASTCALL, _codecs_latin_1_decode__doc__}, static TyObject * -_codecs_latin_1_decode_impl(TyObject *module, Py_buffer *data, +_codecs_latin_1_decode_impl(TyObject *module, Ty_buffer *data, const char *errors); static TyObject * _codecs_latin_1_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; if (!_TyArg_CheckPositional("latin_1_decode", nargs, 1, 2)) { @@ -1301,14 +1301,14 @@ PyDoc_STRVAR(_codecs_ascii_decode__doc__, {"ascii_decode", _PyCFunction_CAST(_codecs_ascii_decode), METH_FASTCALL, _codecs_ascii_decode__doc__}, static TyObject * -_codecs_ascii_decode_impl(TyObject *module, Py_buffer *data, +_codecs_ascii_decode_impl(TyObject *module, Ty_buffer *data, const char *errors); static TyObject * _codecs_ascii_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; if (!_TyArg_CheckPositional("ascii_decode", nargs, 1, 2)) { @@ -1359,14 +1359,14 @@ PyDoc_STRVAR(_codecs_charmap_decode__doc__, {"charmap_decode", _PyCFunction_CAST(_codecs_charmap_decode), METH_FASTCALL, _codecs_charmap_decode__doc__}, static TyObject * -_codecs_charmap_decode_impl(TyObject *module, Py_buffer *data, +_codecs_charmap_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, TyObject *mapping); static TyObject * _codecs_charmap_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; TyObject *mapping = Ty_None; @@ -1424,14 +1424,14 @@ PyDoc_STRVAR(_codecs_mbcs_decode__doc__, {"mbcs_decode", _PyCFunction_CAST(_codecs_mbcs_decode), METH_FASTCALL, _codecs_mbcs_decode__doc__}, static TyObject * -_codecs_mbcs_decode_impl(TyObject *module, Py_buffer *data, +_codecs_mbcs_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_mbcs_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -1494,14 +1494,14 @@ PyDoc_STRVAR(_codecs_oem_decode__doc__, {"oem_decode", _PyCFunction_CAST(_codecs_oem_decode), METH_FASTCALL, _codecs_oem_decode__doc__}, static TyObject * -_codecs_oem_decode_impl(TyObject *module, Py_buffer *data, +_codecs_oem_decode_impl(TyObject *module, Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_oem_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -1565,14 +1565,14 @@ PyDoc_STRVAR(_codecs_code_page_decode__doc__, static TyObject * _codecs_code_page_decode_impl(TyObject *module, int codepage, - Py_buffer *data, const char *errors, int final); + Ty_buffer *data, const char *errors, int final); static TyObject * _codecs_code_page_decode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; int codepage; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; @@ -1637,14 +1637,14 @@ PyDoc_STRVAR(_codecs_readbuffer_encode__doc__, {"readbuffer_encode", _PyCFunction_CAST(_codecs_readbuffer_encode), METH_FASTCALL, _codecs_readbuffer_encode__doc__}, static TyObject * -_codecs_readbuffer_encode_impl(TyObject *module, Py_buffer *data, +_codecs_readbuffer_encode_impl(TyObject *module, Ty_buffer *data, const char *errors); static TyObject * _codecs_readbuffer_encode(TyObject *module, TyObject *const *args, Ty_ssize_t nargs) { TyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; + Ty_buffer data = {NULL, NULL}; const char *errors = NULL; if (!_TyArg_CheckPositional("readbuffer_encode", nargs, 1, 2)) { diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index ae8c2f0..348c2e0 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -164,10 +164,10 @@ faulthandler_get_fileno(TyObject **file_ptr) /* Get the state of the current thread: only call this function if the current thread holds the GIL. Raise an exception on error. */ -static PyThreadState* +static TyThreadState* get_thread_state(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate == NULL) { /* just in case but very unlikely... */ TyErr_SetString(TyExc_RuntimeError, @@ -196,7 +196,7 @@ faulthandler_dump_traceback(int fd, int all_threads, fault if the thread released the GIL, and so this function cannot be used. Read the thread specific storage (TSS) instead: call TyGILState_GetThisThreadState(). */ - PyThreadState *tstate = TyGILState_GetThisThreadState(); + TyThreadState *tstate = TyGILState_GetThisThreadState(); if (all_threads == 1) { (void)_Ty_DumpTracebackThreads(fd, NULL, tstate); @@ -238,7 +238,7 @@ faulthandler_dump_traceback_py(TyObject *self, static char *kwlist[] = {"file", "all_threads", NULL}; TyObject *file = NULL; int all_threads = 1; - PyThreadState *tstate; + TyThreadState *tstate; const char *errmsg; int fd; @@ -332,7 +332,7 @@ deduce_all_threads(void) return 0; } // We can't use _TyThreadState_GET, so use the stored GILstate one - PyThreadState *tstate = TyGILState_GetThisThreadState(); + TyThreadState *tstate = TyGILState_GetThisThreadState(); if (tstate == NULL) { return 0; } @@ -575,7 +575,7 @@ faulthandler_py_enable(TyObject *self, TyObject *args, TyObject *kwargs) int all_threads = 1; int fd; int c_stack = 1; - PyThreadState *tstate; + TyThreadState *tstate; if (!TyArg_ParseTupleAndKeywords(args, kwargs, "|Opp:enable", kwlist, &file, &all_threads, &c_stack)) @@ -743,7 +743,7 @@ faulthandler_dump_traceback_later(TyObject *self, TyObject *file = NULL; int fd; int exit = 0; - PyThreadState *tstate; + TyThreadState *tstate; char *header; size_t header_len; @@ -948,7 +948,7 @@ faulthandler_register_py(TyObject *self, int fd; user_signal_t *user; _Ty_sighandler_t previous; - PyThreadState *tstate; + TyThreadState *tstate; int err; if (!TyArg_ParseTupleAndKeywords(args, kwargs, @@ -1419,7 +1419,7 @@ faulthandler_init_enable(void) return 0; } -PyStatus +TyStatus _PyFaulthandler_Init(int enable) { #ifdef FAULTHANDLER_USE_ALT_STACK diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index df11a63..c40fd7e 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -84,7 +84,7 @@ static Ty_ssize_t gc_collect_impl(TyObject *module, int generation) /*[clinic end generated code: output=b697e633043233c7 input=40720128b682d879]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (generation < 0 || generation >= NUM_GENERATIONS) { _TyErr_SetString(tstate, TyExc_ValueError, "invalid generation"); diff --git a/Modules/getpath.c b/Modules/getpath.c index 6c30f2a..07364a8 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -852,10 +852,10 @@ _Py_Get_Getpath_CodeObject(void) safe because already-configured values are not recalculated. To actually recalculate paths, you need a clean PyConfig. */ -PyStatus +TyStatus _TyConfig_InitPathConfig(PyConfig *config, int compute_path_config) { - PyStatus status = _TyPathConfig_ReadGlobal(config); + TyStatus status = _TyPathConfig_ReadGlobal(config); if (_TyStatus_EXCEPTION(status) || !compute_path_config) { return status; diff --git a/Modules/getpath_noop.c b/Modules/getpath_noop.c index 37a0352..f29c96f 100644 --- a/Modules/getpath_noop.c +++ b/Modules/getpath_noop.c @@ -3,7 +3,7 @@ #include "Python.h" #include "pycore_pathconfig.h" -PyStatus +TyStatus _TyConfig_InitPathConfig(PyConfig *config, int compute_path_config) { return TyStatus_Error("path configuration is unsupported"); diff --git a/Modules/main.c b/Modules/main.c index 231ca16..14d7516 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -32,10 +32,10 @@ /* --- pymain_init() ---------------------------------------------- */ -static PyStatus +static TyStatus pymain_init(const _PyArgv *args) { - PyStatus status; + TyStatus status; status = _PyRuntime_Initialize(); if (_TyStatus_EXCEPTION(status)) { @@ -753,7 +753,7 @@ exit_sigint(void) static void _Py_NO_RETURN -pymain_exit_error(PyStatus status) +pymain_exit_error(TyStatus status) { if (_TyStatus_IS_EXIT(status)) { /* If it's an error rather than a regular exit, leave Python runtime @@ -793,7 +793,7 @@ Ty_RunMain(void) static int pymain_main(_PyArgv *args) { - PyStatus status = pymain_init(args); + TyStatus status = pymain_init(args); if (_TyStatus_IS_EXIT(status)) { pymain_free(); return status.exitcode; diff --git a/Modules/overlapped.c b/Modules/overlapped.c index 111d76e..c613ce1 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -98,7 +98,7 @@ typedef struct { /* Buffer allocated by us: TYPE_READ and TYPE_ACCEPT */ TyObject *allocated_buffer; /* Buffer passed by the user: TYPE_WRITE, TYPE_WRITE_TO, and TYPE_READINTO */ - Py_buffer user_buffer; + Ty_buffer user_buffer; /* Data used for reading from a connectionless socket: TYPE_READ_FROM */ @@ -117,7 +117,7 @@ typedef struct { // A (number of bytes read, (host, port)) tuple TyObject* result; /* Buffer passed by the user */ - Py_buffer user_buffer; + Ty_buffer user_buffer; struct sockaddr_in6 address; int address_length; } read_from_into; @@ -128,10 +128,10 @@ typedef struct { static inline void -steal_buffer(Py_buffer * dst, Py_buffer * src) +steal_buffer(Ty_buffer * dst, Ty_buffer * src) { - memcpy(dst, src, sizeof(Py_buffer)); - memset(src, 0, sizeof(Py_buffer)); + memcpy(dst, src, sizeof(Ty_buffer)); + memset(src, 0, sizeof(Ty_buffer)); } /* @@ -660,7 +660,7 @@ _overlapped_Overlapped_impl(TyTypeObject *type, HANDLE event) self->type = TYPE_NONE; self->allocated_buffer = NULL; memset(&self->overlapped, 0, sizeof(OVERLAPPED)); - memset(&self->user_buffer, 0, sizeof(Py_buffer)); + memset(&self->user_buffer, 0, sizeof(Ty_buffer)); if (event) self->overlapped.hEvent = event; return (TyObject *)self; @@ -1073,7 +1073,7 @@ _overlapped_Overlapped_ReadFile_impl(OverlappedObject *self, HANDLE handle, _overlapped.Overlapped.ReadFileInto handle: HANDLE - buf as bufobj: Py_buffer + buf as bufobj: Ty_buffer / Start overlapped receive. @@ -1081,7 +1081,7 @@ Start overlapped receive. static TyObject * _overlapped_Overlapped_ReadFileInto_impl(OverlappedObject *self, - HANDLE handle, Py_buffer *bufobj) + HANDLE handle, Ty_buffer *bufobj) /*[clinic end generated code: output=8754744506023071 input=4f037ba09939e32d]*/ { if (self->type != TYPE_NONE) { @@ -1178,7 +1178,7 @@ _overlapped_Overlapped_WSARecv_impl(OverlappedObject *self, HANDLE handle, _overlapped.Overlapped.WSARecvInto handle: HANDLE - buf as bufobj: Py_buffer + buf as bufobj: Ty_buffer flags: DWORD / @@ -1187,7 +1187,7 @@ Start overlapped receive. static TyObject * _overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self, - HANDLE handle, Py_buffer *bufobj, + HANDLE handle, Ty_buffer *bufobj, DWORD flags) /*[clinic end generated code: output=59ae7688786cf86b input=73e7fa00db633edd]*/ { @@ -1215,7 +1215,7 @@ _overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self, _overlapped.Overlapped.WriteFile handle: HANDLE - buf as bufobj: Py_buffer + buf as bufobj: Ty_buffer / Start overlapped write. @@ -1223,7 +1223,7 @@ Start overlapped write. static TyObject * _overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle, - Py_buffer *bufobj) + Ty_buffer *bufobj) /*[clinic end generated code: output=fa5d5880a1bf04b1 input=ac54424c362abfc1]*/ { DWORD written; @@ -1267,7 +1267,7 @@ _overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle, _overlapped.Overlapped.WSASend handle: HANDLE - buf as bufobj: Py_buffer + buf as bufobj: Ty_buffer flags: DWORD / @@ -1276,7 +1276,7 @@ Start overlapped send. static TyObject * _overlapped_Overlapped_WSASend_impl(OverlappedObject *self, HANDLE handle, - Py_buffer *bufobj, DWORD flags) + Ty_buffer *bufobj, DWORD flags) /*[clinic end generated code: output=3baaa6e1f7fe229e input=c4167420ba2f93d8]*/ { DWORD written; @@ -1746,7 +1746,7 @@ _overlapped_WSAConnect_impl(TyObject *module, HANDLE ConnectSocket, _overlapped.Overlapped.WSASendTo handle: HANDLE - buf as bufobj: Py_buffer + buf as bufobj: Ty_buffer flags: DWORD address_as_bytes as AddressObj: object(subclass_of='&TyTuple_Type') / @@ -1756,7 +1756,7 @@ Start overlapped sendto over a connectionless (UDP) socket. static TyObject * _overlapped_Overlapped_WSASendTo_impl(OverlappedObject *self, HANDLE handle, - Py_buffer *bufobj, DWORD flags, + Ty_buffer *bufobj, DWORD flags, TyObject *AddressObj) /*[clinic end generated code: output=3cdedc4cfaeb70cd input=31f44cd4ab92fc33]*/ { @@ -1883,7 +1883,7 @@ _overlapped_Overlapped_WSARecvFrom_impl(OverlappedObject *self, _overlapped.Overlapped.WSARecvFromInto handle: HANDLE - buf as bufobj: Py_buffer + buf as bufobj: Ty_buffer size: DWORD flags: DWORD = 0 / @@ -1893,7 +1893,7 @@ Start overlapped receive. static TyObject * _overlapped_Overlapped_WSARecvFromInto_impl(OverlappedObject *self, - HANDLE handle, Py_buffer *bufobj, + HANDLE handle, Ty_buffer *bufobj, DWORD size, DWORD flags) /*[clinic end generated code: output=30c7ea171a691757 input=4be4b08d03531e76]*/ { diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 21a9682..968d866 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -682,7 +682,7 @@ TyOS_AfterFork_Parent(void) } static void -reset_remotedebug_data(PyThreadState *tstate) +reset_remotedebug_data(TyThreadState *tstate) { tstate->remote_debugger_support.debugger_pending_call = 0; memset(tstate->remote_debugger_support.debugger_script_path, 0, @@ -693,7 +693,7 @@ reset_remotedebug_data(PyThreadState *tstate) void TyOS_AfterFork_Child(void) { - PyStatus status; + TyStatus status; _PyRuntimeState *runtime = &_PyRuntime; // re-creates runtime->interpreters.mutex (HEAD_UNLOCK) @@ -702,7 +702,7 @@ TyOS_AfterFork_Child(void) goto fatal_error; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _Ty_EnsureTstateNotNULL(tstate); assert(tstate->thread_id == PyThread_get_thread_ident()); @@ -729,7 +729,7 @@ TyOS_AfterFork_Child(void) // thread state left to undo the stop the world call in `TyOS_BeforeFork`. // That needs to happen before `_TyThreadState_DeleteList`, because that // may call destructors. - PyThreadState *list = _TyThreadState_RemoveExcept(tstate); + TyThreadState *list = _TyThreadState_RemoveExcept(tstate); _TyEval_StartTheWorldAll(&_PyRuntime); _TyThreadState_DeleteList(list, /*is_after_fork=*/1); @@ -1342,7 +1342,7 @@ path_converter(TyObject *o, void *p) path->function_name ? ": " : "", \ path->argument_name ? path->argument_name : "path") - /* Py_CLEANUP_SUPPORTED support */ + /* Ty_CLEANUP_SUPPORTED support */ if (o == NULL) { path_cleanup(path); return 1; @@ -1505,7 +1505,7 @@ path_converter(TyObject *o, void *p) path->value_error = 0; path->length = length; path->object = o; - return Py_CLEANUP_SUPPORTED; + return Ty_CLEANUP_SUPPORTED; error_exit: Ty_XDECREF(o); @@ -1523,7 +1523,7 @@ path_converter(TyObject *o, void *p) path->value_error = 1; path->length = 0; path->object = NULL; - return Py_CLEANUP_SUPPORTED; + return Ty_CLEANUP_SUPPORTED; } static void @@ -11488,7 +11488,7 @@ os_read_impl(TyObject *module, int fd, Ty_ssize_t length) /*[clinic input] os.readinto -> Ty_ssize_t fd: int - buffer: Py_buffer(accept={rwbuffer}) + buffer: Ty_buffer(accept={rwbuffer}) / Read into a buffer object from a file descriptor. @@ -11505,7 +11505,7 @@ negative. [clinic start generated code]*/ static Ty_ssize_t -os_readinto_impl(TyObject *module, int fd, Py_buffer *buffer) +os_readinto_impl(TyObject *module, int fd, Ty_buffer *buffer) /*[clinic end generated code: output=8091a3513c683a80 input=d40074d0a68de575]*/ { assert(buffer->len >= 0); @@ -11522,7 +11522,7 @@ os_readinto_impl(TyObject *module, int fd, Py_buffer *buffer) || defined(HAVE_READV) || defined(HAVE_PREADV) || defined (HAVE_PREADV2) \ || defined(HAVE_WRITEV) || defined(HAVE_PWRITEV) || defined (HAVE_PWRITEV2) static int -iov_setup(struct iovec **iov, Py_buffer **buf, TyObject *seq, Ty_ssize_t cnt, int type) +iov_setup(struct iovec **iov, Ty_buffer **buf, TyObject *seq, Ty_ssize_t cnt, int type) { Ty_ssize_t i, j; @@ -11532,7 +11532,7 @@ iov_setup(struct iovec **iov, Py_buffer **buf, TyObject *seq, Ty_ssize_t cnt, in return -1; } - *buf = TyMem_New(Py_buffer, cnt); + *buf = TyMem_New(Ty_buffer, cnt); if (*buf == NULL) { TyMem_Free(*iov); TyErr_NoMemory(); @@ -11563,7 +11563,7 @@ fail: } static void -iov_cleanup(struct iovec *iov, Py_buffer *buf, int cnt) +iov_cleanup(struct iovec *iov, Ty_buffer *buf, int cnt) { int i; TyMem_Free(iov); @@ -11601,7 +11601,7 @@ os_readv_impl(TyObject *module, int fd, TyObject *buffers) Ty_ssize_t cnt, n; int async_err = 0; struct iovec *iov; - Py_buffer *buf; + Ty_buffer *buf; if (!PySequence_Check(buffers)) { TyErr_SetString(TyExc_TypeError, @@ -11724,7 +11724,7 @@ os_preadv_impl(TyObject *module, int fd, TyObject *buffers, Ty_off_t offset, Ty_ssize_t cnt, n; int async_err = 0; struct iovec *iov; - Py_buffer *buf; + Ty_buffer *buf; if (!PySequence_Check(buffers)) { TyErr_SetString(TyExc_TypeError, @@ -11797,14 +11797,14 @@ os_preadv_impl(TyObject *module, int fd, TyObject *buffers, Ty_off_t offset, os.write -> Ty_ssize_t fd: int - data: Py_buffer + data: Ty_buffer / Write a bytes object to a file descriptor. [clinic start generated code]*/ static Ty_ssize_t -os_write_impl(TyObject *module, int fd, Py_buffer *data) +os_write_impl(TyObject *module, int fd, Ty_buffer *data) /*[clinic end generated code: output=e4ef5bc904b58ef9 input=3207e28963234f3c]*/ { return _Ty_write(fd, data->buf, data->len); @@ -11876,7 +11876,7 @@ os_sendfile_impl(TyObject *module, int out_fd, int in_fd, TyObject *offobj, #ifndef __APPLE__ off_t sbytes; #endif - Py_buffer *hbuf, *tbuf; + Ty_buffer *hbuf, *tbuf; struct sf_hdtr sf; sf.headers = NULL; @@ -12266,7 +12266,7 @@ os_writev_impl(TyObject *module, int fd, TyObject *buffers) Ty_ssize_t result; int async_err = 0; struct iovec *iov; - Py_buffer *buf; + Ty_buffer *buf; if (!PySequence_Check(buffers)) { TyErr_SetString(TyExc_TypeError, @@ -12301,7 +12301,7 @@ os_writev_impl(TyObject *module, int fd, TyObject *buffers) os.pwrite -> Ty_ssize_t fd: int - buffer: Py_buffer + buffer: Ty_buffer offset: Ty_off_t / @@ -12313,7 +12313,7 @@ current file offset. [clinic start generated code]*/ static Ty_ssize_t -os_pwrite_impl(TyObject *module, int fd, Py_buffer *buffer, Ty_off_t offset) +os_pwrite_impl(TyObject *module, int fd, Ty_buffer *buffer, Ty_off_t offset) /*[clinic end generated code: output=c74da630758ee925 input=614acbc7e5a0339a]*/ { Ty_ssize_t size; @@ -12370,7 +12370,7 @@ os_pwritev_impl(TyObject *module, int fd, TyObject *buffers, Ty_off_t offset, Ty_ssize_t result; int async_err = 0; struct iovec *iov; - Py_buffer *buf; + Ty_buffer *buf; if (!PySequence_Check(buffers)) { TyErr_SetString(TyExc_TypeError, @@ -14946,7 +14946,7 @@ os.setxattr path: path_t(allow_fd=True) attribute: path_t - value: Py_buffer + value: Ty_buffer flags: int = 0 * follow_symlinks: bool = True @@ -14962,7 +14962,7 @@ If follow_symlinks is False, and the last element of the path is a symbolic static TyObject * os_setxattr_impl(TyObject *module, path_t *path, path_t *attribute, - Py_buffer *value, int flags, int follow_symlinks) + Ty_buffer *value, int flags, int follow_symlinks) /*[clinic end generated code: output=98b83f63fdde26bb input=c17c0103009042f0]*/ { ssize_t result; diff --git a/Modules/readline.c b/Modules/readline.c index 349ba9c..21cf158 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1437,7 +1437,7 @@ static char * readline_until_enter_or_signal(const char *prompt, int *signal) { // Defined in Parser/myreadline.c - extern PyThreadState *_TyOS_ReadlineTState; + extern TyThreadState *_TyOS_ReadlineTState; char * not_done_reading = ""; fd_set selectset; diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index ea22dc7..7fcb86d 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -503,7 +503,7 @@ signal_signal_impl(TyObject *module, int signalnum, TyObject *handler) } #endif - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!_Ty_ThreadCanHandleSignals(tstate->interp)) { _TyErr_SetString(tstate, TyExc_ValueError, "signal only works in main thread " @@ -747,7 +747,7 @@ signal_set_wakeup_fd_impl(TyObject *module, TyObject *fdobj, } #endif - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!_Ty_ThreadCanHandleSignals(tstate->interp)) { _TyErr_SetString(tstate, TyExc_ValueError, "set_wakeup_fd only works in main thread " @@ -1660,7 +1660,7 @@ signal_module_exec(TyObject *m) } #endif - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_Ty_IsMainInterpreter(tstate->interp)) { if (signal_get_set_handlers(state, d) < 0) { return -1; @@ -1764,7 +1764,7 @@ _PySignal_Fini(void) int TyErr_CheckSignals(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* Opportunistically check if the GC is scheduled to run and run it if we have a request. This is done here because native code needs @@ -1791,7 +1791,7 @@ TyErr_CheckSignals(void) /* Declared in cpython/pyerrors.h */ int -_TyErr_CheckSignalsTstate(PyThreadState *tstate) +_TyErr_CheckSignalsTstate(TyThreadState *tstate) { _Ty_CHECK_EMSCRIPTEN_SIGNALS(); if (!_Ty_atomic_load_int(&is_tripped)) { @@ -1882,7 +1882,7 @@ _TyErr_CheckSignalsTstate(PyThreadState *tstate) int _TyErr_CheckSignals(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyErr_CheckSignalsTstate(tstate); } @@ -2000,7 +2000,7 @@ _PySignal_Init(int install_signal_handlers) // The caller doesn't have to hold the GIL int -_TyOS_InterruptOccurred(PyThreadState *tstate) +_TyOS_InterruptOccurred(TyThreadState *tstate) { _Ty_EnsureTstateNotNULL(tstate); if (!_Ty_ThreadCanHandleSignals(tstate->interp)) { @@ -2020,7 +2020,7 @@ _TyOS_InterruptOccurred(PyThreadState *tstate) int TyOS_InterruptOccurred(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyOS_InterruptOccurred(tstate); } diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 88eecc1..50d2d2d 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1845,7 +1845,7 @@ idna_converter(TyObject *obj, void *arg) TyErr_SetString(TyExc_TypeError, "host name must not contain null character"); return 0; } - return Py_CLEANUP_SUPPORTED; + return Ty_CLEANUP_SUPPORTED; } /* Parse a socket address argument according to the socket object's @@ -1862,7 +1862,7 @@ getsockaddrarg(PySocketSockObject *s, TyObject *args, #if defined(AF_UNIX) case AF_UNIX: { - Py_buffer path; + Ty_buffer path; int retval = 0; /* PEP 383. Not using TyUnicode_FSConverter since we need to @@ -2268,7 +2268,7 @@ getsockaddrarg(PySocketSockObject *s, TyObject *args, int protoNumber; int hatype = 0; int pkttype = PACKET_HOST; - Py_buffer haddr = {NULL, NULL}; + Ty_buffer haddr = {NULL, NULL}; if (!TyTuple_Check(args)) { TyErr_Format( @@ -3341,7 +3341,7 @@ sock_setsockopt(TyObject *self, TyObject *args) int level; int optname; int res; - Py_buffer optval; + Ty_buffer optval; int flag; unsigned int optlen; TyObject *none; @@ -4005,7 +4005,7 @@ sock_recv_into(TyObject *self, TyObject *args, TyObject *kwds) PySocketSockObject *s = _PySocketSockObject_CAST(self); int flags = 0; - Py_buffer pbuf; + Ty_buffer pbuf; char *buf; Ty_ssize_t buflen, readlen, recvlen = 0; @@ -4196,7 +4196,7 @@ sock_recvfrom_into(TyObject *self, TyObject *args, TyObject* kwds) PySocketSockObject *s = _PySocketSockObject_CAST(self); int flags = 0; - Py_buffer pbuf; + Ty_buffer pbuf; char *buf; Ty_ssize_t readlen, buflen, recvlen = 0; @@ -4496,7 +4496,7 @@ sock_recvmsg_into(TyObject *self, TyObject *args) int flags = 0; struct iovec *iovs = NULL; Ty_ssize_t i, nitems, nbufs = 0; - Py_buffer *bufs = NULL; + Ty_buffer *bufs = NULL; TyObject *buffers_arg, *fast, *retval = NULL; if (!TyArg_ParseTuple(args, "O|ni:recvmsg_into", @@ -4513,10 +4513,10 @@ sock_recvmsg_into(TyObject *self, TyObject *args) goto finally; } - /* Fill in an iovec for each item, and save the Py_buffer + /* Fill in an iovec for each item, and save the Ty_buffer structs to release afterwards. */ if (nitems > 0 && ((iovs = TyMem_New(struct iovec, nitems)) == NULL || - (bufs = TyMem_New(Py_buffer, nitems)) == NULL)) { + (bufs = TyMem_New(Ty_buffer, nitems)) == NULL)) { TyErr_NoMemory(); goto finally; } @@ -4606,7 +4606,7 @@ sock_send(TyObject *self, TyObject *args) PySocketSockObject *s = _PySocketSockObject_CAST(self); int flags = 0; - Py_buffer pbuf; + Ty_buffer pbuf; struct sock_send ctx; if (!TyArg_ParseTuple(args, "y*|i:send", &pbuf, &flags)) @@ -4646,7 +4646,7 @@ sock_sendall(TyObject *self, TyObject *args) char *buf; Ty_ssize_t len, n; int flags = 0; - Py_buffer pbuf; + Ty_buffer pbuf; struct sock_send ctx; int has_timeout = (s->sock_timeout > 0); PyTime_t timeout = s->sock_timeout; @@ -4750,7 +4750,7 @@ sock_sendto(TyObject *self, TyObject *args) { PySocketSockObject *s = _PySocketSockObject_CAST(self); - Py_buffer pbuf; + Ty_buffer pbuf; TyObject *addro; Ty_ssize_t arglen; sock_addr_t addrbuf; @@ -4826,14 +4826,14 @@ struct sock_sendmsg { static int sock_sendmsg_iovec(PySocketSockObject *s, TyObject *data_arg, struct msghdr *msg, - Py_buffer **databufsout, Ty_ssize_t *ndatabufsout) { + Ty_buffer **databufsout, Ty_ssize_t *ndatabufsout) { Ty_ssize_t ndataparts, ndatabufs = 0; int result = -1; struct iovec *iovs = NULL; TyObject *data_fast = NULL; - Py_buffer *databufs = NULL; + Ty_buffer *databufs = NULL; - /* Fill in an iovec for each message part, and save the Py_buffer + /* Fill in an iovec for each message part, and save the Ty_buffer structs to release afterwards. */ data_fast = PySequence_Fast(data_arg, "sendmsg() argument 1 must be an " @@ -4857,7 +4857,7 @@ sock_sendmsg_iovec(PySocketSockObject *s, TyObject *data_arg, } msg->msg_iov = iovs; - databufs = TyMem_New(Py_buffer, ndataparts); + databufs = TyMem_New(Ty_buffer, ndataparts); if (databufs == NULL) { TyErr_NoMemory(); goto finally; @@ -4897,13 +4897,13 @@ sock_sendmsg(TyObject *self, TyObject *args) PySocketSockObject *s = _PySocketSockObject_CAST(self); Ty_ssize_t i, ndatabufs = 0, ncmsgs, ncmsgbufs = 0; - Py_buffer *databufs = NULL; + Ty_buffer *databufs = NULL; sock_addr_t addrbuf; struct msghdr msg; struct cmsginfo { int level; int type; - Py_buffer data; + Ty_buffer data; } *cmsgs = NULL; void *controlbuf = NULL; size_t controllen, controllen_last; @@ -4937,7 +4937,7 @@ sock_sendmsg(TyObject *self, TyObject *args) } } - /* Fill in an iovec for each message part, and save the Py_buffer + /* Fill in an iovec for each message part, and save the Ty_buffer structs to release afterwards. */ if (sock_sendmsg_iovec(s, data_arg, &msg, &databufs, &ndatabufs) == -1) { goto finally; @@ -4961,7 +4961,7 @@ sock_sendmsg(TyObject *self, TyObject *args) goto finally; } #endif - /* Save level, type and Py_buffer for each control message, + /* Save level, type and Ty_buffer for each control message, and calculate total size. */ if (ncmsgs > 0 && (cmsgs = TyMem_New(struct cmsginfo, ncmsgs)) == NULL) { TyErr_NoMemory(); @@ -5105,10 +5105,10 @@ sock_sendmsg_afalg(TyObject *s, TyObject *args, TyObject *kwds) TyObject *retval = NULL; Ty_ssize_t i, ndatabufs = 0; - Py_buffer *databufs = NULL; + Ty_buffer *databufs = NULL; TyObject *data_arg = NULL; - Py_buffer iv = {NULL, NULL}; + Ty_buffer iv = {NULL, NULL}; TyObject *opobj = NULL; int op = -1; @@ -5184,7 +5184,7 @@ sock_sendmsg_afalg(TyObject *s, TyObject *args, TyObject *kwds) msg.msg_controllen = controllen; msg.msg_control = controlbuf; - /* Fill in an iovec for each message part, and save the Py_buffer + /* Fill in an iovec for each message part, and save the Ty_buffer structs to release afterwards. */ if (data_arg != NULL) { if (sock_sendmsg_iovec(self, data_arg, &msg, &databufs, &ndatabufs) == -1) { @@ -5918,7 +5918,7 @@ static TyObject * socket_sethostname(TyObject *self, TyObject *args) { TyObject *hnobj; - Py_buffer buf; + Ty_buffer buf; int res, flag = 0; #if defined(_AIX) || (defined(__sun) && defined(__SVR4) && Py_SUNOS_VERSION <= 510) @@ -6740,14 +6740,14 @@ _socket_inet_aton_impl(TyObject *module, const char *ip_addr) #ifdef HAVE_INET_NTOA /*[clinic input] _socket.inet_ntoa - packed_ip: Py_buffer + packed_ip: Ty_buffer / Convert an IP address from 32-bit packed binary format to string format. [clinic start generated code]*/ static TyObject * -_socket_inet_ntoa_impl(TyObject *module, Py_buffer *packed_ip) +_socket_inet_ntoa_impl(TyObject *module, Ty_buffer *packed_ip) /*[clinic end generated code: output=3077324c50af0935 input=2850d4f57e4db345]*/ { struct in_addr packed_addr; @@ -6829,7 +6829,7 @@ static TyObject * socket_inet_ntop(TyObject *self, TyObject *args) { int af; - Py_buffer packed_ip; + Ty_buffer packed_ip; const char* retval; #ifdef ENABLE_IPV6 char ip[Py_MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN)]; diff --git a/Objects/abstract.c b/Objects/abstract.c index 3679bd3..d9c860f 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -30,7 +30,7 @@ type_error(const char *msg, TyObject *obj) static TyObject * null_error(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!_TyErr_Occurred(tstate)) { _TyErr_SetString(tstate, TyExc_SystemError, "null argument to internal routine"); @@ -99,7 +99,7 @@ PyObject_LengthHint(TyObject *o, Ty_ssize_t defaultvalue) if (_TyObject_HasLen(o)) { res = PyObject_Length(o); if (res < 0) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(_TyErr_Occurred(tstate)); if (!_TyErr_ExceptionMatches(tstate, TyExc_TypeError)) { return -1; @@ -120,7 +120,7 @@ PyObject_LengthHint(TyObject *o, Ty_ssize_t defaultvalue) result = _TyObject_CallNoArgs(hint); Ty_DECREF(hint); if (result == NULL) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TyErr_ExceptionMatches(tstate, TyExc_TypeError)) { _TyErr_Clear(tstate); return defaultvalue; @@ -872,7 +872,7 @@ PyObject_Format(TyObject *obj, TyObject *format_spec) /* Find the (unbound!) __format__ method */ meth = _TyObject_LookupSpecial(obj, &_Ty_ID(__format__)); if (meth == NULL) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!_TyErr_Occurred(tstate)) { _TyErr_Format(tstate, TyExc_TypeError, "Type %.100s doesn't define __format__", @@ -1468,7 +1468,7 @@ PyNumber_AsSsize_t(TyObject *item, TyObject *err) if (result != -1) goto finish; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); runerr = _TyErr_Occurred(tstate); if (!runerr) { goto finish; @@ -2106,7 +2106,7 @@ PySequence_Fast(TyObject *v, const char *m) it = PyObject_GetIter(v); if (it == NULL) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TyErr_ExceptionMatches(tstate, TyExc_TypeError)) { _TyErr_SetString(tstate, TyExc_TypeError, m); } @@ -2432,7 +2432,7 @@ method_output_as_list(TyObject *o, TyObject *meth) } it = PyObject_GetIter(meth_output); if (it == NULL) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TyErr_ExceptionMatches(tstate, TyExc_TypeError)) { _TyErr_Format(tstate, TyExc_TypeError, "%.200s.%U() returned a non-iterable (type %.200s)", @@ -2582,7 +2582,7 @@ check_class(TyObject *cls, const char *error) TyObject *bases = abstract_get_bases(cls); if (bases == NULL) { /* Do not mask errors. */ - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!_TyErr_Occurred(tstate)) { _TyErr_SetString(tstate, TyExc_TypeError, error); } @@ -2629,7 +2629,7 @@ object_isinstance(TyObject *inst, TyObject *cls) } static int -object_recursive_isinstance(PyThreadState *tstate, TyObject *inst, TyObject *cls) +object_recursive_isinstance(TyThreadState *tstate, TyObject *inst, TyObject *cls) { /* Quick test for an exact match */ if (Ty_IS_TYPE(inst, (TyTypeObject *)cls)) { @@ -2696,7 +2696,7 @@ object_recursive_isinstance(PyThreadState *tstate, TyObject *inst, TyObject *cls int PyObject_IsInstance(TyObject *inst, TyObject *cls) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return object_recursive_isinstance(tstate, inst, cls); } @@ -2722,7 +2722,7 @@ recursive_issubclass(TyObject *derived, TyObject *cls) } static int -object_issubclass(PyThreadState *tstate, TyObject *derived, TyObject *cls) +object_issubclass(TyThreadState *tstate, TyObject *derived, TyObject *cls) { TyObject *checker; @@ -2784,7 +2784,7 @@ object_issubclass(PyThreadState *tstate, TyObject *derived, TyObject *cls) int PyObject_IsSubclass(TyObject *derived, TyObject *cls) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return object_issubclass(tstate, derived, cls); } @@ -2871,7 +2871,7 @@ iternext(TyObject *iter, TyObject **item) return 1; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* When the iterator is exhausted it must return NULL; * a StopIteration exception may or may not be set. */ if (!_TyErr_Occurred(tstate)) { diff --git a/Objects/call.c b/Objects/call.c index 7d48580..64f3699 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -11,7 +11,7 @@ static TyObject * -null_error(PyThreadState *tstate) +null_error(TyThreadState *tstate) { if (!_TyErr_Occurred(tstate)) { _TyErr_SetString(tstate, TyExc_SystemError, @@ -22,7 +22,7 @@ null_error(PyThreadState *tstate) TyObject* -_Ty_CheckFunctionResult(PyThreadState *tstate, TyObject *callable, +_Ty_CheckFunctionResult(TyThreadState *tstate, TyObject *callable, TyObject *result, const char *where) { assert((callable != NULL) ^ (where != NULL)); @@ -74,7 +74,7 @@ _Ty_CheckFunctionResult(PyThreadState *tstate, TyObject *callable, int _Ty_CheckSlotResult(TyObject *obj, const char *slot_name, int success) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!success) { if (!_TyErr_Occurred(tstate)) { _Ty_FatalErrorFormat(__func__, @@ -102,13 +102,13 @@ TyObject * PyObject_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); } TyObject * -_TyObject_VectorcallDictTstate(PyThreadState *tstate, TyObject *callable, +_TyObject_VectorcallDictTstate(TyThreadState *tstate, TyObject *callable, TyObject *const *args, size_t nargsf, TyObject *kwargs) { @@ -155,12 +155,12 @@ TyObject * PyObject_VectorcallDict(TyObject *callable, TyObject *const *args, size_t nargsf, TyObject *kwargs) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyObject_VectorcallDictTstate(tstate, callable, args, nargsf, kwargs); } static void -object_is_not_callable(PyThreadState *tstate, TyObject *callable) +object_is_not_callable(TyThreadState *tstate, TyObject *callable) { if (Ty_IS_TYPE(callable, &TyModule_Type)) { // >>> import pprint @@ -197,7 +197,7 @@ basic_type_error: TyObject * -_TyObject_MakeTpCall(PyThreadState *tstate, TyObject *callable, +_TyObject_MakeTpCall(TyThreadState *tstate, TyObject *callable, TyObject *const *args, Ty_ssize_t nargs, TyObject *keywords) { @@ -261,7 +261,7 @@ PyVectorcall_Function(TyObject *callable) static TyObject * -_PyVectorcall_Call(PyThreadState *tstate, vectorcallfunc func, +_PyVectorcall_Call(TyThreadState *tstate, vectorcallfunc func, TyObject *callable, TyObject *tuple, TyObject *kwargs) { assert(func != NULL); @@ -293,7 +293,7 @@ _PyVectorcall_Call(PyThreadState *tstate, vectorcallfunc func, TyObject * PyVectorcall_Call(TyObject *callable, TyObject *tuple, TyObject *kwargs) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* get vectorcallfunc as in _PyVectorcall_Function, but without * the Ty_TPFLAGS_HAVE_VECTORCALL check */ @@ -323,14 +323,14 @@ TyObject * PyObject_Vectorcall(TyObject *callable, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyObject_VectorcallTstate(tstate, callable, args, nargsf, kwnames); } TyObject * -_TyObject_Call(PyThreadState *tstate, TyObject *callable, +_TyObject_Call(TyThreadState *tstate, TyObject *callable, TyObject *args, TyObject *kwargs) { ternaryfunc call; @@ -369,7 +369,7 @@ _TyObject_Call(PyThreadState *tstate, TyObject *callable, TyObject * PyObject_Call(TyObject *callable, TyObject *args, TyObject *kwargs) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyObject_Call(tstate, callable, args, kwargs); } @@ -390,7 +390,7 @@ PyObject_CallOneArg(TyObject *func, TyObject *arg) TyObject *_args[2]; TyObject **args = _args + 1; // For PY_VECTORCALL_ARGUMENTS_OFFSET args[0] = arg; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET; return _TyObject_VectorcallTstate(tstate, func, args, nargsf, NULL); } @@ -406,7 +406,7 @@ _PyFunction_Vectorcall(TyObject *func, TyObject* const* stack, PyFunctionObject *f = (PyFunctionObject *)func; Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); assert(nargs >= 0); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(nargs == 0 || stack != NULL); EVAL_CALL_STAT_INC(EVAL_CALL_FUNCTION_VECTORCALL); if (((PyCodeObject *)f->func_code)->co_flags & CO_OPTIMIZED) { @@ -426,7 +426,7 @@ PyAPI_FUNC(TyObject*) TyEval_CallObjectWithKeywords(TyObject *callable, TyObject *args, TyObject *kwargs) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); #ifdef Ty_DEBUG /* TyEval_CallObjectWithKeywords() must not be called with an exception set. It raises a new exception if parameters are invalid or if @@ -459,7 +459,7 @@ TyEval_CallObjectWithKeywords(TyObject *callable, TyObject * PyObject_CallObject(TyObject *callable, TyObject *args) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(!_TyErr_Occurred(tstate)); if (args == NULL) { return _TyObject_CallNoArgsTstate(tstate, callable); @@ -475,7 +475,7 @@ PyObject_CallObject(TyObject *callable, TyObject *args) /* Call callable(obj, *args, **kwargs). */ TyObject * -_TyObject_Call_Prepend(PyThreadState *tstate, TyObject *callable, +_TyObject_Call_Prepend(TyThreadState *tstate, TyObject *callable, TyObject *obj, TyObject *args, TyObject *kwargs) { assert(TyTuple_Check(args)); @@ -514,7 +514,7 @@ _TyObject_Call_Prepend(PyThreadState *tstate, TyObject *callable, /* --- Call with a format string ---------------------------------- */ static TyObject * -_TyObject_CallFunctionVa(PyThreadState *tstate, TyObject *callable, +_TyObject_CallFunctionVa(TyThreadState *tstate, TyObject *callable, const char *format, va_list va) { TyObject* small_stack[_PY_FASTCALL_SMALL_STACK]; @@ -568,7 +568,7 @@ PyObject_CallFunction(TyObject *callable, const char *format, ...) { va_list va; TyObject *result; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); va_start(va, format); result = _TyObject_CallFunctionVa(tstate, callable, format, va); @@ -585,7 +585,7 @@ TyEval_CallFunction(TyObject *callable, const char *format, ...) { va_list va; TyObject *result; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); va_start(va, format); result = _TyObject_CallFunctionVa(tstate, callable, format, va); @@ -601,7 +601,7 @@ TyEval_CallFunction(TyObject *callable, const char *format, ...) PyAPI_FUNC(TyObject *) /* abi_only */ _TyObject_CallFunction_SizeT(TyObject *callable, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); va_list va; va_start(va, format); @@ -613,7 +613,7 @@ _TyObject_CallFunction_SizeT(TyObject *callable, const char *format, ...) static TyObject* -callmethod(PyThreadState *tstate, TyObject* callable, const char *format, va_list va) +callmethod(TyThreadState *tstate, TyObject* callable, const char *format, va_list va) { assert(callable != NULL); if (!PyCallable_Check(callable)) { @@ -629,7 +629,7 @@ callmethod(PyThreadState *tstate, TyObject* callable, const char *format, va_lis TyObject * PyObject_CallMethod(TyObject *obj, const char *name, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (obj == NULL || name == NULL) { return null_error(tstate); @@ -655,7 +655,7 @@ PyObject_CallMethod(TyObject *obj, const char *name, const char *format, ...) PyAPI_FUNC(TyObject*) TyEval_CallMethod(TyObject *obj, const char *name, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (obj == NULL || name == NULL) { return null_error(tstate); } @@ -679,7 +679,7 @@ TyObject * _TyObject_CallMethod(TyObject *obj, TyObject *name, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (obj == NULL || name == NULL) { return null_error(tstate); } @@ -703,7 +703,7 @@ TyObject * _TyObject_CallMethodId(TyObject *obj, _Ty_Identifier *name, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (obj == NULL || name == NULL) { return null_error(tstate); } @@ -723,7 +723,7 @@ _TyObject_CallMethodId(TyObject *obj, _Ty_Identifier *name, } -TyObject * _TyObject_CallMethodFormat(PyThreadState *tstate, TyObject *callable, +TyObject * _TyObject_CallMethodFormat(TyThreadState *tstate, TyObject *callable, const char *format, ...) { va_list va; @@ -740,7 +740,7 @@ PyAPI_FUNC(TyObject *) /* abi_only */ _TyObject_CallMethod_SizeT(TyObject *obj, const char *name, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (obj == NULL || name == NULL) { return null_error(tstate); } @@ -763,7 +763,7 @@ _TyObject_CallMethod_SizeT(TyObject *obj, const char *name, /* --- Call with "..." arguments ---------------------------------- */ static TyObject * -object_vacall(PyThreadState *tstate, TyObject *base, +object_vacall(TyThreadState *tstate, TyObject *base, TyObject *callable, va_list vargs) { TyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; @@ -833,7 +833,7 @@ PyObject_VectorcallMethod(TyObject *name, TyObject *const *args, assert(args != NULL); assert(PyVectorcall_NARGS(nargsf) >= 1); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *callable = NULL; /* Use args[0] as "self" argument */ int unbound = _TyObject_GetMethod(args[0], name, &callable); @@ -863,7 +863,7 @@ PyObject_VectorcallMethod(TyObject *name, TyObject *const *args, TyObject * PyObject_CallMethodObjArgs(TyObject *obj, TyObject *name, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (obj == NULL || name == NULL) { return null_error(tstate); } @@ -888,7 +888,7 @@ PyObject_CallMethodObjArgs(TyObject *obj, TyObject *name, ...) TyObject * _TyObject_CallMethodIdObjArgs(TyObject *obj, _Ty_Identifier *name, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (obj == NULL || name == NULL) { return null_error(tstate); } @@ -918,7 +918,7 @@ _TyObject_CallMethodIdObjArgs(TyObject *obj, _Ty_Identifier *name, ...) TyObject * PyObject_CallFunctionObjArgs(TyObject *callable, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); va_list vargs; TyObject *result; @@ -957,7 +957,7 @@ _PyStack_AsDict(TyObject *const *values, TyObject *kwnames) When done, you must call _PyStack_UnpackDict_Free(stack, nargs, kwnames) */ TyObject *const * -_PyStack_UnpackDict(PyThreadState *tstate, +_PyStack_UnpackDict(TyThreadState *tstate, TyObject *const *args, Ty_ssize_t nargs, TyObject *kwargs, TyObject **p_kwnames) { diff --git a/Objects/classobject.c b/Objects/classobject.c index dcb057e..18a126f 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -48,7 +48,7 @@ method_vectorcall(TyObject *method, TyObject *const *args, { assert(Ty_IS_TYPE(method, &TyMethod_Type)); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *self = TyMethod_GET_SELF(method); TyObject *func = TyMethod_GET_FUNCTION(method); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 7e9f351..afa087e 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -1712,7 +1712,7 @@ GETITEM(TyObject *v, Ty_ssize_t i) #endif static int -identify_unbound_names(PyThreadState *tstate, PyCodeObject *co, +identify_unbound_names(TyThreadState *tstate, PyCodeObject *co, TyObject *globalnames, TyObject *attrnames, TyObject *globalsns, TyObject *builtinsns, struct co_unbound_counts *counts, int *p_numdupes) @@ -1912,7 +1912,7 @@ _TyCode_GetVarCounts(PyCodeObject *co, _TyCode_var_counts_t *counts) } int -_TyCode_SetUnboundVarCounts(PyThreadState *tstate, +_TyCode_SetUnboundVarCounts(TyThreadState *tstate, PyCodeObject *co, _TyCode_var_counts_t *counts, TyObject *globalnames, TyObject *attrnames, TyObject *globalsns, TyObject *builtinsns) @@ -2024,7 +2024,7 @@ _TyCode_CheckNoExternalState(PyCodeObject *co, _TyCode_var_counts_t *counts, } int -_TyCode_VerifyStateless(PyThreadState *tstate, +_TyCode_VerifyStateless(TyThreadState *tstate, PyCodeObject *co, TyObject *globalnames, TyObject *globalsns, TyObject *builtinsns) { @@ -2384,7 +2384,7 @@ free_monitoring_data(_PyCoMonitoringData *data) static void code_dealloc(TyObject *self) { - PyThreadState *tstate = TyThreadState_GET(); + TyThreadState *tstate = TyThreadState_GET(); _Ty_atomic_add_uint64(&tstate->interp->_code_object_generation, 1); PyCodeObject *co = _PyCodeObject_CAST(self); _TyObject_ResurrectStart(self); @@ -3247,7 +3247,7 @@ destroy_key(void *key) } #endif -PyStatus +TyStatus _TyCode_Init(PyInterpreterState *interp) { #ifdef Ty_GIL_DISABLED @@ -3311,7 +3311,7 @@ _Ty_ReserveTLBCIndex(PyInterpreterState *interp) void _Ty_ClearTLBCIndex(_PyThreadStateImpl *tstate) { - PyInterpreterState *interp = ((PyThreadState *)tstate)->interp; + PyInterpreterState *interp = ((TyThreadState *)tstate)->interp; if (interp->config.tlbc_enabled) { _PyIndexPool_FreeIndex(&interp->tlbc_indices, tstate->tlbc_index); } diff --git a/Objects/descrobject.c b/Objects/descrobject.c index a851930..495ae88 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -295,7 +295,7 @@ method_check_args(TyObject *func, TyObject *const *args, Ty_ssize_t nargs, TyObj typedef void (*funcptr)(void); static inline funcptr -method_enter_call(PyThreadState *tstate, TyObject *func) +method_enter_call(TyThreadState *tstate, TyObject *func) { if (_Ty_EnterRecursiveCallTstate(tstate, " while calling a Python object")) { return NULL; @@ -308,7 +308,7 @@ static TyObject * method_vectorcall_VARARGS( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (method_check_args(func, args, nargs, kwnames)) { return NULL; @@ -333,7 +333,7 @@ static TyObject * method_vectorcall_VARARGS_KEYWORDS( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (method_check_args(func, args, nargs, NULL)) { return NULL; @@ -369,7 +369,7 @@ static TyObject * method_vectorcall_FASTCALL_KEYWORDS_METHOD( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (method_check_args(func, args, nargs, NULL)) { return NULL; @@ -389,7 +389,7 @@ static TyObject * method_vectorcall_FASTCALL( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (method_check_args(func, args, nargs, kwnames)) { return NULL; @@ -408,7 +408,7 @@ static TyObject * method_vectorcall_FASTCALL_KEYWORDS( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (method_check_args(func, args, nargs, NULL)) { return NULL; @@ -427,7 +427,7 @@ static TyObject * method_vectorcall_NOARGS( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (method_check_args(func, args, nargs, kwnames)) { return NULL; @@ -454,7 +454,7 @@ static TyObject * method_vectorcall_O( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (method_check_args(func, args, nargs, kwnames)) { return NULL; diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 5db1691..72e87cd 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2238,7 +2238,7 @@ dict_getitem(TyObject *op, TyObject *key, const char *warnmsg) return NULL; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); #ifdef Ty_DEBUG // bpo-40839: Before Python 3.10, it was possible to call TyDict_GetItem() // with the GIL released. diff --git a/Objects/exceptions.c b/Objects/exceptions.c index c3a7943..19ce4bc 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -4006,7 +4006,7 @@ MemoryError_new(TyTypeObject *type, TyObject *args, TyObject *kwds) } TyObject * -_TyErr_NoMemory(PyThreadState *tstate) +_TyErr_NoMemory(TyThreadState *tstate) { if (Ty_IS_TYPE(TyExc_MemoryError, NULL)) { /* TyErr_NoMemory() has been called before TyExc_MemoryError has been @@ -4373,7 +4373,7 @@ _PyExc_FiniTypes(PyInterpreterState *interp) } -PyStatus +TyStatus _PyExc_InitGlobalObjects(PyInterpreterState *interp) { if (preallocate_memerrors() < 0) { @@ -4382,7 +4382,7 @@ _PyExc_InitGlobalObjects(PyInterpreterState *interp) return _TyStatus_OK(); } -PyStatus +TyStatus _PyExc_InitState(PyInterpreterState *interp) { struct _Py_exc_state *state = &interp->exc_state; diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 85d6221..b3144d0 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1959,7 +1959,7 @@ _TyFloat_InitState(PyInterpreterState *interp) _init_global_state(); } -PyStatus +TyStatus _TyFloat_InitTypes(PyInterpreterState *interp) { /* Init float info */ diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 9c88fc3..f641766 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -1818,7 +1818,7 @@ frame_lineno_set_impl(PyFrameObject *self, TyObject *value) /* Pop exception stack as well as the evaluation stack */ TyObject *exc = PyStackRef_AsPyObjectBorrow(popped); assert(PyExceptionInstance_Check(exc) || exc == Ty_None); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_XSETREF(tstate->exc_info->exc_value, exc == Ty_None ? NULL : exc); } else { @@ -2092,7 +2092,7 @@ TyTypeObject TyFrame_Type = { }; static void -init_frame(PyThreadState *tstate, _PyInterpreterFrame *frame, +init_frame(TyThreadState *tstate, _PyInterpreterFrame *frame, PyFunctionObject *func, TyObject *locals) { PyCodeObject *code = (PyCodeObject *)func->func_code; @@ -2122,7 +2122,7 @@ _TyFrame_New_NoTrack(PyCodeObject *code) /* Legacy API */ PyFrameObject* -TyFrame_New(PyThreadState *tstate, PyCodeObject *code, +TyFrame_New(TyThreadState *tstate, PyCodeObject *code, TyObject *globals, TyObject *locals) { TyObject *builtins = _TyDict_LoadBuiltinsFromGlobals(globals); diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 752b731..e0447de 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -974,7 +974,7 @@ function___type_params___set_impl(PyFunctionObject *self, TyObject *value) } TyObject * -_Ty_set_function_type_params(PyThreadState *Py_UNUSED(ignored), TyObject *func, +_Ty_set_function_type_params(TyThreadState *Py_UNUSED(ignored), TyObject *func, TyObject *type_params) { assert(TyFunction_Check(func)); @@ -1242,7 +1242,7 @@ TyTypeObject TyFunction_Type = { int -_PyFunction_VerifyStateless(PyThreadState *tstate, TyObject *func) +_PyFunction_VerifyStateless(TyThreadState *tstate, TyObject *func) { assert(!TyErr_Occurred()); assert(TyFunction_Check(func)); diff --git a/Objects/genobject.c b/Objects/genobject.c index c7d6a1b..63e9887 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -192,7 +192,7 @@ static PySendResult gen_send_ex2(PyGenObject *gen, TyObject *arg, TyObject **presult, int exc, int closing) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyInterpreterFrame *frame = &gen->gi_iframe; *presult = NULL; @@ -486,7 +486,7 @@ _gen_throw(PyGenObject *gen, int close_on_genexit, return gen_send_ex(gen, Ty_None, 1, 0); goto throw_here; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(tstate != NULL); if (TyGen_CheckExact(yf) || TyCoro_CheckExact(yf)) { /* `yf` is a generator or a coroutine. */ @@ -960,7 +960,7 @@ _Ty_MakeCoro(PyFunctionObject *func) if (!coro) { return NULL; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); int origin_depth = tstate->coroutine_origin_tracking_depth; if (origin_depth == 0) { @@ -1402,7 +1402,7 @@ TyCoro_New(PyFrameObject *f, TyObject *name, TyObject *qualname) return NULL; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); int origin_depth = tstate->coroutine_origin_tracking_depth; if (origin_depth == 0) { @@ -1491,7 +1491,7 @@ async_gen_repr(TyObject *self) static int async_gen_init_hooks(PyAsyncGenObject *o) { - PyThreadState *tstate; + TyThreadState *tstate; TyObject *finalizer; TyObject *firstiter; @@ -2043,7 +2043,7 @@ TyTypeObject _PyAsyncGenWrappedValue_Type = { TyObject * -_PyAsyncGenValueWrapperNew(PyThreadState *tstate, TyObject *val) +_PyAsyncGenValueWrapperNew(TyThreadState *tstate, TyObject *val) { assert(val); diff --git a/Objects/interpolationobject.c b/Objects/interpolationobject.c index 9c58fb2..b72e8fe 100644 --- a/Objects/interpolationobject.c +++ b/Objects/interpolationobject.c @@ -160,7 +160,7 @@ TyTypeObject _PyInterpolation_Type = { .tp_traverse = interpolation_traverse, }; -PyStatus +TyStatus _PyInterpolation_InitTypes(PyInterpreterState *interp) { TyObject *tuple = Ty_BuildValue("(ssss)", "value", "expression", "conversion", "format_spec"); diff --git a/Objects/longobject.c b/Objects/longobject.c index 5d83e67..b15e1a3 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -6427,7 +6427,7 @@ long_vectorcall(TyObject *type, TyObject * const*args, { Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (kwnames != NULL) { - PyThreadState *tstate = TyThreadState_GET(); + TyThreadState *tstate = TyThreadState_GET(); return _TyObject_MakeTpCall(tstate, type, args, nargs, kwnames); } switch (nargs) { @@ -6641,7 +6641,7 @@ TyLong_GetInfo(void) /* runtime lifecycle */ -PyStatus +TyStatus _TyLong_InitTypes(PyInterpreterState *interp) { /* initialize int_info */ diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 451107d..a3c9b58 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -404,7 +404,7 @@ TyTypeObject PyCMethod_Type = { */ static inline int -cfunction_check_kwargs(PyThreadState *tstate, TyObject *func, TyObject *kwnames) +cfunction_check_kwargs(TyThreadState *tstate, TyObject *func, TyObject *kwnames) { assert(!_TyErr_Occurred(tstate)); assert(PyCFunction_Check(func)); @@ -423,7 +423,7 @@ cfunction_check_kwargs(PyThreadState *tstate, TyObject *func, TyObject *kwnames) typedef void (*funcptr)(void); static inline funcptr -cfunction_enter_call(PyThreadState *tstate, TyObject *func) +cfunction_enter_call(TyThreadState *tstate, TyObject *func) { if (_Ty_EnterRecursiveCallTstate(tstate, " while calling a Python object")) { return NULL; @@ -436,7 +436,7 @@ static TyObject * cfunction_vectorcall_FASTCALL( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (cfunction_check_kwargs(tstate, func, kwnames)) { return NULL; } @@ -455,7 +455,7 @@ static TyObject * cfunction_vectorcall_FASTCALL_KEYWORDS( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyCFunctionFastWithKeywords meth = (PyCFunctionFastWithKeywords) cfunction_enter_call(tstate, func); @@ -471,7 +471,7 @@ static TyObject * cfunction_vectorcall_FASTCALL_KEYWORDS_METHOD( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyTypeObject *cls = PyCFunction_GET_CLASS(func); Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyCMethod meth = (PyCMethod)cfunction_enter_call(tstate, func); @@ -487,7 +487,7 @@ static TyObject * cfunction_vectorcall_NOARGS( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (cfunction_check_kwargs(tstate, func, kwnames)) { return NULL; } @@ -515,7 +515,7 @@ static TyObject * cfunction_vectorcall_O( TyObject *func, TyObject *const *args, size_t nargsf, TyObject *kwnames) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (cfunction_check_kwargs(tstate, func, kwnames)) { return NULL; } @@ -545,7 +545,7 @@ cfunction_call(TyObject *func, TyObject *args, TyObject *kwargs) { assert(kwargs == NULL || TyDict_Check(kwargs)); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(!_TyErr_Occurred(tstate)); int flags = PyCFunction_GET_FLAGS(func); diff --git a/Objects/object.c b/Objects/object.c index be0313f..6cac8e0 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -83,7 +83,7 @@ get_legacy_reftotal(void) interp->object_state.reftotal static inline void -reftotal_add(PyThreadState *tstate, Ty_ssize_t n) +reftotal_add(TyThreadState *tstate, Ty_ssize_t n) { #ifdef Ty_GIL_DISABLED _PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate; @@ -288,19 +288,19 @@ _Ty_DECREF_DecRefTotal(void) } void -_Ty_IncRefTotal(PyThreadState *tstate) +_Ty_IncRefTotal(TyThreadState *tstate) { reftotal_add(tstate, 1); } void -_Ty_DecRefTotal(PyThreadState *tstate) +_Ty_DecRefTotal(TyThreadState *tstate) { reftotal_add(tstate, -1); } void -_Ty_AddRefTotal(PyThreadState *tstate, Ty_ssize_t n) +_Ty_AddRefTotal(TyThreadState *tstate, Ty_ssize_t n) { reftotal_add(tstate, n); } @@ -762,7 +762,7 @@ PyObject_Repr(TyObject *v) return TyUnicode_FromFormat("<%s object at %p>", Ty_TYPE(v)->tp_name, v); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); #ifdef Ty_DEBUG /* PyObject_Repr() must not be called with an exception set, because it can clear it (directly or indirectly) and so the @@ -806,7 +806,7 @@ PyObject_Str(TyObject *v) if (Ty_TYPE(v)->tp_str == NULL) return PyObject_Repr(v); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); #ifdef Ty_DEBUG /* PyObject_Str() must not be called with an exception set, because it can clear it (directly or indirectly) and so the @@ -922,7 +922,7 @@ free_object(void *obj) void _TyObject_ClearFreeLists(struct _Ty_freelists *freelists, int is_finalization) { - // In the free-threaded build, freelists are per-PyThreadState and cleared in TyThreadState_Clear() + // In the free-threaded build, freelists are per-TyThreadState and cleared in TyThreadState_Clear() // In the default build, freelists are per-interpreter and cleared in finalize_interp_types() clear_freelist(&freelists->floats, is_finalization, free_object); for (Ty_ssize_t i = 0; i < TyTuple_MAXSAVESIZE; i++) { @@ -1040,7 +1040,7 @@ static const char * const opstrings[] = {"<", "<=", "==", "!=", ">", ">="}; /* Perform a rich comparison, raising TypeError when the requested comparison operator is not supported. */ static TyObject * -do_richcompare(PyThreadState *tstate, TyObject *v, TyObject *w, int op) +do_richcompare(TyThreadState *tstate, TyObject *v, TyObject *w, int op) { richcmpfunc f; TyObject *res; @@ -1093,7 +1093,7 @@ do_richcompare(PyThreadState *tstate, TyObject *v, TyObject *w, int op) TyObject * PyObject_RichCompare(TyObject *v, TyObject *w, int op) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(Py_LT <= op && op <= Py_GE); if (v == NULL || w == NULL) { @@ -1695,7 +1695,7 @@ _TyObject_GenericGetAttrWithDict(TyObject *obj, TyObject *name, Ty_INCREF(name); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyCStackRef cref; _TyThreadState_PushCStackRef(tstate, &cref); @@ -1819,7 +1819,7 @@ _TyObject_GenericSetAttrWithDict(TyObject *obj, TyObject *name, Ty_INCREF(name); Ty_INCREF(tp); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyCStackRef cref; _TyThreadState_PushCStackRef(tstate, &cref); @@ -1977,7 +1977,7 @@ _dir_locals(void) locals = _TyEval_GetFrameLocals(); } else { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); locals = _TyEval_GetGlobalsFromRunningMain(tstate); if (locals == NULL) { if (!_TyErr_Occurred(tstate)) { @@ -2282,7 +2282,7 @@ TyTypeObject _PyNotImplemented_Type = { TyObject _Ty_NotImplementedStruct = _TyObject_HEAD_INIT(&_PyNotImplemented_Type); -PyStatus +TyStatus _TyObject_InitState(PyInterpreterState *interp) { #ifdef Ty_TRACE_REFS @@ -2439,7 +2439,7 @@ static TyTypeObject* static_types[] = { }; -PyStatus +TyStatus _PyTypes_InitTypes(PyInterpreterState *interp) { // All other static types (unless initialized elsewhere) @@ -2928,7 +2928,7 @@ finally: * Ty_DECREF must already have been called on it. */ void -_PyTrash_thread_deposit_object(PyThreadState *tstate, TyObject *op) +_PyTrash_thread_deposit_object(TyThreadState *tstate, TyObject *op) { _TyObject_ASSERT(op, Ty_REFCNT(op) == 0); TyTypeObject *tp = Ty_TYPE(op); @@ -2952,7 +2952,7 @@ _PyTrash_thread_deposit_object(PyThreadState *tstate, TyObject *op) /* Deallocate all the objects in the gcstate->trash_delete_later list. * Called when the call-stack unwinds again. */ void -_PyTrash_thread_destroy_chain(PyThreadState *tstate) +_PyTrash_thread_destroy_chain(TyThreadState *tstate) { while (tstate->delete_later) { TyObject *op = tstate->delete_later; @@ -3045,7 +3045,7 @@ _Ty_Dealloc(TyObject *op) TyTypeObject *type = Ty_TYPE(op); unsigned long gc_flag = type->tp_flags & Ty_TPFLAGS_HAVE_GC; destructor dealloc = type->tp_dealloc; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); intptr_t margin = _Ty_RecursionLimit_GetMargin(tstate); if (margin < 2 && gc_flag) { _PyTrash_thread_deposit_object(tstate, (TyObject *)op); diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index d1853dc..b4abd39 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1285,7 +1285,7 @@ free_delayed(uintptr_t ptr, size_t size) // Normally the processing of delayed items is done from the eval // breaker. Processing here is a safety measure to ensure too much // work does not accumulate. - _TyMem_ProcessDelayed((PyThreadState *)tstate); + _TyMem_ProcessDelayed((TyThreadState *)tstate); } #endif } @@ -1379,7 +1379,7 @@ maybe_process_interp_queue(struct _Ty_mem_interp_free_queue *queue, } void -_TyMem_ProcessDelayed(PyThreadState *tstate) +_TyMem_ProcessDelayed(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; _PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate; @@ -1394,7 +1394,7 @@ _TyMem_ProcessDelayed(PyThreadState *tstate) } void -_TyMem_ProcessDelayedNoDealloc(PyThreadState *tstate, delayed_dealloc_cb cb, void *state) +_TyMem_ProcessDelayedNoDealloc(TyThreadState *tstate, delayed_dealloc_cb cb, void *state) { PyInterpreterState *interp = tstate->interp; _PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate; @@ -1407,7 +1407,7 @@ _TyMem_ProcessDelayedNoDealloc(PyThreadState *tstate, delayed_dealloc_cb cb, voi } void -_TyMem_AbandonDelayed(PyThreadState *tstate) +_TyMem_AbandonDelayed(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; struct llist_node *queue = &((_PyThreadStateImpl *)tstate)->mem_free_queue; @@ -3048,7 +3048,7 @@ _TyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes) static inline void _TyMem_DebugCheckGIL(const char *func) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate == NULL) { #ifndef Ty_GIL_DISABLED _Ty_FatalErrorFunc(func, diff --git a/Objects/stringlib/join.h b/Objects/stringlib/join.h index 412f882..395af64 100644 --- a/Objects/stringlib/join.h +++ b/Objects/stringlib/join.h @@ -20,7 +20,7 @@ STRINGLIB(bytes_join)(TyObject *sep, TyObject *iterable) Ty_buffer static_buffers[NB_STATIC_BUFFERS]; #define GIL_THRESHOLD 1048576 int drop_gil = 1; - PyThreadState *save = NULL; + TyThreadState *save = NULL; seq = PySequence_Fast(iterable, "can only join an iterable"); if (seq == NULL) { diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 33f79ad..ce20457 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1148,7 +1148,7 @@ static int has_custom_mro(TyTypeObject *tp) { _PyCStackRef c_ref1, c_ref2; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyThreadState_PushCStackRef(tstate, &c_ref1); _TyThreadState_PushCStackRef(tstate, &c_ref2); @@ -2264,7 +2264,7 @@ type_call(TyObject *self, TyObject *args, TyObject *kwds) { TyTypeObject *type = PyTypeObject_CAST(self); TyObject *obj; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); #ifdef Ty_DEBUG /* type_call() must not be called with an exception set, @@ -2875,7 +2875,7 @@ lookup_method(TyObject *self, TyObject *attr, _PyStackRef *out) static inline TyObject* -vectorcall_unbound(PyThreadState *tstate, int unbound, TyObject *func, +vectorcall_unbound(TyThreadState *tstate, int unbound, TyObject *func, TyObject *const *args, Ty_ssize_t nargs) { size_t nargsf = nargs; @@ -2905,7 +2905,7 @@ call_unbound_noarg(int unbound, TyObject *func, TyObject *self) static TyObject * call_method_noarg(TyObject *self, TyObject *attr) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyCStackRef cref; _TyThreadState_PushCStackRef(tstate, &cref); TyObject *res = NULL; @@ -2921,7 +2921,7 @@ call_method_noarg(TyObject *self, TyObject *attr) static TyObject * call_method(TyObject *self, TyObject *attr, TyObject *args, TyObject *kwds) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyCStackRef cref; _TyThreadState_PushCStackRef(tstate, &cref); TyObject *res = NULL; @@ -2949,7 +2949,7 @@ vectorcall_method(TyObject *name, TyObject *const *args, Ty_ssize_t nargs) { assert(nargs >= 1); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *retval = NULL; TyObject *self = args[0]; _PyCStackRef cref; @@ -2966,7 +2966,7 @@ vectorcall_method(TyObject *name, TyObject *const *args, Ty_ssize_t nargs) /* Clone of vectorcall_method() that returns NotImplemented * when the lookup fails. */ static TyObject * -vectorcall_maybe(PyThreadState *tstate, TyObject *name, +vectorcall_maybe(TyThreadState *tstate, TyObject *name, TyObject *const *args, Ty_ssize_t nargs) { assert(nargs >= 1); @@ -2995,7 +2995,7 @@ vectorcall_maybe(PyThreadState *tstate, TyObject *name, static TyObject * maybe_call_special_no_args(TyObject *self, TyObject *attr, int *attr_is_none) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyCStackRef cref; _TyThreadState_PushCStackRef(tstate, &cref); @@ -3016,7 +3016,7 @@ static TyObject * maybe_call_special_one_arg(TyObject *self, TyObject *attr, TyObject *arg, int *attr_is_none) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyCStackRef cref; _TyThreadState_PushCStackRef(tstate, &cref); @@ -4746,7 +4746,7 @@ type_vectorcall(TyObject *metatype, TyObject *const *args, } /* In other (much less common) cases, fall back to more flexible calling conventions. */ - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyObject_MakeTpCall(tstate, metatype, args, nargs, kwnames); } @@ -9852,7 +9852,7 @@ static TyObject * \ FUNCNAME(TyObject *self, TyObject *other) \ { \ TyObject* stack[2]; \ - PyThreadState *tstate = _TyThreadState_GET(); \ + TyThreadState *tstate = _TyThreadState_GET(); \ int do_other = !Ty_IS_TYPE(self, Ty_TYPE(other)) && \ Ty_TYPE(other)->tp_as_number != NULL && \ Ty_TYPE(other)->tp_as_number->SLOTNAME == TESTFUNC; \ @@ -10032,7 +10032,7 @@ slot_nb_power(TyObject *self, TyObject *other, TyObject *modulus) /* The following code is a copy of SLOT1BINFULL, but for three arguments. */ TyObject* stack[3]; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); int do_other = !Ty_IS_TYPE(self, Ty_TYPE(other)) && Ty_TYPE(other)->tp_as_number != NULL && Ty_TYPE(other)->tp_as_number->nb_power == slot_nb_power; @@ -10358,7 +10358,7 @@ slot_tp_richcompare(TyObject *self, TyObject *other, int op) static int has_dunder_getitem(TyObject *self) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyCStackRef c_ref; _TyThreadState_PushCStackRef(tstate, &c_ref); lookup_maybe_method(self, &_Ty_ID(__getitem__), &c_ref.ref); @@ -10459,7 +10459,7 @@ slot_tp_init(TyObject *self, TyObject *args, TyObject *kwds) static TyObject * slot_tp_new(TyTypeObject *type, TyObject *args, TyObject *kwds) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *func, *result; func = PyObject_GetAttr((TyObject *)type, &_Ty_ID(__new__)); @@ -10476,7 +10476,7 @@ static void slot_tp_finalize(TyObject *self) { /* Save the current exception, if any. */ - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *exc = _TyErr_GetRaisedException(tstate); _PyCStackRef cref; @@ -12049,7 +12049,7 @@ super_init_impl(TyObject *self, TyTypeObject *type, TyObject *obj) { if (type == NULL) { /* Call super(), without args -- fill in from __class__ and first local variable on the stack. */ - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyInterpreterFrame *frame = _TyThreadState_GetFrame(tstate); if (frame == NULL) { TyErr_SetString(TyExc_RuntimeError, diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c index 336a36f..2101978 100644 --- a/Objects/typevarobject.c +++ b/Objects/typevarobject.c @@ -1814,21 +1814,21 @@ _Ty_make_typevar(TyObject *name, TyObject *evaluate_bound, TyObject *evaluate_co } TyObject * -_Ty_make_paramspec(PyThreadState *Py_UNUSED(ignored), TyObject *v) +_Ty_make_paramspec(TyThreadState *Py_UNUSED(ignored), TyObject *v) { assert(TyUnicode_Check(v)); return (TyObject *)paramspec_alloc(v, NULL, NULL, false, false, true, NULL); } TyObject * -_Ty_make_typevartuple(PyThreadState *Py_UNUSED(ignored), TyObject *v) +_Ty_make_typevartuple(TyThreadState *Py_UNUSED(ignored), TyObject *v) { assert(TyUnicode_Check(v)); return (TyObject *)typevartuple_alloc(v, NULL, NULL); } static TyObject * -get_type_param_default(PyThreadState *ts, TyObject *typeparam) { +get_type_param_default(TyThreadState *ts, TyObject *typeparam) { // Does not modify refcount of existing objects. if (Ty_IS_TYPE(typeparam, ts->interp->cached_objects.typevar_type)) { return typevar_default(typeparam, NULL); @@ -1969,7 +1969,7 @@ typealias_check_type_params(TyObject *type_params, int *err) { return NULL; } - PyThreadState *ts = _TyThreadState_GET(); + TyThreadState *ts = _TyThreadState_GET(); int default_seen = 0; for (Ty_ssize_t index = 0; index < length; index++) { TyObject *type_param = TyTuple_GET_ITEM(type_params, index); @@ -2173,7 +2173,7 @@ TyTypeObject _PyTypeAlias_Type = { }; TyObject * -_Ty_make_typealias(PyThreadState* unused, TyObject *args) +_Ty_make_typealias(TyThreadState* unused, TyObject *args) { assert(TyTuple_Check(args)); assert(TyTuple_GET_SIZE(args) == 3); @@ -2270,7 +2270,7 @@ generic_class_getitem(TyObject *cls, TyObject *args, TyObject *kwargs) } TyObject * -_Ty_subscript_generic(PyThreadState* unused, TyObject *params) +_Ty_subscript_generic(TyThreadState* unused, TyObject *params) { params = unpack_typevartuples(params); @@ -2362,7 +2362,7 @@ void _Ty_clear_generic_types(PyInterpreterState *interp) } TyObject * -_Ty_set_typeparam_default(PyThreadState *ts, TyObject *typeparam, TyObject *evaluate_default) +_Ty_set_typeparam_default(TyThreadState *ts, TyObject *typeparam, TyObject *evaluate_default) { if (Ty_IS_TYPE(typeparam, ts->interp->cached_objects.typevar_type)) { Ty_XSETREF(((typevarobject *)typeparam)->evaluate_default, Ty_NewRef(evaluate_default)); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c8a0c7d..523dbb6 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -375,7 +375,7 @@ clear_interned_dict(PyInterpreterState *interp) } } -static PyStatus +static TyStatus init_global_interned_strings(PyInterpreterState *interp) { assert(INTERNED_STRINGS == NULL); @@ -15840,11 +15840,11 @@ _TyUnicode_InitState(PyInterpreterState *interp) } -PyStatus +TyStatus _TyUnicode_InitGlobalObjects(PyInterpreterState *interp) { if (_Ty_IsMainInterpreter(interp)) { - PyStatus status = init_global_interned_strings(interp); + TyStatus status = init_global_interned_strings(interp); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -15860,7 +15860,7 @@ _TyUnicode_InitGlobalObjects(PyInterpreterState *interp) } -PyStatus +TyStatus _TyUnicode_InitTypes(PyInterpreterState *interp) { if (_PyStaticType_InitBuiltin(interp, &EncodingMapType) < 0) { @@ -16483,7 +16483,7 @@ error: } -static PyStatus +static TyStatus init_stdio_encoding(PyInterpreterState *interp) { /* Update the stdio encoding to the normalized Python codec name. */ @@ -16553,8 +16553,8 @@ init_fs_codec(PyInterpreterState *interp) } -static PyStatus -init_fs_encoding(PyThreadState *tstate) +static TyStatus +init_fs_encoding(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; @@ -16575,10 +16575,10 @@ init_fs_encoding(PyThreadState *tstate) } -PyStatus -_TyUnicode_InitEncodings(PyThreadState *tstate) +TyStatus +_TyUnicode_InitEncodings(TyThreadState *tstate) { - PyStatus status = _PyCodec_InitRegistry(tstate->interp); + TyStatus status = _PyCodec_InitRegistry(tstate->interp); if (_TyStatus_EXCEPTION(status)) { return status; } diff --git a/Parser/myreadline.c b/Parser/myreadline.c index db70cfb..f25c706 100644 --- a/Parser/myreadline.c +++ b/Parser/myreadline.c @@ -27,8 +27,8 @@ // Export the symbol since it's used by the readline shared extension -PyAPI_DATA(PyThreadState*) _TyOS_ReadlineTState; -PyThreadState *_TyOS_ReadlineTState = NULL; +PyAPI_DATA(TyThreadState*) _TyOS_ReadlineTState; +TyThreadState *_TyOS_ReadlineTState = NULL; static PyMutex _TyOS_ReadlineLock; @@ -38,7 +38,7 @@ int (*TyOS_InputHook)(void) = NULL; except if _TyOS_InterruptOccurred() returns true. */ static int -my_fgets(PyThreadState* tstate, char *buf, int len, FILE *fp) +my_fgets(TyThreadState* tstate, char *buf, int len, FILE *fp) { #ifdef MS_WINDOWS HANDLE handle; @@ -127,7 +127,7 @@ my_fgets(PyThreadState* tstate, char *buf, int len, FILE *fp) extern char _get_console_type(HANDLE handle); char * -_TyOS_WindowsConsoleReadline(PyThreadState *tstate, HANDLE hStdIn) +_TyOS_WindowsConsoleReadline(TyThreadState *tstate, HANDLE hStdIn) { static wchar_t wbuf_local[1024 * 16]; const DWORD chunk_size = 1024; @@ -259,7 +259,7 @@ TyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) { size_t n; char *p, *pr; - PyThreadState *tstate = _TyOS_ReadlineTState; + TyThreadState *tstate = _TyOS_ReadlineTState; assert(tstate != NULL); #ifdef HAVE_WINDOWS_CONSOLE_IO @@ -374,7 +374,7 @@ TyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) char *rv, *res; size_t len; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_Ty_atomic_load_ptr_relaxed(&_TyOS_ReadlineTState) == tstate) { TyErr_SetString(TyExc_RuntimeError, "can't re-enter readline"); diff --git a/Parser/pegen.c b/Parser/pegen.c index a1d2045..0b908bc 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -715,7 +715,7 @@ _TyPegen_number_token(Parser *p) if (c == NULL) { p->error_indicator = 1; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); // The only way a ValueError should happen in _this_ code is via // TyLong_FromString hitting a length limit. if (tstate->current_exception != NULL && diff --git a/Programs/_bootstrap_python.c b/Programs/_bootstrap_python.c index 387e126..1259552 100644 --- a/Programs/_bootstrap_python.c +++ b/Programs/_bootstrap_python.c @@ -52,7 +52,7 @@ wmain(int argc, wchar_t **argv) main(int argc, char **argv) #endif { - PyStatus status; + TyStatus status; PyConfig config; TyConfig_InitIsolatedConfig(&config); diff --git a/Programs/_freeze_module.c b/Programs/_freeze_module.c index a985139..231508d 100644 --- a/Programs/_freeze_module.c +++ b/Programs/_freeze_module.c @@ -50,7 +50,7 @@ runtime_init(void) config.site_import = 0; - PyStatus status; + TyStatus status; status = TyConfig_SetString(&config, &config.program_name, L"./_freeze_module"); if (TyStatus_Exception(status)) { diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 1f75054..43459e0 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -55,7 +55,7 @@ static void error(const char *msg) static void config_set_string(PyConfig *config, wchar_t **config_str, const wchar_t *str) { - PyStatus status = TyConfig_SetString(config, config_str, str); + TyStatus status = TyConfig_SetString(config, config_str, str); if (TyStatus_Exception(status)) { TyConfig_Clear(config); Ty_ExitStatusException(status); @@ -72,7 +72,7 @@ static void config_set_program_name(PyConfig *config) static void init_from_config_clear(PyConfig *config) { - PyStatus status = Ty_InitializeFromConfig(config); + TyStatus status = Ty_InitializeFromConfig(config); TyConfig_Clear(config); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); @@ -111,7 +111,7 @@ static void print_subinterp(void) { /* Output information about the interpreter in the format expected in Lib/test/test_capi.py (test_subinterps). */ - PyThreadState *ts = TyThreadState_Get(); + TyThreadState *ts = TyThreadState_Get(); PyInterpreterState *interp = ts->interp; int64_t id = TyInterpreterState_GetID(interp); printf("interp %" PRId64 " <0x%" PRIXPTR ">, thread state <0x%" PRIXPTR ">: ", @@ -126,7 +126,7 @@ static void print_subinterp(void) static int test_repeated_init_and_subinterpreters(void) { - PyThreadState *mainstate, *substate; + TyThreadState *mainstate, *substate; TyGILState_STATE gilstate; for (int i=1; i <= INIT_LOOPS; i++) { @@ -504,7 +504,7 @@ static int test_init_initialize_config(void) static void config_set_argv(PyConfig *config, Ty_ssize_t argc, wchar_t * const *argv) { - PyStatus status = TyConfig_SetArgv(config, argc, argv); + TyStatus status = TyConfig_SetArgv(config, argc, argv); if (TyStatus_Exception(status)) { TyConfig_Clear(config); Ty_ExitStatusException(status); @@ -516,7 +516,7 @@ static void config_set_wide_string_list(PyConfig *config, PyWideStringList *list, Ty_ssize_t length, wchar_t **items) { - PyStatus status = TyConfig_SetWideStringList(config, list, length, items); + TyStatus status = TyConfig_SetWideStringList(config, list, length, items); if (TyStatus_Exception(status)) { TyConfig_Clear(config); Ty_ExitStatusException(status); @@ -526,7 +526,7 @@ config_set_wide_string_list(PyConfig *config, PyWideStringList *list, static int check_init_compat_config(int preinit) { - PyStatus status; + TyStatus status; if (preinit) { PyPreConfig preconfig; @@ -627,7 +627,7 @@ static int test_init_from_config(void) Ty_UTF8Mode = 0; preconfig.utf8_mode = 1; - PyStatus status = Ty_PreInitialize(&preconfig); + TyStatus status = Ty_PreInitialize(&preconfig); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } @@ -944,7 +944,7 @@ static int test_preinit_isolated1(void) preconfig.isolated = 1; - PyStatus status = Ty_PreInitialize(&preconfig); + TyStatus status = Ty_PreInitialize(&preconfig); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } @@ -970,7 +970,7 @@ static int test_preinit_isolated2(void) preconfig.isolated = 0; - PyStatus status = Ty_PreInitialize(&preconfig); + TyStatus status = Ty_PreInitialize(&preconfig); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } @@ -1007,7 +1007,7 @@ static int test_preinit_dont_parse_argv(void) L"-X", L"dev", L"-X", L"utf8", L"script.py"}; - PyStatus status = Ty_PreInitializeFromArgs(&preconfig, + TyStatus status = Ty_PreInitializeFromArgs(&preconfig, Ty_ARRAY_LENGTH(argv), argv); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); @@ -1074,7 +1074,7 @@ static void set_all_global_config_variables(void) static int check_preinit_isolated_config(int preinit) { - PyStatus status; + TyStatus status; PyPreConfig *rt_preconfig; /* environment variables must be ignored */ @@ -1144,7 +1144,7 @@ static int check_init_python_config(int preinit) PyPreConfig preconfig; TyPreConfig_InitPythonConfig(&preconfig); - PyStatus status = Ty_PreInitialize(&preconfig); + TyStatus status = Ty_PreInitialize(&preconfig); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } @@ -1183,7 +1183,7 @@ static int test_init_dont_configure_locale(void) preconfig.coerce_c_locale = 1; preconfig.coerce_c_locale_warn = 1; - PyStatus status = Ty_PreInitialize(&preconfig); + TyStatus status = Ty_PreInitialize(&preconfig); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } @@ -1500,7 +1500,7 @@ static int run_audit_run_test(int argc, wchar_t **argv, void *test) TySys_AddAuditHook(_audit_hook_run, test); - PyStatus status = Ty_InitializeFromConfig(&config); + TyStatus status = Ty_InitializeFromConfig(&config); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } @@ -1531,7 +1531,7 @@ static int test_audit_run_stdin(void) static int test_init_read_set(void) { - PyStatus status; + TyStatus status; PyConfig config; TyConfig_InitPythonConfig(&config); @@ -1587,7 +1587,7 @@ static int test_init_sys_add(void) config_set_argv(&config, Ty_ARRAY_LENGTH(argv), argv); config.parse_argv = 1; - PyStatus status; + TyStatus status; status = TyWideStringList_Append(&config.xoptions, L"config_xoption"); if (TyStatus_Exception(status)) { @@ -1643,7 +1643,7 @@ static int test_init_setpath_config(void) /* Explicitly preinitializes with Python preconfiguration to avoid Ty_SetPath() implicit preinitialization with compat preconfiguration. */ - PyStatus status = Ty_PreInitialize(&preconfig); + TyStatus status = Ty_PreInitialize(&preconfig); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } @@ -1753,7 +1753,7 @@ static int test_init_warnoptions(void) config_set_program_name(&config); - PyStatus status; + TyStatus status; status = TyWideStringList_Append(&config.warnoptions, L"ignore:::TyConfig_BeforeRead"); if (TyStatus_Exception(status)) { @@ -2082,7 +2082,7 @@ static int test_get_argc_argv(void) // Calling TyConfig_Read() twice must not change Ty_GetArgcArgv() result. // The second call is done by Ty_InitializeFromConfig(). - PyStatus status = TyConfig_Read(&config); + TyStatus status = TyConfig_Read(&config); if (TyStatus_Exception(status)) { TyConfig_Clear(&config); Ty_ExitStatusException(status); diff --git a/Python/_warnings.c b/Python/_warnings.c index 094397f..f8d2099 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -44,10 +44,10 @@ get_current_interp(void) return check_interp(interp) ? interp : NULL; } -static inline PyThreadState * +static inline TyThreadState * get_current_tstate(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate == NULL) { (void)check_interp(NULL); return NULL; @@ -664,7 +664,7 @@ update_registry(PyInterpreterState *interp, TyObject *registry, TyObject *text, } static void -show_warning(PyThreadState *tstate, TyObject *filename, int lineno, +show_warning(TyThreadState *tstate, TyObject *filename, int lineno, TyObject *text, TyObject *category, TyObject *sourceline) { TyObject *f_stderr = NULL; @@ -734,7 +734,7 @@ error: } static int -call_show_warning(PyThreadState *tstate, TyObject *category, +call_show_warning(TyThreadState *tstate, TyObject *category, TyObject *text, TyObject *message, TyObject *filename, int lineno, TyObject *lineno_obj, TyObject *sourceline, TyObject *source) @@ -790,7 +790,7 @@ error: } static TyObject * -warn_explicit(PyThreadState *tstate, TyObject *category, TyObject *message, +warn_explicit(TyThreadState *tstate, TyObject *category, TyObject *message, TyObject *filename, int lineno, TyObject *module, TyObject *registry, TyObject *sourceline, TyObject *source) @@ -1030,7 +1030,7 @@ setup_context(Ty_ssize_t stack_level, TyObject *globals; /* Setup globals, filename and lineno. */ - PyThreadState *tstate = get_current_tstate(); + TyThreadState *tstate = get_current_tstate(); if (tstate == NULL) { return 0; } @@ -1158,7 +1158,7 @@ do_warn(TyObject *message, TyObject *category, Ty_ssize_t stack_level, TyObject *filename, *module, *registry, *res; int lineno; - PyThreadState *tstate = get_current_tstate(); + TyThreadState *tstate = get_current_tstate(); if (tstate == NULL) { return NULL; } @@ -1300,7 +1300,7 @@ warnings_warn_explicit_impl(TyObject *module, TyObject *message, TyObject *source_line = NULL; TyObject *returned; - PyThreadState *tstate = get_current_tstate(); + TyThreadState *tstate = get_current_tstate(); if (tstate == NULL) { return NULL; } @@ -1464,7 +1464,7 @@ TyErr_WarnExplicitObject(TyObject *category, TyObject *message, TyObject *res; if (category == NULL) category = TyExc_RuntimeWarning; - PyThreadState *tstate = get_current_tstate(); + TyThreadState *tstate = get_current_tstate(); if (tstate == NULL) { return -1; } @@ -1557,7 +1557,7 @@ TyErr_WarnExplicitFormat(TyObject *category, message = TyUnicode_FromFormatV(format, vargs); if (message != NULL) { TyObject *res; - PyThreadState *tstate = get_current_tstate(); + TyThreadState *tstate = get_current_tstate(); if (tstate != NULL) { warnings_lock(tstate->interp); res = warn_explicit(tstate, category, message, filename, lineno, diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index d486a2c..9f82feb 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -201,7 +201,7 @@ builtin___build_class__(TyObject *self, TyObject *const *args, Ty_ssize_t nargs, Ty_TYPE(ns)->tp_name); goto error; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); EVAL_CALL_STAT_INC(EVAL_CALL_BUILD_CLASS); cell = _TyEval_Vector(tstate, (PyFunctionObject *)func, ns, NULL, 0, NULL); if (cell != NULL) { @@ -958,7 +958,7 @@ builtin_eval_impl(TyObject *module, TyObject *source, TyObject *globals, TyObject *locals) /*[clinic end generated code: output=0a0824aa70093116 input=7c7bce5299a89062]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *result = NULL, *source_copy; const char *str; @@ -1083,7 +1083,7 @@ builtin_exec_impl(TyObject *module, TyObject *source, TyObject *globals, TyObject *locals, TyObject *closure) /*[clinic end generated code: output=7579eb4e7646743d input=25e989b6d87a3a21]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *v; int fromframe = 0; @@ -1274,7 +1274,7 @@ builtin_globals_impl(TyObject *module) assert(globals != NULL); return Ty_NewRef(globals); } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); globals = _TyEval_GetGlobalsFromRunningMain(tstate); if (globals == NULL) { if (_TyErr_Occurred(tstate)) { @@ -1424,7 +1424,7 @@ map_vectorcall(TyObject *type, TyObject * const*args, Ty_ssize_t nargs = PyVectorcall_NARGS(nargsf); if (kwnames != NULL && TyTuple_GET_SIZE(kwnames) != 0) { // Fallback to map_new() - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyObject_MakeTpCall(tstate, type, args, nargs, kwnames); } @@ -1487,7 +1487,7 @@ map_next(TyObject *self) TyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; TyObject **stack; TyObject *result = NULL; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); const Ty_ssize_t niters = TyTuple_GET_SIZE(lz->iters); if (niters <= (Ty_ssize_t)Ty_ARRAY_LENGTH(small_stack)) { @@ -1932,7 +1932,7 @@ builtin_locals_impl(TyObject *module) assert(locals != NULL || TyErr_Occurred()); return locals; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); locals = _TyEval_GetGlobalsFromRunningMain(tstate); if (locals == NULL) { if (_TyErr_Occurred(tstate)) { @@ -2680,7 +2680,7 @@ builtin_vars(TyObject *self, TyObject *args) d = _TyEval_GetFrameLocals(); } else { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); d = _TyEval_GetGlobalsFromRunningMain(tstate); if (d == NULL) { if (!_TyErr_Occurred(tstate)) { diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c index ddeb6c2..f6b49e6 100644 --- a/Python/bootstrap_hash.c +++ b/Python/bootstrap_hash.c @@ -549,7 +549,7 @@ _TyOS_URandomNonblock(void *buffer, Ty_ssize_t size) } -PyStatus +TyStatus _Ty_HashRandomization_Init(const PyConfig *config) { void *secret = &_Ty_HashSecret; diff --git a/Python/brc.c b/Python/brc.c index 49e1291..6378827 100644 --- a/Python/brc.c +++ b/Python/brc.c @@ -114,7 +114,7 @@ merge_queued_objects(_PyObjectStack *to_merge) // Process this thread's queue of objects to merge. void -_Ty_brc_merge_refcounts(PyThreadState *tstate) +_Ty_brc_merge_refcounts(TyThreadState *tstate) { struct _brc_thread_state *brc = &((_PyThreadStateImpl *)tstate)->brc; struct _brc_bucket *bucket = get_bucket(tstate->interp, brc->tid); @@ -141,7 +141,7 @@ _Ty_brc_init_state(PyInterpreterState *interp) } void -_Ty_brc_init_thread(PyThreadState *tstate) +_Ty_brc_init_thread(TyThreadState *tstate) { struct _brc_thread_state *brc = &((_PyThreadStateImpl *)tstate)->brc; uintptr_t tid = _Ty_ThreadId(); @@ -155,7 +155,7 @@ _Ty_brc_init_thread(PyThreadState *tstate) } void -_Ty_brc_remove_thread(PyThreadState *tstate) +_Ty_brc_remove_thread(TyThreadState *tstate) { struct _brc_thread_state *brc = &((_PyThreadStateImpl *)tstate)->brc; if (brc->tid == 0) { diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 8338691..3462d0a 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -81,7 +81,7 @@ static _PyExecutorObject *current_executor; static TyObject * dummy_func( - PyThreadState *tstate, + TyThreadState *tstate, _PyInterpreterFrame *frame, unsigned char opcode, unsigned int oparg, diff --git a/Python/ceval.c b/Python/ceval.c index d308b26..6ed9d12 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -280,26 +280,26 @@ maybe_lltrace_resume_frame(_PyInterpreterFrame *frame, TyObject *globals) #endif -static void monitor_reraise(PyThreadState *tstate, +static void monitor_reraise(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr); -static int monitor_stop_iteration(PyThreadState *tstate, +static int monitor_stop_iteration(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *value); -static void monitor_unwind(PyThreadState *tstate, +static void monitor_unwind(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr); -static int monitor_handled(PyThreadState *tstate, +static int monitor_handled(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *exc); -static void monitor_throw(PyThreadState *tstate, +static void monitor_throw(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr); static int get_exception_handler(PyCodeObject *, int, int*, int*, int*); static _PyInterpreterFrame * -_PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, +_PyEvalFramePushAndInit_Ex(TyThreadState *tstate, _PyStackRef func, TyObject *locals, Ty_ssize_t nargs, TyObject *callargs, TyObject *kwargs, _PyInterpreterFrame *previous); #ifdef HAVE_ERRNO_H @@ -329,7 +329,7 @@ Ty_SetRecursionLimit(int new_limit) } int -_Ty_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count) +_Ty_ReachedRecursionLimitWithMargin(TyThreadState *tstate, int margin_count) { uintptr_t here_addr = _Ty_get_machine_stack_pointer(); _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; @@ -343,7 +343,7 @@ _Ty_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count) } void -_Ty_EnterRecursiveCallUnchecked(PyThreadState *tstate) +_Ty_EnterRecursiveCallUnchecked(TyThreadState *tstate) { uintptr_t here_addr = _Ty_get_machine_stack_pointer(); _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; @@ -426,7 +426,7 @@ int pthread_attr_destroy(pthread_attr_t *a) void -_Ty_InitializeRecursionLimits(PyThreadState *tstate) +_Ty_InitializeRecursionLimits(TyThreadState *tstate) { _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; #ifdef WIN32 @@ -473,7 +473,7 @@ _Ty_InitializeRecursionLimits(PyThreadState *tstate) /* The function _Ty_EnterRecursiveCallTstate() only calls _Ty_CheckRecursiveCall() if the recursion_depth reaches recursion_limit. */ int -_Ty_CheckRecursiveCall(PyThreadState *tstate, const char *where) +_Ty_CheckRecursiveCall(TyThreadState *tstate, const char *where) { _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; uintptr_t here_addr = _Ty_get_machine_stack_pointer(); @@ -603,7 +603,7 @@ const size_t _Ty_FunctionAttributeOffsets[] = { // Return a tuple of values corresponding to keys, with error checks for // duplicate/missing keys. TyObject * -_TyEval_MatchKeys(PyThreadState *tstate, TyObject *map, TyObject *keys) +_TyEval_MatchKeys(TyThreadState *tstate, TyObject *map, TyObject *keys) { assert(TyTuple_CheckExact(keys)); Ty_ssize_t nkeys = TyTuple_GET_SIZE(keys); @@ -685,7 +685,7 @@ fail: // raise TypeErrors for repeated lookups. On failure, return NULL (with no // error set). Use _TyErr_Occurred(tstate) to disambiguate. static TyObject * -match_class_attr(PyThreadState *tstate, TyObject *subject, TyObject *type, +match_class_attr(TyThreadState *tstate, TyObject *subject, TyObject *type, TyObject *name, TyObject *seen) { assert(TyUnicode_CheckExact(name)); @@ -707,7 +707,7 @@ match_class_attr(PyThreadState *tstate, TyObject *subject, TyObject *type, // On success (match), return a tuple of extracted attributes. On failure (no // match), return NULL. Use _TyErr_Occurred(tstate) to disambiguate. TyObject* -_TyEval_MatchClass(PyThreadState *tstate, TyObject *subject, TyObject *type, +_TyEval_MatchClass(TyThreadState *tstate, TyObject *subject, TyObject *type, Ty_ssize_t nargs, TyObject *kwargs) { if (!TyType_Check(type)) { @@ -821,12 +821,12 @@ fail: } -static int do_raise(PyThreadState *tstate, TyObject *exc, TyObject *cause); +static int do_raise(TyThreadState *tstate, TyObject *exc, TyObject *cause); TyObject * TyEval_EvalCode(TyObject *co, TyObject *globals, TyObject *locals) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (locals == NULL) { locals = globals; } @@ -862,21 +862,21 @@ TyObject * TyEval_EvalFrame(PyFrameObject *f) { /* Function kept for backward compatibility */ - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyEval_EvalFrame(tstate, f->f_frame, 0); } TyObject * TyEval_EvalFrameEx(PyFrameObject *f, int throwflag) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyEval_EvalFrame(tstate, f->f_frame, throwflag); } #include "ceval_macros.h" int _Ty_CheckRecursiveCallPy( - PyThreadState *tstate) + TyThreadState *tstate) { if (tstate->recursion_headroom) { if (tstate->py_recursion_remaining < -50) { @@ -993,7 +993,7 @@ typedef struct { } _PyEntryFrame; TyObject* _Ty_HOT_FUNCTION DONT_SLP_VECTORIZE -_TyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag) +_TyEval_EvalFrameDefault(TyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag) { _Ty_EnsureTstateNotNULL(tstate); CALL_STAT_INC(pyeval_calls); @@ -1234,7 +1234,7 @@ early_exit: #endif static void -format_missing(PyThreadState *tstate, const char *kind, +format_missing(TyThreadState *tstate, const char *kind, PyCodeObject *co, TyObject *names, TyObject *qualname) { int err; @@ -1297,7 +1297,7 @@ format_missing(PyThreadState *tstate, const char *kind, } static void -missing_arguments(PyThreadState *tstate, PyCodeObject *co, +missing_arguments(TyThreadState *tstate, PyCodeObject *co, Ty_ssize_t missing, Ty_ssize_t defcount, _PyStackRef *localsplus, TyObject *qualname) { @@ -1336,7 +1336,7 @@ missing_arguments(PyThreadState *tstate, PyCodeObject *co, } static void -too_many_positional(PyThreadState *tstate, PyCodeObject *co, +too_many_positional(TyThreadState *tstate, PyCodeObject *co, Ty_ssize_t given, TyObject *defaults, _PyStackRef *localsplus, TyObject *qualname) { @@ -1394,7 +1394,7 @@ too_many_positional(PyThreadState *tstate, PyCodeObject *co, } static int -positional_only_passed_as_keyword(PyThreadState *tstate, PyCodeObject *co, +positional_only_passed_as_keyword(TyThreadState *tstate, PyCodeObject *co, Ty_ssize_t kwcount, TyObject* kwnames, TyObject *qualname) { @@ -1526,7 +1526,7 @@ get_exception_handler(PyCodeObject *code, int index, int *level, int *handler, i } static int -initialize_locals(PyThreadState *tstate, PyFunctionObject *func, +initialize_locals(TyThreadState *tstate, PyFunctionObject *func, _PyStackRef *localsplus, _PyStackRef const *args, Ty_ssize_t argcount, TyObject *kwnames) { @@ -1775,7 +1775,7 @@ fail_post_args: } static void -clear_thread_frame(PyThreadState *tstate, _PyInterpreterFrame * frame) +clear_thread_frame(TyThreadState *tstate, _PyInterpreterFrame * frame) { assert(frame->owner == FRAME_OWNED_BY_THREAD); // Make sure that this is, indeed, the top frame. We can't check this in @@ -1789,7 +1789,7 @@ clear_thread_frame(PyThreadState *tstate, _PyInterpreterFrame * frame) } static void -clear_gen_frame(PyThreadState *tstate, _PyInterpreterFrame * frame) +clear_gen_frame(TyThreadState *tstate, _PyInterpreterFrame * frame) { assert(frame->owner == FRAME_OWNED_BY_GENERATOR); PyGenObject *gen = _TyGen_GetGeneratorFromFrame(frame); @@ -1804,7 +1804,7 @@ clear_gen_frame(PyThreadState *tstate, _PyInterpreterFrame * frame) } void -_TyEval_FrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame * frame) +_TyEval_FrameClearAndPop(TyThreadState *tstate, _PyInterpreterFrame * frame) { if (frame->owner == FRAME_OWNED_BY_THREAD) { clear_thread_frame(tstate, frame); @@ -1816,7 +1816,7 @@ _TyEval_FrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame * frame) /* Consumes references to func, locals and all the args */ _PyInterpreterFrame * -_PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func, +_PyEvalFramePushAndInit(TyThreadState *tstate, _PyStackRef func, TyObject *locals, _PyStackRef const* args, size_t argcount, TyObject *kwnames, _PyInterpreterFrame *previous) { @@ -1855,7 +1855,7 @@ fail: Steals references to func, callargs and kwargs. */ static _PyInterpreterFrame * -_PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, +_PyEvalFramePushAndInit_Ex(TyThreadState *tstate, _PyStackRef func, TyObject *locals, Ty_ssize_t nargs, TyObject *callargs, TyObject *kwargs, _PyInterpreterFrame *previous) { bool has_dict = (kwargs != NULL && TyDict_GET_SIZE(kwargs) > 0); @@ -1916,7 +1916,7 @@ error: } TyObject * -_TyEval_Vector(PyThreadState *tstate, PyFunctionObject *func, +_TyEval_Vector(TyThreadState *tstate, PyFunctionObject *func, TyObject *locals, TyObject* const* args, size_t argcount, TyObject *kwnames) @@ -1969,7 +1969,7 @@ TyEval_EvalCodeEx(TyObject *_co, TyObject *globals, TyObject *locals, TyObject *const *defs, int defcount, TyObject *kwdefs, TyObject *closure) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *res = NULL; TyObject *defaults = _TyTuple_FromArray(defs, defcount); if (defaults == NULL) { @@ -2039,7 +2039,7 @@ fail: /* Logic for the raise statement (too complicated for inlining). This *consumes* a reference count to each of its arguments. */ static int -do_raise(PyThreadState *tstate, TyObject *exc, TyObject *cause) +do_raise(TyThreadState *tstate, TyObject *exc, TyObject *cause) { TyObject *type = NULL, *value = NULL; @@ -2231,7 +2231,7 @@ _TyEval_ExceptionGroupMatch(_PyInterpreterFrame *frame, TyObject* exc_value, */ int -_TyEval_UnpackIterableStackRef(PyThreadState *tstate, TyObject *v, +_TyEval_UnpackIterableStackRef(TyThreadState *tstate, TyObject *v, int argcnt, int argcntafter, _PyStackRef *sp) { int i = 0, j = 0; @@ -2335,7 +2335,7 @@ Error: } static int -do_monitor_exc(PyThreadState *tstate, _PyInterpreterFrame *frame, +do_monitor_exc(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, int event) { assert(event < _PY_MONITORING_UNGROUPED_EVENTS); @@ -2356,13 +2356,13 @@ do_monitor_exc(PyThreadState *tstate, _PyInterpreterFrame *frame, } static inline bool -no_tools_for_global_event(PyThreadState *tstate, int event) +no_tools_for_global_event(TyThreadState *tstate, int event) { return tstate->interp->monitors.tools[event] == 0; } static inline bool -no_tools_for_local_event(PyThreadState *tstate, _PyInterpreterFrame *frame, int event) +no_tools_for_local_event(TyThreadState *tstate, _PyInterpreterFrame *frame, int event) { assert(event < _PY_MONITORING_LOCAL_EVENTS); _PyCoMonitoringData *data = _TyFrame_GetCode(frame)->_co_monitoring; @@ -2375,7 +2375,7 @@ no_tools_for_local_event(PyThreadState *tstate, _PyInterpreterFrame *frame, int } void -_TyEval_MonitorRaise(PyThreadState *tstate, _PyInterpreterFrame *frame, +_TyEval_MonitorRaise(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr) { if (no_tools_for_global_event(tstate, PY_MONITORING_EVENT_RAISE)) { @@ -2385,7 +2385,7 @@ _TyEval_MonitorRaise(PyThreadState *tstate, _PyInterpreterFrame *frame, } static void -monitor_reraise(PyThreadState *tstate, _PyInterpreterFrame *frame, +monitor_reraise(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr) { if (no_tools_for_global_event(tstate, PY_MONITORING_EVENT_RERAISE)) { @@ -2395,7 +2395,7 @@ monitor_reraise(PyThreadState *tstate, _PyInterpreterFrame *frame, } static int -monitor_stop_iteration(PyThreadState *tstate, _PyInterpreterFrame *frame, +monitor_stop_iteration(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *value) { if (no_tools_for_local_event(tstate, frame, PY_MONITORING_EVENT_STOP_ITERATION)) { @@ -2412,7 +2412,7 @@ monitor_stop_iteration(PyThreadState *tstate, _PyInterpreterFrame *frame, } static void -monitor_unwind(PyThreadState *tstate, +monitor_unwind(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr) { @@ -2424,7 +2424,7 @@ monitor_unwind(PyThreadState *tstate, static int -monitor_handled(PyThreadState *tstate, +monitor_handled(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *exc) { @@ -2435,7 +2435,7 @@ monitor_handled(PyThreadState *tstate, } static void -monitor_throw(PyThreadState *tstate, +monitor_throw(TyThreadState *tstate, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr) { @@ -2446,14 +2446,14 @@ monitor_throw(PyThreadState *tstate, } void -TyThreadState_EnterTracing(PyThreadState *tstate) +TyThreadState_EnterTracing(TyThreadState *tstate) { assert(tstate->tracing >= 0); tstate->tracing++; } void -TyThreadState_LeaveTracing(PyThreadState *tstate) +TyThreadState_LeaveTracing(TyThreadState *tstate) { assert(tstate->tracing > 0); tstate->tracing--; @@ -2464,7 +2464,7 @@ TyObject* _TyEval_CallTracing(TyObject *func, TyObject *args) { // Save and disable tracing - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); int save_tracing = tstate->tracing; tstate->tracing = 0; @@ -2479,7 +2479,7 @@ _TyEval_CallTracing(TyObject *func, TyObject *args) void TyEval_SetProfile(Ty_tracefunc func, TyObject *arg) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TyEval_SetProfile(tstate, func, arg) < 0) { /* Log _TySys_Audit() error */ TyErr_FormatUnraisable("Exception ignored in TyEval_SetProfile"); @@ -2489,12 +2489,12 @@ TyEval_SetProfile(Ty_tracefunc func, TyObject *arg) void TyEval_SetProfileAllThreads(Ty_tracefunc func, TyObject *arg) { - PyThreadState *this_tstate = _TyThreadState_GET(); + TyThreadState *this_tstate = _TyThreadState_GET(); PyInterpreterState* interp = this_tstate->interp; _PyRuntimeState *runtime = &_PyRuntime; HEAD_LOCK(runtime); - PyThreadState* ts = TyInterpreterState_ThreadHead(interp); + TyThreadState* ts = TyInterpreterState_ThreadHead(interp); HEAD_UNLOCK(runtime); while (ts) { @@ -2510,7 +2510,7 @@ TyEval_SetProfileAllThreads(Ty_tracefunc func, TyObject *arg) void TyEval_SetTrace(Ty_tracefunc func, TyObject *arg) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TyEval_SetTrace(tstate, func, arg) < 0) { /* Log _TySys_Audit() error */ TyErr_FormatUnraisable("Exception ignored in TyEval_SetTrace"); @@ -2520,12 +2520,12 @@ TyEval_SetTrace(Ty_tracefunc func, TyObject *arg) void TyEval_SetTraceAllThreads(Ty_tracefunc func, TyObject *arg) { - PyThreadState *this_tstate = _TyThreadState_GET(); + TyThreadState *this_tstate = _TyThreadState_GET(); PyInterpreterState* interp = this_tstate->interp; _PyRuntimeState *runtime = &_PyRuntime; HEAD_LOCK(runtime); - PyThreadState* ts = TyInterpreterState_ThreadHead(interp); + TyThreadState* ts = TyInterpreterState_ThreadHead(interp); HEAD_UNLOCK(runtime); while (ts) { @@ -2541,7 +2541,7 @@ TyEval_SetTraceAllThreads(Ty_tracefunc func, TyObject *arg) int _TyEval_SetCoroutineOriginTrackingDepth(int depth) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (depth < 0) { _TyErr_SetString(tstate, TyExc_ValueError, "depth must be >= 0"); return -1; @@ -2554,14 +2554,14 @@ _TyEval_SetCoroutineOriginTrackingDepth(int depth) int _TyEval_GetCoroutineOriginTrackingDepth(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return tstate->coroutine_origin_tracking_depth; } int _TyEval_SetAsyncGenFirstiter(TyObject *firstiter) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TySys_Audit(tstate, "sys.set_asyncgen_hook_firstiter", NULL) < 0) { return -1; @@ -2574,14 +2574,14 @@ _TyEval_SetAsyncGenFirstiter(TyObject *firstiter) TyObject * _TyEval_GetAsyncGenFirstiter(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return tstate->async_gen_firstiter; } int _TyEval_SetAsyncGenFinalizer(TyObject *finalizer) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TySys_Audit(tstate, "sys.set_asyncgen_hook_finalizer", NULL) < 0) { return -1; @@ -2594,14 +2594,14 @@ _TyEval_SetAsyncGenFinalizer(TyObject *finalizer) TyObject * _TyEval_GetAsyncGenFinalizer(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return tstate->async_gen_finalizer; } _PyInterpreterFrame * _TyEval_GetFrame(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyThreadState_GetFrame(tstate); } @@ -2620,7 +2620,7 @@ TyEval_GetFrame(void) } TyObject * -_TyEval_GetBuiltins(PyThreadState *tstate) +_TyEval_GetBuiltins(TyThreadState *tstate) { _PyInterpreterFrame *frame = _TyThreadState_GetFrame(tstate); if (frame != NULL) { @@ -2632,7 +2632,7 @@ _TyEval_GetBuiltins(PyThreadState *tstate) TyObject * TyEval_GetBuiltins(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyEval_GetBuiltins(tstate); } @@ -2657,7 +2657,7 @@ TyObject * TyEval_GetLocals(void) { // We need to return a borrowed reference here, so some tricks are needed - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyInterpreterFrame *current_frame = _TyThreadState_GetFrame(tstate); if (current_frame == NULL) { _TyErr_SetString(tstate, TyExc_SystemError, "frame does not exist"); @@ -2701,7 +2701,7 @@ TyEval_GetLocals(void) TyObject * _TyEval_GetFrameLocals(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyInterpreterFrame *current_frame = _TyThreadState_GetFrame(tstate); if (current_frame == NULL) { _TyErr_SetString(tstate, TyExc_SystemError, "frame does not exist"); @@ -2733,7 +2733,7 @@ _TyEval_GetFrameLocals(void) } static TyObject * -_TyEval_GetGlobals(PyThreadState *tstate) +_TyEval_GetGlobals(TyThreadState *tstate) { _PyInterpreterFrame *current_frame = _TyThreadState_GetFrame(tstate); if (current_frame == NULL) { @@ -2745,12 +2745,12 @@ _TyEval_GetGlobals(PyThreadState *tstate) TyObject * TyEval_GetGlobals(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyEval_GetGlobals(tstate); } TyObject * -_TyEval_GetGlobalsFromRunningMain(PyThreadState *tstate) +_TyEval_GetGlobalsFromRunningMain(TyThreadState *tstate) { if (!_TyInterpreterState_IsRunningMain(tstate->interp)) { return NULL; @@ -2801,7 +2801,7 @@ set_globals_builtins(TyObject *globals, TyObject *builtins) } int -_TyEval_EnsureBuiltins(PyThreadState *tstate, TyObject *globals, +_TyEval_EnsureBuiltins(TyThreadState *tstate, TyObject *globals, TyObject **p_builtins) { TyObject *builtins = get_globals_builtins(globals); @@ -2830,7 +2830,7 @@ _TyEval_EnsureBuiltins(PyThreadState *tstate, TyObject *globals, } int -_TyEval_EnsureBuiltinsWithModule(PyThreadState *tstate, TyObject *globals, +_TyEval_EnsureBuiltinsWithModule(TyThreadState *tstate, TyObject *globals, TyObject **p_builtins) { TyObject *builtins = get_globals_builtins(globals); @@ -2864,7 +2864,7 @@ TyEval_GetFrameLocals(void) TyObject* TyEval_GetFrameGlobals(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyInterpreterFrame *current_frame = _TyThreadState_GetFrame(tstate); if (current_frame == NULL) { return NULL; @@ -2874,14 +2874,14 @@ TyObject* TyEval_GetFrameGlobals(void) TyObject* TyEval_GetFrameBuiltins(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return Ty_XNewRef(_TyEval_GetBuiltins(tstate)); } int TyEval_MergeCompilerFlags(PyCompilerFlags *cf) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyInterpreterFrame *current_frame = tstate->current_frame; int result = cf->cf_flags != 0; @@ -2932,7 +2932,7 @@ TyEval_GetFuncDesc(TyObject *func) int _TyEval_SliceIndex(TyObject *v, Ty_ssize_t *pi) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!Ty_IsNone(v)) { Ty_ssize_t x; if (_PyIndex_Check(v)) { @@ -2954,7 +2954,7 @@ _TyEval_SliceIndex(TyObject *v, Ty_ssize_t *pi) int _TyEval_SliceIndexNotNone(TyObject *v, Ty_ssize_t *pi) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); Ty_ssize_t x; if (_PyIndex_Check(v)) { x = PyNumber_AsSsize_t(v, NULL); @@ -2972,7 +2972,7 @@ _TyEval_SliceIndexNotNone(TyObject *v, Ty_ssize_t *pi) } TyObject * -_TyEval_ImportName(PyThreadState *tstate, _PyInterpreterFrame *frame, +_TyEval_ImportName(TyThreadState *tstate, _PyInterpreterFrame *frame, TyObject *name, TyObject *fromlist, TyObject *level) { TyObject *import_func; @@ -3011,7 +3011,7 @@ _TyEval_ImportName(PyThreadState *tstate, _PyInterpreterFrame *frame, } TyObject * -_TyEval_ImportFrom(PyThreadState *tstate, TyObject *v, TyObject *name) +_TyEval_ImportFrom(TyThreadState *tstate, TyObject *v, TyObject *name) { TyObject *x; TyObject *fullmodname, *mod_name, *origin, *mod_name_or_unknown, *errmsg, *spec; @@ -3185,7 +3185,7 @@ done: "is not allowed. Use except instead." int -_TyEval_CheckExceptTypeValid(PyThreadState *tstate, TyObject* right) +_TyEval_CheckExceptTypeValid(TyThreadState *tstate, TyObject* right) { if (TyTuple_Check(right)) { Ty_ssize_t i, length; @@ -3210,7 +3210,7 @@ _TyEval_CheckExceptTypeValid(PyThreadState *tstate, TyObject* right) } int -_TyEval_CheckExceptStarTypeValid(PyThreadState *tstate, TyObject* right) +_TyEval_CheckExceptStarTypeValid(TyThreadState *tstate, TyObject* right) { if (_TyEval_CheckExceptTypeValid(tstate, right) < 0) { return -1; @@ -3247,7 +3247,7 @@ _TyEval_CheckExceptStarTypeValid(PyThreadState *tstate, TyObject* right) } int -_Ty_Check_ArgsIterable(PyThreadState *tstate, TyObject *func, TyObject *args) +_Ty_Check_ArgsIterable(TyThreadState *tstate, TyObject *func, TyObject *args) { if (Ty_TYPE(args)->tp_iter == NULL && !PySequence_Check(args)) { /* _Ty_Check_ArgsIterable() may be called with a live exception: @@ -3267,7 +3267,7 @@ _Ty_Check_ArgsIterable(PyThreadState *tstate, TyObject *func, TyObject *args) } void -_TyEval_FormatKwargsError(PyThreadState *tstate, TyObject *func, TyObject *kwargs) +_TyEval_FormatKwargsError(TyThreadState *tstate, TyObject *func, TyObject *kwargs) { /* _TyDict_MergeEx raises attribute * error (percolated from an attempt @@ -3310,7 +3310,7 @@ _TyEval_FormatKwargsError(PyThreadState *tstate, TyObject *func, TyObject *kwarg } void -_TyEval_FormatExcCheckArg(PyThreadState *tstate, TyObject *exc, +_TyEval_FormatExcCheckArg(TyThreadState *tstate, TyObject *exc, const char *format_str, TyObject *obj) { const char *obj_str; @@ -3339,7 +3339,7 @@ _TyEval_FormatExcCheckArg(PyThreadState *tstate, TyObject *exc, } void -_TyEval_FormatExcUnbound(PyThreadState *tstate, PyCodeObject *co, int oparg) +_TyEval_FormatExcUnbound(TyThreadState *tstate, PyCodeObject *co, int oparg) { TyObject *name; /* Don't stomp existing exception */ @@ -3356,7 +3356,7 @@ _TyEval_FormatExcUnbound(PyThreadState *tstate, PyCodeObject *co, int oparg) } void -_TyEval_FormatAwaitableError(PyThreadState *tstate, TyTypeObject *type, int oparg) +_TyEval_FormatAwaitableError(TyThreadState *tstate, TyTypeObject *type, int oparg) { if (type->tp_as_async == NULL || type->tp_as_async->am_await == NULL) { if (oparg == 1) { @@ -3506,7 +3506,7 @@ _TyEval_GetAwaitable(TyObject *iterable, int oparg) } TyObject * -_TyEval_LoadName(PyThreadState *tstate, _PyInterpreterFrame *frame, TyObject *name) +_TyEval_LoadName(TyThreadState *tstate, _PyInterpreterFrame *frame, TyObject *name) { TyObject *value; diff --git a/Python/ceval_gil.c b/Python/ceval_gil.c index a3f00bf..662c552 100644 --- a/Python/ceval_gil.c +++ b/Python/ceval_gil.c @@ -70,7 +70,7 @@ copy_eval_breaker_bits(uintptr_t *from, uintptr_t *to, uintptr_t mask) // When attaching a thread, set the global instrumentation version and // _PY_CALLS_TO_DO_BIT from the current state of the interpreter. static inline void -update_eval_breaker_for_thread(PyInterpreterState *interp, PyThreadState *tstate) +update_eval_breaker_for_thread(PyInterpreterState *interp, TyThreadState *tstate) { #ifdef Ty_GIL_DISABLED // Free-threaded builds eagerly update the eval_breaker on *all* threads as @@ -200,7 +200,7 @@ static void recreate_gil(struct _gil_runtime_state *gil) #endif static inline void -drop_gil_impl(PyThreadState *tstate, struct _gil_runtime_state *gil) +drop_gil_impl(TyThreadState *tstate, struct _gil_runtime_state *gil) { MUTEX_LOCK(gil->mutex); _Ty_ANNOTATE_RWLOCK_RELEASED(&gil->locked, /*is_write=*/1); @@ -213,7 +213,7 @@ drop_gil_impl(PyThreadState *tstate, struct _gil_runtime_state *gil) } static void -drop_gil(PyInterpreterState *interp, PyThreadState *tstate, int final_release) +drop_gil(PyInterpreterState *interp, TyThreadState *tstate, int final_release) { struct _ceval_state *ceval = &interp->ceval; /* If final_release is true, the caller is indicating that we're releasing @@ -259,7 +259,7 @@ drop_gil(PyInterpreterState *interp, PyThreadState *tstate, int final_release) _Ty_eval_breaker_bit_is_set(tstate, _PY_GIL_DROP_REQUEST_BIT)) { MUTEX_LOCK(gil->switch_mutex); /* Not switched yet => wait */ - if (((PyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder)) == tstate) + if (((TyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder)) == tstate) { assert(_TyThreadState_CheckConsistency(tstate)); _Ty_unset_eval_breaker_bit(tstate, _PY_GIL_DROP_REQUEST_BIT); @@ -282,7 +282,7 @@ drop_gil(PyInterpreterState *interp, PyThreadState *tstate, int final_release) tstate must be non-NULL. */ static void -take_gil(PyThreadState *tstate) +take_gil(TyThreadState *tstate) { int err = errno; @@ -337,8 +337,8 @@ take_gil(PyThreadState *tstate) _Ty_atomic_load_int_relaxed(&gil->locked) && gil->switch_number == saved_switchnum) { - PyThreadState *holder_tstate = - (PyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder); + TyThreadState *holder_tstate = + (TyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder); if (_TyThreadState_MustExit(tstate)) { MUTEX_UNLOCK(gil->mutex); // gh-96387: If the loop requested a drop request in a previous @@ -381,7 +381,7 @@ take_gil(PyThreadState *tstate) _Ty_atomic_store_int_relaxed(&gil->locked, 1); _Ty_ANNOTATE_RWLOCK_ACQUIRED(&gil->locked, /*is_write=*/1); - if (tstate != (PyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder)) { + if (tstate != (TyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder)) { _Ty_atomic_store_ptr_relaxed(&gil->last_holder, tstate); ++gil->switch_number; } @@ -457,7 +457,7 @@ TyEval_ThreadsInitialized(void) #ifndef NDEBUG static inline int -current_thread_holds_gil(struct _gil_runtime_state *gil, PyThreadState *tstate) +current_thread_holds_gil(struct _gil_runtime_state *gil, TyThreadState *tstate) { int holds_gil = tstate->holds_gil; @@ -465,7 +465,7 @@ current_thread_holds_gil(struct _gil_runtime_state *gil, PyThreadState *tstate) // are consistent with it. int locked = _Ty_atomic_load_int_relaxed(&gil->locked); int is_last_holder = - ((PyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder)) == tstate; + ((TyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder)) == tstate; assert(!holds_gil || locked); assert(!holds_gil || is_last_holder); @@ -496,7 +496,7 @@ init_own_gil(PyInterpreterState *interp, struct _gil_runtime_state *gil) } void -_TyEval_InitGIL(PyThreadState *tstate, int own_gil) +_TyEval_InitGIL(TyThreadState *tstate, int own_gil) { assert(tstate->interp->ceval.gil == NULL); if (!own_gil) { @@ -564,7 +564,7 @@ _TyEval_Fini(void) PyAPI_FUNC(void) TyEval_AcquireLock(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _Ty_EnsureTstateNotNULL(tstate); take_gil(tstate); @@ -574,7 +574,7 @@ TyEval_AcquireLock(void) PyAPI_FUNC(void) TyEval_ReleaseLock(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* This function must succeed when the current thread state is NULL. We therefore avoid TyThreadState_Get() which dumps a fatal error in debug mode. */ @@ -582,7 +582,7 @@ TyEval_ReleaseLock(void) } void -_TyEval_AcquireLock(PyThreadState *tstate) +_TyEval_AcquireLock(TyThreadState *tstate) { _Ty_EnsureTstateNotNULL(tstate); take_gil(tstate); @@ -590,7 +590,7 @@ _TyEval_AcquireLock(PyThreadState *tstate) void _TyEval_ReleaseLock(PyInterpreterState *interp, - PyThreadState *tstate, + TyThreadState *tstate, int final_release) { assert(tstate != NULL); @@ -599,14 +599,14 @@ _TyEval_ReleaseLock(PyInterpreterState *interp, } void -TyEval_AcquireThread(PyThreadState *tstate) +TyEval_AcquireThread(TyThreadState *tstate) { _Ty_EnsureTstateNotNULL(tstate); _TyThreadState_Attach(tstate); } void -TyEval_ReleaseThread(PyThreadState *tstate) +TyEval_ReleaseThread(TyThreadState *tstate) { assert(_TyThreadState_CheckConsistency(tstate)); _TyThreadState_Detach(tstate); @@ -615,8 +615,8 @@ TyEval_ReleaseThread(PyThreadState *tstate) #ifdef HAVE_FORK /* This function is called from TyOS_AfterFork_Child to re-initialize the GIL and pending calls lock. */ -PyStatus -_TyEval_ReInitThreads(PyThreadState *tstate) +TyStatus +_TyEval_ReInitThreads(TyThreadState *tstate) { assert(tstate->interp == _TyInterpreterState_Main()); @@ -635,16 +635,16 @@ _TyEval_ReInitThreads(PyThreadState *tstate) } #endif -PyThreadState * +TyThreadState * TyEval_SaveThread(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyThreadState_Detach(tstate); return tstate; } void -TyEval_RestoreThread(PyThreadState *tstate) +TyEval_RestoreThread(TyThreadState *tstate) { #ifdef MS_WINDOWS int err = GetLastError(); @@ -677,7 +677,7 @@ signal_active_thread(PyInterpreterState *interp, uintptr_t bit) // interpreter will have its bit set as part of taking the GIL. MUTEX_LOCK(gil->mutex); if (_Ty_atomic_load_int_relaxed(&gil->locked)) { - PyThreadState *holder = (PyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder); + TyThreadState *holder = (TyThreadState*)_Ty_atomic_load_ptr_relaxed(&gil->last_holder); if (holder->interp == interp) { _Ty_set_eval_breaker_bit(holder, bit); } @@ -821,7 +821,7 @@ Ty_AddPendingCall(_Ty_pending_call_func func, void *arg) } static int -handle_signals(PyThreadState *tstate) +handle_signals(TyThreadState *tstate) { assert(_TyThreadState_CheckConsistency(tstate)); _Ty_unset_eval_breaker_bit(tstate, _PY_SIGNALS_PENDING_BIT); @@ -885,7 +885,7 @@ finally: } static void -signal_pending_calls(PyThreadState *tstate, PyInterpreterState *interp) +signal_pending_calls(TyThreadState *tstate, PyInterpreterState *interp) { #ifdef Ty_GIL_DISABLED _Ty_set_eval_breaker_bit_all(interp, _PY_CALLS_TO_DO_BIT); @@ -895,7 +895,7 @@ signal_pending_calls(PyThreadState *tstate, PyInterpreterState *interp) } static void -unsignal_pending_calls(PyThreadState *tstate, PyInterpreterState *interp) +unsignal_pending_calls(TyThreadState *tstate, PyInterpreterState *interp) { #ifdef Ty_GIL_DISABLED _Ty_unset_eval_breaker_bit_all(interp, _PY_CALLS_TO_DO_BIT); @@ -917,7 +917,7 @@ clear_pending_handling_thread(struct _pending_calls *pending) } static int -make_pending_calls(PyThreadState *tstate) +make_pending_calls(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; struct _pending_calls *pending = &interp->ceval.pending; @@ -995,7 +995,7 @@ _Ty_unset_eval_breaker_bit_all(PyInterpreterState *interp, uintptr_t bit) } void -_Ty_FinishPendingCalls(PyThreadState *tstate) +_Ty_FinishPendingCalls(TyThreadState *tstate) { _Ty_AssertHoldsTstate(); assert(_TyThreadState_CheckConsistency(tstate)); @@ -1031,7 +1031,7 @@ _Ty_FinishPendingCalls(PyThreadState *tstate) } int -_TyEval_MakePendingCalls(PyThreadState *tstate) +_TyEval_MakePendingCalls(TyThreadState *tstate) { int res; @@ -1060,7 +1060,7 @@ Ty_MakePendingCalls(void) { _Ty_AssertHoldsTstate(); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(_TyThreadState_CheckConsistency(tstate)); /* Only execute pending calls on the main thread. */ @@ -1078,7 +1078,7 @@ _TyEval_InitState(PyInterpreterState *interp) #ifdef Ty_GIL_DISABLED int -_TyEval_EnableGILTransient(PyThreadState *tstate) +_TyEval_EnableGILTransient(TyThreadState *tstate) { const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp); if (config->enable_gil != _TyConfig_GIL_DEFAULT) { @@ -1130,7 +1130,7 @@ _TyEval_EnableGILTransient(PyThreadState *tstate) } int -_TyEval_EnableGILPermanent(PyThreadState *tstate) +_TyEval_EnableGILPermanent(TyThreadState *tstate) { const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp); if (config->enable_gil != _TyConfig_GIL_DEFAULT) { @@ -1150,7 +1150,7 @@ _TyEval_EnableGILPermanent(PyThreadState *tstate) } int -_TyEval_DisableGIL(PyThreadState *tstate) +_TyEval_DisableGIL(TyThreadState *tstate) { const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp); if (config->enable_gil != _TyConfig_GIL_DEFAULT) { @@ -1255,7 +1255,7 @@ static inline void run_remote_debugger_script(TyObject *path) } } -int _PyRunRemoteDebugger(PyThreadState *tstate) +int _PyRunRemoteDebugger(TyThreadState *tstate) { const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp); if (config->remote_debug == 1 @@ -1306,7 +1306,7 @@ int _PyRunRemoteDebugger(PyThreadState *tstate) * of a code object sequentially. However, the runtime supports a * number of out-of-band execution scenarios that may pause that * sequential execution long enough to do that out-of-band work -* in the current thread using the current PyThreadState. +* in the current thread using the current TyThreadState. * * The scenarios include: * @@ -1354,7 +1354,7 @@ int _PyRunRemoteDebugger(PyThreadState *tstate) * until so desired. */ int -_Ty_HandlePending(PyThreadState *tstate) +_Ty_HandlePending(TyThreadState *tstate) { uintptr_t breaker = _Ty_atomic_load_uintptr_relaxed(&tstate->eval_breaker); diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index de9541f..cca6a97 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -71,10 +71,10 @@ #endif #ifdef Ty_STATS -# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Ty_CODEUNIT *next_instr, int oparg, int lastopcode +# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, TyThreadState *tstate, _Ty_CODEUNIT *next_instr, int oparg, int lastopcode # define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, lastopcode #else -# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Ty_CODEUNIT *next_instr, int oparg +# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, TyThreadState *tstate, _Ty_CODEUNIT *next_instr, int oparg # define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg #endif @@ -326,12 +326,12 @@ do { \ } while (0); -static inline int _Ty_EnterRecursivePy(PyThreadState *tstate) { +static inline int _Ty_EnterRecursivePy(TyThreadState *tstate) { return (tstate->py_recursion_remaining-- <= 0) && _Ty_CheckRecursiveCallPy(tstate); } -static inline void _Ty_LeaveRecursiveCallPy(PyThreadState *tstate) { +static inline void _Ty_LeaveRecursiveCallPy(TyThreadState *tstate) { tstate->py_recursion_remaining++; } diff --git a/Python/codecs.c b/Python/codecs.c index cd37373..b51a4d6 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -1567,7 +1567,7 @@ surrogateescape_errors(TyObject *Py_UNUSED(self), TyObject *exc) } -PyStatus +TyStatus _PyCodec_InitRegistry(PyInterpreterState *interp) { static struct { diff --git a/Python/context.c b/Python/context.c index 2545208..2cb54a8 100644 --- a/Python/context.c +++ b/Python/context.c @@ -111,7 +111,7 @@ context_event_name(PyContextEvent event) { } static void -notify_context_watchers(PyThreadState *ts, PyContextEvent event, TyObject *ctx) +notify_context_watchers(TyThreadState *ts, PyContextEvent event, TyObject *ctx) { if (ctx == NULL) { // This will happen after exiting the last context in the stack, which @@ -181,7 +181,7 @@ PyContext_ClearWatcher(int watcher_id) static inline void -context_switched(PyThreadState *ts) +context_switched(TyThreadState *ts) { ts->context_ver++; // ts->context is used instead of context_get() because context_get() might @@ -191,7 +191,7 @@ context_switched(PyThreadState *ts) static int -_TyContext_Enter(PyThreadState *ts, TyObject *octx) +_TyContext_Enter(TyThreadState *ts, TyObject *octx) { ENSURE_Context(octx, -1) PyContext *ctx = (PyContext *)octx; @@ -214,14 +214,14 @@ _TyContext_Enter(PyThreadState *ts, TyObject *octx) int PyContext_Enter(TyObject *octx) { - PyThreadState *ts = _TyThreadState_GET(); + TyThreadState *ts = _TyThreadState_GET(); assert(ts != NULL); return _TyContext_Enter(ts, octx); } static int -_TyContext_Exit(PyThreadState *ts, TyObject *octx) +_TyContext_Exit(TyThreadState *ts, TyObject *octx) { ENSURE_Context(octx, -1) PyContext *ctx = (PyContext *)octx; @@ -251,7 +251,7 @@ _TyContext_Exit(PyThreadState *ts, TyObject *octx) int PyContext_Exit(TyObject *octx) { - PyThreadState *ts = _TyThreadState_GET(); + TyThreadState *ts = _TyThreadState_GET(); assert(ts != NULL); return _TyContext_Exit(ts, octx); } @@ -276,7 +276,7 @@ PyContextVar_Get(TyObject *ovar, TyObject *def, TyObject **val) ENSURE_ContextVar(ovar, -1) PyContextVar *var = (PyContextVar *)ovar; - PyThreadState *ts = _TyThreadState_GET(); + TyThreadState *ts = _TyThreadState_GET(); assert(ts != NULL); if (ts->context == NULL) { goto not_found; @@ -479,7 +479,7 @@ context_new_from_vars(PyHamtObject *vars) static inline PyContext * context_get(void) { - PyThreadState *ts = _TyThreadState_GET(); + TyThreadState *ts = _TyThreadState_GET(); assert(ts != NULL); PyContext *current_ctx = (PyContext *)ts->context; if (current_ctx == NULL) { @@ -713,7 +713,7 @@ static TyObject * context_run(TyObject *self, TyObject *const *args, Ty_ssize_t nargs, TyObject *kwnames) { - PyThreadState *ts = _TyThreadState_GET(); + TyThreadState *ts = _TyThreadState_GET(); if (nargs < 1) { _TyErr_SetString(ts, TyExc_TypeError, @@ -784,7 +784,7 @@ contextvar_set(PyContextVar *var, TyObject *val) { #ifndef Ty_GIL_DISABLED var->var_cached = NULL; - PyThreadState *ts = _TyThreadState_GET(); + TyThreadState *ts = _TyThreadState_GET(); #endif PyContext *ctx = context_get(); @@ -1354,7 +1354,7 @@ get_token_missing(void) /////////////////////////// -PyStatus +TyStatus _TyContext_Init(PyInterpreterState *interp) { if (!_Ty_IsMainInterpreter(interp)) { diff --git a/Python/critical_section.c b/Python/critical_section.c index 0ab1108..1ddb5fb 100644 --- a/Python/critical_section.c +++ b/Python/critical_section.c @@ -20,7 +20,7 @@ void _PyCriticalSection_BeginSlow(PyCriticalSection *c, PyMutex *m) { #ifdef Ty_GIL_DISABLED - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); // As an optimisation for locking the same object recursively, skip // locking if the mutex is currently locked by the top-most critical // section. @@ -44,7 +44,7 @@ _PyCriticalSection2_BeginSlow(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2, int is_m1_locked) { #ifdef Ty_GIL_DISABLED - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); c->_cs_base._cs_mutex = NULL; c->_cs_mutex2 = NULL; c->_cs_base._cs_prev = tstate->critical_section; @@ -63,7 +63,7 @@ _PyCriticalSection2_BeginSlow(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2, // Release all locks held by critical sections. This is called by // _TyThreadState_Detach. void -_PyCriticalSection_SuspendAll(PyThreadState *tstate) +_PyCriticalSection_SuspendAll(TyThreadState *tstate) { #ifdef Ty_GIL_DISABLED uintptr_t *tagptr = &tstate->critical_section; @@ -87,7 +87,7 @@ _PyCriticalSection_SuspendAll(PyThreadState *tstate) } void -_PyCriticalSection_Resume(PyThreadState *tstate) +_PyCriticalSection_Resume(TyThreadState *tstate) { #ifdef Ty_GIL_DISABLED uintptr_t p = tstate->critical_section; diff --git a/Python/crossinterp.c b/Python/crossinterp.c index f8cd234..7cac39b 100644 --- a/Python/crossinterp.c +++ b/Python/crossinterp.c @@ -22,7 +22,7 @@ _Ty_GetMainfile(char *buffer, size_t maxlen) { // We don't expect subinterpreters to have the __main__ module's // __name__ set, but proceed just in case. - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *module = _Ty_GetMainModule(tstate); if (_Ty_CheckMainModule(module) < 0) { Ty_XDECREF(module); @@ -90,7 +90,7 @@ sync_module_clear(struct sync_module *data) } static void -sync_module_capture_exc(PyThreadState *tstate, struct sync_module *data) +sync_module_capture_exc(TyThreadState *tstate, struct sync_module *data) { assert(_TyErr_Occurred(tstate)); TyObject *context = data->cached.failed; @@ -104,7 +104,7 @@ sync_module_capture_exc(PyThreadState *tstate, struct sync_module *data) static int -ensure_isolated_main(PyThreadState *tstate, struct sync_module *main) +ensure_isolated_main(TyThreadState *tstate, struct sync_module *main) { // Load the module from the original file (or from a cache). @@ -205,7 +205,7 @@ main_mod_matches(TyObject *expected) #endif static int -apply_isolated_main(PyThreadState *tstate, struct sync_module *main) +apply_isolated_main(TyThreadState *tstate, struct sync_module *main) { assert((main->cached.loaded == NULL) == (main->cached.loaded == NULL)); if (main->cached.failed != NULL) { @@ -225,7 +225,7 @@ apply_isolated_main(PyThreadState *tstate, struct sync_module *main) } static void -restore_main(PyThreadState *tstate, struct sync_module *main) +restore_main(TyThreadState *tstate, struct sync_module *main) { assert(main->cached.failed == NULL); assert(main->cached.module != NULL); @@ -275,7 +275,7 @@ _Ty_CallInInterpreterAndRawFree(PyInterpreterState *interp, { if (interp == PyInterpreterState_Get()) { int res = func(arg); - PyMem_RawFree(arg); + TyMem_RawFree(arg); return res; } // XXX Emit a warning if this fails? @@ -318,7 +318,7 @@ _PyXIData_Free(_PyXIData_t *xid) { PyInterpreterState *interp = PyInterpreterState_Get(); _PyXIData_Clear(interp, xid); - PyMem_RawFree(xid); + TyMem_RawFree(xid); } @@ -390,7 +390,7 @@ _PyXIData_InitWithSize(_PyXIData_t *xidata, if (xidata->data == NULL) { return -1; } - xidata->free = PyMem_RawFree; + xidata->free = TyMem_RawFree; return 0; } @@ -409,7 +409,7 @@ _PyXIData_Clear(PyInterpreterState *interp, _PyXIData_t *xidata) /* getting cross-interpreter data */ static inline void -_set_xid_lookup_failure(PyThreadState *tstate, TyObject *obj, const char *msg, +_set_xid_lookup_failure(TyThreadState *tstate, TyObject *obj, const char *msg, TyObject *cause) { if (msg != NULL) { @@ -428,7 +428,7 @@ _set_xid_lookup_failure(PyThreadState *tstate, TyObject *obj, const char *msg, int -_TyObject_CheckXIData(PyThreadState *tstate, TyObject *obj) +_TyObject_CheckXIData(TyThreadState *tstate, TyObject *obj) { dlcontext_t ctx; if (get_lookup_context(tstate, &ctx) < 0) { @@ -445,7 +445,7 @@ _TyObject_CheckXIData(PyThreadState *tstate, TyObject *obj) } static int -_check_xidata(PyThreadState *tstate, _PyXIData_t *xidata) +_check_xidata(TyThreadState *tstate, _PyXIData_t *xidata) { // xidata->data can be anything, including NULL, so we don't check it. @@ -467,7 +467,7 @@ _check_xidata(PyThreadState *tstate, _PyXIData_t *xidata) } static int -_get_xidata(PyThreadState *tstate, +_get_xidata(TyThreadState *tstate, TyObject *obj, xidata_fallback_t fallback, _PyXIData_t *xidata) { PyInterpreterState *interp = tstate->interp; @@ -521,14 +521,14 @@ _get_xidata(PyThreadState *tstate, } int -_TyObject_GetXIDataNoFallback(PyThreadState *tstate, +_TyObject_GetXIDataNoFallback(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { return _get_xidata(tstate, obj, _PyXIDATA_XIDATA_ONLY, xidata); } int -_TyObject_GetXIData(PyThreadState *tstate, +_TyObject_GetXIData(TyThreadState *tstate, TyObject *obj, xidata_fallback_t fallback, _PyXIData_t *xidata) { @@ -569,7 +569,7 @@ _TyObject_GetXIData(PyThreadState *tstate, /* pickle C-API */ struct _pickle_context { - PyThreadState *tstate; + TyThreadState *tstate; }; static TyObject * @@ -586,7 +586,7 @@ _PyPickle_Dumps(struct _pickle_context *ctx, TyObject *obj) struct _unpickle_context { - PyThreadState *tstate; + TyThreadState *tstate; // We only special-case the __main__ module, // since other modules behave consistently. struct sync_module main; @@ -632,7 +632,7 @@ check_missing___main___attr(TyObject *exc) static TyObject * _PyPickle_Loads(struct _unpickle_context *ctx, TyObject *pickled) { - PyThreadState *tstate = ctx->tstate; + TyThreadState *tstate = ctx->tstate; TyObject *exc = NULL; TyObject *loads = TyImport_ImportModuleAttrString("pickle", "loads"); @@ -698,7 +698,7 @@ struct _pickle_xid_context { }; static int -_set_pickle_xid_context(PyThreadState *tstate, struct _pickle_xid_context *ctx) +_set_pickle_xid_context(TyThreadState *tstate, struct _pickle_xid_context *ctx) { // Set mainfile if possible. Ty_ssize_t len = _Ty_GetMainfile(ctx->mainfile._utf8, MAXPATHLEN); @@ -723,7 +723,7 @@ struct _shared_pickle_data { TyObject * _PyPickle_LoadFromXIData(_PyXIData_t *xidata) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); struct _shared_pickle_data *shared = (struct _shared_pickle_data *)xidata->data; // We avoid copying the pickled data by wrapping it in a memoryview. @@ -756,7 +756,7 @@ _PyPickle_LoadFromXIData(_PyXIData_t *xidata) int -_PyPickle_GetXIData(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_PyPickle_GetXIData(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { // Pickle the object. struct _pickle_context ctx = { @@ -800,7 +800,7 @@ _PyPickle_GetXIData(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) TyObject * _TyMarshal_ReadObjectFromXIData(_PyXIData_t *xidata) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyBytes_data_t *shared = (_TyBytes_data_t *)xidata->data; TyObject *obj = PyMarshal_ReadObjectFromString(shared->bytes, shared->len); if (obj == NULL) { @@ -815,7 +815,7 @@ _TyMarshal_ReadObjectFromXIData(_PyXIData_t *xidata) } int -_TyMarshal_GetXIData(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_TyMarshal_GetXIData(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { TyObject *bytes = PyMarshal_WriteObjectToString(obj, Ty_MARSHAL_VERSION); if (bytes == NULL) { @@ -840,7 +840,7 @@ _TyMarshal_GetXIData(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) /* script wrapper */ static int -verify_script(PyThreadState *tstate, PyCodeObject *co, int checked, int pure) +verify_script(TyThreadState *tstate, PyCodeObject *co, int checked, int pure) { // Make sure it isn't a closure and (optionally) doesn't use globals. TyObject *builtins = NULL; @@ -874,7 +874,7 @@ verify_script(PyThreadState *tstate, PyCodeObject *co, int checked, int pure) } static int -get_script_xidata(PyThreadState *tstate, TyObject *obj, int pure, +get_script_xidata(TyThreadState *tstate, TyObject *obj, int pure, _PyXIData_t *xidata) { // Get the corresponding code object. @@ -955,14 +955,14 @@ error: } int -_TyCode_GetScriptXIData(PyThreadState *tstate, +_TyCode_GetScriptXIData(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { return get_script_xidata(tstate, obj, 0, xidata); } int -_TyCode_GetPureScriptXIData(PyThreadState *tstate, +_TyCode_GetPureScriptXIData(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { return get_script_xidata(tstate, obj, 1, xidata); @@ -990,7 +990,7 @@ _xidata_release(_PyXIData_t *xidata, int rawfree) if ((xidata->data == NULL || xidata->free == NULL) && xidata->obj == NULL) { // Nothing to release! if (rawfree) { - PyMem_RawFree(xidata); + TyMem_RawFree(xidata); } else { xidata->data = NULL; @@ -1007,7 +1007,7 @@ _xidata_release(_PyXIData_t *xidata, int rawfree) // XXX Someone leaked some memory... assert(TyErr_Occurred()); if (rawfree) { - PyMem_RawFree(xidata); + TyMem_RawFree(xidata); } return -1; } @@ -1274,13 +1274,13 @@ _excinfo_clear_type(struct _excinfo_type *info) assert(_Ty_IsImmortal((TyObject *)info->builtin)); } if (info->name != NULL) { - PyMem_RawFree((void *)info->name); + TyMem_RawFree((void *)info->name); } if (info->qualname != NULL) { - PyMem_RawFree((void *)info->qualname); + TyMem_RawFree((void *)info->qualname); } if (info->module != NULL) { - PyMem_RawFree((void *)info->module); + TyMem_RawFree((void *)info->module); } *info = (struct _excinfo_type){NULL}; } @@ -1326,10 +1326,10 @@ _PyXI_excinfo_clear(_PyXI_excinfo *info) { _excinfo_clear_type(&info->type); if (info->msg != NULL) { - PyMem_RawFree((void *)info->msg); + TyMem_RawFree((void *)info->msg); } if (info->errdisplay != NULL) { - PyMem_RawFree((void *)info->errdisplay); + TyMem_RawFree((void *)info->errdisplay); } *info = (_PyXI_excinfo){{NULL}}; } @@ -1652,7 +1652,7 @@ _PyXI_NewExcInfo(TyObject *exc) failure = _PyXI_excinfo_InitFromObject(info, exc); } if (failure != NULL) { - PyMem_RawFree(info); + TyMem_RawFree(info); set_exc_with_cause(TyExc_Exception, failure); return NULL; } @@ -1663,7 +1663,7 @@ void _PyXI_FreeExcInfo(_PyXI_excinfo *info) { _PyXI_excinfo_clear(info); - PyMem_RawFree(info); + TyMem_RawFree(info); } TyObject * @@ -1688,7 +1688,7 @@ _PyXI_ExcInfoAsObject(_PyXI_excinfo *info) static int _PyXI_ApplyErrorCode(_PyXI_errcode code, PyInterpreterState *interp) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(!TyErr_Occurred()); assert(code != _PyXI_ERR_NO_ERROR); @@ -1751,7 +1751,7 @@ static void clear_xi_failure(_PyXI_failure *failure) { if (failure->msg != NULL && failure->msg_owned) { - PyMem_RawFree((void*)failure->msg); + TyMem_RawFree((void*)failure->msg); } *failure = XI_FAILURE_INIT; } @@ -1779,7 +1779,7 @@ void _PyXI_FreeFailure(_PyXI_failure *failure) { clear_xi_failure(failure); - PyMem_RawFree(failure); + TyMem_RawFree(failure); } _PyXI_errcode @@ -1871,7 +1871,7 @@ xi_error_has_override(_PyXI_error *err) } static TyObject * -xi_error_resolve_current_exc(PyThreadState *tstate, +xi_error_resolve_current_exc(TyThreadState *tstate, _PyXI_failure *override) { assert(override == NULL || override->code != _PyXI_ERR_NO_ERROR); @@ -1899,7 +1899,7 @@ xi_error_resolve_current_exc(PyThreadState *tstate, } static void -xi_error_set_override(PyThreadState *tstate, _PyXI_error *err, +xi_error_set_override(TyThreadState *tstate, _PyXI_error *err, _PyXI_failure *override) { assert(err->override == NULL); @@ -1914,7 +1914,7 @@ xi_error_set_override(PyThreadState *tstate, _PyXI_error *err, } static void -xi_error_set_override_code(PyThreadState *tstate, _PyXI_error *err, +xi_error_set_override_code(TyThreadState *tstate, _PyXI_error *err, _PyXI_errcode code) { _PyXI_failure override = XI_FAILURE_INIT; @@ -1923,7 +1923,7 @@ xi_error_set_override_code(PyThreadState *tstate, _PyXI_error *err, } static const char * -xi_error_set_exc(PyThreadState *tstate, _PyXI_error *err, TyObject *exc) +xi_error_set_exc(TyThreadState *tstate, _PyXI_error *err, TyObject *exc) { assert(!_TyErr_Occurred(tstate)); assert(!xi_error_is_set(err)); @@ -1950,7 +1950,7 @@ xi_error_set_exc(PyThreadState *tstate, _PyXI_error *err, TyObject *exc) static TyObject * _PyXI_ApplyError(_PyXI_error *error, const char *failure) { - PyThreadState *tstate = PyThreadState_Get(); + TyThreadState *tstate = PyThreadState_Get(); if (failure != NULL) { xi_error_clear(error); @@ -2072,9 +2072,9 @@ _sharednsitem_set_value(_PyXI_namespace_item *item, TyObject *value, if (item->xidata == NULL) { return -1; } - PyThreadState *tstate = PyThreadState_Get(); + TyThreadState *tstate = PyThreadState_Get(); if (_TyObject_GetXIData(tstate, value, fallback, item->xidata) < 0) { - PyMem_RawFree(item->xidata); + TyMem_RawFree(item->xidata); item->xidata = NULL; // The caller may want to propagate TyExc_NotShareableError // if currently switched between interpreters. @@ -2098,7 +2098,7 @@ static void _sharednsitem_clear(_PyXI_namespace_item *item) { if (item->name != NULL) { - PyMem_RawFree((void *)item->name); + TyMem_RawFree((void *)item->name); item->name = NULL; } _sharednsitem_clear_value(item); @@ -2312,7 +2312,7 @@ _sharedns_free(_PyXI_namespace *ns) } #endif - PyMem_RawFree(ns); + TyMem_RawFree(ns); } static _PyXI_namespace * @@ -2369,7 +2369,7 @@ error: return NULL; } -static void _propagate_not_shareable_error(PyThreadState *, +static void _propagate_not_shareable_error(TyThreadState *, _PyXI_failure *); static int @@ -2380,7 +2380,7 @@ _fill_sharedns(_PyXI_namespace *ns, TyObject *nsobj, assert(_sharedns_check_counts(ns)); assert(ns->numnames == ns->maxitems); assert(ns->numvalues == 0); - PyThreadState *tstate = PyThreadState_Get(); + TyThreadState *tstate = PyThreadState_Get(); for (Ty_ssize_t i=0; i < ns->maxitems; i++) { if (_sharednsitem_copy_from_ns(&ns->items[i], nsobj, fallback) < 0) { if (p_err != NULL) { @@ -2461,10 +2461,10 @@ struct xi_session { // current before the session. If it is different from cur_tstate // then we must have switched interpreters. Either way, this will // be the current tstate once we exit the session. - PyThreadState *prev_tstate; + TyThreadState *prev_tstate; // Once a session has been entered, this is the current tstate. // It must be current when the session exits. - PyThreadState *init_tstate; + TyThreadState *init_tstate; // This is true if init_tstate needs cleanup during exit. int own_init_tstate; @@ -2500,7 +2500,7 @@ void _PyXI_FreeSession(_PyXI_session *session) { assert(session->status == SESSION_UNUSED); - PyMem_RawFree(session); + TyMem_RawFree(session); } @@ -2526,13 +2526,13 @@ _enter_session(_PyXI_session *session, PyInterpreterState *interp) assert(session->main_ns == NULL); // Switch to interpreter. - PyThreadState *tstate = PyThreadState_Get(); - PyThreadState *prev = tstate; + TyThreadState *tstate = PyThreadState_Get(); + TyThreadState *prev = tstate; int same_interp = (interp == tstate->interp); if (!same_interp) { tstate = _TyThreadState_NewBound(interp, _TyThreadState_WHENCE_EXEC); // XXX Possible GILState issues? - PyThreadState *swapped = PyThreadState_Swap(tstate); + TyThreadState *swapped = PyThreadState_Swap(tstate); assert(swapped == prev); (void)swapped; } @@ -2549,7 +2549,7 @@ _enter_session(_PyXI_session *session, PyInterpreterState *interp) static void _exit_session(_PyXI_session *session) { - PyThreadState *tstate = session->init_tstate; + TyThreadState *tstate = session->init_tstate; assert(tstate != NULL); assert(PyThreadState_Get() == tstate); assert(!_TyErr_Occurred(tstate)); @@ -2582,7 +2582,7 @@ _exit_session(_PyXI_session *session) } static void -_propagate_not_shareable_error(PyThreadState *tstate, +_propagate_not_shareable_error(TyThreadState *tstate, _PyXI_failure *override) { assert(override != NULL); @@ -2611,7 +2611,7 @@ _PyXI_Enter(_PyXI_session *session, _PyXI_session_result *result) { #ifndef NDEBUG - PyThreadState *tstate = _TyThreadState_GET(); // Only used for asserts + TyThreadState *tstate = _TyThreadState_GET(); // Only used for asserts #endif // Convert the attrs for cross-interpreter use. @@ -2728,7 +2728,7 @@ int _PyXI_Exit(_PyXI_session *session, _PyXI_failure *override, _PyXI_session_result *result) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); int res = 0; // Capture the raised exception, if any. @@ -2835,7 +2835,7 @@ capture_session_error(_PyXI_session *session, _PyXI_error *err, { assert(_session_is_active(session)); assert(!xi_error_is_set(err)); - PyThreadState *tstate = session->init_tstate; + TyThreadState *tstate = session->init_tstate; // Normalize the exception override. if (override != NULL) { @@ -2874,7 +2874,7 @@ static int _ensure_main_ns(_PyXI_session *session, _PyXI_failure *failure) { assert(_session_is_active(session)); - PyThreadState *tstate = session->init_tstate; + TyThreadState *tstate = session->init_tstate; if (session->main_ns != NULL) { return 0; } @@ -3110,7 +3110,7 @@ _Ty_xi_state_fini(_PyXI_state_t *state, PyInterpreterState *interp) } -PyStatus +TyStatus _PyXI_Init(PyInterpreterState *interp) { if (_Ty_IsMainInterpreter(interp)) { @@ -3167,7 +3167,7 @@ _PyXI_Fini(PyInterpreterState *interp) } } -PyStatus +TyStatus _PyXI_InitTypes(PyInterpreterState *interp) { if (init_static_exctypes(&_PyXI_GET_STATE(interp)->exceptions, interp) < 0) { @@ -3195,13 +3195,13 @@ _PyXI_FiniTypes(PyInterpreterState *interp) PyInterpreterState * _PyXI_NewInterpreter(PyInterpreterConfig *config, long *maybe_whence, - PyThreadState **p_tstate, PyThreadState **p_save_tstate) + TyThreadState **p_tstate, TyThreadState **p_save_tstate) { - PyThreadState *save_tstate = PyThreadState_Swap(NULL); + TyThreadState *save_tstate = PyThreadState_Swap(NULL); assert(save_tstate != NULL); - PyThreadState *tstate; - PyStatus status = Ty_NewInterpreterFromConfig(&tstate, config); + TyThreadState *tstate; + TyStatus status = Ty_NewInterpreterFromConfig(&tstate, config); if (TyStatus_Exception(status)) { // Since no new thread state was created, there is no exception // to propagate; raise a fresh one after swapping back in the @@ -3242,7 +3242,7 @@ _PyXI_NewInterpreter(PyInterpreterConfig *config, long *maybe_whence, void _PyXI_EndInterpreter(PyInterpreterState *interp, - PyThreadState *tstate, PyThreadState **p_save_tstate) + TyThreadState *tstate, TyThreadState **p_save_tstate) { #ifndef NDEBUG long whence = _TyInterpreterState_GetWhence(interp); @@ -3260,8 +3260,8 @@ _PyXI_EndInterpreter(PyInterpreterState *interp, } assert(whence != _TyInterpreterState_WHENCE_UNKNOWN); - PyThreadState *save_tstate = NULL; - PyThreadState *cur_tstate = PyThreadState_GET(); + TyThreadState *save_tstate = NULL; + TyThreadState *cur_tstate = PyThreadState_GET(); if (tstate == NULL) { if (PyThreadState_GetInterpreter(cur_tstate) == interp) { tstate = cur_tstate; diff --git a/Python/crossinterp_data_lookup.h b/Python/crossinterp_data_lookup.h index bf0e091..ad6f787 100644 --- a/Python/crossinterp_data_lookup.h +++ b/Python/crossinterp_data_lookup.h @@ -31,7 +31,7 @@ xid_lookup_fini(_PyXIData_lookup_t *state) } static int -get_lookup_context(PyThreadState *tstate, dlcontext_t *res) +get_lookup_context(TyThreadState *tstate, dlcontext_t *res) { _PyXI_global_state_t *global = _PyXI_GET_GLOBAL_STATE(tstate->interp); if (global == NULL) { @@ -63,7 +63,7 @@ lookup_getdata(dlcontext_t *ctx, TyObject *obj) /* exported API */ TyObject * -_PyXIData_GetNotShareableErrorType(PyThreadState *tstate) +_PyXIData_GetNotShareableErrorType(TyThreadState *tstate) { TyObject *exctype = get_notshareableerror_type(tstate); assert(exctype != NULL); @@ -71,14 +71,14 @@ _PyXIData_GetNotShareableErrorType(PyThreadState *tstate) } void -_PyXIData_SetNotShareableError(PyThreadState *tstate, const char *msg) +_PyXIData_SetNotShareableError(TyThreadState *tstate, const char *msg) { TyObject *cause = NULL; set_notshareableerror(tstate, cause, 1, msg); } void -_PyXIData_FormatNotShareableError(PyThreadState *tstate, +_PyXIData_FormatNotShareableError(TyThreadState *tstate, const char *format, ...) { TyObject *cause = NULL; @@ -89,7 +89,7 @@ _PyXIData_FormatNotShareableError(PyThreadState *tstate, } int -_PyXI_UnwrapNotShareableError(PyThreadState * tstate, _PyXI_failure *failure) +_PyXI_UnwrapNotShareableError(TyThreadState * tstate, _PyXI_failure *failure) { TyObject *exctype = get_notshareableerror_type(tstate); assert(exctype != NULL); @@ -117,7 +117,7 @@ _PyXI_UnwrapNotShareableError(PyThreadState * tstate, _PyXI_failure *failure) _PyXIData_getdata_t -_PyXIData_Lookup(PyThreadState *tstate, TyObject *obj) +_PyXIData_Lookup(TyThreadState *tstate, TyObject *obj) { dlcontext_t ctx; if (get_lookup_context(tstate, &ctx) < 0) { @@ -313,7 +313,7 @@ _xidregistry_clear(dlregistry_t *xidregistry) } int -_PyXIData_RegisterClass(PyThreadState *tstate, +_PyXIData_RegisterClass(TyThreadState *tstate, TyTypeObject *cls, _PyXIData_getdata_t getdata) { if (!TyType_Check(cls)) { @@ -349,7 +349,7 @@ finally: } int -_PyXIData_UnregisterClass(PyThreadState *tstate, TyTypeObject *cls) +_PyXIData_UnregisterClass(TyThreadState *tstate, TyTypeObject *cls) { int res = 0; dlcontext_t ctx; @@ -415,7 +415,7 @@ _TyBytes_FromXIData(_PyXIData_t *xidata) } static int -_bytes_shared(PyThreadState *tstate, +_bytes_shared(TyThreadState *tstate, TyObject *obj, size_t size, xid_newobjfunc newfunc, _PyXIData_t *xidata) { @@ -435,7 +435,7 @@ _bytes_shared(PyThreadState *tstate, } int -_TyBytes_GetXIData(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_TyBytes_GetXIData(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { if (!TyBytes_Check(obj)) { TyErr_Format(TyExc_TypeError, "expected bytes, got %R", obj); @@ -446,7 +446,7 @@ _TyBytes_GetXIData(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) } _TyBytes_data_t * -_TyBytes_GetXIDataWrapped(PyThreadState *tstate, +_TyBytes_GetXIDataWrapped(TyThreadState *tstate, TyObject *obj, size_t size, xid_newobjfunc newfunc, _PyXIData_t *xidata) { @@ -488,7 +488,7 @@ _new_str_object(_PyXIData_t *xidata) } static int -_str_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_str_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { if (_PyXIData_InitWithSize( xidata, tstate->interp, sizeof(struct _shared_str_data), obj, @@ -513,7 +513,7 @@ _new_long_object(_PyXIData_t *xidata) } static int -_long_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_long_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { /* Note that this means the size of shareable ints is bounded by * sys.maxsize. Hence on 32-bit architectures that is half the @@ -541,7 +541,7 @@ _new_float_object(_PyXIData_t *xidata) } static int -_float_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_float_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { if (_PyXIData_InitWithSize( xidata, tstate->interp, sizeof(double), NULL, @@ -565,7 +565,7 @@ _new_none_object(_PyXIData_t *xidata) } static int -_none_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_none_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { _PyXIData_Init(xidata, tstate->interp, NULL, NULL, _new_none_object); // xidata->data, xidata->obj and xidata->free remain NULL @@ -584,7 +584,7 @@ _new_bool_object(_PyXIData_t *xidata) } static int -_bool_shared(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_bool_shared(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { _PyXIData_Init(xidata, tstate->interp, (void *) (Ty_IsTrue(obj) ? (uintptr_t) 1 : (uintptr_t) 0), NULL, @@ -640,7 +640,7 @@ _tuple_shared_free(void* data) } static int -_tuple_shared(PyThreadState *tstate, TyObject *obj, xidata_fallback_t fallback, +_tuple_shared(TyThreadState *tstate, TyObject *obj, xidata_fallback_t fallback, _PyXIData_t *xidata) { Ty_ssize_t len = TyTuple_GET_SIZE(obj); @@ -696,7 +696,7 @@ _TyCode_FromXIData(_PyXIData_t *xidata) } int -_TyCode_GetXIData(PyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) +_TyCode_GetXIData(TyThreadState *tstate, TyObject *obj, _PyXIData_t *xidata) { if (!TyCode_Check(obj)) { _PyXIData_FormatNotShareableError(tstate, "expected code, got %R", obj); @@ -725,7 +725,7 @@ _PyFunction_FromXIData(_PyXIData_t *xidata) // For stateless functions (no globals) we use __main__ as __globals__, // just like we do for builtins like exec(). assert(TyCode_Check(code)); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *globals = _TyEval_GetGlobalsFromRunningMain(tstate); // borrowed if (globals == NULL) { if (_TyErr_Occurred(tstate)) { @@ -753,7 +753,7 @@ _PyFunction_FromXIData(_PyXIData_t *xidata) } int -_PyFunction_GetXIData(PyThreadState *tstate, TyObject *func, +_PyFunction_GetXIData(TyThreadState *tstate, TyObject *func, _PyXIData_t *xidata) { if (!TyFunction_Check(func)) { diff --git a/Python/crossinterp_exceptions.h b/Python/crossinterp_exceptions.h index 3593f5d..8570694 100644 --- a/Python/crossinterp_exceptions.h +++ b/Python/crossinterp_exceptions.h @@ -1,6 +1,6 @@ static void -_ensure_current_cause(PyThreadState *tstate, TyObject *cause) +_ensure_current_cause(TyThreadState *tstate, TyObject *cause) { if (cause == NULL) { return; @@ -62,7 +62,7 @@ _fini_notshareableerror(exceptions_t *state) } static TyObject * -get_notshareableerror_type(PyThreadState *tstate) +get_notshareableerror_type(TyThreadState *tstate) { _PyXI_state_t *local = _PyXI_GET_STATE(tstate->interp); if (local == NULL) { @@ -73,7 +73,7 @@ get_notshareableerror_type(PyThreadState *tstate) } static void -_ensure_notshareableerror(PyThreadState *tstate, +_ensure_notshareableerror(TyThreadState *tstate, TyObject *cause, int force, TyObject *msgobj) { TyObject *ctx = _TyErr_GetRaisedException(tstate); @@ -95,7 +95,7 @@ _ensure_notshareableerror(PyThreadState *tstate, } static void -set_notshareableerror(PyThreadState *tstate, TyObject *cause, int force, const char *msg) +set_notshareableerror(TyThreadState *tstate, TyObject *cause, int force, const char *msg) { TyObject *msgobj = TyUnicode_FromString(msg); if (msgobj == NULL) { @@ -108,7 +108,7 @@ set_notshareableerror(PyThreadState *tstate, TyObject *cause, int force, const c } static void -format_notshareableerror_v(PyThreadState *tstate, TyObject *cause, int force, +format_notshareableerror_v(TyThreadState *tstate, TyObject *cause, int force, const char *format, va_list vargs) { TyObject *msgobj = TyUnicode_FromFormatV(format, vargs); @@ -122,7 +122,7 @@ format_notshareableerror_v(PyThreadState *tstate, TyObject *cause, int force, } static void -format_notshareableerror(PyThreadState *tstate, TyObject *cause, int force, +format_notshareableerror(TyThreadState *tstate, TyObject *cause, int force, const char *format, ...) { va_list vargs; diff --git a/Python/dtoa.c b/Python/dtoa.c index a0f574b..dd3cd8e 100644 --- a/Python/dtoa.c +++ b/Python/dtoa.c @@ -2803,7 +2803,7 @@ _Ty_dg_dtoa(double dd, int mode, int ndigits, #endif // _PY_SHORT_FLOAT_REPR == 1 -PyStatus +TyStatus _PyDtoa_Init(PyInterpreterState *interp) { #if _PY_SHORT_FLOAT_REPR == 1 && !defined(Ty_USING_MEMORY_DEBUGGER) diff --git a/Python/errors.c b/Python/errors.c index f00fde5..4708b46 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -22,7 +22,7 @@ void -_TyErr_SetRaisedException(PyThreadState *tstate, TyObject *exc) +_TyErr_SetRaisedException(TyThreadState *tstate, TyObject *exc) { TyObject *old_exc = tstate->current_exception; tstate->current_exception = exc; @@ -56,7 +56,7 @@ _TyErr_CreateException(TyObject *exception_type, TyObject *value) } void -_TyErr_Restore(PyThreadState *tstate, TyObject *type, TyObject *value, +_TyErr_Restore(TyThreadState *tstate, TyObject *type, TyObject *value, TyObject *traceback) { if (type == NULL) { @@ -101,19 +101,19 @@ _TyErr_Restore(PyThreadState *tstate, TyObject *type, TyObject *value, void TyErr_Restore(TyObject *type, TyObject *value, TyObject *traceback) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_Restore(tstate, type, value, traceback); } void TyErr_SetRaisedException(TyObject *exc) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_SetRaisedException(tstate, exc); } _TyErr_StackItem * -_TyErr_GetTopmostException(PyThreadState *tstate) +_TyErr_GetTopmostException(TyThreadState *tstate) { _TyErr_StackItem *exc_info = tstate->exc_info; assert(exc_info); @@ -127,7 +127,7 @@ _TyErr_GetTopmostException(PyThreadState *tstate) } static TyObject * -get_normalization_failure_note(PyThreadState *tstate, TyObject *exception, TyObject *value) +get_normalization_failure_note(TyThreadState *tstate, TyObject *exception, TyObject *value) { TyObject *args = PyObject_Repr(value); if (args == NULL) { @@ -149,7 +149,7 @@ get_normalization_failure_note(PyThreadState *tstate, TyObject *exception, TyObj } void -_TyErr_SetObject(PyThreadState *tstate, TyObject *exception, TyObject *value) +_TyErr_SetObject(TyThreadState *tstate, TyObject *exception, TyObject *value) { TyObject *exc_value; TyObject *tb = NULL; @@ -243,7 +243,7 @@ _TyErr_SetObject(PyThreadState *tstate, TyObject *exception, TyObject *value) void TyErr_SetObject(TyObject *exception, TyObject *value) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_SetObject(tstate, exception, value); } @@ -253,7 +253,7 @@ TyErr_SetObject(TyObject *exception, TyObject *value) void _TyErr_SetKeyError(TyObject *arg) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *exc = PyObject_CallOneArg(TyExc_KeyError, arg); if (!exc) { /* caller will expect error to be set anyway */ @@ -265,7 +265,7 @@ _TyErr_SetKeyError(TyObject *arg) } void -_TyErr_SetNone(PyThreadState *tstate, TyObject *exception) +_TyErr_SetNone(TyThreadState *tstate, TyObject *exception) { _TyErr_SetObject(tstate, exception, (TyObject *)NULL); } @@ -274,13 +274,13 @@ _TyErr_SetNone(PyThreadState *tstate, TyObject *exception) void TyErr_SetNone(TyObject *exception) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_SetNone(tstate, exception); } void -_TyErr_SetString(PyThreadState *tstate, TyObject *exception, +_TyErr_SetString(TyThreadState *tstate, TyObject *exception, const char *string) { TyObject *value = TyUnicode_FromString(string); @@ -293,7 +293,7 @@ _TyErr_SetString(PyThreadState *tstate, TyObject *exception, void TyErr_SetString(TyObject *exception, const char *string) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_SetString(tstate, exception, string); } @@ -313,7 +313,7 @@ TyErr_Occurred(void) /* The caller must hold a thread state. */ _Ty_AssertHoldsTstate(); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyErr_Occurred(tstate); } @@ -351,7 +351,7 @@ TyErr_GivenExceptionMatches(TyObject *err, TyObject *exc) int -_TyErr_ExceptionMatches(PyThreadState *tstate, TyObject *exc) +_TyErr_ExceptionMatches(TyThreadState *tstate, TyObject *exc) { return TyErr_GivenExceptionMatches(_TyErr_Occurred(tstate), exc); } @@ -360,7 +360,7 @@ _TyErr_ExceptionMatches(PyThreadState *tstate, TyObject *exc) int TyErr_ExceptionMatches(TyObject *exc) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyErr_ExceptionMatches(tstate, exc); } @@ -376,7 +376,7 @@ TyErr_ExceptionMatches(TyObject *exc) PyException_SetTraceback() with the resulting value and tb? */ void -_TyErr_NormalizeException(PyThreadState *tstate, TyObject **exc, +_TyErr_NormalizeException(TyThreadState *tstate, TyObject **exc, TyObject **val, TyObject **tb) { int recursion_depth = 0; @@ -481,13 +481,13 @@ _TyErr_NormalizeException(PyThreadState *tstate, TyObject **exc, void TyErr_NormalizeException(TyObject **exc, TyObject **val, TyObject **tb) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_NormalizeException(tstate, exc, val, tb); } TyObject * -_TyErr_GetRaisedException(PyThreadState *tstate) { +_TyErr_GetRaisedException(TyThreadState *tstate) { TyObject *exc = tstate->current_exception; tstate->current_exception = NULL; return exc; @@ -496,12 +496,12 @@ _TyErr_GetRaisedException(PyThreadState *tstate) { TyObject * TyErr_GetRaisedException(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyErr_GetRaisedException(tstate); } void -_TyErr_Fetch(PyThreadState *tstate, TyObject **p_type, TyObject **p_value, +_TyErr_Fetch(TyThreadState *tstate, TyObject **p_type, TyObject **p_value, TyObject **p_traceback) { TyObject *exc = _TyErr_GetRaisedException(tstate); @@ -520,13 +520,13 @@ _TyErr_Fetch(PyThreadState *tstate, TyObject **p_type, TyObject **p_value, void TyErr_Fetch(TyObject **p_type, TyObject **p_value, TyObject **p_traceback) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_Fetch(tstate, p_type, p_value, p_traceback); } void -_TyErr_Clear(PyThreadState *tstate) +_TyErr_Clear(TyThreadState *tstate) { _TyErr_Restore(tstate, NULL, NULL, NULL); } @@ -535,7 +535,7 @@ _TyErr_Clear(PyThreadState *tstate) void TyErr_Clear(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_Clear(tstate); } @@ -567,7 +567,7 @@ get_exc_traceback(TyObject *exc_value) /* returns a strong ref */ } void -_TyErr_GetExcInfo(PyThreadState *tstate, +_TyErr_GetExcInfo(TyThreadState *tstate, TyObject **p_type, TyObject **p_value, TyObject **p_traceback) { _TyErr_StackItem *exc_info = _TyErr_GetTopmostException(tstate); @@ -578,7 +578,7 @@ _TyErr_GetExcInfo(PyThreadState *tstate, } TyObject* -_TyErr_GetHandledException(PyThreadState *tstate) +_TyErr_GetHandledException(TyThreadState *tstate) { _TyErr_StackItem *exc_info = _TyErr_GetTopmostException(tstate); TyObject *exc = exc_info->exc_value; @@ -591,12 +591,12 @@ _TyErr_GetHandledException(PyThreadState *tstate) TyObject* TyErr_GetHandledException(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyErr_GetHandledException(tstate); } void -_TyErr_SetHandledException(PyThreadState *tstate, TyObject *exc) +_TyErr_SetHandledException(TyThreadState *tstate, TyObject *exc) { Ty_XSETREF(tstate->exc_info->exc_value, Ty_XNewRef(exc == Ty_None ? NULL : exc)); } @@ -604,14 +604,14 @@ _TyErr_SetHandledException(PyThreadState *tstate, TyObject *exc) void TyErr_SetHandledException(TyObject *exc) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_SetHandledException(tstate, exc); } void TyErr_GetExcInfo(TyObject **p_type, TyObject **p_value, TyObject **p_traceback) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_GetExcInfo(tstate, p_type, p_value, p_traceback); } @@ -662,7 +662,7 @@ _TyErr_ChainExceptions(TyObject *typ, TyObject *val, TyObject *tb) if (typ == NULL) return; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!PyExceptionClass_Check(typ)) { _TyErr_Format(tstate, TyExc_SystemError, @@ -694,7 +694,7 @@ _TyErr_ChainExceptions(TyObject *typ, TyObject *val, TyObject *tb) The caller is responsible for ensuring that this call won't create any cycles in the exception context chain. */ void -_TyErr_ChainExceptions1Tstate(PyThreadState *tstate, TyObject *exc) +_TyErr_ChainExceptions1Tstate(TyThreadState *tstate, TyObject *exc) { if (exc == NULL) { return; @@ -712,7 +712,7 @@ _TyErr_ChainExceptions1Tstate(PyThreadState *tstate, TyObject *exc) void _TyErr_ChainExceptions1(TyObject *exc) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_ChainExceptions1Tstate(tstate, exc); } @@ -725,7 +725,7 @@ _TyErr_ChainExceptions1(TyObject *exc) void _TyErr_ChainStackItem(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(_TyErr_Occurred(tstate)); _TyErr_StackItem *exc_info = tstate->exc_info; @@ -735,13 +735,13 @@ _TyErr_ChainStackItem(void) TyObject *exc = _TyErr_GetRaisedException(tstate); - /* _TyErr_SetObject sets the context from PyThreadState. */ + /* _TyErr_SetObject sets the context from TyThreadState. */ _TyErr_SetObject(tstate, (TyObject *) Ty_TYPE(exc), exc); Ty_DECREF(exc); // since _TyErr_Occurred was true } static TyObject * -_TyErr_FormatVFromCause(PyThreadState *tstate, TyObject *exception, +_TyErr_FormatVFromCause(TyThreadState *tstate, TyObject *exception, const char *format, va_list vargs) { assert(_TyErr_Occurred(tstate)); @@ -757,7 +757,7 @@ _TyErr_FormatVFromCause(PyThreadState *tstate, TyObject *exception, } TyObject * -_TyErr_FormatFromCauseTstate(PyThreadState *tstate, TyObject *exception, +_TyErr_FormatFromCauseTstate(TyThreadState *tstate, TyObject *exception, const char *format, ...) { va_list vargs; @@ -770,7 +770,7 @@ _TyErr_FormatFromCauseTstate(PyThreadState *tstate, TyObject *exception, TyObject * _TyErr_FormatFromCause(TyObject *exception, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); va_list vargs; va_start(vargs, format); _TyErr_FormatVFromCause(tstate, exception, format, vargs); @@ -783,7 +783,7 @@ _TyErr_FormatFromCause(TyObject *exception, const char *format, ...) int TyErr_BadArgument(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_SetString(tstate, TyExc_TypeError, "bad argument type for built-in operation"); return 0; @@ -792,7 +792,7 @@ TyErr_BadArgument(void) TyObject * TyErr_NoMemory(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyErr_NoMemory(tstate); } @@ -805,7 +805,7 @@ TyErr_SetFromErrnoWithFilenameObject(TyObject *exc, TyObject *filenameObject) TyObject * TyErr_SetFromErrnoWithFilenameObjects(TyObject *exc, TyObject *filenameObject, TyObject *filenameObject2) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *message; TyObject *v, *args; int i = errno; @@ -941,7 +941,7 @@ TyObject *TyErr_SetExcFromWindowsErrWithFilenameObjects( TyObject *filenameObject, TyObject *filenameObject2) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); int len; WCHAR *s_buf = NULL; /* Free via LocalFree */ TyObject *message; @@ -1063,7 +1063,7 @@ TyObject *TyErr_SetFromWindowsErrWithFilename( static TyObject * new_importerror( - PyThreadState *tstate, TyObject *exctype, TyObject *msg, + TyThreadState *tstate, TyObject *exctype, TyObject *msg, TyObject *name, TyObject *path, TyObject* from_name) { TyObject *exc = NULL; @@ -1120,7 +1120,7 @@ _TyErr_SetImportErrorSubclassWithNameFrom( TyObject *exception, TyObject *msg, TyObject *name, TyObject *path, TyObject* from_name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *error = new_importerror( tstate, exception, msg, name, path, from_name); if (error != NULL) { @@ -1153,7 +1153,7 @@ TyErr_SetImportError(TyObject *msg, TyObject *name, TyObject *path) int _TyErr_SetModuleNotFoundError(TyObject *name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (name == NULL) { _TyErr_SetString(tstate, TyExc_TypeError, "expected a name argument"); return -1; @@ -1176,7 +1176,7 @@ _TyErr_SetModuleNotFoundError(TyObject *name) void _TyErr_BadInternalCall(const char *filename, int lineno) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_Format(tstate, TyExc_SystemError, "%s:%d: bad argument to internal function", filename, lineno); @@ -1189,7 +1189,7 @@ void TyErr_BadInternalCall(void) { assert(0 && "bad argument to internal function"); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_SetString(tstate, TyExc_SystemError, "bad argument to internal function"); } @@ -1197,7 +1197,7 @@ TyErr_BadInternalCall(void) TyObject * -_TyErr_FormatV(PyThreadState *tstate, TyObject *exception, +_TyErr_FormatV(TyThreadState *tstate, TyObject *exception, const char *format, va_list vargs) { TyObject* string; @@ -1218,13 +1218,13 @@ _TyErr_FormatV(PyThreadState *tstate, TyObject *exception, TyObject * TyErr_FormatV(TyObject *exception, const char *format, va_list vargs) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _TyErr_FormatV(tstate, exception, format, vargs); } TyObject * -_TyErr_Format(PyThreadState *tstate, TyObject *exception, +_TyErr_Format(TyThreadState *tstate, TyObject *exception, const char *format, ...) { va_list vargs; @@ -1238,7 +1238,7 @@ _TyErr_Format(PyThreadState *tstate, TyObject *exception, TyObject * TyErr_Format(TyObject *exception, const char *format, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); va_list vargs; va_start(vargs, format); _TyErr_FormatV(tstate, exception, format, vargs); @@ -1277,7 +1277,7 @@ error: TyObject * TyErr_NewException(const char *name, TyObject *base, TyObject *dict) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *modulename = NULL; TyObject *mydict = NULL; TyObject *bases = NULL; @@ -1386,7 +1386,7 @@ static PyStructSequence_Desc UnraisableHookArgs_desc = { }; -PyStatus +TyStatus _TyErr_InitTypes(PyInterpreterState *interp) { if (_PyStructSequence_InitBuiltin(interp, &UnraisableHookArgsType, @@ -1406,7 +1406,7 @@ _TyErr_FiniTypes(PyInterpreterState *interp) static TyObject * -make_unraisable_hook_args(PyThreadState *tstate, TyObject *exc_type, +make_unraisable_hook_args(TyThreadState *tstate, TyObject *exc_type, TyObject *exc_value, TyObject *exc_tb, TyObject *err_msg, TyObject *obj) { @@ -1447,7 +1447,7 @@ make_unraisable_hook_args(PyThreadState *tstate, TyObject *exc_type, Do nothing if sys.stderr attribute doesn't exist or is set to None. */ static int -write_unraisable_exc_file(PyThreadState *tstate, TyObject *exc_type, +write_unraisable_exc_file(TyThreadState *tstate, TyObject *exc_type, TyObject *exc_value, TyObject *exc_tb, TyObject *err_msg, TyObject *obj, TyObject *file) { @@ -1565,7 +1565,7 @@ write_unraisable_exc_file(PyThreadState *tstate, TyObject *exc_type, static int -write_unraisable_exc(PyThreadState *tstate, TyObject *exc_type, +write_unraisable_exc(TyThreadState *tstate, TyObject *exc_type, TyObject *exc_value, TyObject *exc_tb, TyObject *err_msg, TyObject *obj) { @@ -1589,7 +1589,7 @@ write_unraisable_exc(PyThreadState *tstate, TyObject *exc_type, TyObject* _TyErr_WriteUnraisableDefaultHook(TyObject *args) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!Ty_IS_TYPE(args, &UnraisableHookArgsType)) { _TyErr_SetString(tstate, TyExc_TypeError, @@ -1628,7 +1628,7 @@ static void format_unraisable_v(const char *format, va_list va, TyObject *obj) { const char *err_msg_str; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _Ty_EnsureTstateNotNULL(tstate); TyObject *err_msg = NULL; @@ -1778,7 +1778,7 @@ static void TyErr_SyntaxLocationObjectEx(TyObject *filename, int lineno, int col_offset, int end_lineno, int end_col_offset) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* add attributes for the line number and filename for the error */ TyObject *exc = _TyErr_GetRaisedException(tstate); @@ -1892,7 +1892,7 @@ TyErr_RangedSyntaxLocationObject(TyObject *filename, int lineno, int col_offset, void TyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *fileobj; if (filename != NULL) { fileobj = TyUnicode_DecodeFSDefault(filename); diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 2c9880d..d139fd0 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -1391,12 +1391,12 @@ JUMP_TO_JUMP_TARGET(); } Ty_UCS4 c = TyUnicode_READ_CHAR(str, index); - if (Ty_ARRAY_LENGTH(_Py_SINGLETON(strings).ascii) <= c) { + if (Ty_ARRAY_LENGTH(_Ty_SINGLETON(strings).ascii) <= c) { UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); } STAT_INC(BINARY_OP, hit); - TyObject *res_o = (TyObject*)&_Py_SINGLETON(strings).ascii[c]; + TyObject *res_o = (TyObject*)&_Ty_SINGLETON(strings).ascii[c]; PyStackRef_CLOSE_SPECIALIZED(sub_st, _TyLong_ExactDealloc); stack_pointer += -2; assert(WITHIN_STACK_BOUNDS()); @@ -6923,7 +6923,7 @@ case _SET_IP: { TyObject *instr_ptr = (TyObject *)CURRENT_OPERAND0(); - frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr; + frame->instr_ptr = (_Ty_CODEUNIT *)instr_ptr; break; } @@ -6956,7 +6956,7 @@ TyObject *exit_p = (TyObject *)CURRENT_OPERAND0(); _PyExitData *exit = (_PyExitData *)exit_p; PyCodeObject *code = _TyFrame_GetCode(frame); - _Py_CODEUNIT *target = _TyFrame_GetBytecode(frame) + exit->target; + _Ty_CODEUNIT *target = _TyFrame_GetBytecode(frame) + exit->target; #if defined(Ty_DEBUG) && !defined(_Py_JIT) OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); if (frame->lltrace >= 2) { @@ -6977,7 +6977,7 @@ stack_pointer = _TyFrame_GetStackPointer(frame); } if (exit->executor == NULL) { - _Py_BackoffCounter temperature = exit->temperature; + _Ty_BackoffCounter temperature = exit->temperature; if (!backoff_counter_triggers(temperature)) { exit->temperature = advance_backoff_counter(temperature); GOTO_TIER_ONE(target); diff --git a/Python/frozen_stubs.c b/Python/frozen_stubs.c index b8fb707..92ec098 100644 --- a/Python/frozen_stubs.c +++ b/Python/frozen_stubs.c @@ -70,7 +70,7 @@ _TyImport_GetDLOpenFlags(PyInterpreterState *interp) } /* Path config stub - minimal implementation */ -PyStatus +TyStatus _TyConfig_InitPathConfig(PyConfig *config, int compute_path_config) { return TyStatus_Ok(); diff --git a/Python/frozenmain.c b/Python/frozenmain.c index b693575..c8dc89c 100644 --- a/Python/frozenmain.c +++ b/Python/frozenmain.c @@ -20,7 +20,7 @@ extern int PyInitFrozenExtensions(void); int Ty_FrozenMain(int argc, char **argv) { - PyStatus status = _PyRuntime_Initialize(); + TyStatus status = _PyRuntime_Initialize(); if (TyStatus_Exception(status)) { Ty_ExitStatusException(status); } diff --git a/Python/gc.c b/Python/gc.c index ce55046..5a843f8 100644 --- a/Python/gc.c +++ b/Python/gc.c @@ -172,7 +172,7 @@ _TyGC_InitState(GCState *gcstate) } -PyStatus +TyStatus _TyGC_Init(PyInterpreterState *interp) { GCState *gcstate = &interp->gc; @@ -1052,7 +1052,7 @@ debug_cycle(const char *msg, TyObject *op) * merged into the old list regardless. */ static void -handle_legacy_finalizers(PyThreadState *tstate, +handle_legacy_finalizers(TyThreadState *tstate, GCState *gcstate, TyGC_Head *finalizers, TyGC_Head *old) { @@ -1079,7 +1079,7 @@ handle_legacy_finalizers(PyThreadState *tstate, * list, due to refcounts falling to 0. */ static void -finalize_garbage(PyThreadState *tstate, TyGC_Head *collectable) +finalize_garbage(TyThreadState *tstate, TyGC_Head *collectable) { destructor finalize; TyGC_Head seen; @@ -1116,7 +1116,7 @@ finalize_garbage(PyThreadState *tstate, TyGC_Head *collectable) * objects may be freed. It is possible I screwed something up here. */ static void -delete_garbage(PyThreadState *tstate, GCState *gcstate, +delete_garbage(TyThreadState *tstate, GCState *gcstate, TyGC_Head *collectable, TyGC_Head *old) { assert(!_TyErr_Occurred(tstate)); @@ -1266,7 +1266,7 @@ handle_resurrected_objects(TyGC_Head *unreachable, TyGC_Head* still_unreachable, } static void -gc_collect_region(PyThreadState *tstate, +gc_collect_region(TyThreadState *tstate, TyGC_Head *from, TyGC_Head *to, struct gc_collection_stats *stats); @@ -1311,7 +1311,7 @@ add_stats(GCState *gcstate, int gen, struct gc_collection_stats *stats) } static void -gc_collect_young(PyThreadState *tstate, +gc_collect_young(TyThreadState *tstate, struct gc_collection_stats *stats) { GCState *gcstate = &tstate->interp->gc; @@ -1483,7 +1483,7 @@ mark_stacks(PyInterpreterState *interp, TyGC_Head *visited, int visited_space, b // Move all objects on stacks to reachable _PyRuntimeState *runtime = &_PyRuntime; HEAD_LOCK(runtime); - PyThreadState* ts = TyInterpreterState_ThreadHead(interp); + TyThreadState* ts = TyInterpreterState_ThreadHead(interp); HEAD_UNLOCK(runtime); while (ts) { _PyInterpreterFrame *frame = ts->current_frame; @@ -1557,7 +1557,7 @@ mark_global_roots(PyInterpreterState *interp, TyGC_Head *visited, int visited_sp } static intptr_t -mark_at_start(PyThreadState *tstate) +mark_at_start(TyThreadState *tstate) { // TO DO -- Make this incremental GCState *gcstate = &tstate->interp->gc; @@ -1600,7 +1600,7 @@ assess_work_to_do(GCState *gcstate) } static void -gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats) +gc_collect_increment(TyThreadState *tstate, struct gc_collection_stats *stats) { GC_STAT_ADD(1, collections, 1); GCState *gcstate = &tstate->interp->gc; @@ -1658,7 +1658,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats) } static void -gc_collect_full(PyThreadState *tstate, +gc_collect_full(TyThreadState *tstate, struct gc_collection_stats *stats) { GC_STAT_ADD(2, collections, 1); @@ -1691,7 +1691,7 @@ gc_collect_full(PyThreadState *tstate, /* This is the main function. Read this to understand how the * collection process works. */ static void -gc_collect_region(PyThreadState *tstate, +gc_collect_region(TyThreadState *tstate, TyGC_Head *from, TyGC_Head *to, struct gc_collection_stats *stats) @@ -2007,7 +2007,7 @@ show_stats_each_generations(GCState *gcstate) } Ty_ssize_t -_TyGC_Collect(PyThreadState *tstate, int generation, _TyGC_Reason reason) +_TyGC_Collect(TyThreadState *tstate, int generation, _TyGC_Reason reason) { GCState *gcstate = &tstate->interp->gc; assert(tstate->current_frame == NULL || tstate->current_frame->stackpointer != NULL); @@ -2071,7 +2071,7 @@ TyGC_Collect(void) } void -_TyGC_CollectNoFail(PyThreadState *tstate) +_TyGC_CollectNoFail(TyThreadState *tstate) { /* Ideally, this function is only called on interpreter shutdown, and therefore not recursively. Unfortunately, when there are daemon @@ -2222,7 +2222,7 @@ PyObject_IS_GC(TyObject *obj) } void -_Ty_ScheduleGC(PyThreadState *tstate) +_Ty_ScheduleGC(TyThreadState *tstate) { if (!_Ty_eval_breaker_bit_is_set(tstate, _PY_GC_SCHEDULED_BIT)) { @@ -2237,7 +2237,7 @@ _TyObject_GC_Link(TyObject *op) // gc must be correctly aligned _TyObject_ASSERT(op, ((uintptr_t)gc & (sizeof(uintptr_t)-1)) == 0); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); GCState *gcstate = &tstate->interp->gc; gc->_gc_next = 0; gc->_gc_prev = 0; @@ -2254,7 +2254,7 @@ _TyObject_GC_Link(TyObject *op) } void -_Ty_RunGC(PyThreadState *tstate) +_Ty_RunGC(TyThreadState *tstate) { if (tstate->interp->gc.enabled) { _TyGC_Collect(tstate, 1, _Ty_GC_REASON_HEAP); @@ -2264,7 +2264,7 @@ _Ty_RunGC(PyThreadState *tstate) static TyObject * gc_alloc(TyTypeObject *tp, size_t basicsize, size_t presize) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (basicsize > PY_SSIZE_T_MAX - presize) { return _TyErr_NoMemory(tstate); } diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c index c2a348f..f7c968c 100644 --- a/Python/gc_free_threading.c +++ b/Python/gc_free_threading.c @@ -947,7 +947,7 @@ process_delayed_frees(PyInterpreterState *interp, struct collection_state *state } _Py_FOR_EACH_TSTATE_END(interp); - _TyMem_ProcessDelayedNoDealloc((PyThreadState *)current_tstate, queue_freed_object, state); + _TyMem_ProcessDelayedNoDealloc((TyThreadState *)current_tstate, queue_freed_object, state); } // Subtract an incoming reference from the computed "gc_refs" refcount. @@ -1588,7 +1588,7 @@ _TyGC_InitState(GCState *gcstate) } -PyStatus +TyStatus _TyGC_Init(PyInterpreterState *interp) { GCState *gcstate = &interp->gc; @@ -1639,7 +1639,7 @@ finalize_garbage(struct collection_state *state) static void delete_garbage(struct collection_state *state) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); GCState *gcstate = state->gcstate; assert(!_TyErr_Occurred(tstate)); @@ -1838,7 +1838,7 @@ handle_resurrected_objects(struct collection_state *state) * is starting or stopping */ static void -invoke_gc_callback(PyThreadState *tstate, const char *phase, +invoke_gc_callback(TyThreadState *tstate, const char *phase, int generation, Ty_ssize_t collected, Ty_ssize_t uncollectable) { @@ -2104,7 +2104,7 @@ gc_should_collect(GCState *gcstate) } static void -record_allocation(PyThreadState *tstate) +record_allocation(TyThreadState *tstate) { struct _gc_thread_state *gc = &((_PyThreadStateImpl *)tstate)->gc; @@ -2126,7 +2126,7 @@ record_allocation(PyThreadState *tstate) } static void -record_deallocation(PyThreadState *tstate) +record_deallocation(TyThreadState *tstate) { struct _gc_thread_state *gc = &((_PyThreadStateImpl *)tstate)->gc; @@ -2255,7 +2255,7 @@ gc_collect_internal(PyInterpreterState *interp, struct collection_state *state, /* This is the main function. Read this to understand how the * collection process works. */ static Ty_ssize_t -gc_collect_main(PyThreadState *tstate, int generation, _TyGC_Reason reason) +gc_collect_main(TyThreadState *tstate, int generation, _TyGC_Reason reason) { Ty_ssize_t m = 0; /* # objects collected */ Ty_ssize_t n = 0; /* # unreachable objects that couldn't be collected */ @@ -2596,7 +2596,7 @@ TyGC_IsEnabled(void) Ty_ssize_t TyGC_Collect(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); GCState *gcstate = &tstate->interp->gc; if (!_Ty_atomic_load_int_relaxed(&gcstate->enabled)) { @@ -2612,13 +2612,13 @@ TyGC_Collect(void) } Ty_ssize_t -_TyGC_Collect(PyThreadState *tstate, int generation, _TyGC_Reason reason) +_TyGC_Collect(TyThreadState *tstate, int generation, _TyGC_Reason reason) { return gc_collect_main(tstate, generation, reason); } void -_TyGC_CollectNoFail(PyThreadState *tstate) +_TyGC_CollectNoFail(TyThreadState *tstate) { /* Ideally, this function is only called on interpreter shutdown, and therefore not recursively. Unfortunately, when there are daemon @@ -2740,7 +2740,7 @@ PyObject_IS_GC(TyObject *obj) } void -_Py_ScheduleGC(PyThreadState *tstate) +_Py_ScheduleGC(TyThreadState *tstate) { if (!_Py_eval_breaker_bit_is_set(tstate, _PY_GC_SCHEDULED_BIT)) { @@ -2755,7 +2755,7 @@ _TyObject_GC_Link(TyObject *op) } void -_Py_RunGC(PyThreadState *tstate) +_Py_RunGC(TyThreadState *tstate) { if (!TyGC_IsEnabled()) { return; @@ -2766,7 +2766,7 @@ _Py_RunGC(PyThreadState *tstate) static TyObject * gc_alloc(TyTypeObject *tp, size_t basicsize, size_t presize) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (basicsize > PY_SSIZE_T_MAX - presize) { return _TyErr_NoMemory(tstate); } diff --git a/Python/getargs.c b/Python/getargs.c index d4c28ff..9e19e27 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -57,7 +57,7 @@ static const char *converttuple(TyObject *, const char **, va_list *, int, static const char *convertsimple(TyObject *, const char **, va_list *, int, char *, size_t, freelist_t *); static Ty_ssize_t convertbuffer(TyObject *, const void **p, const char **); -static int getbuffer(TyObject *, Py_buffer *, const char**); +static int getbuffer(TyObject *, Ty_buffer *, const char**); static int vgetargskeywords(TyObject *, TyObject *, const char *, const char * const *, va_list *, int); @@ -172,7 +172,7 @@ cleanup_ptr(TyObject *self, void *ptr) static int cleanup_buffer(TyObject *self, void *ptr) { - Py_buffer *buf = (Py_buffer *)ptr; + Ty_buffer *buf = (Ty_buffer *)ptr; if (buf) { PyBuffer_Release(buf); } @@ -978,7 +978,7 @@ convertsimple(TyObject *arg, const char **p_format, va_list *p_va, int flags, if (*format == '*') { format++; HANDLE_NULLABLE; - if (getbuffer(arg, (Py_buffer*)p, &buf) < 0) + if (getbuffer(arg, (Ty_buffer*)p, &buf) < 0) return converterr(nullable, buf, arg, msgbuf, bufsize); if (addcleanup(p, freelist, cleanup_buffer)) { return converterr( @@ -1014,7 +1014,7 @@ convertsimple(TyObject *arg, const char **p_format, va_list *p_va, int flags, { if (*format == '*') { /* "s*" or "z*" */ - Py_buffer *p = (Py_buffer *)va_arg(*p_va, Py_buffer *); + Ty_buffer *p = (Ty_buffer *)va_arg(*p_va, Ty_buffer *); format++; HANDLE_NULLABLE; @@ -1314,7 +1314,7 @@ convertsimple(TyObject *arg, const char **p_format, va_list *p_va, int flags, if (! (res = (*convert)(arg, addr))) return converterr(nullable, "(unspecified)", arg, msgbuf, bufsize); - if (res == Py_CLEANUP_SUPPORTED && + if (res == Ty_CLEANUP_SUPPORTED && addcleanup(addr, freelist, convert) == -1) return converterr(nullable, "(cleanup problem)", arg, msgbuf, bufsize); @@ -1338,15 +1338,15 @@ convertsimple(TyObject *arg, const char **p_format, va_list *p_va, int flags, format++; HANDLE_NULLABLE; - /* Caller is interested in Py_buffer, and the object supports it + /* Caller is interested in Ty_buffer, and the object supports it directly. The request implicitly asks for PyBUF_SIMPLE, so the result is C-contiguous with format 'B'. */ - if (PyObject_GetBuffer(arg, (Py_buffer*)p, PyBUF_WRITABLE) < 0) { + if (PyObject_GetBuffer(arg, (Ty_buffer*)p, PyBUF_WRITABLE) < 0) { TyErr_Clear(); return converterr(nullable, "read-write bytes-like object", arg, msgbuf, bufsize); } - assert(PyBuffer_IsContiguous((Py_buffer *)p, 'C')); + assert(PyBuffer_IsContiguous((Ty_buffer *)p, 'C')); if (addcleanup(p, freelist, cleanup_buffer)) { return converterr( nullable, "(cleanup problem)", @@ -1371,7 +1371,7 @@ convertbuffer(TyObject *arg, const void **p, const char **errmsg) { PyBufferProcs *pb = Ty_TYPE(arg)->tp_as_buffer; Ty_ssize_t count; - Py_buffer view; + Ty_buffer view; *errmsg = NULL; *p = NULL; @@ -1389,7 +1389,7 @@ convertbuffer(TyObject *arg, const void **p, const char **errmsg) } static int -getbuffer(TyObject *arg, Py_buffer *view, const char **errmsg) +getbuffer(TyObject *arg, Ty_buffer *view, const char **errmsg) { /* PyBUF_SIMPLE implies C-contiguous */ if (PyObject_GetBuffer(arg, view, PyBUF_SIMPLE) != 0) { @@ -2109,8 +2109,8 @@ _parser_init(void *arg) if (kwtuple == NULL) { /* We may temporarily switch to the main interpreter to avoid * creating a tuple that could outlive its owning interpreter. */ - PyThreadState *save_tstate = NULL; - PyThreadState *temp_tstate = NULL; + TyThreadState *save_tstate = NULL; + TyThreadState *temp_tstate = NULL; if (!_Ty_IsMainInterpreter(TyInterpreterState_Get())) { temp_tstate = TyThreadState_New(_TyInterpreterState_Main()); if (temp_tstate == NULL) { diff --git a/Python/import.c b/Python/import.c index 87486d8..d13892e 100644 --- a/Python/import.c +++ b/Python/import.c @@ -183,7 +183,7 @@ _TyImport_ClearModules(PyInterpreterState *interp) } static inline TyObject * -get_modules_dict(PyThreadState *tstate, bool fatal) +get_modules_dict(TyThreadState *tstate, bool fatal) { /* Technically, it would make sense to incref the dict, * since sys.modules could be swapped out and decref'ed to 0 @@ -205,14 +205,14 @@ get_modules_dict(PyThreadState *tstate, bool fatal) TyObject * TyImport_GetModuleDict(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return get_modules_dict(tstate, true); } int _TyImport_SetModule(TyObject *name, TyObject *m) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *modules = get_modules_dict(tstate, true); return PyObject_SetItem(modules, name, m); } @@ -220,13 +220,13 @@ _TyImport_SetModule(TyObject *name, TyObject *m) int _TyImport_SetModuleString(const char *name, TyObject *m) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *modules = get_modules_dict(tstate, true); return PyMapping_SetItemString(modules, name, m); } static TyObject * -import_get_module(PyThreadState *tstate, TyObject *name) +import_get_module(TyThreadState *tstate, TyObject *name) { TyObject *modules = get_modules_dict(tstate, false); if (modules == NULL) { @@ -285,12 +285,12 @@ done: return 0; } -static void remove_importlib_frames(PyThreadState *tstate); +static void remove_importlib_frames(TyThreadState *tstate); TyObject * TyImport_GetModule(TyObject *name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *mod; mod = import_get_module(tstate, name); @@ -309,7 +309,7 @@ TyImport_GetModule(TyObject *name) if not, create a new one and insert it in the modules dictionary. */ static TyObject * -import_add_module(PyThreadState *tstate, TyObject *name) +import_add_module(TyThreadState *tstate, TyObject *name) { TyObject *modules = get_modules_dict(tstate, false); if (modules == NULL) { @@ -342,7 +342,7 @@ TyImport_AddModuleRef(const char *name) if (name_obj == NULL) { return NULL; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *module = import_add_module(tstate, name_obj); Ty_DECREF(name_obj); return module; @@ -352,7 +352,7 @@ TyImport_AddModuleRef(const char *name) TyObject * TyImport_AddModuleObject(TyObject *name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *mod = import_add_module(tstate, name); if (!mod) { return NULL; @@ -405,7 +405,7 @@ TyImport_AddModule(const char *name) * exception, otherwise the old exception is preserved. */ static void -remove_module(PyThreadState *tstate, TyObject *name) +remove_module(TyThreadState *tstate, TyObject *name) { TyObject *exc = _TyErr_GetRaisedException(tstate); @@ -547,7 +547,7 @@ PyState_FindModule(TyModuleDef* module) playing it safe and keeping it around for any stable ABI extensions built against 3.2-3.5. */ int -_PyState_AddModule(PyThreadState *tstate, TyObject* module, TyModuleDef* def) +_PyState_AddModule(TyThreadState *tstate, TyObject* module, TyModuleDef* def) { if (!def) { assert(_TyErr_Occurred(tstate)); @@ -572,7 +572,7 @@ PyState_AddModule(TyObject* module, TyModuleDef* def) return -1; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (def->m_slots) { _TyErr_SetString(tstate, TyExc_SystemError, @@ -597,7 +597,7 @@ PyState_AddModule(TyObject* module, TyModuleDef* def) int PyState_RemoveModule(TyModuleDef* def) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (def->m_slots) { _TyErr_SetString(tstate, TyExc_SystemError, @@ -1538,7 +1538,7 @@ _TyImport_CheckSubinterpIncompatibleExtensionAllowed(const char *name) int _TyImport_CheckGILForModule(TyObject* module, TyObject *module_name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (module == NULL) { _TyEval_DisableGIL(tstate); return 0; @@ -1575,19 +1575,19 @@ _TyImport_CheckGILForModule(TyObject* module, TyObject *module_name) } #endif -static PyThreadState * -switch_to_main_interpreter(PyThreadState *tstate) +static TyThreadState * +switch_to_main_interpreter(TyThreadState *tstate) { if (_Ty_IsMainInterpreter(tstate->interp)) { return tstate; } - PyThreadState *main_tstate = _TyThreadState_NewBound( + TyThreadState *main_tstate = _TyThreadState_NewBound( _TyInterpreterState_Main(), _TyThreadState_WHENCE_EXEC); if (main_tstate == NULL) { return NULL; } #ifndef NDEBUG - PyThreadState *old_tstate = TyThreadState_Swap(main_tstate); + TyThreadState *old_tstate = TyThreadState_Swap(main_tstate); assert(old_tstate == tstate); #else (void)TyThreadState_Swap(main_tstate); @@ -1596,8 +1596,8 @@ switch_to_main_interpreter(PyThreadState *tstate) } static void -switch_back_from_main_interpreter(PyThreadState *tstate, - PyThreadState *main_tstate, +switch_back_from_main_interpreter(TyThreadState *tstate, + TyThreadState *main_tstate, TyObject *tempobj) { assert(main_tstate == TyThreadState_GET()); @@ -1727,7 +1727,7 @@ struct singlephase_global_update { }; static struct extensions_cache_value * -update_global_state_for_extension(PyThreadState *tstate, +update_global_state_for_extension(TyThreadState *tstate, TyObject *path, TyObject *name, TyModuleDef *def, struct singlephase_global_update *singlephase) @@ -1796,7 +1796,7 @@ update_global_state_for_extension(PyThreadState *tstate, /* For multi-phase init modules, the module is finished * by TyModule_FromDefAndSpec(). */ static int -finish_singlephase_extension(PyThreadState *tstate, TyObject *mod, +finish_singlephase_extension(TyThreadState *tstate, TyObject *mod, struct extensions_cache_value *cached, TyObject *name, TyObject *modules) { @@ -1819,7 +1819,7 @@ finish_singlephase_extension(PyThreadState *tstate, TyObject *mod, static TyObject * -reload_singlephase_extension(PyThreadState *tstate, +reload_singlephase_extension(TyThreadState *tstate, struct extensions_cache_value *cached, struct _Ty_ext_module_loader_info *info) { @@ -1930,7 +1930,7 @@ reload_singlephase_extension(PyThreadState *tstate, } static TyObject * -import_find_extension(PyThreadState *tstate, +import_find_extension(TyThreadState *tstate, struct _Ty_ext_module_loader_info *info, struct extensions_cache_value **p_cached) { @@ -1968,7 +1968,7 @@ import_find_extension(PyThreadState *tstate, } static TyObject * -import_run_extension(PyThreadState *tstate, PyModInitFunction p0, +import_run_extension(TyThreadState *tstate, PyModInitFunction p0, struct _Ty_ext_module_loader_info *info, TyObject *spec, TyObject *modules) { @@ -2028,7 +2028,7 @@ import_run_extension(PyThreadState *tstate, PyModInitFunction p0, * such interpreters will be increasingly uncommon, * and the code is a bit simpler if we always switch * to the main interpreter. */ - PyThreadState *main_tstate = switch_to_main_interpreter(tstate); + TyThreadState *main_tstate = switch_to_main_interpreter(tstate); if (main_tstate == NULL) { return NULL; } @@ -2219,8 +2219,8 @@ clear_singlephase_extension(PyInterpreterState *interp, /* We must use the main interpreter to clean up the cache. * See the note in import_run_extension(). */ - PyThreadState *tstate = TyThreadState_GET(); - PyThreadState *main_tstate = switch_to_main_interpreter(tstate); + TyThreadState *tstate = TyThreadState_GET(); + TyThreadState *main_tstate = switch_to_main_interpreter(tstate); if (main_tstate == NULL) { return -1; } @@ -2241,7 +2241,7 @@ clear_singlephase_extension(PyInterpreterState *interp, /*******************/ int -_TyImport_FixupBuiltin(PyThreadState *tstate, TyObject *mod, const char *name, +_TyImport_FixupBuiltin(TyThreadState *tstate, TyObject *mod, const char *name, TyObject *modules) { int res = -1; @@ -2323,7 +2323,7 @@ is_builtin(TyObject *name) } static TyObject* -create_builtin(PyThreadState *tstate, TyObject *name, TyObject *spec) +create_builtin(TyThreadState *tstate, TyObject *name, TyObject *spec) { struct _Ty_ext_module_loader_info info; if (_Ty_ext_module_loader_info_init_for_builtin(&info, name) < 0) { @@ -2628,7 +2628,7 @@ error: } static TyObject * -module_dict_for_exec(PyThreadState *tstate, TyObject *name) +module_dict_for_exec(TyThreadState *tstate, TyObject *name) { TyObject *m, *d; @@ -2654,7 +2654,7 @@ module_dict_for_exec(PyThreadState *tstate, TyObject *name) } static TyObject * -exec_code_in_module(PyThreadState *tstate, TyObject *name, +exec_code_in_module(TyThreadState *tstate, TyObject *name, TyObject *module_dict, TyObject *code_object) { TyObject *v, *m; @@ -2680,7 +2680,7 @@ TyObject* TyImport_ExecCodeModuleObject(TyObject *name, TyObject *co, TyObject *pathname, TyObject *cpathname) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *d, *external, *res; d = module_dict_for_exec(tstate, name); @@ -3048,7 +3048,7 @@ unmarshal_frozen_code(PyInterpreterState *interp, struct frozen_info *info) int TyImport_ImportFrozenModuleObject(TyObject *name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *co, *m, *d = NULL; int err; @@ -3144,7 +3144,7 @@ TyImport_ImportFrozenModule(const char *name) importlib requires the _imp module: this function fix the bootstrap issue. */ static TyObject* -bootstrap_imp(PyThreadState *tstate) +bootstrap_imp(TyThreadState *tstate) { TyObject *name = TyUnicode_FromString("_imp"); if (name == NULL) { @@ -3198,7 +3198,7 @@ error: */ static int -init_importlib(PyThreadState *tstate, TyObject *sysmod) +init_importlib(TyThreadState *tstate, TyObject *sysmod) { assert(!_TyErr_Occurred(tstate)); @@ -3314,7 +3314,7 @@ _TyImport_ImportlibModuleRepr(PyInterpreterState *interp, TyObject *m) path_importer_cache. */ static TyObject * -get_path_importer(PyThreadState *tstate, TyObject *path_importer_cache, +get_path_importer(TyThreadState *tstate, TyObject *path_importer_cache, TyObject *path_hooks, TyObject *p) { TyObject *importer; @@ -3368,7 +3368,7 @@ get_path_importer(PyThreadState *tstate, TyObject *path_importer_cache, TyObject * TyImport_GetImporter(TyObject *path) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *path_importer_cache = _TySys_GetRequiredAttrString("path_importer_cache"); if (path_importer_cache == NULL) { return NULL; @@ -3451,7 +3451,7 @@ TyImport_ImportModuleNoBlock(const char *name) /* Remove importlib frames from the traceback, * except in Verbose mode. */ static void -remove_importlib_frames(PyThreadState *tstate) +remove_importlib_frames(TyThreadState *tstate) { const char *importlib_filename = ""; const char *external_filename = ""; @@ -3518,7 +3518,7 @@ done: static TyObject * -resolve_name(PyThreadState *tstate, TyObject *name, TyObject *globals, int level) +resolve_name(TyThreadState *tstate, TyObject *name, TyObject *globals, int level) { TyObject *abs_name; TyObject *package = NULL; @@ -3669,7 +3669,7 @@ resolve_name(PyThreadState *tstate, TyObject *name, TyObject *globals, int level } static TyObject * -import_find_and_load(PyThreadState *tstate, TyObject *abs_name) +import_find_and_load(TyThreadState *tstate, TyObject *abs_name) { TyObject *mod = NULL; PyInterpreterState *interp = tstate->interp; @@ -3754,7 +3754,7 @@ TyImport_ImportModuleLevelObject(TyObject *name, TyObject *globals, TyObject *locals, TyObject *fromlist, int level) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *abs_name = NULL; TyObject *final_mod = NULL; TyObject *mod = NULL; @@ -3946,7 +3946,7 @@ TyImport_ReloadModule(TyObject *m) TyObject * TyImport_Import(TyObject *module_name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *globals = NULL; TyObject *import = NULL; TyObject *builtins = NULL; @@ -4022,14 +4022,14 @@ TyImport_Import(TyObject *module_name) /* runtime lifecycle */ /*********************/ -PyStatus +TyStatus _TyImport_Init(void) { if (INITTAB != NULL) { return _TyStatus_ERR("global import state already initialized"); } if (init_builtin_modules_table() != 0) { - return PyStatus_NoMemory(); + return TyStatus_NoMemory(); } return _TyStatus_OK(); } @@ -4062,8 +4062,8 @@ _TyImport_Fini2(void) /* interpreter lifecycle */ /*************************/ -PyStatus -_TyImport_InitCore(PyThreadState *tstate, TyObject *sysmod, int importlib) +TyStatus +_TyImport_InitCore(TyThreadState *tstate, TyObject *sysmod, int importlib) { // XXX Initialize here: interp->modules and interp->import_func. // XXX Initialize here: sys.modules and sys.meta_path. @@ -4128,7 +4128,7 @@ _TyImport_FiniCore(PyInterpreterState *interp) /* "external" imports */ static int -init_zipimport(PyThreadState *tstate, int verbose) +init_zipimport(TyThreadState *tstate, int verbose) { TyObject *path_hooks = _TySys_GetRequiredAttrString("path_hooks"); if (path_hooks == NULL) { @@ -4163,8 +4163,8 @@ init_zipimport(PyThreadState *tstate, int verbose) return 0; } -PyStatus -_TyImport_InitExternal(PyThreadState *tstate) +TyStatus +_TyImport_InitExternal(TyThreadState *tstate) { int verbose = _TyInterpreterState_GetConfig(tstate->interp)->verbose; @@ -4335,7 +4335,7 @@ static TyObject * _imp_create_builtin(TyObject *module, TyObject *spec) /*[clinic end generated code: output=ace7ff22271e6f39 input=37f966f890384e47]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *name = PyObject_GetAttrString(spec, "name"); if (name == NULL) { @@ -4406,7 +4406,7 @@ static TyObject * _imp_init_frozen_impl(TyObject *module, TyObject *name) /*[clinic end generated code: output=fc0511ed869fd69c input=13019adfc04f3fb3]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); int ret; ret = TyImport_ImportFrozenModuleObject(name); @@ -4677,7 +4677,7 @@ _imp_create_dynamic_impl(TyObject *module, TyObject *spec, TyObject *file) /*[clinic end generated code: output=83249b827a4fde77 input=c31b954f4cf4e09d]*/ { TyObject *mod = NULL; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); struct _Ty_ext_module_loader_info info; if (_Ty_ext_module_loader_info_init_from_spec(&info, spec) < 0) { diff --git a/Python/initconfig.c b/Python/initconfig.c index 5af508d..778492f 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -569,36 +569,36 @@ _Ty_COMP_DIAG_IGNORE_DEPR_DECLS _Ty_COMP_DIAG_POP } -/* --- PyStatus ----------------------------------------------- */ +/* --- TyStatus ----------------------------------------------- */ -PyStatus PyStatus_Ok(void) +TyStatus PyStatus_Ok(void) { return _TyStatus_OK(); } -PyStatus PyStatus_Error(const char *err_msg) +TyStatus PyStatus_Error(const char *err_msg) { assert(err_msg != NULL); - return (PyStatus){._type = _TyStatus_TYPE_ERROR, + return (TyStatus){._type = _TyStatus_TYPE_ERROR, .err_msg = err_msg}; } -PyStatus PyStatus_NoMemory(void) +TyStatus PyStatus_NoMemory(void) { return PyStatus_Error("memory allocation failed"); } -PyStatus PyStatus_Exit(int exitcode) +TyStatus PyStatus_Exit(int exitcode) { return _TyStatus_EXIT(exitcode); } -int PyStatus_IsError(PyStatus status) +int PyStatus_IsError(TyStatus status) { return _TyStatus_IS_ERROR(status); } -int PyStatus_IsExit(PyStatus status) +int PyStatus_IsExit(TyStatus status) { return _TyStatus_IS_EXIT(status); } -int PyStatus_Exception(PyStatus status) +int PyStatus_Exception(TyStatus status) { return _TyStatus_EXCEPTION(status); } void -_TyErr_SetFromPyStatus(PyStatus status) +_TyErr_SetFromPyStatus(TyStatus status) { if (!_TyStatus_IS_ERROR(status)) { TyErr_Format(TyExc_SystemError, @@ -728,7 +728,7 @@ _TyWideStringList_Copy(PyWideStringList *list, const PyWideStringList *list2) return _TyWideStringList_CopyEx(list, list2, false); } -PyStatus +TyStatus PyWideStringList_Insert(PyWideStringList *list, Ty_ssize_t index, const wchar_t *item) { @@ -769,18 +769,18 @@ PyWideStringList_Insert(PyWideStringList *list, } -PyStatus +TyStatus PyWideStringList_Append(PyWideStringList *list, const wchar_t *item) { return PyWideStringList_Insert(list, list->length, item); } -PyStatus +TyStatus _TyWideStringList_Extend(PyWideStringList *list, const PyWideStringList *list2) { for (Ty_ssize_t i = 0; i < list2->length; i++) { - PyStatus status = PyWideStringList_Append(list, list2->items[i]); + TyStatus status = PyWideStringList_Append(list, list2->items[i]); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -1142,10 +1142,10 @@ PyConfig_InitIsolatedConfig(PyConfig *config) /* Copy str into *config_str (duplicate the string) */ -PyStatus +TyStatus PyConfig_SetString(PyConfig *config, wchar_t **config_str, const wchar_t *str) { - PyStatus status = _Ty_PreInitializeFromConfig(config, NULL); + TyStatus status = _Ty_PreInitializeFromConfig(config, NULL); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -1166,11 +1166,11 @@ PyConfig_SetString(PyConfig *config, wchar_t **config_str, const wchar_t *str) } -static PyStatus +static TyStatus config_set_bytes_string(PyConfig *config, wchar_t **config_str, const char *str, const char *decode_err_msg) { - PyStatus status = _Ty_PreInitializeFromConfig(config, NULL); + TyStatus status = _Ty_PreInitializeFromConfig(config, NULL); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -1204,7 +1204,7 @@ config_set_bytes_string(PyConfig *config, wchar_t **config_str, /* Decode str using Ty_DecodeLocale() and set the result into *config_str. Pre-initialize Python if needed to ensure that encodings are properly configured. */ -PyStatus +TyStatus PyConfig_SetBytesString(PyConfig *config, wchar_t **config_str, const char *str) { @@ -1226,12 +1226,12 @@ preconfig_get_spec_member(const PyPreConfig *preconfig, const PyConfigSpec *spec } -PyStatus +TyStatus _TyConfig_Copy(PyConfig *config, const PyConfig *config2) { PyConfig_Clear(config); - PyStatus status; + TyStatus status; const PyConfigSpec *spec = PYCONFIG_SPEC; for (; spec->name != NULL; spec++) { void *member = config_get_spec_member(config, spec); @@ -1364,7 +1364,7 @@ config_dict_get_wstr(TyObject *dict, const char *name, PyConfig *config, return -1; } - PyStatus status; + TyStatus status; if (item == Ty_None) { status = PyConfig_SetString(config, result, NULL); } @@ -1426,7 +1426,7 @@ config_dict_get_wstrlist(TyObject *dict, const char *name, PyConfig *config, if (wstr == NULL) { goto error; } - PyStatus status = PyWideStringList_Append(&wstrlist, wstr); + TyStatus status = PyWideStringList_Append(&wstrlist, wstr); TyMem_Free(wstr); if (_TyStatus_EXCEPTION(status)) { TyErr_NoMemory(); @@ -1486,7 +1486,7 @@ config_dict_get_xoptions(TyObject *dict, const char *name, PyConfig *config, goto error; } - PyStatus status = PyWideStringList_Append(&wstrlist, wstr); + TyStatus status = PyWideStringList_Append(&wstrlist, wstr); TyMem_Free(wstr); if (_TyStatus_EXCEPTION(status)) { TyErr_NoMemory(); @@ -1615,7 +1615,7 @@ config_get_env(const PyConfig *config, const char *name) /* Get a copy of the environment variable as wchar_t*. Return 0 on success, but *dest can be NULL. Return -1 on memory allocation failure. Return -2 on decoding error. */ -static PyStatus +static TyStatus config_get_env_dup(PyConfig *config, wchar_t **dest, wchar_t *wname, char *name, @@ -1759,7 +1759,7 @@ config_get_xoption_value(const PyConfig *config, wchar_t *name) } -static PyStatus +static TyStatus config_init_hash_seed(PyConfig *config) { static_assert(sizeof(_Ty_HashSecret_t) == sizeof(_Ty_HashSecret.uc), @@ -1810,7 +1810,7 @@ config_wstr_to_int(const wchar_t *wstr, int *result) return 0; } -static PyStatus +static TyStatus config_read_gil(PyConfig *config, size_t len, wchar_t first_char) { if (len == 1 && first_char == L'0') { @@ -1833,10 +1833,10 @@ config_read_gil(PyConfig *config, size_t len, wchar_t first_char) return _TyStatus_OK(); } -static PyStatus +static TyStatus config_read_env_vars(PyConfig *config) { - PyStatus status; + TyStatus status; int use_env = config->use_environment; /* Get environment variables */ @@ -1922,7 +1922,7 @@ config_read_env_vars(PyConfig *config) return _TyStatus_OK(); } -static PyStatus +static TyStatus config_init_cpu_count(PyConfig *config) { const char *env = config_get_env(config, "PYTHON_CPU_COUNT"); @@ -1961,7 +1961,7 @@ error: "n must be greater than 0"); } -static PyStatus +static TyStatus config_init_thread_inherit_context(PyConfig *config) { const char *env = config_get_env(config, "PYTHON_THREAD_INHERIT_CONTEXT"); @@ -1987,7 +1987,7 @@ config_init_thread_inherit_context(PyConfig *config) return _TyStatus_OK(); } -static PyStatus +static TyStatus config_init_context_aware_warnings(PyConfig *config) { const char *env = config_get_env(config, "PYTHON_CONTEXT_AWARE_WARNINGS"); @@ -2013,7 +2013,7 @@ config_init_context_aware_warnings(PyConfig *config) return _TyStatus_OK(); } -static PyStatus +static TyStatus config_init_tlbc(PyConfig *config) { #ifdef Ty_GIL_DISABLED @@ -2043,7 +2043,7 @@ config_init_tlbc(PyConfig *config) #endif } -static PyStatus +static TyStatus config_init_perf_profiling(PyConfig *config) { int active = 0; @@ -2078,7 +2078,7 @@ config_init_perf_profiling(PyConfig *config) } -static PyStatus +static TyStatus config_init_remote_debug(PyConfig *config) { #ifndef Ty_REMOTE_DEBUG @@ -2100,7 +2100,7 @@ config_init_remote_debug(PyConfig *config) } -static PyStatus +static TyStatus config_init_tracemalloc(PyConfig *config) { int nframe; @@ -2144,7 +2144,7 @@ config_init_tracemalloc(PyConfig *config) return _TyStatus_OK(); } -static PyStatus +static TyStatus config_init_int_max_str_digits(PyConfig *config) { int maxdigits; @@ -2191,7 +2191,7 @@ config_init_int_max_str_digits(PyConfig *config) return _TyStatus_OK(); } -static PyStatus +static TyStatus config_init_pycache_prefix(PyConfig *config) { assert(config->pycache_prefix == NULL); @@ -2220,7 +2220,7 @@ config_init_pycache_prefix(PyConfig *config) #ifdef Ty_DEBUG -static PyStatus +static TyStatus config_init_run_presite(PyConfig *config) { assert(config->run_presite == NULL); @@ -2248,7 +2248,7 @@ config_init_run_presite(PyConfig *config) } #endif -static PyStatus +static TyStatus config_init_import_time(PyConfig *config) { int importtime = 0; @@ -2281,7 +2281,7 @@ config_init_import_time(PyConfig *config) return _TyStatus_OK(); } -static PyStatus +static TyStatus config_read_complex_options(PyConfig *config) { /* More complex options configured by env var and -X option */ @@ -2296,7 +2296,7 @@ config_read_complex_options(PyConfig *config) config->code_debug_ranges = 0; } - PyStatus status; + TyStatus status; if (config->import_time < 0) { status = config_init_import_time(config); if (_TyStatus_EXCEPTION(status)) { @@ -2407,7 +2407,7 @@ config_get_stdio_errors(const PyPreConfig *preconfig) // See also config_get_fs_encoding() -static PyStatus +static TyStatus config_get_locale_encoding(PyConfig *config, const PyPreConfig *preconfig, wchar_t **locale_encoding) { @@ -2421,17 +2421,17 @@ config_get_locale_encoding(PyConfig *config, const PyPreConfig *preconfig, if (encoding == NULL) { return _TyStatus_NO_MEMORY(); } - PyStatus status = PyConfig_SetString(config, locale_encoding, encoding); + TyStatus status = PyConfig_SetString(config, locale_encoding, encoding); TyMem_RawFree(encoding); return status; } -static PyStatus +static TyStatus config_init_stdio_encoding(PyConfig *config, const PyPreConfig *preconfig) { - PyStatus status; + TyStatus status; // Exit if encoding and errors are defined if (config->stdio_encoding != NULL && config->stdio_errors != NULL) { @@ -2512,7 +2512,7 @@ config_init_stdio_encoding(PyConfig *config, // See also config_get_locale_encoding() -static PyStatus +static TyStatus config_get_fs_encoding(PyConfig *config, const PyPreConfig *preconfig, wchar_t **fs_encoding) { @@ -2543,10 +2543,10 @@ config_get_fs_encoding(PyConfig *config, const PyPreConfig *preconfig, } -static PyStatus +static TyStatus config_init_fs_encoding(PyConfig *config, const PyPreConfig *preconfig) { - PyStatus status; + TyStatus status; if (config->filesystem_encoding == NULL) { status = config_get_fs_encoding(config, preconfig, @@ -2577,10 +2577,10 @@ config_init_fs_encoding(PyConfig *config, const PyPreConfig *preconfig) } -static PyStatus +static TyStatus config_init_import(PyConfig *config, int compute_path_config) { - PyStatus status; + TyStatus status; status = _TyConfig_InitPathConfig(config, compute_path_config); if (_TyStatus_EXCEPTION(status)) { @@ -2623,17 +2623,17 @@ config_init_import(PyConfig *config, int compute_path_config) return _TyStatus_OK(); } -PyStatus +TyStatus _TyConfig_InitImportConfig(PyConfig *config) { return config_init_import(config, 1); } -static PyStatus +static TyStatus config_read(PyConfig *config, int compute_path_config) { - PyStatus status; + TyStatus status; const PyPreConfig *preconfig = &_PyRuntime.preconfig; if (config->use_environment) { @@ -2786,7 +2786,7 @@ config_init_stdio(const PyConfig *config) - set Ty_xxx global configuration variables - initialize C standard streams (stdin, stdout, stderr) */ -PyStatus +TyStatus _TyConfig_Write(const PyConfig *config, _PyRuntimeState *runtime) { config_set_global_vars(config); @@ -2856,11 +2856,11 @@ config_complete_usage(const wchar_t* program) /* Parse the command line arguments */ -static PyStatus +static TyStatus config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions, Ty_ssize_t *opt_index) { - PyStatus status; + TyStatus status; const PyWideStringList *argv = &config->argv; int print_version = 0; const wchar_t* program = config->program_name; @@ -3066,10 +3066,10 @@ config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions, #endif /* Get warning options from PYTHONWARNINGS environment variable. */ -static PyStatus +static TyStatus config_init_env_warnoptions(PyConfig *config, PyWideStringList *warnoptions) { - PyStatus status; + TyStatus status; /* CONFIG_GET_ENV_DUP requires dest to be initialized to NULL */ wchar_t *env = NULL; status = CONFIG_GET_ENV_DUP(config, &env, @@ -3100,7 +3100,7 @@ config_init_env_warnoptions(PyConfig *config, PyWideStringList *warnoptions) } -static PyStatus +static TyStatus warnoptions_append(PyConfig *config, PyWideStringList *options, const wchar_t *option) { @@ -3120,7 +3120,7 @@ warnoptions_append(PyConfig *config, PyWideStringList *options, } -static PyStatus +static TyStatus warnoptions_extend(PyConfig *config, PyWideStringList *options, const PyWideStringList *options2) { @@ -3128,7 +3128,7 @@ warnoptions_extend(PyConfig *config, PyWideStringList *options, wchar_t *const *items = options2->items; for (Ty_ssize_t i = 0; i < len; i++) { - PyStatus status = warnoptions_append(config, options, items[i]); + TyStatus status = warnoptions_append(config, options, items[i]); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -3137,13 +3137,13 @@ warnoptions_extend(PyConfig *config, PyWideStringList *options, } -static PyStatus +static TyStatus config_init_warnoptions(PyConfig *config, const PyWideStringList *cmdline_warnoptions, const PyWideStringList *env_warnoptions, const PyWideStringList *sys_warnoptions) { - PyStatus status; + TyStatus status; PyWideStringList options = _TyWideStringList_INIT; /* Priority of warnings options, lowest to highest: @@ -3219,7 +3219,7 @@ error: } -static PyStatus +static TyStatus config_update_argv(PyConfig *config, Ty_ssize_t opt_index) { const PyWideStringList *cmdline_argv = &config->argv; @@ -3228,7 +3228,7 @@ config_update_argv(PyConfig *config, Ty_ssize_t opt_index) /* Copy argv to be able to modify it (to force -c/-m) */ if (cmdline_argv->length <= opt_index) { /* Ensure at least one (empty) argument is seen */ - PyStatus status = PyWideStringList_Append(&config_argv, L""); + TyStatus status = PyWideStringList_Append(&config_argv, L""); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -3270,10 +3270,10 @@ config_update_argv(PyConfig *config, Ty_ssize_t opt_index) } -static PyStatus +static TyStatus core_read_precmdline(PyConfig *config, _PyPreCmdline *precmdline) { - PyStatus status; + TyStatus status; if (config->parse_argv == 1) { if (_TyWideStringList_Copy(&precmdline->argv, &config->argv) < 0) { @@ -3304,7 +3304,7 @@ core_read_precmdline(PyConfig *config, _PyPreCmdline *precmdline) /* Get run_filename absolute path */ -static PyStatus +static TyStatus config_run_filename_abspath(PyConfig *config) { if (!config->run_filename) { @@ -3334,10 +3334,10 @@ config_run_filename_abspath(PyConfig *config) } -static PyStatus +static TyStatus config_read_cmdline(PyConfig *config) { - PyStatus status; + TyStatus status; PyWideStringList cmdline_warnoptions = _TyWideStringList_INIT; PyWideStringList env_warnoptions = _TyWideStringList_INIT; PyWideStringList sys_warnoptions = _TyWideStringList_INIT; @@ -3401,10 +3401,10 @@ done: } -PyStatus +TyStatus _TyConfig_SetPyArgv(PyConfig *config, const _PyArgv *args) { - PyStatus status = _Ty_PreInitializeFromConfig(config, args); + TyStatus status = _Ty_PreInitializeFromConfig(config, args); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -3415,7 +3415,7 @@ _TyConfig_SetPyArgv(PyConfig *config, const _PyArgv *args) /* Set config.argv: decode argv using Ty_DecodeLocale(). Pre-initialize Python if needed to ensure that encodings are properly configured. */ -PyStatus +TyStatus PyConfig_SetBytesArgv(PyConfig *config, Ty_ssize_t argc, char * const *argv) { _PyArgv args = { @@ -3427,7 +3427,7 @@ PyConfig_SetBytesArgv(PyConfig *config, Ty_ssize_t argc, char * const *argv) } -PyStatus +TyStatus PyConfig_SetArgv(PyConfig *config, Ty_ssize_t argc, wchar_t * const *argv) { _PyArgv args = { @@ -3439,11 +3439,11 @@ PyConfig_SetArgv(PyConfig *config, Ty_ssize_t argc, wchar_t * const *argv) } -PyStatus +TyStatus PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list, Ty_ssize_t length, wchar_t **items) { - PyStatus status = _Ty_PreInitializeFromConfig(config, NULL); + TyStatus status = _Ty_PreInitializeFromConfig(config, NULL); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -3463,10 +3463,10 @@ PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list, * Ty_xxx global configuration variables The only side effects are to modify config and to call _Ty_SetArgcArgv(). */ -PyStatus +TyStatus _TyConfig_Read(PyConfig *config, int compute_path_config) { - PyStatus status; + TyStatus status; status = _Ty_PreInitializeFromConfig(config, NULL); if (_TyStatus_EXCEPTION(status)) { @@ -3523,7 +3523,7 @@ done: } -PyStatus +TyStatus PyConfig_Read(PyConfig *config) { return _TyConfig_Read(config, 0); @@ -3617,7 +3617,7 @@ init_dump_ascii_wstr(const wchar_t *str) /* Dump the Python path configuration into sys.stderr */ void -_Ty_DumpPathConfig(PyThreadState *tstate) +_Ty_DumpPathConfig(TyThreadState *tstate) { TyObject *exc = _TyErr_GetRaisedException(tstate); @@ -3694,7 +3694,7 @@ struct PyInitConfig { PyConfig config; struct _inittab *inittab; Ty_ssize_t inittab_size; - PyStatus status; + TyStatus status; char *err_msg; }; diff --git a/Python/instrumentation.c b/Python/instrumentation.c index aa3b96b..3b46173 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -970,7 +970,7 @@ remove_per_instruction_tools(PyCodeObject * code, int offset, int tools) /* Return 1 if DISABLE returned, -1 if error, 0 otherwise */ static int call_one_instrument( - PyInterpreterState *interp, PyThreadState *tstate, TyObject **args, + PyInterpreterState *interp, TyThreadState *tstate, TyObject **args, size_t nargsf, int8_t tool, int event) { assert(0 <= tool && tool < 8); @@ -1016,7 +1016,7 @@ global_version(PyInterpreterState *interp) uint32_t version = (uint32_t)_Ty_atomic_load_uintptr_relaxed( &interp->ceval.instrumentation_version); #ifdef Ty_DEBUG - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); uint32_t thread_version = (uint32_t)(_Ty_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & ~_PY_EVAL_EVENTS_MASK); @@ -1038,7 +1038,7 @@ set_version_raw(uintptr_t *ptr, uint32_t version) } static void -set_global_version(PyThreadState *tstate, uint32_t version) +set_global_version(TyThreadState *tstate, uint32_t version) { assert((version & _PY_EVAL_EVENTS_MASK) == 0); PyInterpreterState *interp = tstate->interp; @@ -1138,7 +1138,7 @@ static const char *const event_names [] = { static int call_instrumentation_vector( - _Ty_CODEUNIT *instr, PyThreadState *tstate, int event, + _Ty_CODEUNIT *instr, TyThreadState *tstate, int event, _PyInterpreterFrame *frame, _Ty_CODEUNIT *arg2, Ty_ssize_t nargs, TyObject *args[]) { if (tstate->tracing) { @@ -1202,7 +1202,7 @@ call_instrumentation_vector( Ty_NO_INLINE int _Ty_call_instrumentation( - PyThreadState *tstate, int event, + TyThreadState *tstate, int event, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr) { TyObject *args[3] = { NULL, NULL, NULL }; @@ -1211,7 +1211,7 @@ _Ty_call_instrumentation( Ty_NO_INLINE int _Ty_call_instrumentation_arg( - PyThreadState *tstate, int event, + TyThreadState *tstate, int event, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *arg) { TyObject *args[4] = { NULL, NULL, NULL, arg }; @@ -1220,7 +1220,7 @@ _Ty_call_instrumentation_arg( Ty_NO_INLINE int _Ty_call_instrumentation_2args( - PyThreadState *tstate, int event, + TyThreadState *tstate, int event, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *arg0, TyObject *arg1) { TyObject *args[5] = { NULL, NULL, NULL, arg0, arg1 }; @@ -1229,7 +1229,7 @@ _Ty_call_instrumentation_2args( Ty_NO_INLINE _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) { assert(event == PY_MONITORING_EVENT_JUMP || @@ -1256,7 +1256,7 @@ _Ty_call_instrumentation_jump( static void call_instrumentation_vector_protected( - PyThreadState *tstate, int event, + TyThreadState *tstate, int event, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, Ty_ssize_t nargs, TyObject *args[]) { assert(_TyErr_Occurred(tstate)); @@ -1273,7 +1273,7 @@ call_instrumentation_vector_protected( Ty_NO_INLINE void _Ty_call_instrumentation_exc2( - PyThreadState *tstate, int event, + TyThreadState *tstate, int event, _PyInterpreterFrame *frame, _Ty_CODEUNIT *instr, TyObject *arg0, TyObject *arg1) { assert(_TyErr_Occurred(tstate)); @@ -1295,7 +1295,7 @@ _Ty_Instrumentation_GetLine(PyCodeObject *code, int index) } Ty_NO_INLINE int -_Ty_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame, _Ty_CODEUNIT *instr, _Ty_CODEUNIT *prev) +_Ty_call_instrumentation_line(TyThreadState *tstate, _PyInterpreterFrame* frame, _Ty_CODEUNIT *instr, _Ty_CODEUNIT *prev) { PyCodeObject *code = _TyFrame_GetCode(frame); assert(tstate->tracing == 0); @@ -1397,7 +1397,7 @@ done: } Ty_NO_INLINE int -_Ty_call_instrumentation_instruction(PyThreadState *tstate, _PyInterpreterFrame* frame, _Ty_CODEUNIT *instr) +_Ty_call_instrumentation_instruction(TyThreadState *tstate, _PyInterpreterFrame* frame, _Ty_CODEUNIT *instr) { PyCodeObject *code = _TyFrame_GetCode(frame); int offset = (int)(instr - _TyFrame_GetBytecode(frame)); @@ -1941,7 +1941,7 @@ instrument_all_executing_code_objects(PyInterpreterState *interp) { _PyRuntimeState *runtime = &_PyRuntime; HEAD_LOCK(runtime); - PyThreadState* ts = TyInterpreterState_ThreadHead(interp); + TyThreadState* ts = TyInterpreterState_ThreadHead(interp); HEAD_UNLOCK(runtime); while (ts) { _PyInterpreterFrame *frame = ts->current_frame; @@ -2004,7 +2004,7 @@ int _PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events) { assert(0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); PyInterpreterState *interp = tstate->interp; assert(events < (1 << _PY_MONITORING_UNGROUPED_EVENTS)); if (check_tool(interp, tool_id)) { @@ -2443,7 +2443,7 @@ monitoring_restart_events_impl(TyObject *module) * last restart version > instrumented version for all code objects * last restart version < current version */ - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); PyInterpreterState *interp = tstate->interp; _TyEval_StopTheWorld(interp); @@ -2588,7 +2588,7 @@ static int capi_call_instrumentation(PyMonitoringState *state, TyObject *codelike, int32_t offset, TyObject **args, Ty_ssize_t nargs, int event) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); PyInterpreterState *interp = tstate->interp; uint8_t tools = state->active; diff --git a/Python/intrinsics.c b/Python/intrinsics.c index 6157a19..b828e99 100644 --- a/Python/intrinsics.c +++ b/Python/intrinsics.c @@ -18,14 +18,14 @@ /******** Unary functions ********/ static TyObject * -no_intrinsic1(PyThreadState* tstate, TyObject *unused) +no_intrinsic1(TyThreadState* tstate, TyObject *unused) { _TyErr_SetString(tstate, TyExc_SystemError, "invalid intrinsic function"); return NULL; } static TyObject * -print_expr(PyThreadState* Py_UNUSED(ignored), TyObject *value) +print_expr(TyThreadState* Py_UNUSED(ignored), TyObject *value) { TyObject *hook = _TySys_GetRequiredAttr(&_Ty_ID(displayhook)); if (hook == NULL) { @@ -37,7 +37,7 @@ print_expr(PyThreadState* Py_UNUSED(ignored), TyObject *value) } static int -import_all_from(PyThreadState *tstate, TyObject *locals, TyObject *v) +import_all_from(TyThreadState *tstate, TyObject *locals, TyObject *v) { TyObject *all, *dict, *name, *value; int skip_leading_underscores = 0; @@ -121,7 +121,7 @@ import_all_from(PyThreadState *tstate, TyObject *locals, TyObject *v) } static TyObject * -import_star(PyThreadState* tstate, TyObject *from) +import_star(TyThreadState* tstate, TyObject *from) { _PyInterpreterFrame *frame = tstate->current_frame; @@ -140,7 +140,7 @@ import_star(PyThreadState* tstate, TyObject *from) } static TyObject * -stopiteration_error(PyThreadState* tstate, TyObject *exc) +stopiteration_error(TyThreadState* tstate, TyObject *exc) { _PyInterpreterFrame *frame = tstate->current_frame; assert(frame->owner == FRAME_OWNED_BY_GENERATOR); @@ -184,20 +184,20 @@ stopiteration_error(PyThreadState* tstate, TyObject *exc) } static TyObject * -unary_pos(PyThreadState* unused, TyObject *value) +unary_pos(TyThreadState* unused, TyObject *value) { return PyNumber_Positive(value); } static TyObject * -list_to_tuple(PyThreadState* unused, TyObject *v) +list_to_tuple(TyThreadState* unused, TyObject *v) { assert(TyList_Check(v)); return _TyTuple_FromArray(((PyListObject *)v)->ob_item, Ty_SIZE(v)); } static TyObject * -make_typevar(PyThreadState* Py_UNUSED(ignored), TyObject *v) +make_typevar(TyThreadState* Py_UNUSED(ignored), TyObject *v) { assert(TyUnicode_Check(v)); return _Ty_make_typevar(v, NULL, NULL); @@ -227,21 +227,21 @@ _PyIntrinsics_UnaryFunctions[] = { /******** Binary functions ********/ static TyObject * -no_intrinsic2(PyThreadState* tstate, TyObject *unused1, TyObject *unused2) +no_intrinsic2(TyThreadState* tstate, TyObject *unused1, TyObject *unused2) { _TyErr_SetString(tstate, TyExc_SystemError, "invalid intrinsic function"); return NULL; } static TyObject * -prep_reraise_star(PyThreadState* unused, TyObject *orig, TyObject *excs) +prep_reraise_star(TyThreadState* unused, TyObject *orig, TyObject *excs) { assert(TyList_Check(excs)); return _PyExc_PrepReraiseStar(orig, excs); } static TyObject * -make_typevar_with_bound(PyThreadState* Py_UNUSED(ignored), TyObject *name, +make_typevar_with_bound(TyThreadState* Py_UNUSED(ignored), TyObject *name, TyObject *evaluate_bound) { assert(TyUnicode_Check(name)); @@ -249,7 +249,7 @@ make_typevar_with_bound(PyThreadState* Py_UNUSED(ignored), TyObject *name, } static TyObject * -make_typevar_with_constraints(PyThreadState* Py_UNUSED(ignored), TyObject *name, +make_typevar_with_constraints(TyThreadState* Py_UNUSED(ignored), TyObject *name, TyObject *evaluate_constraints) { assert(TyUnicode_Check(name)); diff --git a/Python/legacy_tracing.c b/Python/legacy_tracing.c index 6417b6c..413aac1 100644 --- a/Python/legacy_tracing.c +++ b/Python/legacy_tracing.c @@ -37,7 +37,7 @@ typedef struct _PyLegacyEventHandler { static TyObject * call_profile_func(_PyLegacyEventHandler *self, TyObject *arg) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate->c_profilefunc == NULL) { Py_RETURN_NONE; } @@ -164,7 +164,7 @@ _TyEval_SetOpcodeTrace( static TyObject * call_trace_func(_PyLegacyEventHandler *self, TyObject *arg) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate->c_tracefunc == NULL) { Py_RETURN_NONE; } @@ -288,7 +288,7 @@ sys_trace_instruction_func( "Missing frame when calling trace function."); return NULL; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!tstate->c_tracefunc || !frame->f_trace_opcodes) { if (_TyEval_SetOpcodeTrace(frame, false) != 0) { return NULL; @@ -307,7 +307,7 @@ sys_trace_instruction_func( static TyObject * trace_line( - PyThreadState *tstate, _PyLegacyEventHandler *self, + TyThreadState *tstate, _PyLegacyEventHandler *self, PyFrameObject *frame, int line ) { if (!frame->f_trace_lines) { @@ -334,7 +334,7 @@ sys_trace_line_func( ) { _PyLegacyEventHandler *self = _PyLegacyEventHandler_CAST(callable); assert(kwnames == NULL); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate->c_tracefunc == NULL) { Py_RETURN_NONE; } @@ -361,7 +361,7 @@ sys_trace_jump_func( ) { _PyLegacyEventHandler *self = _PyLegacyEventHandler_CAST(callable); assert(kwnames == NULL); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate->c_tracefunc == NULL) { Py_RETURN_NONE; } @@ -430,7 +430,7 @@ set_callbacks(int tool, vectorcallfunc vectorcall, int legacy_event, int event1, when a thread continues to run after Python finalization, especially daemon threads. */ static int -is_tstate_valid(PyThreadState *tstate) +is_tstate_valid(TyThreadState *tstate) { assert(!_TyMem_IsPtrFreed(tstate)); assert(!_TyMem_IsPtrFreed(tstate->interp)); @@ -439,7 +439,7 @@ is_tstate_valid(PyThreadState *tstate) #endif static Ty_ssize_t -setup_profile(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg, TyObject **old_profileobj) +setup_profile(TyThreadState *tstate, Ty_tracefunc func, TyObject *arg, TyObject **old_profileobj) { *old_profileobj = NULL; /* Setup PEP 669 monitoring callbacks and events. */ @@ -494,7 +494,7 @@ setup_profile(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg, TyObject } int -_TyEval_SetProfile(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg) +_TyEval_SetProfile(TyThreadState *tstate, Ty_tracefunc func, TyObject *arg) { assert(is_tstate_valid(tstate)); /* The caller must hold a thread state */ @@ -502,7 +502,7 @@ _TyEval_SetProfile(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg) /* Call _TySys_Audit() in the context of the current thread state, even if tstate is not the current thread state. */ - PyThreadState *current_tstate = _TyThreadState_GET(); + TyThreadState *current_tstate = _TyThreadState_GET(); if (_TySys_Audit(current_tstate, "sys.setprofile", NULL) < 0) { return -1; } @@ -526,7 +526,7 @@ _TyEval_SetProfile(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg) } static Ty_ssize_t -setup_tracing(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg, TyObject **old_traceobj) +setup_tracing(TyThreadState *tstate, Ty_tracefunc func, TyObject *arg, TyObject **old_traceobj) { *old_traceobj = NULL; /* Setup PEP 669 monitoring callbacks and events. */ @@ -591,7 +591,7 @@ setup_tracing(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg, TyObject } int -_TyEval_SetTrace(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg) +_TyEval_SetTrace(TyThreadState *tstate, Ty_tracefunc func, TyObject *arg) { assert(is_tstate_valid(tstate)); /* The caller must hold a thread state */ @@ -599,7 +599,7 @@ _TyEval_SetTrace(PyThreadState *tstate, Ty_tracefunc func, TyObject *arg) /* Call _TySys_Audit() in the context of the current thread state, even if tstate is not the current thread state. */ - PyThreadState *current_tstate = _TyThreadState_GET(); + TyThreadState *current_tstate = _TyThreadState_GET(); if (_TySys_Audit(current_tstate, "sys.settrace", NULL) < 0) { return -1; } diff --git a/Python/optimizer.c b/Python/optimizer.c index eddf12c..c53c0c3 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -219,7 +219,7 @@ _Ty_ClearExecutorDeletionList(PyInterpreterState *interp) { _PyRuntimeState *runtime = &_PyRuntime; HEAD_LOCK(runtime); - PyThreadState* ts = TyInterpreterState_ThreadHead(interp); + TyThreadState* ts = TyInterpreterState_ThreadHead(interp); HEAD_UNLOCK(runtime); while (ts) { _PyExecutorObject *current = (_PyExecutorObject *)ts->current_executor; diff --git a/Python/parking_lot.c b/Python/parking_lot.c index 58a32f5..951ebd0 100644 --- a/Python/parking_lot.c +++ b/Python/parking_lot.c @@ -228,7 +228,7 @@ _PySemaphore_PlatformWait(_PySemaphore *sema, PyTime_t timeout) int _PySemaphore_Wait(_PySemaphore *sema, PyTime_t timeout, int detach) { - PyThreadState *tstate = NULL; + TyThreadState *tstate = NULL; if (detach) { tstate = _TyThreadState_GET(); if (tstate && _TyThreadState_IsAttached(tstate)) { diff --git a/Python/pathconfig.c b/Python/pathconfig.c index b94b64c..5821cda 100644 --- a/Python/pathconfig.c +++ b/Python/pathconfig.c @@ -73,10 +73,10 @@ _TyPathConfig_ClearGlobal(void) #undef CLEAR } -PyStatus +TyStatus _TyPathConfig_ReadGlobal(PyConfig *config) { - PyStatus status = _TyStatus_OK(); + TyStatus status = _TyStatus_OK(); #define COPY(ATTR) \ do { \ @@ -118,7 +118,7 @@ done: return status; } -PyStatus +TyStatus _TyPathConfig_UpdateGlobal(const PyConfig *config) { #define COPY(ATTR) \ diff --git a/Python/perf_trampoline.c b/Python/perf_trampoline.c index 19c1bf3..3df14a0 100644 --- a/Python/perf_trampoline.c +++ b/Python/perf_trampoline.c @@ -168,9 +168,9 @@ static void invalidate_icache(char* begin, char*end) { * are passed in the same order as the function requires. This results in * shorter, more efficient ASM code for trampoline. */ -typedef TyObject *(*py_evaluator)(PyThreadState *, _PyInterpreterFrame *, +typedef TyObject *(*py_evaluator)(TyThreadState *, _PyInterpreterFrame *, int throwflag); -typedef TyObject *(*py_trampoline)(PyThreadState *, _PyInterpreterFrame *, int, +typedef TyObject *(*py_trampoline)(TyThreadState *, _PyInterpreterFrame *, int, py_evaluator); extern void *_Ty_trampoline_func_start; // Start of the template of the @@ -383,7 +383,7 @@ compile_trampoline(void) } static TyObject * -py_trampoline_evaluator(PyThreadState *ts, _PyInterpreterFrame *frame, +py_trampoline_evaluator(TyThreadState *ts, _PyInterpreterFrame *frame, int throw) { if (perf_status == PERF_STATUS_FAILED || @@ -439,7 +439,7 @@ int _PyIsPerfTrampolineActive(void) { #ifdef PY_HAVE_PERF_TRAMPOLINE - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return tstate->interp->eval_frame == py_trampoline_evaluator; #endif return 0; @@ -481,7 +481,7 @@ int _PyPerfTrampoline_Init(int activate) { #ifdef PY_HAVE_PERF_TRAMPOLINE - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate->interp->eval_frame && tstate->interp->eval_frame != py_trampoline_evaluator) { TyErr_SetString(TyExc_RuntimeError, @@ -518,7 +518,7 @@ _PyPerfTrampoline_Fini(void) if (perf_status != PERF_STATUS_OK) { return 0; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate->interp->eval_frame == py_trampoline_evaluator) { _TyInterpreterState_SetEvalFrameFunc(tstate->interp, NULL); } @@ -548,7 +548,7 @@ PyUnstable_PerfTrampoline_SetPersistAfterFork(int enable){ return 0; } -PyStatus +TyStatus _PyPerfTrampoline_AfterFork_Child(void) { #ifdef PY_HAVE_PERF_TRAMPOLINE diff --git a/Python/preconfig.c b/Python/preconfig.c index 2766db2..df6a1ee 100644 --- a/Python/preconfig.c +++ b/Python/preconfig.c @@ -75,7 +75,7 @@ _Ty_COMP_DIAG_POP /* --- _PyArgv ---------------------------------------------------- */ /* Decode bytes_argv using Ty_DecodeLocale() */ -PyStatus +TyStatus _PyArgv_AsWstrList(const _PyArgv *args, PyWideStringList *list) { PyWideStringList wargv = _TyWideStringList_INIT; @@ -121,7 +121,7 @@ _PyPreCmdline_Clear(_PyPreCmdline *cmdline) } -PyStatus +TyStatus _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline, const _PyArgv *args) { return _PyArgv_AsWstrList(args, &cmdline->argv); @@ -158,13 +158,13 @@ precmdline_set_preconfig(const _PyPreCmdline *cmdline, PyPreConfig *config) } -PyStatus +TyStatus _PyPreCmdline_SetConfig(const _PyPreCmdline *cmdline, PyConfig *config) { #define COPY_ATTR(ATTR) \ config->ATTR = cmdline->ATTR - PyStatus status = _TyWideStringList_Extend(&config->xoptions, &cmdline->xoptions); + TyStatus status = _TyWideStringList_Extend(&config->xoptions, &cmdline->xoptions); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -180,7 +180,7 @@ _PyPreCmdline_SetConfig(const _PyPreCmdline *cmdline, PyConfig *config) /* Parse the command line arguments */ -static PyStatus +static TyStatus precmdline_parse_cmdline(_PyPreCmdline *cmdline) { const PyWideStringList *argv = &cmdline->argv; @@ -208,7 +208,7 @@ precmdline_parse_cmdline(_PyPreCmdline *cmdline) case 'X': { - PyStatus status = TyWideStringList_Append(&cmdline->xoptions, + TyStatus status = TyWideStringList_Append(&cmdline->xoptions, _TyOS_optarg); if (_TyStatus_EXCEPTION(status)) { return status; @@ -227,13 +227,13 @@ precmdline_parse_cmdline(_PyPreCmdline *cmdline) } -PyStatus +TyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline, const PyPreConfig *preconfig) { precmdline_get_preconfig(cmdline, preconfig); if (preconfig->parse_argv) { - PyStatus status = precmdline_parse_cmdline(cmdline); + TyStatus status = precmdline_parse_cmdline(cmdline); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -346,7 +346,7 @@ TyPreConfig_InitIsolatedConfig(PyPreConfig *config) } -PyStatus +TyStatus _TyPreConfig_InitFromPreConfig(PyPreConfig *config, const PyPreConfig *config2) { @@ -599,7 +599,7 @@ _Ty_get_xoption(const PyWideStringList *xoptions, const wchar_t *name) } -static PyStatus +static TyStatus preconfig_init_utf8_mode(PyPreConfig *config, const _PyPreCmdline *cmdline) { #ifdef MS_WINDOWS @@ -717,7 +717,7 @@ preconfig_init_coerce_c_locale(PyPreConfig *config) } -static PyStatus +static TyStatus preconfig_init_allocator(PyPreConfig *config) { if (config->allocator == PYMEM_ALLOCATOR_NOT_SET) { @@ -742,10 +742,10 @@ preconfig_init_allocator(PyPreConfig *config) } -static PyStatus +static TyStatus preconfig_read(PyPreConfig *config, _PyPreCmdline *cmdline) { - PyStatus status; + TyStatus status; status = _PyPreCmdline_Read(cmdline, config); if (_TyStatus_EXCEPTION(status)) { @@ -794,10 +794,10 @@ preconfig_read(PyPreConfig *config, _PyPreCmdline *cmdline) - environment variables - Ty_xxx global configuration variables - the LC_CTYPE locale */ -PyStatus +TyStatus _TyPreConfig_Read(PyPreConfig *config, const _PyArgv *args) { - PyStatus status; + TyStatus status; status = _PyRuntime_Initialize(); if (_TyStatus_EXCEPTION(status)) { @@ -934,12 +934,12 @@ done: Do nothing if called after Ty_Initialize(): ignore the new pre-configuration. */ -PyStatus +TyStatus _TyPreConfig_Write(const PyPreConfig *src_config) { PyPreConfig config; - PyStatus status = _TyPreConfig_InitFromPreConfig(&config, src_config); + TyStatus status = _TyPreConfig_InitFromPreConfig(&config, src_config); if (_TyStatus_EXCEPTION(status)) { return status; } diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 8eed324..b57e088 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -86,17 +86,17 @@ /* Forward declarations */ -static PyStatus add_main_module(PyInterpreterState *interp); -static PyStatus init_import_site(void); -static PyStatus init_set_builtins_open(void); -static PyStatus init_sys_streams(PyThreadState *tstate); +static TyStatus add_main_module(PyInterpreterState *interp); +static TyStatus init_import_site(void); +static TyStatus init_set_builtins_open(void); +static TyStatus init_sys_streams(TyThreadState *tstate); #ifdef __ANDROID__ -static PyStatus init_android_streams(PyThreadState *tstate); +static TyStatus init_android_streams(TyThreadState *tstate); #endif #if defined(__APPLE__) && HAS_APPLE_SYSTEM_LOG -static PyStatus init_apple_streams(PyThreadState *tstate); +static TyStatus init_apple_streams(TyThreadState *tstate); #endif -static void wait_for_thread_shutdown(PyThreadState *tstate); +static void wait_for_thread_shutdown(TyThreadState *tstate); static void finalize_subinterpreters(void); static void call_ll_exitfuncs(_PyRuntimeState *runtime); @@ -117,7 +117,7 @@ _Ty_COMP_DIAG_POP static int runtime_initialized = 0; -PyStatus +TyStatus _PyRuntime_Initialize(void) { /* XXX We only initialize once in the process, which aligns with @@ -397,12 +397,12 @@ _Ty_SetLocaleFromEnv(int category) static int -interpreter_update_config(PyThreadState *tstate, int only_update_path_config) +interpreter_update_config(TyThreadState *tstate, int only_update_path_config) { const PyConfig *config = &tstate->interp->config; if (!only_update_path_config) { - PyStatus status = _TyConfig_Write(config, tstate->interp->runtime); + TyStatus status = _TyConfig_Write(config, tstate->interp->runtime); if (_TyStatus_EXCEPTION(status)) { _TyErr_SetFromPyStatus(status); return -1; @@ -410,7 +410,7 @@ interpreter_update_config(PyThreadState *tstate, int only_update_path_config) } if (_Ty_IsMainInterpreter(tstate->interp)) { - PyStatus status = _TyPathConfig_UpdateGlobal(config); + TyStatus status = _TyPathConfig_UpdateGlobal(config); if (_TyStatus_EXCEPTION(status)) { _TyErr_SetFromPyStatus(status); return -1; @@ -439,13 +439,13 @@ interpreter_update_config(PyThreadState *tstate, int only_update_path_config) */ -static PyStatus +static TyStatus pyinit_core_reconfigure(_PyRuntimeState *runtime, - PyThreadState **tstate_p, + TyThreadState **tstate_p, const PyConfig *config) { - PyStatus status; - PyThreadState *tstate = _TyThreadState_GET(); + TyStatus status; + TyThreadState *tstate = _TyThreadState_GET(); if (!tstate) { return _TyStatus_ERR("failed to read thread state"); } @@ -478,7 +478,7 @@ pyinit_core_reconfigure(_PyRuntimeState *runtime, } -static PyStatus +static TyStatus pycore_init_runtime(_PyRuntimeState *runtime, const PyConfig *config) { @@ -486,7 +486,7 @@ pycore_init_runtime(_PyRuntimeState *runtime, return _TyStatus_ERR("main interpreter already initialized"); } - PyStatus status = _TyConfig_Write(config, runtime); + TyStatus status = _TyConfig_Write(config, runtime); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -522,7 +522,7 @@ pycore_init_runtime(_PyRuntimeState *runtime, } -static PyStatus +static TyStatus init_interp_settings(PyInterpreterState *interp, const PyInterpreterConfig *config) { @@ -579,7 +579,7 @@ init_interp_settings(PyInterpreterState *interp, static void -init_interp_create_gil(PyThreadState *tstate, int gil) +init_interp_create_gil(TyThreadState *tstate, int gil) { /* finalize_interp_delete() comment explains why _TyEval_FiniGIL() is only called here. */ @@ -608,12 +608,12 @@ builtins_dict_watcher(TyDict_WatchEvent event, TyObject *dict, TyObject *key, Ty return 0; } -static PyStatus +static TyStatus pycore_create_interpreter(_PyRuntimeState *runtime, const PyConfig *src_config, - PyThreadState **tstate_p) + TyThreadState **tstate_p) { - PyStatus status; + TyStatus status; PyInterpreterState *interp; status = _TyInterpreterState_New(NULL, &interp); if (_TyStatus_EXCEPTION(status)) { @@ -664,7 +664,7 @@ pycore_create_interpreter(_PyRuntimeState *runtime, return status; } - PyThreadState *tstate = _TyThreadState_New(interp, + TyThreadState *tstate = _TyThreadState_New(interp, _TyThreadState_WHENCE_INIT); if (tstate == NULL) { return _TyStatus_ERR("can't make first thread"); @@ -679,10 +679,10 @@ pycore_create_interpreter(_PyRuntimeState *runtime, } -static PyStatus +static TyStatus pycore_init_global_objects(PyInterpreterState *interp) { - PyStatus status; + TyStatus status; _TyFloat_InitState(interp); @@ -701,10 +701,10 @@ pycore_init_global_objects(PyInterpreterState *interp) } -static PyStatus +static TyStatus pycore_init_types(PyInterpreterState *interp) { - PyStatus status; + TyStatus status; status = _PyTypes_InitTypes(interp); if (_TyStatus_EXCEPTION(status)) { @@ -768,8 +768,8 @@ pycore_init_types(PyInterpreterState *interp) return _TyStatus_OK(); } -static PyStatus -pycore_init_builtins(PyThreadState *tstate) +static TyStatus +pycore_init_builtins(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; @@ -856,15 +856,15 @@ error: } -static PyStatus -pycore_interp_init(PyThreadState *tstate) +static TyStatus +pycore_interp_init(TyThreadState *tstate) { _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; if (_tstate->c_stack_hard_limit == 0) { _Ty_InitializeRecursionLimits(tstate); } PyInterpreterState *interp = tstate->interp; - PyStatus status; + TyStatus status; TyObject *sysmod = NULL; // Create singletons before the first TyType_Ready() call, since @@ -934,17 +934,17 @@ done: } -static PyStatus +static TyStatus pyinit_config(_PyRuntimeState *runtime, - PyThreadState **tstate_p, + TyThreadState **tstate_p, const PyConfig *config) { - PyStatus status = pycore_init_runtime(runtime, config); + TyStatus status = pycore_init_runtime(runtime, config); if (_TyStatus_EXCEPTION(status)) { return status; } - PyThreadState *tstate; + TyThreadState *tstate; status = pycore_create_interpreter(runtime, config, &tstate); if (_TyStatus_EXCEPTION(status)) { return status; @@ -962,10 +962,10 @@ pyinit_config(_PyRuntimeState *runtime, } -PyStatus +TyStatus _Ty_PreInitializeFromPyArgv(const PyPreConfig *src_config, const _PyArgv *args) { - PyStatus status; + TyStatus status; if (src_config == NULL) { return _TyStatus_ERR("preinitialization config is NULL"); @@ -1009,7 +1009,7 @@ _Ty_PreInitializeFromPyArgv(const PyPreConfig *src_config, const _PyArgv *args) } -PyStatus +TyStatus Ty_PreInitializeFromBytesArgs(const PyPreConfig *src_config, Ty_ssize_t argc, char **argv) { _PyArgv args = {.use_bytes_argv = 1, .argc = argc, .bytes_argv = argv}; @@ -1017,7 +1017,7 @@ Ty_PreInitializeFromBytesArgs(const PyPreConfig *src_config, Ty_ssize_t argc, ch } -PyStatus +TyStatus Ty_PreInitializeFromArgs(const PyPreConfig *src_config, Ty_ssize_t argc, wchar_t **argv) { _PyArgv args = {.use_bytes_argv = 0, .argc = argc, .wchar_argv = argv}; @@ -1025,20 +1025,20 @@ Ty_PreInitializeFromArgs(const PyPreConfig *src_config, Ty_ssize_t argc, wchar_t } -PyStatus +TyStatus Ty_PreInitialize(const PyPreConfig *src_config) { return _Ty_PreInitializeFromPyArgv(src_config, NULL); } -PyStatus +TyStatus _Ty_PreInitializeFromConfig(const PyConfig *config, const _PyArgv *args) { assert(config != NULL); - PyStatus status = _PyRuntime_Initialize(); + TyStatus status = _PyRuntime_Initialize(); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -1086,12 +1086,12 @@ _Ty_PreInitializeFromConfig(const PyConfig *config, * to the Python C API (unless the API is explicitly listed as being * safe to call without calling Ty_Initialize first) */ -static PyStatus +static TyStatus pyinit_core(_PyRuntimeState *runtime, const PyConfig *src_config, - PyThreadState **tstate_p) + TyThreadState **tstate_p) { - PyStatus status; + TyStatus status; status = _Ty_PreInitializeFromConfig(src_config, NULL); if (_TyStatus_EXCEPTION(status)) { @@ -1132,8 +1132,8 @@ done: /* Ty_Initialize() has already been called: update the main interpreter configuration. Example of bpo-34008: Ty_Main() called after Ty_Initialize(). */ -static PyStatus -pyinit_main_reconfigure(PyThreadState *tstate) +static TyStatus +pyinit_main_reconfigure(TyThreadState *tstate) { if (interpreter_update_config(tstate, 0) < 0) { return _TyStatus_ERR("fail to reconfigure Python"); @@ -1144,7 +1144,7 @@ pyinit_main_reconfigure(PyThreadState *tstate) #ifdef Ty_DEBUG static void -run_presite(PyThreadState *tstate) +run_presite(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; const PyConfig *config = _TyInterpreterState_GetConfig(interp); @@ -1173,12 +1173,12 @@ run_presite(PyThreadState *tstate) #endif -static PyStatus -init_interp_main(PyThreadState *tstate) +static TyStatus +init_interp_main(TyThreadState *tstate) { assert(!_TyErr_Occurred(tstate)); - PyStatus status; + TyStatus status; int is_main_interp = _Ty_IsMainInterpreter(tstate->interp); PyInterpreterState *interp = tstate->interp; const PyConfig *config = _TyInterpreterState_GetConfig(interp); @@ -1398,8 +1398,8 @@ init_interp_main(PyThreadState *tstate) * Other errors should be reported as normal Python exceptions with a * non-zero return code. */ -static PyStatus -pyinit_main(PyThreadState *tstate) +static TyStatus +pyinit_main(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; if (!interp->runtime->core_initialized) { @@ -1410,7 +1410,7 @@ pyinit_main(PyThreadState *tstate) return pyinit_main_reconfigure(tstate); } - PyStatus status = init_interp_main(tstate); + TyStatus status = init_interp_main(tstate); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -1418,14 +1418,14 @@ pyinit_main(PyThreadState *tstate) } -PyStatus +TyStatus Ty_InitializeFromConfig(const PyConfig *config) { if (config == NULL) { return _TyStatus_ERR("initialization config is NULL"); } - PyStatus status; + TyStatus status; status = _PyRuntime_Initialize(); if (_TyStatus_EXCEPTION(status)) { @@ -1433,7 +1433,7 @@ Ty_InitializeFromConfig(const PyConfig *config) } _PyRuntimeState *runtime = &_PyRuntime; - PyThreadState *tstate = NULL; + TyThreadState *tstate = NULL; status = pyinit_core(runtime, config, &tstate); if (_TyStatus_EXCEPTION(status)) { return status; @@ -1454,7 +1454,7 @@ Ty_InitializeFromConfig(const PyConfig *config) void Ty_InitializeEx(int install_sigs) { - PyStatus status; + TyStatus status; status = _PyRuntime_Initialize(); if (_TyStatus_EXCEPTION(status)) { @@ -1487,7 +1487,7 @@ Ty_Initialize(void) static void -finalize_modules_delete_special(PyThreadState *tstate, int verbose) +finalize_modules_delete_special(TyThreadState *tstate, int verbose) { // List of names to clear in sys static const char * const sys_deletes[] = { @@ -1634,7 +1634,7 @@ finalize_clear_modules_dict(TyObject *modules) static void -finalize_restore_builtins(PyThreadState *tstate) +finalize_restore_builtins(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; TyObject *dict = TyDict_Copy(interp->builtins); @@ -1696,7 +1696,7 @@ finalize_clear_sys_builtins_dict(PyInterpreterState *interp, int verbose) /* Clear modules, as good as we can */ // XXX Move most of this to import.c. static void -finalize_modules(PyThreadState *tstate) +finalize_modules(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; @@ -1899,7 +1899,7 @@ finalize_interp_types(PyInterpreterState *interp) static void -finalize_interp_clear(PyThreadState *tstate) +finalize_interp_clear(TyThreadState *tstate) { int is_main_interp = _Ty_IsMainInterpreter(tstate->interp); @@ -1963,16 +1963,16 @@ finalize_interp_delete(PyInterpreterState *interp) there may be users relying on the unconstrained behavior. Thus, we do our best here to accommodate that possibility. */ -static PyThreadState * +static TyThreadState * resolve_final_tstate(_PyRuntimeState *runtime) { - PyThreadState *main_tstate = runtime->main_tstate; + TyThreadState *main_tstate = runtime->main_tstate; assert(main_tstate != NULL); assert(main_tstate->thread_id == runtime->main_thread); PyInterpreterState *main_interp = _TyInterpreterState_Main(); assert(main_tstate->interp == main_interp); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_Ty_IsMainThread()) { if (tstate != main_tstate) { /* This implies that Ty_Finalize() was called while @@ -2021,7 +2021,7 @@ _Ty_Finalize(_PyRuntimeState *runtime) } /* Get final thread state pointer. */ - PyThreadState *tstate = resolve_final_tstate(runtime); + TyThreadState *tstate = resolve_final_tstate(runtime); // Block some operations. tstate->interp->finalizing = 1; @@ -2076,8 +2076,8 @@ _Ty_Finalize(_PyRuntimeState *runtime) except if wait_for_thread_shutdown() has been cancelled by CTRL+C. We start the world once we are the only thread state left, before we call destructors. */ - PyThreadState *list = _TyThreadState_RemoveExcept(tstate); - for (PyThreadState *p = list; p != NULL; p = p->next) { + TyThreadState *list = _TyThreadState_RemoveExcept(tstate); + for (TyThreadState *p = list; p != NULL; p = p->next) { _TyThreadState_SetShuttingDown(p); } _TyEval_StartTheWorldAll(runtime); @@ -2278,11 +2278,11 @@ Ty_Finalize(void) */ -static PyStatus -new_interpreter(PyThreadState **tstate_p, +static TyStatus +new_interpreter(TyThreadState **tstate_p, const PyInterpreterConfig *config, long whence) { - PyStatus status; + TyStatus status; status = _PyRuntime_Initialize(); if (_TyStatus_EXCEPTION(status)) { @@ -2307,8 +2307,8 @@ new_interpreter(PyThreadState **tstate_p, interp->_ready = 1; // XXX Might new_interpreter() have been called without the GIL held? - PyThreadState *save_tstate = _TyThreadState_GET(); - PyThreadState *tstate = NULL; + TyThreadState *save_tstate = _TyThreadState_GET(); + TyThreadState *tstate = NULL; /* From this point until the init_interp_create_gil() call, we must not do anything that requires that the GIL be held @@ -2394,21 +2394,21 @@ error: return status; } -PyStatus -Ty_NewInterpreterFromConfig(PyThreadState **tstate_p, +TyStatus +Ty_NewInterpreterFromConfig(TyThreadState **tstate_p, const PyInterpreterConfig *config) { long whence = _TyInterpreterState_WHENCE_CAPI; return new_interpreter(tstate_p, config, whence); } -PyThreadState * +TyThreadState * Ty_NewInterpreter(void) { - PyThreadState *tstate = NULL; + TyThreadState *tstate = NULL; long whence = _TyInterpreterState_WHENCE_LEGACY_CAPI; const PyInterpreterConfig config = _PyInterpreterConfig_LEGACY_INIT; - PyStatus status = new_interpreter(&tstate, &config, whence); + TyStatus status = new_interpreter(&tstate, &config, whence); if (_TyStatus_EXCEPTION(status)) { Ty_ExitStatusException(status); } @@ -2428,7 +2428,7 @@ Ty_NewInterpreter(void) */ void -Ty_EndInterpreter(PyThreadState *tstate) +Ty_EndInterpreter(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; @@ -2471,7 +2471,7 @@ _Ty_IsInterpreterFinalizing(PyInterpreterState *interp) { /* We check the runtime first since, in a daemon thread, interp might be dangling pointer. */ - PyThreadState *finalizing = _PyRuntimeState_GetFinalizing(&_PyRuntime); + TyThreadState *finalizing = _PyRuntimeState_GetFinalizing(&_PyRuntime); if (finalizing == NULL) { finalizing = _TyInterpreterState_GetFinalizing(interp); } @@ -2481,7 +2481,7 @@ _Ty_IsInterpreterFinalizing(PyInterpreterState *interp) static void finalize_subinterpreters(void) { - PyThreadState *final_tstate = _TyThreadState_GET(); + TyThreadState *final_tstate = _TyThreadState_GET(); PyInterpreterState *main_interp = _TyInterpreterState_Main(); assert(final_tstate->interp == main_interp); _PyRuntimeState *runtime = main_interp->runtime; @@ -2517,7 +2517,7 @@ finalize_subinterpreters(void) /* Find the tstate to use for fini. We assume the interpreter will have at most one tstate at this point. */ - PyThreadState *tstate = interp->threads.head; + TyThreadState *tstate = interp->threads.head; if (tstate != NULL) { /* Ideally we would be able to use tstate as-is, and rely on it being in a ready state: no exception set, not @@ -2553,7 +2553,7 @@ finalize_subinterpreters(void) /* Add the __main__ module */ -static PyStatus +static TyStatus add_main_module(PyInterpreterState *interp) { TyObject *m, *d; @@ -2605,7 +2605,7 @@ add_main_module(PyInterpreterState *interp) /* Import the site module (not into __main__ though) */ -static PyStatus +static TyStatus init_import_site(void) { TyObject *m; @@ -2759,12 +2759,12 @@ error: } /* Set builtins.open to io.open */ -static PyStatus +static TyStatus init_set_builtins_open(void) { TyObject *wrapper; TyObject *bimod = NULL; - PyStatus res = _TyStatus_OK(); + TyStatus res = _TyStatus_OK(); if (!(bimod = TyImport_ImportModule("builtins"))) { goto error; @@ -2792,14 +2792,14 @@ done: /* Create sys.stdin, sys.stdout and sys.stderr */ -static PyStatus -init_sys_streams(PyThreadState *tstate) +static TyStatus +init_sys_streams(TyThreadState *tstate) { TyObject *iomod = NULL; TyObject *std = NULL; int fd; TyObject * encoding_attr; - PyStatus res = _TyStatus_OK(); + TyStatus res = _TyStatus_OK(); const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp); /* Check that stdin is not a directory @@ -2914,10 +2914,10 @@ static TyMethodDef android_log_write_method = { }; -static PyStatus -init_android_streams(PyThreadState *tstate) +static TyStatus +init_android_streams(TyThreadState *tstate) { - PyStatus status = _TyStatus_OK(); + TyStatus status = _TyStatus_OK(); TyObject *_android_support = NULL; TyObject *android_log_write = NULL; TyObject *result = NULL; @@ -2978,10 +2978,10 @@ static TyMethodDef apple_log_write_method = { }; -static PyStatus -init_apple_streams(PyThreadState *tstate) +static TyStatus +init_apple_streams(TyThreadState *tstate) { - PyStatus status = _TyStatus_OK(); + TyStatus status = _TyStatus_OK(); TyObject *_apple_support = NULL; TyObject *apple_log_write = NULL; TyObject *result = NULL; @@ -3021,7 +3021,7 @@ done: static void _Ty_FatalError_DumpTracebacks(int fd, PyInterpreterState *interp, - PyThreadState *tstate) + TyThreadState *tstate) { PUTS(fd, "\n"); @@ -3042,7 +3042,7 @@ _Ty_FatalError_DumpTracebacks(int fd, PyInterpreterState *interp, Return 1 if the traceback was displayed, 0 otherwise. */ static int -_Ty_FatalError_PrintExc(PyThreadState *tstate) +_Ty_FatalError_PrintExc(TyThreadState *tstate) { TyObject *exc = _TyErr_GetRaisedException(tstate); if (exc == NULL) { @@ -3120,7 +3120,7 @@ static void fatal_error_dump_runtime(int fd, _PyRuntimeState *runtime) { PUTS(fd, "Typthon runtime state: "); - PyThreadState *finalizing = _PyRuntimeState_GetFinalizing(runtime); + TyThreadState *finalizing = _PyRuntimeState_GetFinalizing(runtime); if (finalizing) { PUTS(fd, "finalizing (tstate=0x"); _Ty_DumpHexadecimal(fd, (uintptr_t)finalizing, sizeof(finalizing) * 2); @@ -3328,9 +3328,9 @@ fatal_error(int fd, int header, const char *prefix, const char *msg, tss_tstate != tstate if the current Python thread does not hold the GIL. */ - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); PyInterpreterState *interp = NULL; - PyThreadState *tss_tstate = TyGILState_GetThisThreadState(); + TyThreadState *tss_tstate = TyGILState_GetThisThreadState(); if (tstate != NULL) { interp = tstate->interp; } @@ -3429,7 +3429,7 @@ _Ty_FatalRefcountErrorFunc(const char *func, const char *msg) void _Ty_NO_RETURN -Ty_ExitStatusException(PyStatus status) +Ty_ExitStatusException(TyStatus status) { if (_TyStatus_IS_EXIT(status)) { exit(status.exitcode); @@ -3448,7 +3448,7 @@ Ty_ExitStatusException(PyStatus status) The shutdown routine will wait until all non-daemon "threading" threads have completed. */ static void -wait_for_thread_shutdown(PyThreadState *tstate) +wait_for_thread_shutdown(TyThreadState *tstate) { TyObject *result; TyObject *threading = TyImport_GetModule(&_Ty_ID(threading)); @@ -3508,7 +3508,7 @@ call_ll_exitfuncs(_PyRuntimeState *runtime) void _Ty_NO_RETURN Ty_Exit(int sts) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate != NULL && _TyThreadState_IsRunningMain(tstate)) { _TyInterpreterState_SetNotRunningMain(tstate->interp); } diff --git a/Python/pystate.c b/Python/pystate.c index fe96a95..370a525 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -69,10 +69,10 @@ to avoid the expense of doing their own locking). #ifdef HAVE_THREAD_LOCAL -_Ty_thread_local PyThreadState *_Ty_tss_tstate = NULL; +_Ty_thread_local TyThreadState *_Ty_tss_tstate = NULL; #endif -static inline PyThreadState * +static inline TyThreadState * current_fast_get(void) { #ifdef HAVE_THREAD_LOCAL @@ -84,7 +84,7 @@ current_fast_get(void) } static inline void -current_fast_set(_PyRuntimeState *Py_UNUSED(runtime), PyThreadState *tstate) +current_fast_set(_PyRuntimeState *Py_UNUSED(runtime), TyThreadState *tstate) { assert(tstate != NULL); #ifdef HAVE_THREAD_LOCAL @@ -111,7 +111,7 @@ current_fast_clear(_PyRuntimeState *Py_UNUSED(runtime)) _Ty_FatalErrorFormat(__func__, "tstate %p is still current", tstate); \ } -PyThreadState * +TyThreadState * _TyThreadState_GetCurrent(void) { return current_fast_get(); @@ -142,15 +142,15 @@ tstate_tss_fini(Ty_tss_t *key) PyThread_tss_delete(key); } -static inline PyThreadState * +static inline TyThreadState * tstate_tss_get(Ty_tss_t *key) { assert(tstate_tss_initialized(key)); - return (PyThreadState *)PyThread_tss_get(key); + return (TyThreadState *)PyThread_tss_get(key); } static inline int -tstate_tss_set(Ty_tss_t *key, PyThreadState *tstate) +tstate_tss_set(Ty_tss_t *key, TyThreadState *tstate) { assert(tstate != NULL); assert(tstate_tss_initialized(key)); @@ -169,13 +169,13 @@ tstate_tss_clear(Ty_tss_t *key) * This should not be necessary, but some - buggy - pthread implementations * don't reset TSS upon fork(), see issue #10517. */ -static PyStatus +static TyStatus tstate_tss_reinit(Ty_tss_t *key) { if (!tstate_tss_initialized(key)) { return _TyStatus_OK(); } - PyThreadState *tstate = tstate_tss_get(key); + TyThreadState *tstate = tstate_tss_get(key); tstate_tss_fini(key); if (tstate_tss_init(key) != 0) { @@ -214,7 +214,7 @@ tstate_tss_reinit(Ty_tss_t *key) tstate_tss_reinit(&(runtime)->autoTSSkey) static inline void -gilstate_tss_set(_PyRuntimeState *runtime, PyThreadState *tstate) +gilstate_tss_set(_PyRuntimeState *runtime, TyThreadState *tstate) { assert(tstate != NULL && tstate->interp->runtime == runtime); if (_gilstate_tss_set(runtime, tstate) != 0) { @@ -232,22 +232,22 @@ gilstate_tss_clear(_PyRuntimeState *runtime) #ifndef NDEBUG -static inline int tstate_is_alive(PyThreadState *tstate); +static inline int tstate_is_alive(TyThreadState *tstate); static inline int -tstate_is_bound(PyThreadState *tstate) +tstate_is_bound(TyThreadState *tstate) { return tstate->_status.bound && !tstate->_status.unbound; } #endif // !NDEBUG -static void bind_gilstate_tstate(PyThreadState *); -static void unbind_gilstate_tstate(PyThreadState *); +static void bind_gilstate_tstate(TyThreadState *); +static void unbind_gilstate_tstate(TyThreadState *); -static void tstate_mimalloc_bind(PyThreadState *); +static void tstate_mimalloc_bind(TyThreadState *); static void -bind_tstate(PyThreadState *tstate) +bind_tstate(TyThreadState *tstate) { assert(tstate != NULL); assert(tstate_is_alive(tstate) && !tstate->_status.bound); @@ -279,7 +279,7 @@ bind_tstate(PyThreadState *tstate) } static void -unbind_tstate(PyThreadState *tstate) +unbind_tstate(TyThreadState *tstate) { assert(tstate != NULL); assert(tstate_is_bound(tstate)); @@ -320,7 +320,7 @@ unbind_tstate(PyThreadState *tstate) */ static void -bind_gilstate_tstate(PyThreadState *tstate) +bind_gilstate_tstate(TyThreadState *tstate) { assert(tstate != NULL); assert(tstate_is_alive(tstate)); @@ -329,7 +329,7 @@ bind_gilstate_tstate(PyThreadState *tstate) assert(!tstate->_status.bound_gilstate); _PyRuntimeState *runtime = tstate->interp->runtime; - PyThreadState *tcur = gilstate_tss_get(runtime); + TyThreadState *tcur = gilstate_tss_get(runtime); assert(tstate != tcur); if (tcur != NULL) { @@ -340,7 +340,7 @@ bind_gilstate_tstate(PyThreadState *tstate) } static void -unbind_gilstate_tstate(PyThreadState *tstate) +unbind_gilstate_tstate(TyThreadState *tstate) { assert(tstate != NULL); // XXX assert(tstate_is_alive(tstate)); @@ -367,7 +367,7 @@ unbind_gilstate_tstate(PyThreadState *tstate) change until we yield the lock. */ static int -holds_gil(PyThreadState *tstate) +holds_gil(TyThreadState *tstate) { // XXX Fall back to tstate->interp->runtime->ceval.gil.last_holder // (and tstate->interp->runtime->ceval.gil.locked). @@ -442,7 +442,7 @@ init_runtime(_PyRuntimeState *runtime, runtime->_initialized = 1; } -PyStatus +TyStatus _PyRuntimeState_Init(_PyRuntimeState *runtime) { /* We preserve the hook across init, because there is @@ -464,7 +464,7 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime) assert(!runtime->_initialized); } - PyStatus status = _TyTime_Init(&runtime->time); + TyStatus status = _TyTime_Init(&runtime->time); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -505,7 +505,7 @@ _PyRuntimeState_Fini(_PyRuntimeState *runtime) #ifdef HAVE_FORK /* This function is called from TyOS_AfterFork_Child to ensure that newly created child processes do not share locks with the parent. */ -PyStatus +TyStatus _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime) { // This was initially set in _PyRuntimeState_Init(). @@ -532,7 +532,7 @@ _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime) _PyTypes_AfterFork(); - PyStatus status = gilstate_tss_reinit(runtime); + TyStatus status = gilstate_tss_reinit(runtime); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -561,7 +561,7 @@ _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime) /* Calling this indicates that the runtime is ready to create interpreters. */ -PyStatus +TyStatus _TyInterpreterState_Enable(_PyRuntimeState *runtime) { struct pyinterpreters *interpreters = &runtime->interpreters; @@ -623,7 +623,7 @@ static inline int check_interpreter_whence(long); main interpreter. We fix those fields here, in addition to the other dynamically initialized fields. */ -static PyStatus +static TyStatus init_interpreter(PyInterpreterState *interp, _PyRuntimeState *runtime, int64_t id, PyInterpreterState *next, @@ -718,8 +718,8 @@ init_interpreter(PyInterpreterState *interp, } -PyStatus -_TyInterpreterState_New(PyThreadState *tstate, PyInterpreterState **pinterp) +TyStatus +_TyInterpreterState_New(TyThreadState *tstate, PyInterpreterState **pinterp) { *pinterp = NULL; @@ -746,7 +746,7 @@ _TyInterpreterState_New(PyThreadState *tstate, PyInterpreterState **pinterp) // Allocate the interpreter and add it to the runtime state. PyInterpreterState *interp; - PyStatus status; + TyStatus status; PyInterpreterState *old_head = interpreters->head; if (old_head == NULL) { // We are creating the main interpreter. @@ -806,10 +806,10 @@ PyInterpreterState * TyInterpreterState_New(void) { // tstate can be NULL - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); PyInterpreterState *interp; - PyStatus status = _TyInterpreterState_New(tstate, &interp); + TyStatus status = _TyInterpreterState_New(tstate, &interp); if (_TyStatus_EXCEPTION(status)) { Ty_ExitStatusException(status); } @@ -823,7 +823,7 @@ _Ty_stackref_report_leaks(PyInterpreterState *interp); #endif static void -interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate) +interpreter_clear(PyInterpreterState *interp, TyThreadState *tstate) { assert(interp != NULL); assert(tstate != NULL); @@ -986,22 +986,22 @@ TyInterpreterState_Clear(PyInterpreterState *interp) // Use the current Python thread state to call audit hooks and to collect // garbage. It can be different than the current Python thread state // of 'interp'. - PyThreadState *current_tstate = current_fast_get(); + TyThreadState *current_tstate = current_fast_get(); _TyImport_ClearCore(interp); interpreter_clear(interp, current_tstate); } void -_TyInterpreterState_Clear(PyThreadState *tstate) +_TyInterpreterState_Clear(TyThreadState *tstate) { _TyImport_ClearCore(tstate->interp); interpreter_clear(tstate->interp, tstate); } -static inline void tstate_deactivate(PyThreadState *tstate); -static void tstate_set_detached(PyThreadState *tstate, int detached_state); +static inline void tstate_deactivate(TyThreadState *tstate); +static void tstate_set_detached(TyThreadState *tstate, int detached_state); static void zapthreads(PyInterpreterState *interp); void @@ -1012,7 +1012,7 @@ TyInterpreterState_Delete(PyInterpreterState *interp) // XXX Clearing the "current" thread state should happen before // we start finalizing the interpreter (or the current thread state). - PyThreadState *tcur = current_fast_get(); + TyThreadState *tcur = current_fast_get(); if (tcur != NULL && interp == tcur->interp) { /* Unset current thread. After this, many C API calls become crashy. */ _TyThreadState_Detach(tcur); @@ -1063,12 +1063,12 @@ TyInterpreterState_Delete(PyInterpreterState *interp) * Delete all interpreter states except the main interpreter. If there * is a current interpreter state, it *must* be the main interpreter. */ -PyStatus +TyStatus _TyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime) { struct pyinterpreters *interpreters = &runtime->interpreters; - PyThreadState *tstate = _TyThreadState_Swap(runtime, NULL); + TyThreadState *tstate = _TyThreadState_Swap(runtime, NULL); if (tstate != NULL && tstate->interp != interpreters->main) { return _TyStatus_ERR("not main interpreter"); } @@ -1103,12 +1103,12 @@ _TyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime) #endif static inline void -set_main_thread(PyInterpreterState *interp, PyThreadState *tstate) +set_main_thread(PyInterpreterState *interp, TyThreadState *tstate) { _Ty_atomic_store_ptr_relaxed(&interp->threads.main, tstate); } -static inline PyThreadState * +static inline TyThreadState * get_main_thread(PyInterpreterState *interp) { return _Ty_atomic_load_ptr_relaxed(&interp->threads.main); @@ -1127,7 +1127,7 @@ _TyInterpreterState_SetRunningMain(PyInterpreterState *interp) _TyErr_SetInterpreterAlreadyRunning(); return -1; } - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); _Ty_EnsureTstateNotNULL(tstate); if (tstate->interp != interp) { TyErr_SetString(TyExc_RuntimeError, @@ -1162,7 +1162,7 @@ _TyInterpreterState_IsRunningMain(PyInterpreterState *interp) } int -_TyThreadState_IsRunningMain(PyThreadState *tstate) +_TyThreadState_IsRunningMain(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; // See the note in _TyInterpreterState_IsRunningMain() about @@ -1171,7 +1171,7 @@ _TyThreadState_IsRunningMain(PyThreadState *tstate) } void -_TyInterpreterState_ReinitRunningMain(PyThreadState *tstate) +_TyInterpreterState_ReinitRunningMain(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; if (get_main_thread(interp) != tstate) { @@ -1221,7 +1221,7 @@ _TyInterpreterState_SetWhence(PyInterpreterState *interp, long whence) TyObject * -_Ty_GetMainModule(PyThreadState *tstate) +_Ty_GetMainModule(TyThreadState *tstate) { // We return None to indicate "not found" or "bogus". TyObject *modules = _TyImport_GetModulesRef(tstate->interp); @@ -1349,11 +1349,11 @@ _TyInterpreterState_IDDecref(PyInterpreterState *interp) Ty_ssize_t refcount = _Ty_atomic_add_ssize(&interp->id_refcount, -1); if (refcount == 1 && interp->requires_idref) { - PyThreadState *tstate = + TyThreadState *tstate = _TyThreadState_NewBound(interp, _TyThreadState_WHENCE_FINI); // XXX Possible GILState issues? - PyThreadState *save_tstate = _TyThreadState_Swap(runtime, tstate); + TyThreadState *save_tstate = _TyThreadState_Swap(runtime, tstate); Ty_EndInterpreter(tstate); _TyThreadState_Swap(runtime, save_tstate); } @@ -1384,7 +1384,7 @@ _TyInterpreterState_RequireIDRef(PyInterpreterState *interp, int required) PyInterpreterState* TyInterpreterState_Get(void) { - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); _Ty_EnsureTstateNotNULL(tstate); PyInterpreterState *interp = tstate->interp; if (interp == NULL) { @@ -1449,7 +1449,7 @@ _TyInterpreterState_LookUpIDObject(TyObject *requested_id) #ifndef NDEBUG static inline int -tstate_is_alive(PyThreadState *tstate) +tstate_is_alive(TyThreadState *tstate) { return (tstate->_status.initialized && !tstate->_status.finalized && @@ -1543,7 +1543,7 @@ static void init_threadstate(_PyThreadStateImpl *_tstate, PyInterpreterState *interp, uint64_t id, int whence) { - PyThreadState *tstate = (PyThreadState *)_tstate; + TyThreadState *tstate = (TyThreadState *)_tstate; if (tstate->_status.initialized) { Ty_FatalError("thread state already initialized"); } @@ -1602,8 +1602,8 @@ init_threadstate(_PyThreadStateImpl *_tstate, } static void -add_threadstate(PyInterpreterState *interp, PyThreadState *tstate, - PyThreadState *next) +add_threadstate(PyInterpreterState *interp, TyThreadState *tstate, + TyThreadState *next) { assert(interp->threads.head != tstate); if (next != NULL) { @@ -1615,7 +1615,7 @@ add_threadstate(PyInterpreterState *interp, PyThreadState *tstate, interp->threads.head = tstate; } -static PyThreadState * +static TyThreadState * new_threadstate(PyInterpreterState *interp, int whence) { // Allocate the thread state. @@ -1646,8 +1646,8 @@ new_threadstate(PyInterpreterState *interp, int whence) init_threadstate(tstate, interp, id, whence); // Add the new thread state to the interpreter. - PyThreadState *old_head = interp->threads.head; - add_threadstate(interp, (PyThreadState *)tstate, old_head); + TyThreadState *old_head = interp->threads.head; + add_threadstate(interp, (TyThreadState *)tstate, old_head); HEAD_UNLOCK(interp->runtime); @@ -1657,19 +1657,19 @@ new_threadstate(PyInterpreterState *interp, int whence) tstate->tlbc_index = tlbc_idx; #endif - return (PyThreadState *)tstate; + return (TyThreadState *)tstate; } -PyThreadState * +TyThreadState * TyThreadState_New(PyInterpreterState *interp) { return _TyThreadState_NewBound(interp, _TyThreadState_WHENCE_UNKNOWN); } -PyThreadState * +TyThreadState * _TyThreadState_NewBound(PyInterpreterState *interp, int whence) { - PyThreadState *tstate = new_threadstate(interp, whence); + TyThreadState *tstate = new_threadstate(interp, whence); if (tstate) { bind_tstate(tstate); // This makes sure there's a gilstate tstate bound @@ -1682,14 +1682,14 @@ _TyThreadState_NewBound(PyInterpreterState *interp, int whence) } // This must be followed by a call to _TyThreadState_Bind(); -PyThreadState * +TyThreadState * _TyThreadState_New(PyInterpreterState *interp, int whence) { return new_threadstate(interp, whence); } // We keep this for stable ABI compabibility. -PyAPI_FUNC(PyThreadState*) +PyAPI_FUNC(TyThreadState*) _TyThreadState_Prealloc(PyInterpreterState *interp) { return _TyThreadState_New(interp, _TyThreadState_WHENCE_UNKNOWN); @@ -1698,14 +1698,14 @@ _TyThreadState_Prealloc(PyInterpreterState *interp) // We keep this around for (accidental) stable ABI compatibility. // Realistically, no extensions are using it. PyAPI_FUNC(void) -_TyThreadState_Init(PyThreadState *tstate) +_TyThreadState_Init(TyThreadState *tstate) { Ty_FatalError("_TyThreadState_Init() is for internal use only"); } static void -clear_datastack(PyThreadState *tstate) +clear_datastack(TyThreadState *tstate) { _PyStackChunk *chunk = tstate->datastack_chunk; tstate->datastack_chunk = NULL; @@ -1717,7 +1717,7 @@ clear_datastack(PyThreadState *tstate) } void -TyThreadState_Clear(PyThreadState *tstate) +TyThreadState_Clear(TyThreadState *tstate) { assert(tstate->_status.initialized && !tstate->_status.cleared); assert(current_fast_get()->interp == tstate->interp); @@ -1851,7 +1851,7 @@ decrement_stoptheworld_countdown(struct _stoptheworld_state *stw); /* Common code for TyThreadState_Delete() and TyThreadState_DeleteCurrent() */ static void -tstate_delete_common(PyThreadState *tstate, int release_gil) +tstate_delete_common(TyThreadState *tstate, int release_gil) { assert(tstate->_status.cleared && !tstate->_status.finalized); tstate_verify_not_active(tstate); @@ -1920,7 +1920,7 @@ tstate_delete_common(PyThreadState *tstate, int release_gil) static void zapthreads(PyInterpreterState *interp) { - PyThreadState *tstate; + TyThreadState *tstate; /* No need to lock the mutex here because this should only happen when the threads are all really dead (XXX famous last words). @@ -1936,7 +1936,7 @@ zapthreads(PyInterpreterState *interp) void -TyThreadState_Delete(PyThreadState *tstate) +TyThreadState_Delete(TyThreadState *tstate) { _Ty_EnsureTstateNotNULL(tstate); tstate_verify_not_active(tstate); @@ -1946,7 +1946,7 @@ TyThreadState_Delete(PyThreadState *tstate) void -_TyThreadState_DeleteCurrent(PyThreadState *tstate) +_TyThreadState_DeleteCurrent(TyThreadState *tstate) { _Ty_EnsureTstateNotNULL(tstate); #ifdef Ty_GIL_DISABLED @@ -1960,7 +1960,7 @@ _TyThreadState_DeleteCurrent(PyThreadState *tstate) void TyThreadState_DeleteCurrent(void) { - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); _TyThreadState_DeleteCurrent(tstate); } @@ -1974,8 +1974,8 @@ TyThreadState_DeleteCurrent(void) // passed as argument. Also, this won't touch any interpreters other // than the current one, since we don't know which thread state should // be kept in those other interpreters. -PyThreadState * -_TyThreadState_RemoveExcept(PyThreadState *tstate) +TyThreadState * +_TyThreadState_RemoveExcept(TyThreadState *tstate) { assert(tstate != NULL); PyInterpreterState *interp = tstate->interp; @@ -1988,7 +1988,7 @@ _TyThreadState_RemoveExcept(PyThreadState *tstate) HEAD_LOCK(runtime); /* Remove all thread states, except tstate, from the linked list of thread states. */ - PyThreadState *list = interp->threads.head; + TyThreadState *list = interp->threads.head; if (list == tstate) { list = tstate->next; } @@ -2013,13 +2013,13 @@ _TyThreadState_RemoveExcept(PyThreadState *tstate) // Otherwise, they are decref'd because they may still be referenced by an // OS thread. void -_TyThreadState_DeleteList(PyThreadState *list, int is_after_fork) +_TyThreadState_DeleteList(TyThreadState *list, int is_after_fork) { // The world can't be stopped because we TyThreadState_Clear() can // call destructors. assert(!_PyRuntime.stoptheworld.world_stopped); - PyThreadState *p, *next; + TyThreadState *p, *next; for (p = list; p; p = next) { next = p->next; TyThreadState_Clear(p); @@ -2044,7 +2044,7 @@ _TyThreadState_DeleteList(PyThreadState *list, int is_after_fork) and the caller should assume no per-thread state is available. */ TyObject * -_TyThreadState_GetDict(PyThreadState *tstate) +_TyThreadState_GetDict(TyThreadState *tstate) { assert(tstate != NULL); if (tstate->dict == NULL) { @@ -2060,7 +2060,7 @@ _TyThreadState_GetDict(PyThreadState *tstate) TyObject * TyThreadState_GetDict(void) { - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); if (tstate == NULL) { return NULL; } @@ -2069,7 +2069,7 @@ TyThreadState_GetDict(void) PyInterpreterState * -TyThreadState_GetInterpreter(PyThreadState *tstate) +TyThreadState_GetInterpreter(TyThreadState *tstate) { assert(tstate != NULL); return tstate->interp; @@ -2077,7 +2077,7 @@ TyThreadState_GetInterpreter(PyThreadState *tstate) PyFrameObject* -TyThreadState_GetFrame(PyThreadState *tstate) +TyThreadState_GetFrame(TyThreadState *tstate) { assert(tstate != NULL); _PyInterpreterFrame *f = _TyThreadState_GetFrame(tstate); @@ -2093,7 +2093,7 @@ TyThreadState_GetFrame(PyThreadState *tstate) uint64_t -TyThreadState_GetID(PyThreadState *tstate) +TyThreadState_GetID(TyThreadState *tstate) { assert(tstate != NULL); return tstate->id; @@ -2101,7 +2101,7 @@ TyThreadState_GetID(PyThreadState *tstate) static inline void -tstate_activate(PyThreadState *tstate) +tstate_activate(TyThreadState *tstate) { assert(tstate != NULL); // XXX assert(tstate_is_alive(tstate)); @@ -2118,7 +2118,7 @@ tstate_activate(PyThreadState *tstate) } static inline void -tstate_deactivate(PyThreadState *tstate) +tstate_deactivate(TyThreadState *tstate) { assert(tstate != NULL); // XXX assert(tstate_is_alive(tstate)); @@ -2132,7 +2132,7 @@ tstate_deactivate(PyThreadState *tstate) } static int -tstate_try_attach(PyThreadState *tstate) +tstate_try_attach(TyThreadState *tstate) { #ifdef Ty_GIL_DISABLED int expected = _Ty_THREAD_DETACHED; @@ -2147,7 +2147,7 @@ tstate_try_attach(PyThreadState *tstate) } static void -tstate_set_detached(PyThreadState *tstate, int detached_state) +tstate_set_detached(TyThreadState *tstate, int detached_state) { assert(_Ty_atomic_load_int_relaxed(&tstate->state) == _Ty_THREAD_ATTACHED); #ifdef Ty_GIL_DISABLED @@ -2158,7 +2158,7 @@ tstate_set_detached(PyThreadState *tstate, int detached_state) } static void -tstate_wait_attach(PyThreadState *tstate) +tstate_wait_attach(TyThreadState *tstate) { do { int state = _Ty_atomic_load_int_relaxed(&tstate->state); @@ -2179,7 +2179,7 @@ tstate_wait_attach(PyThreadState *tstate) } void -_TyThreadState_Attach(PyThreadState *tstate) +_TyThreadState_Attach(TyThreadState *tstate) { #if defined(Ty_DEBUG) // This is called from TyEval_RestoreThread(). Similar @@ -2234,7 +2234,7 @@ _TyThreadState_Attach(PyThreadState *tstate) } static void -detach_thread(PyThreadState *tstate, int detached_state) +detach_thread(TyThreadState *tstate, int detached_state) { // XXX assert(tstate_is_alive(tstate) && tstate_is_bound(tstate)); assert(_Ty_atomic_load_int_relaxed(&tstate->state) == _Ty_THREAD_ATTACHED); @@ -2252,13 +2252,13 @@ detach_thread(PyThreadState *tstate, int detached_state) } void -_TyThreadState_Detach(PyThreadState *tstate) +_TyThreadState_Detach(TyThreadState *tstate) { detach_thread(tstate, _Ty_THREAD_DETACHED); } void -_TyThreadState_Suspend(PyThreadState *tstate) +_TyThreadState_Suspend(TyThreadState *tstate) { _PyRuntimeState *runtime = &_PyRuntime; @@ -2291,7 +2291,7 @@ _TyThreadState_Suspend(PyThreadState *tstate) } void -_TyThreadState_SetShuttingDown(PyThreadState *tstate) +_TyThreadState_SetShuttingDown(TyThreadState *tstate) { _Ty_atomic_store_int(&tstate->state, _Ty_THREAD_SHUTTING_DOWN); #ifdef Ty_GIL_DISABLED @@ -2501,7 +2501,7 @@ TyThreadState_SetAsyncExc(unsigned long id, TyObject *exc) * list of thread states we're traversing, so to prevent that we lock * head_mutex for the duration. */ - PyThreadState *tstate = NULL; + TyThreadState *tstate = NULL; _Ty_FOR_EACH_TSTATE_BEGIN(interp, t) { if (t->thread_id == id) { tstate = t; @@ -2532,25 +2532,25 @@ TyThreadState_SetAsyncExc(unsigned long id, TyObject *exc) // API for the current thread state //--------------------------------- -PyThreadState * +TyThreadState * TyThreadState_GetUnchecked(void) { return current_fast_get(); } -PyThreadState * +TyThreadState * TyThreadState_Get(void) { - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); _Ty_EnsureTstateNotNULL(tstate); return tstate; } -PyThreadState * -_TyThreadState_Swap(_PyRuntimeState *runtime, PyThreadState *newts) +TyThreadState * +_TyThreadState_Swap(_PyRuntimeState *runtime, TyThreadState *newts) { - PyThreadState *oldts = current_fast_get(); + TyThreadState *oldts = current_fast_get(); if (oldts != NULL) { _TyThreadState_Detach(oldts); } @@ -2560,15 +2560,15 @@ _TyThreadState_Swap(_PyRuntimeState *runtime, PyThreadState *newts) return oldts; } -PyThreadState * -TyThreadState_Swap(PyThreadState *newts) +TyThreadState * +TyThreadState_Swap(TyThreadState *newts) { return _TyThreadState_Swap(&_PyRuntime, newts); } void -_TyThreadState_Bind(PyThreadState *tstate) +_TyThreadState_Bind(TyThreadState *tstate) { // gh-104690: If Python is being finalized and TyInterpreterState_Delete() // was called, tstate becomes a dangling pointer. @@ -2587,7 +2587,7 @@ uintptr_t _Ty_GetThreadLocal_Addr(void) { #ifdef HAVE_THREAD_LOCAL - // gh-112535: Use the address of the thread-local PyThreadState variable as + // gh-112535: Use the address of the thread-local TyThreadState variable as // a unique identifier for the current thread. Each thread has a unique // _Ty_tss_tstate variable with a unique address. return (uintptr_t)&_Ty_tss_tstate; @@ -2621,13 +2621,13 @@ TyInterpreterState_Next(PyInterpreterState *interp) { return interp->next; } -PyThreadState * +TyThreadState * TyInterpreterState_ThreadHead(PyInterpreterState *interp) { return interp->threads.head; } -PyThreadState * -TyThreadState_Next(PyThreadState *tstate) { +TyThreadState * +TyThreadState_Next(TyThreadState *tstate) { return tstate->next; } @@ -2645,7 +2645,7 @@ TyObject * _PyThread_CurrentFrames(void) { _PyRuntimeState *runtime = &_PyRuntime; - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); if (_TySys_Audit(tstate, "sys._current_frames", NULL) < 0) { return NULL; } @@ -2707,7 +2707,7 @@ TyObject * _PyThread_CurrentExceptions(void) { _PyRuntimeState *runtime = &_PyRuntime; - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); _Ty_EnsureTstateNotNULL(tstate); @@ -2770,7 +2770,7 @@ done: /* Internal initialization/finalization functions called by Ty_Initialize/Ty_FinalizeEx */ -PyStatus +TyStatus _TyGILState_Init(PyInterpreterState *interp) { if (!_Ty_IsMainInterpreter(interp)) { @@ -2799,7 +2799,7 @@ _TyGILState_Fini(PyInterpreterState *interp) // XXX Drop this. void -_TyGILState_SetTstate(PyThreadState *tstate) +_TyGILState_SetTstate(TyThreadState *tstate) { /* must init with valid states */ assert(tstate != NULL); @@ -2828,7 +2828,7 @@ _TyGILState_GetInterpreterStateUnsafe(void) /* The public functions */ -PyThreadState * +TyThreadState * TyGILState_GetThisThreadState(void) { _PyRuntimeState *runtime = &_PyRuntime; @@ -2850,12 +2850,12 @@ TyGILState_Check(void) return 1; } - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); if (tstate == NULL) { return 0; } - PyThreadState *tcur = gilstate_tss_get(runtime); + TyThreadState *tcur = gilstate_tss_get(runtime); return (tstate == tcur); } @@ -2875,7 +2875,7 @@ TyGILState_Ensure(void) assert(gilstate_tss_initialized(runtime)); assert(runtime->gilstate.autoInterpreterState != NULL); - PyThreadState *tcur = gilstate_tss_get(runtime); + TyThreadState *tcur = gilstate_tss_get(runtime); int has_gil; if (tcur == NULL) { /* Create a new Python thread state for this thread */ @@ -2916,7 +2916,7 @@ void TyGILState_Release(TyGILState_STATE oldstate) { _PyRuntimeState *runtime = &_PyRuntime; - PyThreadState *tstate = gilstate_tss_get(runtime); + TyThreadState *tstate = gilstate_tss_get(runtime); if (tstate == NULL) { Ty_FatalError("auto-releasing thread-state, " "but no thread-state for this thread"); @@ -3006,7 +3006,7 @@ _TyInterpreterState_GetConfig(PyInterpreterState *interp) const PyConfig* _Ty_GetConfig(void) { - PyThreadState *tstate = current_fast_get(); + TyThreadState *tstate = current_fast_get(); _Ty_EnsureTstateNotNULL(tstate); return _TyInterpreterState_GetConfig(tstate->interp); } @@ -3022,7 +3022,7 @@ _TyInterpreterState_HasFeature(PyInterpreterState *interp, unsigned long feature #define MINIMUM_OVERHEAD 1000 static TyObject ** -push_chunk(PyThreadState *tstate, int size) +push_chunk(TyThreadState *tstate, int size) { int allocate_size = _PY_DATA_STACK_CHUNK_SIZE; while (allocate_size < (int)sizeof(TyObject*)*(size + MINIMUM_OVERHEAD)) { @@ -3047,7 +3047,7 @@ push_chunk(PyThreadState *tstate, int size) } _PyInterpreterFrame * -_TyThreadState_PushFrame(PyThreadState *tstate, size_t size) +_TyThreadState_PushFrame(TyThreadState *tstate, size_t size) { assert(size < INT_MAX/sizeof(TyObject *)); if (_TyThreadState_HasStackSpace(tstate, (int)size)) { @@ -3059,7 +3059,7 @@ _TyThreadState_PushFrame(PyThreadState *tstate, size_t size) } void -_TyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame * frame) +_TyThreadState_PopFrame(TyThreadState *tstate, _PyInterpreterFrame * frame) { assert(tstate->datastack_chunk); TyObject **base = (TyObject **)frame; @@ -3084,13 +3084,13 @@ _TyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame * frame) #ifndef NDEBUG // Check that a Python thread state valid. In practice, this function is used // on a Python debug build to check if 'tstate' is a dangling pointer, if the -// PyThreadState memory has been freed. +// TyThreadState memory has been freed. // // Usage: // // assert(_TyThreadState_CheckConsistency(tstate)); int -_TyThreadState_CheckConsistency(PyThreadState *tstate) +_TyThreadState_CheckConsistency(TyThreadState *tstate) { assert(!_TyMem_IsPtrFreed(tstate)); assert(!_TyMem_IsPtrFreed(tstate->interp)); @@ -3108,14 +3108,14 @@ _TyThreadState_CheckConsistency(PyThreadState *tstate) // // tstate must be non-NULL. int -_TyThreadState_MustExit(PyThreadState *tstate) +_TyThreadState_MustExit(TyThreadState *tstate) { int state = _Ty_atomic_load_int_relaxed(&tstate->state); return state == _Ty_THREAD_SHUTTING_DOWN; } void -_TyThreadState_HangThread(PyThreadState *tstate) +_TyThreadState_HangThread(TyThreadState *tstate) { _PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate; decref_threadstate(tstate_impl); @@ -3127,7 +3127,7 @@ _TyThreadState_HangThread(PyThreadState *tstate) /********************/ static void -tstate_mimalloc_bind(PyThreadState *tstate) +tstate_mimalloc_bind(TyThreadState *tstate) { #ifdef Ty_GIL_DISABLED struct _mimalloc_thread_state *mts = &((_PyThreadStateImpl*)tstate)->mimalloc; @@ -3180,7 +3180,7 @@ tstate_mimalloc_bind(PyThreadState *tstate) } void -_TyThreadState_ClearMimallocHeaps(PyThreadState *tstate) +_TyThreadState_ClearMimallocHeaps(TyThreadState *tstate) { #ifdef Ty_GIL_DISABLED if (!tstate->_status.bound) { @@ -3221,7 +3221,7 @@ _Ty_IsMainInterpreterFinalizing(PyInterpreterState *interp) /* bpo-39877: Access _PyRuntime directly rather than using tstate->interp->runtime to support calls from Python daemon threads. After Ty_Finalize() has been called, tstate can be a dangling pointer: - point to PyThreadState freed memory. */ + point to TyThreadState freed memory. */ return (_PyRuntimeState_GetFinalizing(&_PyRuntime) != NULL && interp == &_PyRuntime._main_interpreter); } diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 46405fb..945a4b5 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -315,7 +315,7 @@ TyRun_InteractiveOneObjectEx(FILE *fp, TyObject *filename, _TyArena_Free(arena); Ty_DECREF(main_module); if (res == NULL) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *exc = _TyErr_GetRaisedException(tstate); if (TyType_IsSubtype(Ty_TYPE(exc), (TyTypeObject *) TyExc_SyntaxError)) @@ -691,7 +691,7 @@ handle_system_exit(void) static void -_TyErr_PrintEx(PyThreadState *tstate, int set_sys_last_vars) +_TyErr_PrintEx(TyThreadState *tstate, int set_sys_last_vars) { TyObject *typ = NULL, *tb = NULL, *hook = NULL; handle_system_exit(); @@ -765,7 +765,7 @@ done: } void -_TyErr_Print(PyThreadState *tstate) +_TyErr_Print(TyThreadState *tstate) { _TyErr_PrintEx(tstate, 1); } @@ -773,7 +773,7 @@ _TyErr_Print(PyThreadState *tstate) void TyErr_PrintEx(int set_sys_last_vars) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _TyErr_PrintEx(tstate, set_sys_last_vars); } @@ -1318,7 +1318,7 @@ TyRun_FileExFlags(FILE *fp, const char *filename, int start, TyObject *globals, } static void -flush_io_stream(PyThreadState *tstate, TyObject *name) +flush_io_stream(TyThreadState *tstate, TyObject *name) { TyObject *f; if (_TySys_GetOptionalAttr(name, &f) < 0) { @@ -1335,7 +1335,7 @@ flush_io_stream(PyThreadState *tstate, TyObject *name) static void flush_io(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *exc = _TyErr_GetRaisedException(tstate); flush_io_stream(tstate, &_Ty_ID(stderr)); flush_io_stream(tstate, &_Ty_ID(stdout)); @@ -1343,7 +1343,7 @@ flush_io(void) } static TyObject * -run_eval_code_obj(PyThreadState *tstate, PyCodeObject *co, TyObject *globals, TyObject *locals) +run_eval_code_obj(TyThreadState *tstate, PyCodeObject *co, TyObject *globals, TyObject *locals) { /* Set globals['__builtins__'] if it doesn't exist */ if (!globals || !TyDict_Check(globals)) { @@ -1370,7 +1370,7 @@ run_mod(mod_ty mod, TyObject *filename, TyObject *globals, TyObject *locals, PyCompilerFlags *flags, PyArena *arena, TyObject* interactive_src, int generate_new_source) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject* interactive_filename = filename; if (interactive_src) { PyInterpreterState *interp = tstate->interp; @@ -1442,7 +1442,7 @@ static TyObject * run_pyc_file(FILE *fp, TyObject *globals, TyObject *locals, PyCompilerFlags *flags) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); PyCodeObject *co; TyObject *v; long magic; @@ -1603,7 +1603,7 @@ _Ty_SourceAsString(TyObject *cmd, const char *funcname, const char *what, PyComp int TyOS_CheckStack(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); return _Ty_ReachedRecursionLimit(tstate); } diff --git a/Python/pytime.c b/Python/pytime.c index e6a859a..b2d6cfc 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -1035,7 +1035,7 @@ _TyTime_TimeWithInfo(PyTime_t *t, _Ty_clock_info_t *info) #ifdef MS_WINDOWS -static PyStatus +static TyStatus py_win_perf_counter_frequency(_PyTimeFraction *base) { LARGE_INTEGER freq; @@ -1091,7 +1091,7 @@ py_get_win_perf_counter(PyTime_t *tp, _Ty_clock_info_t *info, int raise_exc) #ifdef __APPLE__ -static PyStatus +static TyStatus py_mach_timebase_info(_PyTimeFraction *base) { mach_timebase_info_data_t timebase; @@ -1120,7 +1120,7 @@ py_mach_timebase_info(_PyTimeFraction *base) } #endif -PyStatus +TyStatus _TyTime_Init(struct _Ty_time_runtime_state *state) { #ifdef MS_WINDOWS diff --git a/Python/qsbr.c b/Python/qsbr.c index 6e97982..772834e 100644 --- a/Python/qsbr.c +++ b/Python/qsbr.c @@ -190,7 +190,7 @@ _Ty_qsbr_reserve(PyInterpreterState *interp) struct _qsbr_thread_state *qsbr = qsbr_allocate(shared); // If there are no free entries, we pause all threads, grow the array, - // and update the pointers in PyThreadState to entries in the new array. + // and update the pointers in TyThreadState to entries in the new array. if (qsbr == NULL) { _TyEval_StopTheWorld(interp); if (grow_thread_array(shared) == 0) { @@ -219,13 +219,13 @@ _Ty_qsbr_register(_PyThreadStateImpl *tstate, PyInterpreterState *interp, PyMutex_Lock(&shared->mutex); struct _qsbr_thread_state *qsbr = &interp->qsbr.array[index].qsbr; assert(qsbr->allocated && qsbr->tstate == NULL); - qsbr->tstate = (PyThreadState *)tstate; + qsbr->tstate = (TyThreadState *)tstate; tstate->qsbr = qsbr; PyMutex_Unlock(&shared->mutex); } void -_Ty_qsbr_unregister(PyThreadState *tstate) +_Ty_qsbr_unregister(TyThreadState *tstate) { struct _qsbr_shared *shared = &tstate->interp->qsbr; struct _PyThreadStateImpl *tstate_imp = (_PyThreadStateImpl*) tstate; diff --git a/Python/remote_debug.h b/Python/remote_debug.h index 2a92056..c82ed87 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -86,7 +86,7 @@ extern "C" { #define _set_debug_exception_cause(exception, format, ...) \ do { \ if (!TyErr_ExceptionMatches(TyExc_PermissionError)) { \ - PyThreadState *tstate = _TyThreadState_GET(); \ + TyThreadState *tstate = _TyThreadState_GET(); \ if (!_TyErr_Occurred(tstate)) { \ _TyErr_Format(tstate, exception, format, ##__VA_ARGS__); \ } else { \ diff --git a/Python/remote_debugging.c b/Python/remote_debugging.c index 1726246..ee7ba0f 100644 --- a/Python/remote_debugging.c +++ b/Python/remote_debugging.c @@ -381,7 +381,7 @@ _PySysRemoteDebug_SendExec(int pid, int tid, const char *debugger_script_path) return -1; #else - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp); if (config->remote_debug != 1) { TyErr_SetString(TyExc_RuntimeError, "Remote debugging is not enabled"); diff --git a/Python/specialize.c b/Python/specialize.c index 30b73a4..a04cb97 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -456,10 +456,10 @@ do { \ // Initialize warmup counters and optimize instructions. This cannot fail. void -_TyCode_Quicken(_Py_CODEUNIT *instructions, Ty_ssize_t size, int enable_counters) +_TyCode_Quicken(_Ty_CODEUNIT *instructions, Ty_ssize_t size, int enable_counters) { #if ENABLE_SPECIALIZATION_FT - _Py_BackoffCounter jump_counter, adaptive_counter; + _Ty_BackoffCounter jump_counter, adaptive_counter; if (enable_counters) { jump_counter = initial_jump_backoff_counter(); adaptive_counter = adaptive_counter_warmup(); @@ -698,7 +698,7 @@ _TyCode_Quicken(_Py_CODEUNIT *instructions, Ty_ssize_t size, int enable_counters #define SPEC_FAIL_CONTAINS_OP_USER_CLASS 12 static inline int -set_opcode(_Py_CODEUNIT *instr, uint8_t opcode) +set_opcode(_Ty_CODEUNIT *instr, uint8_t opcode) { #ifdef Ty_GIL_DISABLED uint8_t old_op = _Ty_atomic_load_uint8_relaxed(&instr->op.code); @@ -719,23 +719,23 @@ set_opcode(_Py_CODEUNIT *instr, uint8_t opcode) } static inline void -set_counter(_Py_BackoffCounter *counter, _Py_BackoffCounter value) +set_counter(_Ty_BackoffCounter *counter, _Ty_BackoffCounter value) { FT_ATOMIC_STORE_UINT16_RELAXED(counter->value_and_backoff, value.value_and_backoff); } -static inline _Py_BackoffCounter -load_counter(_Py_BackoffCounter *counter) +static inline _Ty_BackoffCounter +load_counter(_Ty_BackoffCounter *counter) { - _Py_BackoffCounter result = { + _Ty_BackoffCounter result = { .value_and_backoff = FT_ATOMIC_LOAD_UINT16_RELAXED(counter->value_and_backoff)}; return result; } static inline void -specialize(_Py_CODEUNIT *instr, uint8_t specialized_opcode) +specialize(_Ty_CODEUNIT *instr, uint8_t specialized_opcode) { assert(!TyErr_Occurred()); if (!set_opcode(instr, specialized_opcode)) { @@ -745,11 +745,11 @@ specialize(_Py_CODEUNIT *instr, uint8_t specialized_opcode) return; } STAT_INC(_PyOpcode_Deopt[specialized_opcode], success); - set_counter((_Py_BackoffCounter *)instr + 1, adaptive_counter_cooldown()); + set_counter((_Ty_BackoffCounter *)instr + 1, adaptive_counter_cooldown()); } static inline void -unspecialize(_Py_CODEUNIT *instr) +unspecialize(_Ty_CODEUNIT *instr) { assert(!TyErr_Occurred()); uint8_t opcode = FT_ATOMIC_LOAD_UINT8_RELAXED(instr->op.code); @@ -759,8 +759,8 @@ unspecialize(_Py_CODEUNIT *instr) SPECIALIZATION_FAIL(generic_opcode, SPEC_FAIL_OTHER); return; } - _Py_BackoffCounter *counter = (_Py_BackoffCounter *)instr + 1; - _Py_BackoffCounter cur = load_counter(counter); + _Ty_BackoffCounter *counter = (_Ty_BackoffCounter *)instr + 1; + _Ty_BackoffCounter cur = load_counter(counter); set_counter(counter, adaptive_counter_backoff(cur)); } @@ -769,7 +769,7 @@ static bool function_check_args(TyObject *o, int expected_argcount, int opcode); static uint32_t function_get_version(TyObject *o, int opcode); static int -specialize_module_load_attr_lock_held(PyDictObject *dict, _Py_CODEUNIT *instr, TyObject *name) +specialize_module_load_attr_lock_held(PyDictObject *dict, _Ty_CODEUNIT *instr, TyObject *name) { _PyAttrCache *cache = (_PyAttrCache *)(instr + 1); if (dict->ma_keys->dk_kind != DICT_KEYS_UNICODE) { @@ -805,7 +805,7 @@ specialize_module_load_attr_lock_held(PyDictObject *dict, _Py_CODEUNIT *instr, T static int specialize_module_load_attr( - TyObject *owner, _Py_CODEUNIT *instr, TyObject *name) + TyObject *owner, _Ty_CODEUNIT *instr, TyObject *name) { PyModuleObject *m = (PyModuleObject *)owner; assert((Ty_TYPE(owner)->tp_flags & Ty_TPFLAGS_MANAGED_DICT) == 0); @@ -824,7 +824,7 @@ specialize_module_load_attr( /* Attribute specialization */ Ty_NO_INLINE void -_Py_Specialize_LoadSuperAttr(_PyStackRef global_super_st, _PyStackRef cls_st, _Py_CODEUNIT *instr, int load_method) { +_Py_Specialize_LoadSuperAttr(_PyStackRef global_super_st, _PyStackRef cls_st, _Ty_CODEUNIT *instr, int load_method) { TyObject *global_super = PyStackRef_AsPyObjectBorrow(global_super_st); TyObject *cls = PyStackRef_AsPyObjectBorrow(cls_st); @@ -922,8 +922,8 @@ analyze_descriptor_load(TyTypeObject *type, TyObject *name, TyObject **descr, un /* Normal attribute lookup; */ has_getattr = false; } - else if (getattro_slot == _Py_slot_tp_getattr_hook || - getattro_slot == _Py_slot_tp_getattro) { + else if (getattro_slot == _Ty_slot_tp_getattr_hook || + getattro_slot == _Ty_slot_tp_getattro) { /* One or both of __getattribute__ or __getattr__ may have been overridden See typeobject.c for why these functions are special. */ TyObject *getattribute = _TyType_LookupRefAndVersion(type, @@ -935,7 +935,7 @@ analyze_descriptor_load(TyTypeObject *type, TyObject *name, TyObject **descr, un TyObject *getattr = _TyType_Lookup(type, &_Ty_ID(__getattr__)); has_getattr = getattr != NULL; if (has_custom_getattribute) { - if (getattro_slot == _Py_slot_tp_getattro && + if (getattro_slot == _Ty_slot_tp_getattro && !has_getattr && Ty_IS_TYPE(getattribute, &TyFunction_Type)) { *descr = getattribute; @@ -990,7 +990,7 @@ analyze_descriptor_store(TyTypeObject *type, TyObject *name, TyObject **descr, u static int specialize_dict_access_inline( - TyObject *owner, _Py_CODEUNIT *instr, TyTypeObject *type, + TyObject *owner, _Ty_CODEUNIT *instr, TyTypeObject *type, TyObject *name, unsigned int tp_version, int base_op, int values_op) { @@ -1020,7 +1020,7 @@ specialize_dict_access_inline( static int specialize_dict_access_hint( - PyDictObject *dict, _Py_CODEUNIT *instr, TyTypeObject *type, + PyDictObject *dict, _Ty_CODEUNIT *instr, TyTypeObject *type, TyObject *name, unsigned int tp_version, int base_op, int hint_op) { @@ -1053,7 +1053,7 @@ specialize_dict_access_hint( static int specialize_dict_access( - TyObject *owner, _Py_CODEUNIT *instr, TyTypeObject *type, + TyObject *owner, _Ty_CODEUNIT *instr, TyTypeObject *type, DescriptorClassification kind, TyObject *name, unsigned int tp_version, int base_op, int values_op, int hint_op) { @@ -1102,12 +1102,12 @@ specialize_dict_access( } static int -specialize_attr_loadclassattr(TyObject *owner, _Py_CODEUNIT *instr, +specialize_attr_loadclassattr(TyObject *owner, _Ty_CODEUNIT *instr, TyObject *name, TyObject *descr, unsigned int tp_version, DescriptorClassification kind, bool is_method, uint32_t shared_keys_version); -static int specialize_class_load_attr(TyObject* owner, _Py_CODEUNIT* instr, TyObject* name); +static int specialize_class_load_attr(TyObject* owner, _Ty_CODEUNIT* instr, TyObject* name); /* Returns true if instances of obj's class are * likely to have `name` in their __dict__. @@ -1144,7 +1144,7 @@ instance_has_key(TyObject *obj, TyObject *name, uint32_t *shared_keys_version) } static int -do_specialize_instance_load_attr(TyObject* owner, _Py_CODEUNIT* instr, TyObject* name, +do_specialize_instance_load_attr(TyObject* owner, _Ty_CODEUNIT* instr, TyObject* name, bool shadow, uint32_t shared_keys_version, DescriptorClassification kind, TyObject *descr, unsigned int tp_version) { @@ -1263,7 +1263,7 @@ do_specialize_instance_load_attr(TyObject* owner, _Py_CODEUNIT* instr, TyObject* // In free-threaded builds it's possible for tp_getattro to change // after the call to analyze_descriptor. That is fine: the version // guard will fail. - assert(type->tp_getattro == _Py_slot_tp_getattro); + assert(type->tp_getattro == _Ty_slot_tp_getattro); #endif assert(Ty_IS_TYPE(descr, &TyFunction_Type)); _PyLoadMethodCache *lm_cache = (_PyLoadMethodCache *)(instr + 1); @@ -1319,7 +1319,7 @@ do_specialize_instance_load_attr(TyObject* owner, _Py_CODEUNIT* instr, TyObject* if (shadow) { goto try_instance; } - set_counter((_Py_BackoffCounter*)instr + 1, adaptive_counter_cooldown()); + set_counter((_Ty_BackoffCounter*)instr + 1, adaptive_counter_cooldown()); return 0; } Ty_UNREACHABLE(); @@ -1333,7 +1333,7 @@ try_instance: } static int -specialize_instance_load_attr(TyObject* owner, _Py_CODEUNIT* instr, TyObject* name) +specialize_instance_load_attr(TyObject* owner, _Ty_CODEUNIT* instr, TyObject* name) { // 0 is not a valid version uint32_t shared_keys_version = 0; @@ -1348,7 +1348,7 @@ specialize_instance_load_attr(TyObject* owner, _Py_CODEUNIT* instr, TyObject* na } Ty_NO_INLINE void -_Py_Specialize_LoadAttr(_PyStackRef owner_st, _Py_CODEUNIT *instr, TyObject *name) +_Py_Specialize_LoadAttr(_PyStackRef owner_st, _Ty_CODEUNIT *instr, TyObject *name) { TyObject *owner = PyStackRef_AsPyObjectBorrow(owner_st); @@ -1379,7 +1379,7 @@ _Py_Specialize_LoadAttr(_PyStackRef owner_st, _Py_CODEUNIT *instr, TyObject *nam } Ty_NO_INLINE void -_Py_Specialize_StoreAttr(_PyStackRef owner_st, _Py_CODEUNIT *instr, TyObject *name) +_Py_Specialize_StoreAttr(_PyStackRef owner_st, _Ty_CODEUNIT *instr, TyObject *name) { TyObject *owner = PyStackRef_AsPyObjectBorrow(owner_st); @@ -1516,13 +1516,13 @@ load_attr_fail_kind(DescriptorClassification kind) #endif // Ty_STATS static int -specialize_class_load_attr(TyObject *owner, _Py_CODEUNIT *instr, +specialize_class_load_attr(TyObject *owner, _Ty_CODEUNIT *instr, TyObject *name) { assert(TyType_Check(owner)); TyTypeObject *cls = (TyTypeObject *)owner; _PyLoadMethodCache *cache = (_PyLoadMethodCache *)(instr + 1); - if (Ty_TYPE(cls)->tp_getattro != _Py_type_getattro) { + if (Ty_TYPE(cls)->tp_getattro != _Ty_type_getattro) { SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_METACLASS_OVERRIDDEN); return -1; } @@ -1598,7 +1598,7 @@ specialize_class_load_attr(TyObject *owner, _Py_CODEUNIT *instr, // can cause a significant drop in cache hits. A possible test is // python.exe -m test_typing test_re test_dis test_zlib. static int -specialize_attr_loadclassattr(TyObject *owner, _Py_CODEUNIT *instr, +specialize_attr_loadclassattr(TyObject *owner, _Ty_CODEUNIT *instr, TyObject *name, TyObject *descr, unsigned int tp_version, DescriptorClassification kind, bool is_method, @@ -1688,7 +1688,7 @@ specialize_attr_loadclassattr(TyObject *owner, _Py_CODEUNIT *instr, static void specialize_load_global_lock_held( TyObject *globals, TyObject *builtins, - _Py_CODEUNIT *instr, TyObject *name) + _Ty_CODEUNIT *instr, TyObject *name) { assert(ENABLE_SPECIALIZATION_FT); assert(_PyOpcode_Caches[LOAD_GLOBAL] == INLINE_CACHE_ENTRIES_LOAD_GLOBAL); @@ -1780,7 +1780,7 @@ fail: Ty_NO_INLINE void _Py_Specialize_LoadGlobal( TyObject *globals, TyObject *builtins, - _Py_CODEUNIT *instr, TyObject *name) + _Ty_CODEUNIT *instr, TyObject *name) { Ty_BEGIN_CRITICAL_SECTION2(globals, builtins); specialize_load_global_lock_held(globals, builtins, instr, name); @@ -1898,7 +1898,7 @@ store_subscr_fail_kind(TyObject *container, TyObject *sub) #endif Ty_NO_INLINE void -_Py_Specialize_StoreSubscr(_PyStackRef container_st, _PyStackRef sub_st, _Py_CODEUNIT *instr) +_Py_Specialize_StoreSubscr(_PyStackRef container_st, _PyStackRef sub_st, _Ty_CODEUNIT *instr) { TyObject *container = PyStackRef_AsPyObjectBorrow(container_st); TyObject *sub = PyStackRef_AsPyObjectBorrow(sub_st); @@ -1969,7 +1969,7 @@ get_init_for_simple_managed_python_class(TyTypeObject *tp, unsigned int *tp_vers } static int -specialize_class_call(TyObject *callable, _Py_CODEUNIT *instr, int nargs) +specialize_class_call(TyObject *callable, _Ty_CODEUNIT *instr, int nargs) { assert(TyType_Check(callable)); TyTypeObject *tp = _TyType_CAST(callable); @@ -2022,7 +2022,7 @@ generic: } static int -specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr, +specialize_method_descriptor(PyMethodDescrObject *descr, _Ty_CODEUNIT *instr, int nargs) { switch (descr->d_method->ml_flags & @@ -2043,7 +2043,7 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr, } PyInterpreterState *interp = _TyInterpreterState_GET(); TyObject *list_append = interp->callable_cache.list_append; - _Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_CALL + 1]; + _Ty_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_CALL + 1]; bool pop = (next.op.code == POP_TOP); int oparg = instr->op.arg; if ((TyObject *)descr == list_append && oparg == 1 && pop) { @@ -2067,7 +2067,7 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr, } static int -specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs, +specialize_py_call(PyFunctionObject *func, _Ty_CODEUNIT *instr, int nargs, bool bound_method) { _PyCallCache *cache = (_PyCallCache *)(instr + 1); @@ -2106,7 +2106,7 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs, static int -specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs, +specialize_py_call_kw(PyFunctionObject *func, _Ty_CODEUNIT *instr, int nargs, bool bound_method) { _PyCallCache *cache = (_PyCallCache *)(instr + 1); @@ -2132,7 +2132,7 @@ specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs, } static int -specialize_c_call(TyObject *callable, _Py_CODEUNIT *instr, int nargs) +specialize_c_call(TyObject *callable, _Ty_CODEUNIT *instr, int nargs) { if (PyCFunction_GET_FUNCTION(callable) == NULL) { SPECIALIZATION_FAIL(CALL, SPEC_FAIL_OTHER); @@ -2178,7 +2178,7 @@ specialize_c_call(TyObject *callable, _Py_CODEUNIT *instr, int nargs) } Ty_NO_INLINE void -_Py_Specialize_Call(_PyStackRef callable_st, _Py_CODEUNIT *instr, int nargs) +_Py_Specialize_Call(_PyStackRef callable_st, _Ty_CODEUNIT *instr, int nargs) { TyObject *callable = PyStackRef_AsPyObjectBorrow(callable_st); @@ -2218,7 +2218,7 @@ _Py_Specialize_Call(_PyStackRef callable_st, _Py_CODEUNIT *instr, int nargs) } Ty_NO_INLINE void -_Py_Specialize_CallKw(_PyStackRef callable_st, _Py_CODEUNIT *instr, int nargs) +_Py_Specialize_CallKw(_PyStackRef callable_st, _Ty_CODEUNIT *instr, int nargs) { TyObject *callable = PyStackRef_AsPyObjectBorrow(callable_st); @@ -2573,7 +2573,7 @@ binary_op_extended_specialization(TyObject *lhs, TyObject *rhs, int oparg, } Ty_NO_INLINE void -_Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *instr, +_Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Ty_CODEUNIT *instr, int oparg, _PyStackRef *locals) { TyObject *lhs = PyStackRef_AsPyObjectBorrow(lhs_st); @@ -2593,7 +2593,7 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in break; } if (TyUnicode_CheckExact(lhs)) { - _Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_BINARY_OP + 1]; + _Ty_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_BINARY_OP + 1]; bool to_store = (next.op.code == STORE_FAST); if (to_store && PyStackRef_AsPyObjectBorrow(locals[next.op.arg]) == lhs) { specialize(instr, BINARY_OP_INPLACE_ADD_UNICODE); @@ -2735,7 +2735,7 @@ compare_op_fail_kind(TyObject *lhs, TyObject *rhs) #endif // Ty_STATS Ty_NO_INLINE void -_Py_Specialize_CompareOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *instr, +_Py_Specialize_CompareOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Ty_CODEUNIT *instr, int oparg) { TyObject *lhs = PyStackRef_AsPyObjectBorrow(lhs_st); @@ -2798,7 +2798,7 @@ unpack_sequence_fail_kind(TyObject *seq) #endif // Ty_STATS Ty_NO_INLINE void -_Py_Specialize_UnpackSequence(_PyStackRef seq_st, _Py_CODEUNIT *instr, int oparg) +_Py_Specialize_UnpackSequence(_PyStackRef seq_st, _Ty_CODEUNIT *instr, int oparg) { TyObject *seq = PyStackRef_AsPyObjectBorrow(seq_st); @@ -2905,7 +2905,7 @@ int #endif // Ty_STATS Ty_NO_INLINE void -_Py_Specialize_ForIter(_PyStackRef iter, _Py_CODEUNIT *instr, int oparg) +_Py_Specialize_ForIter(_PyStackRef iter, _Ty_CODEUNIT *instr, int oparg) { assert(ENABLE_SPECIALIZATION_FT); assert(_PyOpcode_Caches[FOR_ITER] == INLINE_CACHE_ENTRIES_FOR_ITER); @@ -2960,7 +2960,7 @@ failure: } Ty_NO_INLINE void -_Py_Specialize_Send(_PyStackRef receiver_st, _Py_CODEUNIT *instr) +_Py_Specialize_Send(_PyStackRef receiver_st, _Ty_CODEUNIT *instr) { TyObject *receiver = PyStackRef_AsPyObjectBorrow(receiver_st); @@ -3030,7 +3030,7 @@ check_type_always_true(TyTypeObject *ty) } Ty_NO_INLINE void -_Py_Specialize_ToBool(_PyStackRef value_o, _Py_CODEUNIT *instr) +_Py_Specialize_ToBool(_PyStackRef value_o, _Ty_CODEUNIT *instr) { assert(ENABLE_SPECIALIZATION_FT); assert(_PyOpcode_Caches[TO_BOOL] == INLINE_CACHE_ENTRIES_TO_BOOL); @@ -3104,7 +3104,7 @@ containsop_fail_kind(TyObject *value) { #endif Ty_NO_INLINE void -_Py_Specialize_ContainsOp(_PyStackRef value_st, _Py_CODEUNIT *instr) +_Py_Specialize_ContainsOp(_PyStackRef value_st, _Ty_CODEUNIT *instr) { TyObject *value = PyStackRef_AsPyObjectBorrow(value_st); @@ -3206,12 +3206,12 @@ static _PyCodeArray init_cleanup_tlbc = { const struct _PyCode8 _Py_InitCleanup = { _PyVarObject_HEAD_INIT(&TyCode_Type, 3), - .co_consts = (TyObject *)&_Py_SINGLETON(tuple_empty), - .co_names = (TyObject *)&_Py_SINGLETON(tuple_empty), - .co_exceptiontable = (TyObject *)&_Py_SINGLETON(bytes_empty), + .co_consts = (TyObject *)&_Ty_SINGLETON(tuple_empty), + .co_names = (TyObject *)&_Ty_SINGLETON(tuple_empty), + .co_exceptiontable = (TyObject *)&_Ty_SINGLETON(bytes_empty), .co_flags = CO_OPTIMIZED | CO_NO_MONITORING_EVENTS, - .co_localsplusnames = (TyObject *)&_Py_SINGLETON(tuple_empty), - .co_localspluskinds = (TyObject *)&_Py_SINGLETON(bytes_empty), + .co_localsplusnames = (TyObject *)&_Ty_SINGLETON(tuple_empty), + .co_localspluskinds = (TyObject *)&_Ty_SINGLETON(bytes_empty), .co_filename = &_Ty_ID(__init__), .co_name = &_Ty_ID(__init__), .co_qualname = &_Ty_ID(__init__), diff --git a/Python/symtable.c b/Python/symtable.c index c93c9dc..a397c21 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -415,7 +415,7 @@ _TySymtable_Build(mod_ty mod, TyObject *filename, _PyFutureFeatures *future) struct symtable *st = symtable_new(); asdl_stmt_seq *seq; Ty_ssize_t i; - PyThreadState *tstate; + TyThreadState *tstate; if (st == NULL) return NULL; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index ad8cfd5..28f1bf7 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -84,7 +84,7 @@ _TySys_GetRequiredAttr(TyObject *name) Ty_TYPE(name)->tp_name); return NULL; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *sysdict = tstate->interp->sysdict; if (sysdict == NULL) { TyErr_SetString(TyExc_RuntimeError, "no sys module"); @@ -100,7 +100,7 @@ _TySys_GetRequiredAttr(TyObject *name) TyObject * _TySys_GetRequiredAttrString(const char *name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *sysdict = tstate->interp->sysdict; if (sysdict == NULL) { TyErr_SetString(TyExc_RuntimeError, "no sys module"); @@ -123,7 +123,7 @@ _TySys_GetOptionalAttr(TyObject *name, TyObject **value) *value = NULL; return -1; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *sysdict = tstate->interp->sysdict; if (sysdict == NULL) { *value = NULL; @@ -135,7 +135,7 @@ _TySys_GetOptionalAttr(TyObject *name, TyObject **value) int _TySys_GetOptionalAttrString(const char *name, TyObject **value) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *sysdict = tstate->interp->sysdict; if (sysdict == NULL) { *value = NULL; @@ -147,7 +147,7 @@ _TySys_GetOptionalAttrString(const char *name, TyObject **value) TyObject * TySys_GetObject(const char *name) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *sysdict = tstate->interp->sysdict; if (sysdict == NULL) { return NULL; @@ -241,7 +241,7 @@ should_audit(PyInterpreterState *interp) static int -sys_audit_tstate(PyThreadState *ts, const char *event, +sys_audit_tstate(TyThreadState *ts, const char *event, const char *argFormat, va_list vargs) { assert(event != NULL); @@ -368,7 +368,7 @@ exit: } int -_TySys_Audit(PyThreadState *tstate, const char *event, +_TySys_Audit(TyThreadState *tstate, const char *event, const char *argFormat, ...) { va_list vargs; @@ -381,7 +381,7 @@ _TySys_Audit(PyThreadState *tstate, const char *event, int TySys_Audit(const char *event, const char *argFormat, ...) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); va_list vargs; va_start(vargs, argFormat); int res = sys_audit_tstate(tstate, event, argFormat, vargs); @@ -410,7 +410,7 @@ TySys_AuditTuple(const char *event, TyObject *args) * * Must be finalizing to clear hooks */ void -_TySys_ClearAuditHooks(PyThreadState *ts) +_TySys_ClearAuditHooks(TyThreadState *ts) { assert(ts != NULL); if (!ts) { @@ -419,7 +419,7 @@ _TySys_ClearAuditHooks(PyThreadState *ts) _PyRuntimeState *runtime = ts->interp->runtime; /* The hooks are global so we have to check for runtime finalization. */ - PyThreadState *finalizing = _PyRuntimeState_GetFinalizing(runtime); + TyThreadState *finalizing = _PyRuntimeState_GetFinalizing(runtime); assert(finalizing == ts); if (finalizing != ts) { return; @@ -470,7 +470,7 @@ TySys_AddAuditHook(Ty_AuditHookFunction hook, void *userData) /* tstate can be NULL, so access directly _PyRuntime: TySys_AddAuditHook() can be called before Python is initialized. */ _PyRuntimeState *runtime = &_PyRuntime; - PyThreadState *tstate; + TyThreadState *tstate; if (runtime->initialized) { tstate = _TyThreadState_GET(); } @@ -522,7 +522,7 @@ static TyObject * sys_addaudithook_impl(TyObject *module, TyObject *hook) /*[clinic end generated code: output=4f9c17aaeb02f44e input=0f3e191217a45e34]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* Invoke existing audit hooks to allow them an opportunity to abort. */ if (_TySys_Audit(tstate, "sys.addaudithook", NULL) < 0) { @@ -565,7 +565,7 @@ static TyObject * sys_audit_impl(TyObject *module, const char *event, TyObject *args) /*[clinic end generated code: output=1d0fc82da768f49d input=ec3b688527945109]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _Ty_EnsureTstateNotNULL(tstate); if (!should_audit(tstate->interp)) { @@ -584,7 +584,7 @@ sys_audit_impl(TyObject *module, const char *event, TyObject *args) static TyObject * sys_breakpointhook(TyObject *self, TyObject *const *args, Ty_ssize_t nargs, TyObject *keywords) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(!_TyErr_Occurred(tstate)); char *envar = Ty_GETENV("PYTHONBREAKPOINT"); @@ -753,7 +753,7 @@ sys_displayhook(TyObject *module, TyObject *o) { TyObject *outf; TyObject *builtins; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); builtins = TyImport_GetModule(&_Ty_ID(builtins)); if (builtins == NULL) { @@ -1069,7 +1069,7 @@ static TyObject *whatstrings[8] = { static TyObject * -call_trampoline(PyThreadState *tstate, TyObject* callback, +call_trampoline(TyThreadState *tstate, TyObject* callback, PyFrameObject *frame, int what, TyObject *arg) { /* call the Python-level function */ @@ -1086,7 +1086,7 @@ static int profile_trampoline(TyObject *self, PyFrameObject *frame, int what, TyObject *arg) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *result = call_trampoline(tstate, self, frame, what, arg); if (result == NULL) { _TyEval_SetProfile(tstate, NULL, NULL); @@ -1112,7 +1112,7 @@ trace_trampoline(TyObject *self, PyFrameObject *frame, return 0; } - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *result = call_trampoline(tstate, callback, frame, what, arg); if (result == NULL) { _TyEval_SetTrace(tstate, NULL, NULL); @@ -1145,7 +1145,7 @@ static TyObject * sys_settrace(TyObject *module, TyObject *function) /*[clinic end generated code: output=999d12e9d6ec4678 input=8107feb01c5f1c4e]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (function == Ty_None) { if (_TyEval_SetTrace(tstate, NULL, NULL) < 0) { return NULL; @@ -1201,7 +1201,7 @@ static TyObject * sys_gettrace_impl(TyObject *module) /*[clinic end generated code: output=e97e3a4d8c971b6e input=373b51bb2147f4d8]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *temp = tstate->c_traceobj; if (temp == NULL) @@ -1225,7 +1225,7 @@ static TyObject * sys_setprofile(TyObject *module, TyObject *function) /*[clinic end generated code: output=1c3503105939db9c input=055d0d7961413a62]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (function == Ty_None) { if (_TyEval_SetProfile(tstate, NULL, NULL) < 0) { return NULL; @@ -1280,7 +1280,7 @@ static TyObject * sys_getprofile_impl(TyObject *module) /*[clinic end generated code: output=579b96b373448188 input=1b3209d89a32965d]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *temp = tstate->c_profileobj; if (temp == NULL) @@ -1349,7 +1349,7 @@ static TyObject * sys_setrecursionlimit_impl(TyObject *module, int new_limit) /*[clinic end generated code: output=35e1c64754800ace input=b0f7a23393924af3]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (new_limit < 1) { _TyErr_SetString(tstate, TyExc_ValueError, @@ -1560,7 +1560,7 @@ static PyStructSequence_Desc hash_info_desc = { }; static TyObject * -get_hash_info(PyThreadState *tstate) +get_hash_info(TyThreadState *tstate) { TyObject *hash_info; int field = 0; @@ -1924,7 +1924,7 @@ _TySys_GetSizeOf(TyObject *o) TyObject *res = NULL; TyObject *method; Ty_ssize_t size; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* Make sure the type is initialized. float gets initialized late */ if (TyType_Ready(Ty_TYPE(o)) < 0) { @@ -1975,7 +1975,7 @@ sys_getsizeof(TyObject *self, TyObject *args, TyObject *kwds) static char *kwlist[] = {"object", "default", 0}; size_t size; TyObject *o, *dflt = NULL; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (!TyArg_ParseTupleAndKeywords(args, kwds, "O|O:getsizeof", kwlist, &o, &dflt)) { @@ -2095,7 +2095,7 @@ static TyObject * sys__getframe_impl(TyObject *module, int depth) /*[clinic end generated code: output=d438776c04d59804 input=c1be8a6464b11ee5]*/ { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _PyInterpreterFrame *frame = tstate->current_frame; if (frame != NULL) { @@ -2969,10 +2969,10 @@ _clear_preinit_entries(_Ty_PreInitEntry *optionlist) } -PyStatus +TyStatus _TySys_ReadPreinitWarnOptions(PyWideStringList *options) { - PyStatus status; + TyStatus status; _Ty_PreInitEntry entry; for (entry = _preinit_warnoptions; entry != NULL; entry = entry->next) { @@ -2987,10 +2987,10 @@ _TySys_ReadPreinitWarnOptions(PyWideStringList *options) } -PyStatus +TyStatus _TySys_ReadPreinitXOptions(PyConfig *config) { - PyStatus status; + TyStatus status; _Ty_PreInitEntry entry; for (entry = _preinit_xoptions; entry != NULL; entry = entry->next) { @@ -3006,7 +3006,7 @@ _TySys_ReadPreinitXOptions(PyConfig *config) static TyObject * -get_warnoptions(PyThreadState *tstate) +get_warnoptions(TyThreadState *tstate) { TyObject *warnoptions; if (_TySys_GetOptionalAttr(&_Ty_ID(warnoptions), &warnoptions) < 0) { @@ -3039,7 +3039,7 @@ get_warnoptions(PyThreadState *tstate) void TySys_ResetWarnOptions(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate == NULL) { _clear_preinit_entries(&_preinit_warnoptions); return; @@ -3057,7 +3057,7 @@ TySys_ResetWarnOptions(void) } static int -_TySys_AddWarnOptionWithError(PyThreadState *tstate, TyObject *option) +_TySys_AddWarnOptionWithError(TyThreadState *tstate, TyObject *option) { assert(tstate != NULL); TyObject *warnoptions = get_warnoptions(tstate); @@ -3076,7 +3076,7 @@ _TySys_AddWarnOptionWithError(PyThreadState *tstate, TyObject *option) PyAPI_FUNC(void) TySys_AddWarnOptionUnicode(TyObject *option) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); _Ty_EnsureTstateNotNULL(tstate); assert(!_TyErr_Occurred(tstate)); if (_TySys_AddWarnOptionWithError(tstate, option) < 0) { @@ -3089,7 +3089,7 @@ TySys_AddWarnOptionUnicode(TyObject *option) PyAPI_FUNC(void) TySys_AddWarnOption(const wchar_t *s) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate == NULL) { _append_preinit_entry(&_preinit_warnoptions, s); return; @@ -3121,7 +3121,7 @@ TySys_HasWarnOptions(void) } static TyObject * -get_xoptions(PyThreadState *tstate) +get_xoptions(TyThreadState *tstate) { TyObject *xoptions; if (_TySys_GetOptionalAttr(&_Ty_ID(_xoptions), &xoptions) < 0) { @@ -3156,7 +3156,7 @@ _TySys_AddXOptionWithError(const wchar_t *s) { TyObject *name = NULL, *value = NULL; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *opts = get_xoptions(tstate); if (opts == NULL) { goto error; @@ -3199,7 +3199,7 @@ error: PyAPI_FUNC(void) TySys_AddXOption(const wchar_t *s) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (tstate == NULL) { _append_preinit_entry(&_preinit_xoptions, s); return; @@ -3213,7 +3213,7 @@ TySys_AddXOption(const wchar_t *s) TyObject * TySys_GetXOptions(void) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *opts = get_xoptions(tstate); Ty_XDECREF(opts); return opts; @@ -3499,7 +3499,7 @@ static PyStructSequence_Desc version_info_desc = { }; static TyObject * -make_version_info(PyThreadState *tstate) +make_version_info(TyThreadState *tstate) { TyObject *version_info; char *s; @@ -3762,8 +3762,8 @@ static struct TyModuleDef sysmodule = { #define SET_SYS_FROM_STRING(key, value) \ SET_SYS(key, TyUnicode_FromString(value)) -static PyStatus -_TySys_InitCore(PyThreadState *tstate, TyObject *sysdict) +static TyStatus +_TySys_InitCore(TyThreadState *tstate, TyObject *sysdict) { TyObject *version_info; int res; @@ -3892,7 +3892,7 @@ err_occurred: // Update sys attributes for a new PyConfig configuration. // This function also adds attributes that _TySys_InitCore() didn't add. int -_TySys_UpdateConfig(PyThreadState *tstate) +_TySys_UpdateConfig(TyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; TyObject *sysdict = interp->sysdict; @@ -3981,7 +3981,7 @@ err_occurred: infrastructure for the io module in place. Use UTF-8/backslashreplace and ignore EAGAIN errors. */ -static PyStatus +static TyStatus _TySys_SetPreliminaryStderr(TyObject *sysdict) { TyObject *pstderr = TyFile_NewStdPrinter(fileno(stderr)); @@ -4071,8 +4071,8 @@ static struct TyModuleDef _jit_module = { /* Create sys module without all attributes. _TySys_UpdateConfig() should be called later to add remaining attributes. */ -PyStatus -_TySys_Create(PyThreadState *tstate, TyObject **sysmod_p) +TyStatus +_TySys_Create(TyThreadState *tstate, TyObject **sysmod_p) { assert(!_TyErr_Occurred(tstate)); @@ -4106,7 +4106,7 @@ _TySys_Create(PyThreadState *tstate, TyObject **sysmod_p) goto error; } - PyStatus status = _TySys_SetPreliminaryStderr(sysdict); + TyStatus status = _TySys_SetPreliminaryStderr(sysdict); if (_TyStatus_EXCEPTION(status)) { return status; } @@ -4238,7 +4238,7 @@ void TySys_SetArgvEx(int argc, wchar_t **argv, int updatepath) { wchar_t* empty_argv[1] = {L""}; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (argc < 1 || argv == NULL) { /* Ensure at least one (empty) argument is seen */ @@ -4359,7 +4359,7 @@ sys_write(TyObject *key, FILE *fp, const char *format, va_list va) TyObject *file; char buffer[1001]; int written; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *exc = _TyErr_GetRaisedException(tstate); written = TyOS_vsnprintf(buffer, sizeof(buffer), format, va); @@ -4402,7 +4402,7 @@ sys_format(TyObject *key, FILE *fp, const char *format, va_list va) { TyObject *file, *message; const char *utf8; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); TyObject *exc = _TyErr_GetRaisedException(tstate); message = TyUnicode_FromFormatV(format, va); diff --git a/Python/thread.c b/Python/thread.c index 20e82fa..98bfbeb 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -132,7 +132,7 @@ PyLockStatus PyThread_acquire_lock_timed_with_retries(PyThread_type_lock lock, PY_TIMEOUT_T timeout) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); PyTime_t endtime = 0; if (timeout > 0) { endtime = _PyDeadline_Init(timeout); diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 38f700e..5b3e8f5 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -199,7 +199,7 @@ PyThread_start_joinable_thread(void (*func)(void *), void *arg, return -1; obj->func = func; obj->arg = arg; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); size_t stacksize = tstate ? tstate->interp->threads.stacksize : 0; hThread = (HANDLE)_beginthreadex(0, Ty_SAFE_DOWNCAST(stacksize, Ty_ssize_t, unsigned int), diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index dc76cca..1629e02 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -263,7 +263,7 @@ do_start_joinable_thread(void (*func)(void *), void *arg, pthread_t* out_id) return -1; #endif #if defined(THREAD_STACK_SIZE) - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); size_t stacksize = tstate ? tstate->interp->threads.stacksize : 0; tss = (stacksize != 0) ? stacksize : THREAD_STACK_SIZE; if (tss != 0) { diff --git a/Python/traceback.c b/Python/traceback.c index 2c8da03..44fe151 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -335,7 +335,7 @@ void _TyTraceback_Add(const char *funcname, const char *filename, int lineno) TyObject *globals; PyCodeObject *code; PyFrameObject *frame; - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); /* Save and clear the current exception. Python functions must not be called with an exception set. Calling Python functions happens when @@ -398,7 +398,7 @@ _Ty_FindSourceFile(TyObject *filename, char* namebuf, size_t namelen, TyObject * tail++; taillen = strlen(tail); - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); if (_TySys_GetOptionalAttr(&_Ty_ID(path), &syspath) < 0) { TyErr_Clear(); goto error; @@ -1017,7 +1017,7 @@ dump_frame(int fd, _PyInterpreterFrame *frame) } static int -tstate_is_freed(PyThreadState *tstate) +tstate_is_freed(TyThreadState *tstate) { if (_TyMem_IsPtrFreed(tstate)) { return 1; @@ -1037,7 +1037,7 @@ interp_is_freed(PyInterpreterState *interp) static void -dump_traceback(int fd, PyThreadState *tstate, int write_header) +dump_traceback(int fd, TyThreadState *tstate, int write_header) { if (write_header) { PUTS(fd, "Stack (most recent call first):\n"); @@ -1092,7 +1092,7 @@ dump_traceback(int fd, PyThreadState *tstate, int write_header) The caller is responsible to call TyErr_CheckSignals() to call Python signal handlers if signals were received. */ void -_Ty_DumpTraceback(int fd, PyThreadState *tstate) +_Ty_DumpTraceback(int fd, TyThreadState *tstate) { dump_traceback(fd, tstate, 1); } @@ -1114,7 +1114,7 @@ _Ty_DumpTraceback(int fd, PyThreadState *tstate) This function is signal safe. */ static void -write_thread_id(int fd, PyThreadState *tstate, int is_current) +write_thread_id(int fd, TyThreadState *tstate, int is_current) { if (is_current) PUTS(fd, "Current thread 0x"); @@ -1155,7 +1155,7 @@ write_thread_id(int fd, PyThreadState *tstate, int is_current) handlers if signals were received. */ const char* _Ty_DumpTracebackThreads(int fd, PyInterpreterState *interp, - PyThreadState *current_tstate) + TyThreadState *current_tstate) { if (current_tstate == NULL) { /* _Ty_DumpTracebackThreads() is called from signal handlers by @@ -1195,7 +1195,7 @@ _Ty_DumpTracebackThreads(int fd, PyInterpreterState *interp, } /* Get the current interpreter from the current thread */ - PyThreadState *tstate = TyInterpreterState_ThreadHead(interp); + TyThreadState *tstate = TyInterpreterState_ThreadHead(interp); if (tstate == NULL) return "unable to get the thread head state"; diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c index ea3c881..8c25727 100644 --- a/Python/tracemalloc.c +++ b/Python/tracemalloc.c @@ -298,7 +298,7 @@ traceback_hash(traceback_t *traceback) static void traceback_get_frames(traceback_t *traceback) { - PyThreadState *tstate = _TyThreadState_GET(); + TyThreadState *tstate = _TyThreadState_GET(); assert(tstate != NULL); _PyInterpreterFrame *pyframe = _TyThreadState_GetFrame(tstate); @@ -726,7 +726,7 @@ tracemalloc_clear_traces_unlocked(void) } -PyStatus +TyStatus _PyTraceMalloc_Init(void) { assert(tracemalloc_config.initialized == TRACEMALLOC_NOT_INITIALIZED); diff --git a/Python/uniqueid.c b/Python/uniqueid.c index 50e0831..7428d0c 100644 --- a/Python/uniqueid.c +++ b/Python/uniqueid.c @@ -162,7 +162,7 @@ _TyObject_ThreadIncrefSlow(TyObject *obj, size_t idx) assert(idx < (size_t)tstate->refcounts.size); tstate->refcounts.values[idx]++; #ifdef Ty_REF_DEBUG - _Ty_IncRefTotal((PyThreadState *)tstate); + _Ty_IncRefTotal((TyThreadState *)tstate); #endif _Ty_INCREF_STAT_INC(); } diff --git a/Tools/jit/shim.c b/Tools/jit/shim.c index 749a243..bd89d3f 100644 --- a/Tools/jit/shim.c +++ b/Tools/jit/shim.c @@ -7,7 +7,7 @@ #include "jit.h" _Ty_CODEUNIT * -_JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate) +_JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, TyThreadState *tstate) { // Note that this is *not* a tail call: PATCH_VALUE(jit_func_preserve_none, call, _JIT_CONTINUE); diff --git a/Tools/jit/template.c b/Tools/jit/template.c index 6b76757..9818f01 100644 --- a/Tools/jit/template.c +++ b/Tools/jit/template.c @@ -89,7 +89,7 @@ do { \ #define TIER_TWO 2 __attribute__((preserve_none)) _Ty_CODEUNIT * -_JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate) +_JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, TyThreadState *tstate) { // Locals that the instruction implementations expect to exist: PATCH_VALUE(_PyExecutorObject *, current_executor, _JIT_EXECUTOR)