python-015-fix-sqlite-without-threads.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. sqlite3: fix build when threads are not used/available
  2. When threads are not used/available, a function in the sqlite3 extension
  3. ends up with a label at the end:
  4. void _pysqlite_final_callback(sqlite3_context* context)
  5. {
  6. PyObject* function_result;
  7. PyObject** aggregate_instance;
  8. int ok;
  9. #ifdef WITH_THREAD
  10. PyGILState_STATE threadstate;
  11. threadstate = PyGILState_Ensure();
  12. #endif
  13. aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
  14. if (!*aggregate_instance) {
  15. goto error;
  16. }
  17. [......]
  18. error:
  19. #ifdef WITH_THREAD
  20. PyGILState_Release(threadstate);
  21. #endif
  22. }
  23. This is not valid, and gcc complains.
  24. Fix that by adding a dummy statement after the label, so that the label
  25. is never the last statement of the function.
  26. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  27. diff -durN python-2.7.8.orig/Modules/_sqlite/connection.c python-2.7.8/Modules/_sqlite/connection.c
  28. --- python-2.7.8.orig/Modules/_sqlite/connection.c 2014-06-30 04:05:42.000000000 +0200
  29. +++ python-2.7.8/Modules/_sqlite/connection.c 2014-07-12 13:53:32.258041224 +0200
  30. @@ -786,6 +786,7 @@
  31. #ifdef WITH_THREAD
  32. PyGILState_Release(threadstate);
  33. #endif
  34. + ; /* Make gcc happy: a label can't be at the end of a function */
  35. }
  36. static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)