added support for reload-on-exception on PyPy and interval-based cron syntax

This commit is contained in:
roberto@mrspurr
2012-04-06 07:40:21 +02:00
parent e2024ed2fd
commit cceee511f2
6 changed files with 65 additions and 45 deletions
+4 -6
View File
@@ -277,7 +277,6 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre
wi->response_subhandler = uwsgi_response_subhandler_wsgi;
wi->argc = 2;
}
#ifndef UWSGI_PYPY
else if (app_type == PYTHON_APP_TYPE_WEB3) {
#ifdef UWSGI_DEBUG
uwsgi_log("-- Web3 callable selected --\n");
@@ -292,7 +291,6 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre
wi->request_subhandler = uwsgi_request_subhandler_pump;
wi->response_subhandler = uwsgi_response_subhandler_pump;
}
#endif
#ifdef UWSGI_ASYNC
wi->args = malloc(sizeof(PyObject*)*uwsgi.cores);
@@ -712,8 +710,10 @@ PyObject *uwsgi_paste_loader(void *arg1) {
PyObject *uwsgi_eval_loader(void *arg1) {
#ifndef UWSGI_PYPY
#ifdef UWSGI_PYPY
uwsgi_log("the eval loader is currently not supported under PyPy !!!\n");
return NULL;
#else
char *code = (char *) arg1;
PyObject *wsgi_eval_module, *wsgi_eval_callable = NULL;
@@ -769,8 +769,6 @@ PyObject *uwsgi_eval_loader(void *arg1) {
}
return wsgi_eval_callable;
#else
return NULL;
#endif
}
+1 -1
View File
@@ -321,9 +321,9 @@ UWSGI_RELEASE_GIL
PyObject *uwsgi_pyimport_by_filename(char *name, char *filename) {
#ifdef UWSGI_PYPY
uwsgi_log("import by filename is currently not supported on PyPy !!!\n");
return NULL;
#else
FILE *pyfile;
struct _node *py_file_node = NULL;
PyObject *py_compiled_node, *py_file_module;
+2 -10
View File
@@ -8,17 +8,16 @@ int manage_python_response(struct wsgi_request *wsgi_req) {
return uwsgi_response_subhandler_wsgi(wsgi_req);
}
#ifndef UWSGI_PYPY
char *uwsgi_python_get_exception_type(PyObject *exc) {
char *class_name = NULL;
#ifndef PYTHREE
#if !defined(PYTHREE) && !defined(UWSGI_PYPY)
if (PyClass_Check(exc)) {
class_name = PyString_AsString( ((PyClassObject*)(exc))->cl_name );
}
else {
#endif
class_name = (char *) ((PyTypeObject*)exc)->tp_name;
#ifndef PYTHREE
#if !defined(PYTHREE) && !defined(UWSGI_PYPY)
}
#endif
@@ -91,7 +90,6 @@ int uwsgi_python_manage_exceptions(void) {
return ret;
}
#endif
PyObject *python_call(PyObject *callable, PyObject *args, int catch, struct wsgi_request *wsgi_req) {
@@ -104,11 +102,7 @@ PyObject *python_call(PyObject *callable, PyObject *args, int catch, struct wsgi
if (PyErr_Occurred()) {
#ifndef UWSGI_PYPY
int do_exit = uwsgi_python_manage_exceptions();
#else
int do_exit = 0;
#endif
if (PyErr_ExceptionMatches(PyExc_MemoryError)) {
uwsgi_log("Memory Error detected !!!\n");
@@ -227,9 +221,7 @@ void init_pyargv() {
}
#ifndef UWSGI_PYPY
PySys_SetArgv(up.argc, up.py_argv);
#endif
PyObject *sys_dict = get_uwsgi_pydict("sys");
if (!sys_dict) {
-4
View File
@@ -216,11 +216,7 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
if (!pychunk) {
if (PyErr_Occurred()) {
#ifndef UWSGI_PYPY
int do_exit = uwsgi_python_manage_exceptions();
#else
int do_exit = 0;
#endif
if (PyErr_ExceptionMatches(PyExc_MemoryError)) {
uwsgi_log("Memory Error detected !!!\n");
}