File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -306,16 +306,13 @@ _Py_AssertHoldsTstateFunc(const char *func)
306306#define _Py_AssertHoldsTstate ()
307307#endif
308308
309+ #if !_Py__has_builtin (__builtin_frame_address ) && !defined(__GNUC__ ) && !defined(_MSC_VER )
309310static uintptr_t return_pointer_as_int (char * p ) {
310311 return (uintptr_t )p ;
311312}
313+ #endif
312314
313- static inline uintptr_t
314- _Py_get_machine_stack_pointer (void ) {
315- char here ;
316- /* Avoid compiler warning about returning stack address */
317- return return_pointer_as_int (& here );
318- }
315+ PyAPI_DATA (uintptr_t ) _Py_get_machine_stack_pointer (void );
319316
320317static inline intptr_t
321318_Py_RecursionLimit_GetMargin (PyThreadState * tstate )
Original file line number Diff line number Diff line change @@ -3286,3 +3286,16 @@ _Py_GetMainConfig(void)
32863286 }
32873287 return _PyInterpreterState_GetConfig (interp );
32883288}
3289+
3290+ uintptr_t
3291+ _Py_get_machine_stack_pointer (void ) {
3292+ #if _Py__has_builtin (__builtin_frame_address ) || defined(__GNUC__ )
3293+ return (uintptr_t )__builtin_frame_address (0 );
3294+ #elif defined(_MSC_VER )
3295+ return (uintptr_t )_AddressOfReturnAddress ();
3296+ #else
3297+ char here ;
3298+ /* Avoid compiler warning about returning stack address */
3299+ return return_pointer_as_int (& here );
3300+ #endif
3301+ }
You can’t perform that action at this time.
0 commit comments