@@ -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 ))
@@ -2381,6 +2393,8 @@ static PyMethodDef module_functions[] = {
2381
2393
{"get_configs" , get_configs , METH_NOARGS },
2382
2394
{"get_recursion_depth" , get_recursion_depth , METH_NOARGS },
2383
2395
{"get_c_recursion_remaining" , get_c_recursion_remaining , METH_NOARGS },
2396
+ {"get_stack_pointer" , get_stack_pointer , METH_NOARGS },
2397
+ {"get_stack_margin" , get_stack_margin , METH_NOARGS },
2384
2398
{"test_bswap" , test_bswap , METH_NOARGS },
2385
2399
{"test_popcount" , test_popcount , METH_NOARGS },
2386
2400
{"test_bit_length" , test_bit_length , METH_NOARGS },
0 commit comments