Skip to content

Commit

Permalink
avoid interleaving pywsgi threadstate
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Aug 19, 2024
1 parent 52d858a commit a374e00
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions plugins/pyuwsgi/pyuwsgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ pyuwsgi_setup(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}

//TODO: ...???
// actually do the thing!
PyThreadState *_tstate = PyThreadState_Get();
uwsgi_setup(orig_argc, orig_argv, environ);
PyThreadState_Swap(_tstate);

Py_INCREF(self);
return self;
}
Expand All @@ -133,6 +127,7 @@ pyuwsgi_init(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}

uwsgi_setup(orig_argc, orig_argv, environ);
int rc = uwsgi_run();

// never(?) here
Expand All @@ -149,6 +144,7 @@ pyuwsgi_run(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}

uwsgi_setup(orig_argc, orig_argv, environ);
int rc = uwsgi_run();

// never(?) here
Expand Down

0 comments on commit a374e00

Please sign in to comment.