]> granicus.if.org Git - python/commitdiff
bpo-30866: Add _testcapi.stack_pointer() (#2601)
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 10 Jul 2017 12:37:49 +0000 (14:37 +0200)
committerGitHub <noreply@github.com>
Mon, 10 Jul 2017 12:37:49 +0000 (14:37 +0200)
Modules/_testcapimodule.c

index c9c279864369b3514305f539f0b13f4b9afc5468..655669050dd22216706d4dc8e090a0f6a847d3b7 100644 (file)
@@ -4272,6 +4272,13 @@ test_pyobject_fastcallkeywords(PyObject *self, PyObject *args)
     return _PyObject_FastCallKeywords(func, stack, nargs, kwnames);
 }
 
+static PyObject*
+stack_pointer(PyObject *self, PyObject *args)
+{
+    int v = 5;
+    return PyLong_FromVoidPtr(&v);
+}
+
 
 static PyMethodDef TestMethods[] = {
     {"raise_exception",         raise_exception,                 METH_VARARGS},
@@ -4485,6 +4492,7 @@ static PyMethodDef TestMethods[] = {
     {"pyobject_fastcall", test_pyobject_fastcall, METH_VARARGS},
     {"pyobject_fastcalldict", test_pyobject_fastcalldict, METH_VARARGS},
     {"pyobject_fastcallkeywords", test_pyobject_fastcallkeywords, METH_VARARGS},
+    {"stack_pointer", stack_pointer, METH_NOARGS},
     {NULL, NULL} /* sentinel */
 };