Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Try a fix
  • Loading branch information
Fidget-Spinner committed Mar 27, 2026
commit bde6c5bbf46134c75638ded1ab57e544a0178a68
6 changes: 0 additions & 6 deletions Include/internal/pycore_pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,6 @@ _Py_AssertHoldsTstateFunc(const char *func)
#define _Py_AssertHoldsTstate()
#endif

#if !_Py__has_builtin(__builtin_frame_address) && !defined(__GNUC__) && !defined(_MSC_VER)
static uintptr_t return_pointer_as_int(char* p) {
return (uintptr_t)p;
}
#endif

PyAPI_DATA(uintptr_t) _Py_get_machine_stack_pointer(void);

static inline intptr_t
Expand Down
12 changes: 5 additions & 7 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3287,15 +3287,13 @@ _Py_GetMainConfig(void)
return _PyInterpreterState_GetConfig(interp);
}

uintptr_t
static uintptr_t return_pointer_as_int(char* p) {
return (uintptr_t)p;
}

Py_NO_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
}
Loading