From b386317921f10e52dbd54133ddec7a2174bd74a4 Mon Sep 17 00:00:00 2001 From: "roberto@precise64" Date: Mon, 19 Mar 2012 13:39:07 +0100 Subject: [PATCH] fixed python3 reload-on-exception --- plugins/python/pyutils.c | 4 ++++ uwsgi.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/python/pyutils.c b/plugins/python/pyutils.c index b574e7b9..552420ac 100644 --- a/plugins/python/pyutils.c +++ b/plugins/python/pyutils.c @@ -10,12 +10,16 @@ int manage_python_response(struct wsgi_request *wsgi_req) { char *uwsgi_python_get_exception_type(PyObject *exc) { char *class_name = NULL; +#ifndef PYTHREE if (PyClass_Check(exc)) { class_name = PyString_AsString( ((PyClassObject*)(exc))->cl_name ); } else { +#endif class_name = (char *) ((PyTypeObject*)exc)->tp_name; +#ifndef PYTHREE } +#endif if (class_name) { char *dot = strrchr(class_name, '.'); diff --git a/uwsgi.c b/uwsgi.c index f1993e1a..6e5158d8 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -261,9 +261,9 @@ static struct uwsgi_option uwsgi_base_options[] = { {"ignore-script-name", no_argument, 0, "ignore SCRIPT_NAME", uwsgi_opt_true, &uwsgi.ignore_script_name, 0}, {"catch-exceptions", no_argument, 0, "report exception has http output (discouraged)", uwsgi_opt_true, &uwsgi.catch_exceptions, 0}, {"reload-on-exception", no_argument, 0, "reload a worker when an exception is raised", uwsgi_opt_true, &uwsgi.reload_on_exception, 0}, - {"reload-on-exception-type", no_argument, 0, "reload a worker when a specific exception type is raised", uwsgi_opt_add_string_list, &uwsgi.reload_on_exception_type, 0}, - {"reload-on-exception-value", no_argument, 0, "reload a worker when a specific exception value is raised", uwsgi_opt_add_string_list, &uwsgi.reload_on_exception_value, 0}, - {"reload-on-exception-repr", no_argument, 0, "reload a worker when a specific exception type+value (language-specific) is raised", uwsgi_opt_add_string_list, &uwsgi.reload_on_exception_repr, 0}, + {"reload-on-exception-type", required_argument, 0, "reload a worker when a specific exception type is raised", uwsgi_opt_add_string_list, &uwsgi.reload_on_exception_type, 0}, + {"reload-on-exception-value", required_argument, 0, "reload a worker when a specific exception value is raised", uwsgi_opt_add_string_list, &uwsgi.reload_on_exception_value, 0}, + {"reload-on-exception-repr", required_argument, 0, "reload a worker when a specific exception type+value (language-specific) is raised", uwsgi_opt_add_string_list, &uwsgi.reload_on_exception_repr, 0}, #ifdef UWSGI_UDP {"udp", required_argument, 0, "run the udp server on the specified address", uwsgi_opt_set_str, &uwsgi.udp_socket, UWSGI_OPT_MASTER}, #endif