summaryrefslogtreecommitdiffstats
path: root/Include/pystate.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-12-21 18:28:10 (GMT)
committerGuido van Rossum <guido@python.org>1998-12-21 18:28:10 (GMT)
commit275ea67e6b272234c3bccfedf0085308f8969412 (patch)
tree18bf74c6323cbbe60407f6471babd41274d96e14 /Include/pystate.h
parent18bc7c227676c91a6cfe97cd571bd0a5a187e373 (diff)
downloadcpython-275ea67e6b272234c3bccfedf0085308f8969412.zip
cpython-275ea67e6b272234c3bccfedf0085308f8969412.tar.gz
cpython-275ea67e6b272234c3bccfedf0085308f8969412.tar.bz2
Add macro version of PyThreadState_GET(). This uses
_PyThreadState_Current, defined in pystate.c.
Diffstat (limited to 'Include/pystate.h')
-rw-r--r--Include/pystate.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/pystate.h b/Include/pystate.h
index 8a58a39..f6a26fd 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -101,6 +101,17 @@ DL_IMPORT(PyThreadState *) PyThreadState_Get Py_PROTO((void));
DL_IMPORT(PyThreadState *) PyThreadState_Swap Py_PROTO((PyThreadState *));
DL_IMPORT(PyObject *) PyThreadState_GetDict Py_PROTO((void));
+
+/* Variable and macro for in-line access to current thread state */
+
+DL_IMPORT(PyThreadState *) _PyThreadState_Current;
+
+#ifdef Py_DEBUG
+#define PyThreadState_GET() PyThreadState_Get()
+#else
+#define PyThreadState_GET() (_PyThreadState_Current)
+#endif
+
#ifdef __cplusplus
}
#endif