@@ -125,6 +125,18 @@ get_c_recursion_remaining(PyObject *self, PyObject *Py_UNUSED(args))
125
125
return PyLong_FromLong (remaining );
126
126
}
127
127
128
+ static PyObject *
129
+ get_stack_pointer (PyObject * self , PyObject * Py_UNUSED (args ))
130
+ {
131
+ uintptr_t here_addr = _Py_get_machine_stack_pointer ();
132
+ return PyLong_FromSize_t (here_addr );
133
+ }
134
+
135
+ static PyObject *
136
+ get_stack_margin (PyObject * self , PyObject * Py_UNUSED (args ))
137
+ {
138
+ return PyLong_FromSize_t (_PyOS_STACK_MARGIN_BYTES );
139
+ }
128
140
129
141
static PyObject *
130
142
test_bswap (PyObject * self , PyObject * Py_UNUSED (args ))
@@ -2390,6 +2402,8 @@ static PyMethodDef module_functions[] = {
2390
2402
{"get_configs" , get_configs , METH_NOARGS },
2391
2403
{"get_recursion_depth" , get_recursion_depth , METH_NOARGS },
2392
2404
{"get_c_recursion_remaining" , get_c_recursion_remaining , METH_NOARGS },
2405
+ {"get_stack_pointer" , get_stack_pointer , METH_NOARGS },
2406
+ {"get_stack_margin" , get_stack_margin , METH_NOARGS },
2393
2407
{"test_bswap" , test_bswap , METH_NOARGS },
2394
2408
{"test_popcount" , test_popcount , METH_NOARGS },
2395
2409
{"test_bit_length" , test_bit_length , METH_NOARGS },
0 commit comments