* [Buildroot] [PATCH] package/python: fix sqlite3 extension without threads
@ 2014-07-12 12:11 Yann E. MORIN
2014-07-15 17:18 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2014-07-12 12:11 UTC (permalink / raw)
To: buildroot
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>
---
.../python-015-fix-sqlite-without-threads.patch | 48 ++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 package/python/python-015-fix-sqlite-without-threads.patch
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 0000000..805edff
--- /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)
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] package/python: fix sqlite3 extension without threads
2014-07-12 12:11 [Buildroot] [PATCH] package/python: fix sqlite3 extension without threads Yann E. MORIN
@ 2014-07-15 17:18 ` Thomas Petazzoni
2014-07-15 17:24 ` Yann E. MORIN
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2014-07-15 17:18 UTC (permalink / raw)
To: buildroot
Dear Yann E. MORIN,
On Sat, 12 Jul 2014 14:11:52 +0200, Yann E. MORIN wrote:
> 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>
> ---
> .../python-015-fix-sqlite-without-threads.patch | 48 ++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
> create mode 100644 package/python/python-015-fix-sqlite-without-threads.patch
Applied, thanks. Do you know if Python 3 is affected as well?
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] package/python: fix sqlite3 extension without threads
2014-07-15 17:18 ` Thomas Petazzoni
@ 2014-07-15 17:24 ` Yann E. MORIN
2014-07-15 18:07 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2014-07-15 17:24 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2014-07-15 19:18 +0200, Thomas Petazzoni spake thusly:
> On Sat, 12 Jul 2014 14:11:52 +0200, Yann E. MORIN wrote:
> > 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>
> > ---
> > .../python-015-fix-sqlite-without-threads.patch | 48 ++++++++++++++++++++++
> > 1 file changed, 48 insertions(+)
> > create mode 100644 package/python/python-015-fix-sqlite-without-threads.patch
>
> Applied, thanks. Do you know if Python 3 is affected as well?
It is not. The cset I backported is from 3.3, and we're using 3.4.1:
http://hg.python.org/cpython/file/v3.4.1/Modules/_sqlite/connection.c#l760
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] package/python: fix sqlite3 extension without threads
2014-07-15 17:24 ` Yann E. MORIN
@ 2014-07-15 18:07 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2014-07-15 18:07 UTC (permalink / raw)
To: buildroot
Dear Yann E. MORIN,
On Tue, 15 Jul 2014 19:24:01 +0200, Yann E. MORIN wrote:
> > Applied, thanks. Do you know if Python 3 is affected as well?
>
> It is not. The cset I backported is from 3.3, and we're using 3.4.1:
> http://hg.python.org/cpython/file/v3.4.1/Modules/_sqlite/connection.c#l760
Excellent, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-15 18:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-12 12:11 [Buildroot] [PATCH] package/python: fix sqlite3 extension without threads Yann E. MORIN
2014-07-15 17:18 ` Thomas Petazzoni
2014-07-15 17:24 ` Yann E. MORIN
2014-07-15 18:07 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox