summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2011-05-11 19:12:59 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2011-05-11 19:12:59 +0000
commit1cf672a9ffa621a960ecbb8ead1edaebb6d58ea2 (patch)
treeae6aafe2a08112e2c61b53c8ed0ae9805d78fadf /www-apache
parentfix build with ffmpeg/libav trunk (diff)
downloadhistorical-1cf672a9ffa621a960ecbb8ead1edaebb6d58ea2.tar.gz
historical-1cf672a9ffa621a960ecbb8ead1edaebb6d58ea2.tar.bz2
historical-1cf672a9ffa621a960ecbb8ead1edaebb6d58ea2.zip
Fix compatibility with Python 3.2 (bug #364583).
Package-Manager: portage-2.2.0_alpha32_p17/cvs/Linux x86_64
Diffstat (limited to 'www-apache')
-rw-r--r--www-apache/mod_wsgi/ChangeLog6
-rw-r--r--www-apache/mod_wsgi/Manifest30
-rw-r--r--www-apache/mod_wsgi/files/mod_wsgi-3.3-python-3.2.patch256
3 files changed, 273 insertions, 19 deletions
diff --git a/www-apache/mod_wsgi/ChangeLog b/www-apache/mod_wsgi/ChangeLog
index 86c32867384a..7951a7b6514c 100644
--- a/www-apache/mod_wsgi/ChangeLog
+++ b/www-apache/mod_wsgi/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for www-apache/mod_wsgi
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/www-apache/mod_wsgi/ChangeLog,v 1.30 2011/04/22 21:58:23 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/www-apache/mod_wsgi/ChangeLog,v 1.31 2011/05/11 19:12:59 arfrever Exp $
+
+ 11 May 2011; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
+ files/mod_wsgi-3.3-python-3.2.patch:
+ Fix compatibility with Python 3.2 (bug #364583).
22 Apr 2011; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
mod_wsgi-3.3.ebuild, +files/mod_wsgi-3.3-python-3.2.patch:
diff --git a/www-apache/mod_wsgi/Manifest b/www-apache/mod_wsgi/Manifest
index 61ea1bb8949b..2eb908624296 100644
--- a/www-apache/mod_wsgi/Manifest
+++ b/www-apache/mod_wsgi/Manifest
@@ -2,25 +2,25 @@
Hash: SHA1
AUX 70_mod_wsgi.conf 100 RMD160 60c74317eded93c727cc5ebb74e33f1e040d4187 SHA1 cf23e48a59c624cfc021dda43f3d16a899f4be3a SHA256 a4c1b49eb8c6d6609ad8ae8a9f8d6621f9f2bbc2c99addef3e2d6404ac364ed7
-AUX mod_wsgi-3.3-python-3.2.patch 1514 RMD160 a2dcf7eb773269970d5b47849e671e4918a44d8c SHA1 c7b1c4256983ecb206f8d489befc301456cfd49d SHA256 a4f32c4391aeb7c41fe6e0e2becd93981ad4ec7795b61508fe3b466b3c5de7d2
+AUX mod_wsgi-3.3-python-3.2.patch 8849 RMD160 99947d46936b15bc92cd345e90ac4bf538252000 SHA1 5542fb478cea29b704ce1d6657f39c18424a854b SHA256 49c15768d67ef05b9dad2d6890c139e744e6945c00ce3d333b10c7077e4dc899
DIST mod_wsgi-3.3.tar.gz 117930 RMD160 759cf57d691924271fbc45af10596c033c063c89 SHA1 f32d38e5d3ed5de1efd5abefb52678f833dc9166 SHA256 d96e1078990484cfe5579df1e95dc73f009495e9c3f9a066b0983650bd9e3243
EBUILD mod_wsgi-3.3.ebuild 801 RMD160 cbfc68715573bf2a759cc58194b94d14039689b8 SHA1 52053953eda8b8bef87d5a3e54a00397056607cb SHA256 556d1a54bca96772a53fd2ef18eadc983bc77941501960e8e12a217e0e6aaf0a
-MISC ChangeLog 3903 RMD160 4338abbfc789a071aaebb358b73c41df253f9b0b SHA1 26d1e45801398853a455730be2da88020122d549 SHA256 69a780ae559f0405f01ebe1a0b70abf473fdb2ceb8fff0394ceb700f4ce62ea5
+MISC ChangeLog 4067 RMD160 3121261069efc041e73a674cdb545d1ccd3b65dc SHA1 057fa249f1ac1e98908de86a74b5d5508ccefe4b SHA256 ace09267060834af32c85e9b3dc95f986f6f81e7a14d2cfbe8e9e251da5dfe76
MISC metadata.xml 259 RMD160 fdfb533f35254e0f704a6c83132a4bd2b65809f9 SHA1 3afaadaec126f2d24b4fe32a5d8870368f5d72e3 SHA256 5aa0df1f4a87632694a5d911aa6efc123c1c80aeb9ddf39d63de7ba9e0de8536
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
-iQIcBAEBAgAGBQJNsfoMAAoJENgZr6v6gHY0jxYQAMIY1XWpNQ1njlbtaRA0QpnK
-Q7bua6JWkaFKnwhyjbgXRfPQWuV3h83pFkcwgTIR8tEGhzN1NjFS+gmeweAlzoZM
-Djs84xbjOXJrHzPEfbWADfdIEzQTGws/T4/tSzE+lUymFwdd56mVbg5PQpZcrrSf
-y1c0KDFr2cArwn7r+VzaVVdOuarxCN7CmU855ItO3RoCjhasv/IgnV31XglwB1cO
-Egl0eMESeg1y44lyy85FOLpdWP0YsBmV5AYgkolVUEjl9ib0bsPBR4SaZldQf2iK
-3j+yznZj5pBbf6d0Nt7mAudmWLo4BB3w37YRsRtC4gygMLU/XIo3EP7nQXOrjsXE
-ug+2c7xKh73k4ed9XQT31pjWBWnvbVplZQ+d7bGEI5DpL6w3BZf7fl8aa0yapSZR
-RMXi0mTaItq6D+o8ITVF/mpxukdSkreb4KBC2KtgFQRaSBILqH2fMNjMgoNYoX/M
-OaDnuzTx8V7L6TN5dASpnyIg6bNnhz25jfrOfnBth/qo6pjZkjyJcA3fAwGXjUPs
-AbjxJWZShOdAJjT9dyWfaCOXuhBne0gKZhRzYh+fdNNJHQit7/nvEtH4KXBGgAxT
-I090el6vbgZTPA2FxX5dX6T9wfQLedVFGHA1xUv7Gdnq5ILDjZBVRkI9nEH03oXj
-UqBfrSgBdufz1E+OvZ0X
-=y/5E
+iQIcBAEBAgAGBQJNyt/PAAoJENgZr6v6gHY0jJwP/jrj0sKTErNf5+klCFAOhMkg
++P7U1QM168N6sEJ4QLhscwaE6NHg7VwblK9qzR/b8CE7kSQPyrFzTz4ze8hVNdnV
+tlGT03I2LF+3t5gZpqU5xwHKE+C/Ln7sE6sYtcBAElAq2ZEzj2pSKqh9hGDdXSpv
+nD+J6gt4ffcALw5kB9Vyx9BOqY5Id83nM30j2cJfLdUGjfaN8rw4QM9ueXnzON8t
+kg5KoTB+aYHAZ9f0NMX8/UI+ZmxqFzn0JctQT6DznElznoOZ+TPKnqqd5U3d996q
+xZ2rQE8xt5dCu7bKip3TML39qTFEid0/K6mejugvvNcN7nhsl02oPbDMA6hTFAq2
+SANO9BAMVAmZbg8E/TIOLKV+wlkXkps623M9Bz81/CYiFLLR9E4jcwJMC0wR52Qp
+XjuJi4sd+8RfPWS7UQdLEwISgdZtBiIY6wiFN2LM8UwvQp9odlM2in05v/Szp2jc
+1I1kzyHpDHYYl0p9hf5z8oDORUCvO4JS35SremIujEiKMNCV4jyyBNi00VrjFE4m
+sHEZmraIA6XFC2BJv5krHHJkAIbPW1fWnZa3R9hYXs2b8H2PXRcsHUQbesgZ1ULv
+CnME1ssMrIUKfOKfA6JrO0nxE58jmtaUMuCb5mO0w9LVibaf7aisRo1eno4FvG8d
+kth5L51Mskyl7o5jem1Y
+=Igi7
-----END PGP SIGNATURE-----
diff --git a/www-apache/mod_wsgi/files/mod_wsgi-3.3-python-3.2.patch b/www-apache/mod_wsgi/files/mod_wsgi-3.3-python-3.2.patch
index 2f50954ca856..ad35ff29097b 100644
--- a/www-apache/mod_wsgi/files/mod_wsgi-3.3-python-3.2.patch
+++ b/www-apache/mod_wsgi/files/mod_wsgi-3.3-python-3.2.patch
@@ -1,4 +1,5 @@
http://code.google.com/p/modwsgi/source/detail?r=637ee0510a49f5bf80fe49b2ee27158cf01855c6
+http://code.google.com/p/modwsgi/source/detail?r=d40a1bf6b9ad9cacc50caf0b3806b9a231e0d4d7
--- mod_wsgi.c
+++ mod_wsgi.c
@@ -11,7 +12,18 @@ http://code.google.com/p/modwsgi/source/detail?r=637ee0510a49f5bf80fe49b2ee27158
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
-@@ -3598,7 +3598,11 @@
+@@ -386,6 +386,10 @@
+ #define WSGI_RELOAD_MODULE 0
+ #define WSGI_RELOAD_PROCESS 1
+
++/* Python interpreter state. */
++
++static PyThreadState *wsgi_main_tstate = NULL;
++
+ /* Base server object. */
+
+ static server_rec *wsgi_server = NULL;
+@@ -3598,7 +3602,11 @@
*/
if (!wsgi_daemon_pool && self->config->pass_apache_request) {
@@ -23,7 +35,198 @@ http://code.google.com/p/modwsgi/source/detail?r=637ee0510a49f5bf80fe49b2ee27158
PyDict_SetItemString(vars, "apache.request_rec", object);
Py_DECREF(object);
}
-@@ -8369,7 +8373,11 @@
+@@ -5147,15 +5155,22 @@
+ PyObject *exitfunc = NULL;
+ PyObject *module = NULL;
+
++ PyThreadState *tstate_enter = NULL;
++
+ /*
+- * We should always enter here with the Python GIL held, but
+- * there will be no active thread state. Note that it should
+- * be safe to always assume that the simplified GIL state
+- * API lock was originally unlocked as always calling in
+- * from an Apache thread outside of Python.
++ * We should always enter here with the Python GIL
++ * held and an active thread state. This should only
++ * now occur when shutting down interpreter and not
++ * when releasing interpreter as don't support
++ * recyling of interpreters within the process. Thus
++ * the thread state should be that for the main
++ * Python interpreter. Where dealing with a named
++ * sub interpreter, we need to change the thread
++ * state to that which was originally used to create
++ * that sub interpreter before doing anything.
+ */
+
+- PyEval_ReleaseLock();
++ tstate_enter = PyThreadState_Get();
+
+ if (*self->name) {
+ #if APR_HAS_THREADS
+@@ -5194,10 +5209,13 @@
+ tstate = self->tstate;
+ #endif
+
+- PyEval_AcquireThread(tstate);
++ /*
++ * Swap to interpreter thread state that was used when
++ * the sub interpreter was created.
++ */
++
++ PyThreadState_Swap(tstate);
+ }
+- else
+- PyGILState_Ensure();
+
+ if (self->owner) {
+ Py_BEGIN_ALLOW_THREADS
+@@ -5492,20 +5510,7 @@
+
+ /* If we own it, we destroy it. */
+
+- if (!self->owner) {
+- if (*self->name) {
+- tstate = PyThreadState_Get();
+-
+- PyThreadState_Clear(tstate);
+- PyEval_ReleaseThread(tstate);
+- PyThreadState_Delete(tstate);
+- }
+- else
+- PyGILState_Release(PyGILState_UNLOCKED);
+-
+- PyEval_AcquireLock();
+- }
+- else {
++ if (self->owner) {
+ /*
+ * We need to destroy all the thread state objects
+ * associated with the interpreter. If there are
+@@ -5539,6 +5544,8 @@
+ /* Can now destroy the interpreter. */
+
+ Py_EndInterpreter(tstate);
++
++ PyThreadState_Swap(tstate_enter);
+ }
+
+ free(self->name);
+@@ -5647,7 +5654,14 @@
+ ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), wsgi_server,
+ "mod_wsgi (pid=%d): Terminating Python.", getpid());
+
+- PyGILState_Ensure();
++ /*
++ * We should be executing in the main thread again at this
++ * point but without the GIL, so simply restore the original
++ * thread state for that thread that we remembered when we
++ * initialised the interpreter.
++ */
++
++ PyEval_AcquireThread(wsgi_main_tstate);
+
+ /*
+ * Work around bug in Python 3.X whereby it will crash if
+@@ -5822,15 +5836,24 @@
+ /* Initialise threading. */
+
+ PyEval_InitThreads();
+- PyThreadState_Swap(NULL);
+- PyEval_ReleaseLock();
++
++ /*
++ * We now want to release the GIL. Before we do that
++ * though we remember what the current thread state is.
++ * We will use that later to restore the main thread
++ * state when we want to cleanup interpreters on
++ * shutdown.
++ */
++
++ wsgi_main_tstate = PyThreadState_Get();
++ PyEval_ReleaseThread(wsgi_main_tstate);
+
+ wsgi_python_initialized = 1;
+
+- /*
+- * Register cleanups to be performed on parent restart
+- * or shutdown. This will destroy Python itself.
+- */
++ /*
++ * Register cleanups to be performed on parent restart
++ * or shutdown. This will destroy Python itself.
++ */
+
+ #if AP_SERVER_MAJORVERSION_NUMBER < 2
+ ap_register_cleanup(p, NULL, wsgi_python_parent_cleanup,
+@@ -5879,7 +5902,11 @@
+
+ /*
+ * This function should never be called when the
+- * Python GIL is held, so need to acquire it.
++ * Python GIL is held, so need to acquire it. Even
++ * though we may need to work with a sub
++ * interpreter, we need to acquire GIL against main
++ * interpreter first to work with interpreter
++ * dictionary.
+ */
+
+ state = PyGILState_Ensure();
+@@ -5998,6 +6025,8 @@
+ {
+ PyThreadState *tstate = NULL;
+
++ PyGILState_STATE state;
++
+ /*
+ * Need to release and destroy the thread state that
+ * was created against the interpreter. This will
+@@ -6023,11 +6052,11 @@
+ * in its destruction if its the last reference.
+ */
+
+- PyEval_AcquireLock();
++ state = PyGILState_Ensure();
+
+ Py_DECREF(handle);
+
+- PyEval_ReleaseLock();
++ PyGILState_Release(state);
+ }
+
+ /*
+@@ -6630,7 +6659,14 @@
+ apr_thread_mutex_lock(wsgi_interp_lock);
+ #endif
+
+- PyEval_AcquireLock();
++ /*
++ * We should be executing in the main thread again at this
++ * point but without the GIL, so simply restore the original
++ * thread state for that thread that we remembered when we
++ * initialised the interpreter.
++ */
++
++ PyEval_AcquireThread(wsgi_main_tstate);
+
+ /*
+ * Extract a handle to the main Python interpreter from
+@@ -6668,7 +6704,13 @@
+
+ Py_DECREF(interp);
+
+- PyEval_ReleaseLock();
++ /*
++ * The code which performs actual shutdown of the main
++ * interpreter expects to be called without the GIL, so
++ * we release it here again.
++ */
++
++ PyEval_ReleaseThread(wsgi_main_tstate);
+
+ /*
+ * Destroy Python itself including the main interpreter.
+@@ -8369,7 +8411,11 @@
*/
if (!wsgi_daemon_pool && self->config->pass_apache_request) {
@@ -35,7 +238,54 @@ http://code.google.com/p/modwsgi/source/detail?r=637ee0510a49f5bf80fe49b2ee27158
PyDict_SetItemString(vars, "apache.request_rec", object);
Py_DECREF(object);
}
-@@ -13372,7 +13380,11 @@
+@@ -10509,6 +10555,8 @@
+ {
+ WSGIDaemonProcess *daemon = data;
+
++ PyGILState_STATE gilstate;
++
+ if (wsgi_server_config->verbose_debugging) {
+ ap_log_error(APLOG_MARK, WSGI_LOG_DEBUG(0), wsgi_server,
+ "mod_wsgi (pid=%d): Enable deadlock thread in "
+@@ -10523,8 +10571,8 @@
+ while (1) {
+ apr_sleep(apr_time_from_sec(1));
+
+- PyEval_AcquireLock();
+- PyEval_ReleaseLock();
++ gilstate = PyGILState_Ensure();
++ PyGILState_Release(gilstate);
+
+ apr_thread_mutex_lock(wsgi_shutdown_lock);
+ wsgi_deadlock_shutdown_time = apr_time_now();
+@@ -11101,6 +11149,7 @@
+ if (wsgi_python_after_fork)
+ wsgi_python_init(p);
+
++#if PY_MAJOR_VERSION < 3
+ /*
+ * If mod_python is also being loaded and thus it was
+ * responsible for initialising Python it can leave in
+@@ -11110,7 +11159,9 @@
+ * initialisation but in daemon process we skip the
+ * mod_python child initialisation so the active thread
+ * state still exists. Thus need to do a bit of a fiddle
+- * to ensure there is no active thread state.
++ * to ensure there is no active thread state. Don't need
++ * to worry about this with Python 3.X as mod_python
++ * only supports Python 2.X.
+ */
+
+ if (!wsgi_python_initialized) {
+@@ -11126,6 +11177,7 @@
+
+ PyEval_ReleaseLock();
+ }
++#endif
+
+ /*
+ * If the daemon is associated with a virtual host then
+@@ -13372,7 +13424,11 @@
*/
if (!wsgi_daemon_pool && self->config->pass_apache_request) {