Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions Include/internal/pycore_pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,7 @@ static uintptr_t return_pointer_as_int(char* p) {
}
#endif

static inline uintptr_t
_Py_get_machine_stack_pointer(void) {
#if _Py__has_builtin(__builtin_frame_address) || defined(__GNUC__)
return (uintptr_t)__builtin_frame_address(0);
#elif defined(_MSC_VER)
return (uintptr_t)_AddressOfReturnAddress();
#else
char here;
/* Avoid compiler warning about returning stack address */
return return_pointer_as_int(&here);
#endif
}
PyAPI_DATA(uintptr_t) _Py_get_machine_stack_pointer(void);

static inline intptr_t
_Py_RecursionLimit_GetMargin(PyThreadState *tstate)
Expand Down
13 changes: 13 additions & 0 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3286,3 +3286,16 @@ _Py_GetMainConfig(void)
}
return _PyInterpreterState_GetConfig(interp);
}

uintptr_t
_Py_get_machine_stack_pointer(void) {
#if _Py__has_builtin(__builtin_frame_address) || defined(__GNUC__)
return (uintptr_t)__builtin_frame_address(0);
#elif defined(_MSC_VER)
return (uintptr_t)_AddressOfReturnAddress();
#else
char here;
/* Avoid compiler warning about returning stack address */
return return_pointer_as_int(&here);
#endif
}
Loading