summaryrefslogtreecommitdiffstats
path: root/package/python/python-015-fix-sqlite-without-threads.patch
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2014-07-12 14:11:52 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-07-15 19:16:50 +0200
commit85a016f5e17100999de884dc48473e52b0b67389 (patch)
treea47f7e969fb367611e83be48045bb3b519f96eb6 /package/python/python-015-fix-sqlite-without-threads.patch
parent95074ee8d2d8a901d7e5a3043659b4011a069c8e (diff)
downloadbuildroot-85a016f5e17100999de884dc48473e52b0b67389.tar.gz
buildroot-85a016f5e17100999de884dc48473e52b0b67389.zip
package/python: fix sqlite3 extension without threads
Fix a compiler error when building the sqlite3 extension, when the toolchain does not have threads. Fixes: http://autobuild.buildroot.net/results/10f/10f268cd55f16ee53f4c5e17e1248b0a1820f6ea/ Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/python/python-015-fix-sqlite-without-threads.patch')
-rw-r--r--package/python/python-015-fix-sqlite-without-threads.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/package/python/python-015-fix-sqlite-without-threads.patch b/package/python/python-015-fix-sqlite-without-threads.patch
new file mode 100644
index 0000000000..805edff6d3
--- /dev/null
+++ b/package/python/python-015-fix-sqlite-without-threads.patch
@@ -0,0 +1,48 @@
+sqlite3: fix build when threads are not used/available
+
+When threads are not used/available, a function in the sqlite3 extension
+ends up with a label at the end:
+
+ void _pysqlite_final_callback(sqlite3_context* context)
+ {
+ PyObject* function_result;
+ PyObject** aggregate_instance;
+ int ok;
+
+ #ifdef WITH_THREAD
+ PyGILState_STATE threadstate;
+
+ threadstate = PyGILState_Ensure();
+ #endif
+
+ aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
+ if (!*aggregate_instance) {
+ goto error;
+ }
+
+ [......]
+
+ error:
+ #ifdef WITH_THREAD
+ PyGILState_Release(threadstate);
+ #endif
+ }
+
+This is not valid, and gcc complains.
+
+Fix that by adding a dummy statement after the label, so that the label
+is never the last statement of the function.
+
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+
+diff -durN python-2.7.8.orig/Modules/_sqlite/connection.c python-2.7.8/Modules/_sqlite/connection.c
+--- python-2.7.8.orig/Modules/_sqlite/connection.c 2014-06-30 04:05:42.000000000 +0200
++++ python-2.7.8/Modules/_sqlite/connection.c 2014-07-12 13:53:32.258041224 +0200
+@@ -786,6 +786,7 @@
+ #ifdef WITH_THREAD
+ PyGILState_Release(threadstate);
+ #endif
++ ; /* Make gcc happy: a label can't be at the end of a function */
+ }
+
+ static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)
OpenPOWER on IntegriCloud