{"action":"closed","issue":{"url":"https://api.github.com/repos/unbit/uwsgi/issues/1026","labels_url":"https://api.github.com/repos/unbit/uwsgi/issues/1026/labels{/name}","comments_url":"https://api.github.com/repos/unbit/uwsgi/issues/1026/comments","events_url":"https://api.github.com/repos/unbit/uwsgi/issues/1026/events","html_url":"https://github.com/unbit/uwsgi/issues/1026","id":104299869,"number":1026,"title":"Python 3 compilation broken on master","user":{"login":"robotclarke","id":1457648,"avatar_url":"https://avatars.githubusercontent.com/u/1457648?v=3","gravatar_id":"","url":"https://api.github.com/users/robotclarke","html_url":"https://github.com/robotclarke","followers_url":"https://api.github.com/users/robotclarke/followers","following_url":"https://api.github.com/users/robotclarke/following{/other_user}","gists_url":"https://api.github.com/users/robotclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/robotclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robotclarke/subscriptions","organizations_url":"https://api.github.com/users/robotclarke/orgs","repos_url":"https://api.github.com/users/robotclarke/repos","events_url":"https://api.github.com/users/robotclarke/events{/privacy}","received_events_url":"https://api.github.com/users/robotclarke/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-01T16:05:57Z","updated_at":"2015-09-01T20:25:31Z","closed_at":"2015-09-01T20:25:31Z","body":"`make` fails with Python 3 on the master branch with the following errors:\r\n\r\n```\r\nplugins/python/uwsgi_pymodule.c:14:5: error: suggest braces around initialization of\r\n      subobject [-Werror,-Wmissing-braces]\r\n    PyObject_HEAD_INIT(NULL)\r\n    ^~~~~~~~~~~~~~~~~~~~~~~~\r\n/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m/object.h:86:5: note: \r\n      expanded from macro 'PyObject_HEAD_INIT'\r\n    1, type },\r\n    ^~~~~~~\r\nplugins/python/uwsgi_pymodule.c:16:5: error: incompatible pointer to integer\r\n      conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type\r\n      'char [21]' [-Werror,-Wint-conversion]\r\n    \"uwsgi.RequestContext\",\r\n    ^~~~~~~~~~~~~~~~~~~~~~\r\nplugins/python/uwsgi_pymodule.c:34:5: error: incompatible integer to pointer\r\n      conversion initializing 'const char *' with an expression of type\r\n      'unsigned long' [-Werror,-Wint-conversion]\r\n    Py_TPFLAGS_DEFAULT,\r\n    ^~~~~~~~~~~~~~~~~~\r\n/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m/object.h:643:29: note: \r\n      expanded from macro 'Py_TPFLAGS_DEFAULT'\r\n#define Py_TPFLAGS_DEFAULT  ( \\\r\n                            ^~~\r\nplugins/python/uwsgi_pymodule.c:35:5: error: incompatible pointer types initializing\r\n      'traverseproc' (aka 'int (*)(PyObject *, visitproc, void *)') with an\r\n      expression of type 'char [1]' [-Werror,-Wincompatible-pointer-types]\r\n    \"\",\r\n    ^~\r\n4 errors generated.\r\n```\r\n\r\nIt's caused by a difference in `object.h` between Python 2 and 3; here's [Python 2](https://hg.python.org/cpython/file/2.7/Include/object.h#l83) and [Python 3](https://hg.python.org/cpython/file/3.4/Include/object.h#l84).  I've traced it back to a commit made by @yueyoum in `plugins/python/uwsgi_pymodule.c` where we initialize a `PyTypeObject`, if they have another chance to look at it.\r\n\r\nhttps://github.com/robotclarke/uwsgi/commit/bf77e8a80d028719ddc7fb91054351f49ce92e90 fixes the problem for Python 3, but breaks Python 2.  (Sorry for the whitespace changes, my editor removes trailing whitespace).  I don't know how to conditionally check for the version of Python in C (or in fact if that is the best way to fix this!), so hopefully there's enough information here for one of you to fix it for me :smile: "}}