8000 GH-131288: Use `_AddressOfReturnAddress` for MSVC in pycore_ceval.h (… · seehwan/cpython@138d688 · GitHub
[go: up one dir, main page]

Skip to content

Commit 138d688

Browse files
chris-eiblseehwan80
authored andcommitted
pythonGH-131288: Use _AddressOfReturnAddress for MSVC in pycore_ceval.h (pythongh-131289)
Use `_AddressOfReturnAddress` in `_Py_get_machine_stack_pointer` to silence MSVC warning in pycore_ceval.h for release builds.
1 parent f018c93 commit 138d688

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Include/internal/pycore_ceval.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ extern void _PyEval_DeactivateOpCache(void);
196196

197197
/* --- _Py_EnterRecursiveCall() ----------------------------------------- */
198198

199-
#if !_Py__has_builtin(__builtin_frame_address)
199+
#if !_Py__has_builtin(__builtin_frame_address) && !defined(_MSC_VER)
200200
static uintptr_t return_pointer_as_int(char* p) {
201201
return (uintptr_t)p;
202202
}
@@ -206,6 +206,8 @@ static inline uintptr_t
206206
_Py_get_machine_stack_pointer(void) {
207207
#if _Py__has_builtin(__builtin_frame_address)
208208
return (uintptr_t)__builtin_frame_address(0);
209+
#elif defined(_MSC_VER)
210+
return (uintptr_t)_AddressOfReturnAddress();
209211
#else
210212
char here;
211213
/* Avoid compiler warning about returning stack address */

0 commit comments

Comments
 (0)
0