Cleanup accessing/decref of globals, to avoid code bloat in init function.

This commit is contained in:
Andrew Rogers 2018-11-27 23:30:51 +00:00
commit 0fecd1538f
2 changed files with 13 additions and 18 deletions

View file

@ -227,11 +227,7 @@ SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void
SWIGINTERN PyObject *
SWIG_globals(void) {
static PyObject *_SWIG_globals = 0;
if (!_SWIG_globals) {
_SWIG_globals = SWIG_newvarlink();
} else {
Py_INCREF(_SWIG_globals);
}
if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
return _SWIG_globals;
}