Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit efb61d4

Browse files
committed
Fix compatibility with ISO C90
1 parent 7f2631e commit efb61d4

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

pythoncapi_compat.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)
8484
static inline PyCodeObject*
8585
PyFrame_GetCode(PyFrameObject *frame)
8686
{
87+
PyCodeObject *code;
8788
assert(frame != NULL);
88-
PyCodeObject *code = frame->f_code;
89+
code = frame->f_code;
8990
assert(code != NULL);
9091
Py_INCREF(code);
9192
return code;
@@ -106,8 +107,9 @@ _PyFrame_GetCodeBorrow(PyFrameObject *frame)
106107
static inline PyFrameObject*
107108
PyFrame_GetBack(PyFrameObject *frame)
108109
{
110+
PyFrameObject *back;
109111
assert(frame != NULL);
110-
PyFrameObject *back = frame->f_back;
112+
back = frame->f_back;
111113
Py_XINCREF(back);
112114
return back;
113115
}
@@ -138,8 +140,9 @@ PyThreadState_GetInterpreter(PyThreadState *tstate)
138140
static inline PyFrameObject*
139141
PyThreadState_GetFrame(PyThreadState *tstate)
140142
{
143+
PyFrameObject *frame;
141144
assert(tstate != NULL);
142-
PyFrameObject *frame = tstate->frame;
145+
frame = tstate->frame;
143146
Py_XINCREF(frame);
144147
return frame;
145148
}
@@ -159,11 +162,14 @@ _PyThreadState_GetFrameBorrow(PyThreadState *tstate)
159162
static inline PyInterpreterState *
160163
PyInterpreterState_Get(void)
161164
{
162-
PyThreadState *tstate = PyThreadState_GET();
165+
PyThreadState *tstate;
166+
PyInterpreterState *interp;
167+
168+
tstate = PyThreadState_GET();
163169
if (tstate == NULL) {
164170
Py_FatalError("GIL released (tstate is NULL)");
165171
}
166-
PyInterpreterState *interp = tstate->interp;
172+
interp = tstate->interp;
167173
if (interp == NULL) {
168174
Py_FatalError("no current interpreter");
169175
}
@@ -209,14 +215,16 @@ PyObject_CallOneArg(PyObject *func, PyObject *arg)
209215
static inline int
210216
PyModule_AddType(PyObject *module, PyTypeObject *type)
211217
{
218+
const char *name, *dot;
219+
212220
if (PyType_Ready(type) < 0) {
213221
return -1;
214222
}
215223

216224
// inline _PyType_Name()
217-
const char *name = type->tp_name;
225+
name = type->tp_name;
218226
assert(name != NULL);
219-
const char *dot = strrchr(name, '.');
227+
dot = strrchr(name, '.');
220228
if (dot != NULL) {
221229
name = dot + 1;
222230
}

0 commit comments

Comments
 (0)