summaryrefslogtreecommitdiffstats
path: root/Include/pystate.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2019-02-23 18:35:52 (GMT)
committerGitHub <noreply@github.com>2019-02-23 18:35:52 (GMT)
commitbe3b295838547bba267eb08434b418ef0df87ee0 (patch)
tree8daa92ecd7088d6ace08833f64ba2251be9b310f /Include/pystate.h
parent175421b58cc97a2555e474f479f30a6c5d2250b0 (diff)
downloadcpython-be3b295838547bba267eb08434b418ef0df87ee0.zip
cpython-be3b295838547bba267eb08434b418ef0df87ee0.tar.gz
cpython-be3b295838547bba267eb08434b418ef0df87ee0.tar.bz2
bpo-35886: Make PyInterpreterState an opaque type in the public API. (GH-11731)
Move PyInterpreterState into the "internal" header files.
Diffstat (limited to 'Include/pystate.h')
-rw-r--r--Include/pystate.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/Include/pystate.h b/Include/pystate.h
index ba5e988..a541dc8 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -20,22 +20,20 @@ struct _frame;
struct _ts;
struct _is;
-#ifdef Py_LIMITED_API
+/* struct _ts is defined in cpython/pystate.h */
typedef struct _ts PyThreadState;
+/* struct _is is defined in internal/pycore_pystate.h */
typedef struct _is PyInterpreterState;
-#else
-/* PyThreadState and PyInterpreterState are defined in cpython/pystate.h */
-#endif
/* State unique per thread */
-PyAPI_FUNC(struct _is *) PyInterpreterState_New(void);
-PyAPI_FUNC(void) PyInterpreterState_Clear(struct _is *);
-PyAPI_FUNC(void) PyInterpreterState_Delete(struct _is *);
+PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
+PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
+PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
/* New in 3.7 */
-PyAPI_FUNC(int64_t) PyInterpreterState_GetID(struct _is *);
+PyAPI_FUNC(int64_t) PyInterpreterState_GetID(PyInterpreterState *);
#endif
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
/* New in 3.3 */
@@ -44,9 +42,9 @@ PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*);
#endif
PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*);
-PyAPI_FUNC(struct _ts *) PyThreadState_New(struct _is *);
-PyAPI_FUNC(void) PyThreadState_Clear(struct _ts *);
-PyAPI_FUNC(void) PyThreadState_Delete(struct _ts *);
+PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
+PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
+PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
/* Get the current thread state.
@@ -57,7 +55,7 @@ PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
The caller must hold the GIL.
See also PyThreadState_GET() and _PyThreadState_GET(). */
-PyAPI_FUNC(struct _ts *) PyThreadState_Get(void);
+PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
/* Get the current Python thread state.
@@ -70,7 +68,7 @@ PyAPI_FUNC(struct _ts *) PyThreadState_Get(void);
See also PyThreadState_Get() and _PyThreadState_GET(). */
#define PyThreadState_GET() PyThreadState_Get()
-PyAPI_FUNC(struct _ts *) PyThreadState_Swap(struct _ts *);
+PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *);
@@ -118,7 +116,7 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
thread-state, even if no auto-thread-state call has been made
on the main thread.
*/
-PyAPI_FUNC(struct _ts *) PyGILState_GetThisThreadState(void);
+PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
#ifndef Py_LIMITED_API