Merged revisions 71058,71149-71150,71212,71214-71216,71222,71225,71234,71237-71238,71240-71241,71243,71249,71251 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71058 | georg.brandl | 2009-04-02 20:09:04 +0200 (Do, 02 Apr 2009) | 3 lines
PyErr_NormalizeException may not set an error, so convert the PyErr_SetObject
call on hitting the recursion limit into just assigning it to the arguments provided.
........
r71149 | georg.brandl | 2009-04-04 15:42:39 +0200 (Sa, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 15:45:49 +0200 (Sa, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71212 | georg.brandl | 2009-04-05 12:24:20 +0200 (So, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 12:29:57 +0200 (So, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 12:32:26 +0200 (So, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 12:41:02 +0200 (So, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71222 | georg.brandl | 2009-04-05 13:07:14 +0200 (So, 05 Apr 2009) | 1 line
#5615: make it possible to configure --without-threads again.
........
r71225 | georg.brandl | 2009-04-05 13:54:07 +0200 (So, 05 Apr 2009) | 1 line
#5580: no need to use parentheses when converterr() argument is actually a type description.
........
r71234 | georg.brandl | 2009-04-05 15:16:35 +0200 (So, 05 Apr 2009) | 1 line
Whitespace normalization.
........
r71237 | georg.brandl | 2009-04-05 16:24:52 +0200 (So, 05 Apr 2009) | 1 line
#1326077: fix traceback formatting of SyntaxErrors. This fixes two differences with formatting coming from Python: a) the reproduction of location details in the error message if no line text is given, b) the prefixing of the last line by one space.
........
r71238 | georg.brandl | 2009-04-05 16:25:41 +0200 (So, 05 Apr 2009) | 1 line
Add NEWS entry for r71237.
........
r71240 | georg.brandl | 2009-04-05 16:40:06 +0200 (So, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
r71241 | georg.brandl | 2009-04-05 16:48:49 +0200 (So, 05 Apr 2009) | 1 line
#5471: fix expanduser() for $HOME set to "/".
........
r71243 | georg.brandl | 2009-04-05 17:14:29 +0200 (So, 05 Apr 2009) | 1 line
#5432: make plistlib docstring a raw string, since it contains examples with backslash escapes.
........
r71249 | georg.brandl | 2009-04-05 18:30:43 +0200 (So, 05 Apr 2009) | 1 line
#5444: adapt make.bat to new htmlhelp output file name.
........
r71251 | georg.brandl | 2009-04-05 19:17:42 +0200 (So, 05 Apr 2009) | 1 line
#5298: clarify docs about GIL by using more consistent wording.
........
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 9d6952e..8aa0882 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -168,8 +168,9 @@
self->detect_types = detect_types;
self->timeout = timeout;
(void)sqlite3_busy_timeout(self->db, (int)(timeout*1000));
-
+#ifdef WITH_THREAD
self->thread_ident = PyThread_get_thread_ident();
+#endif
self->check_same_thread = check_same_thread;
self->function_pinboard = PyDict_New();
@@ -585,9 +586,11 @@
PyObject* py_func;
PyObject* py_retval = NULL;
+#ifdef WITH_THREAD
PyGILState_STATE threadstate;
threadstate = PyGILState_Ensure();
+#endif
py_func = (PyObject*)sqlite3_user_data(context);
@@ -609,7 +612,9 @@
_sqlite3_result_error(context, "user-defined function raised exception", -1);
}
+#ifdef WITH_THREAD
PyGILState_Release(threadstate);
+#endif
}
static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_value** params)
@@ -620,9 +625,11 @@
PyObject** aggregate_instance;
PyObject* stepmethod = NULL;
+#ifdef WITH_THREAD
PyGILState_STATE threadstate;
threadstate = PyGILState_Ensure();
+#endif
aggregate_class = (PyObject*)sqlite3_user_data(context);
@@ -669,7 +676,9 @@
Py_XDECREF(stepmethod);
Py_XDECREF(function_result);
+#ifdef WITH_THREAD
PyGILState_Release(threadstate);
+#endif
}
void _pysqlite_final_callback(sqlite3_context* context)
@@ -678,9 +687,11 @@
PyObject** aggregate_instance;
PyObject* aggregate_class;
+#ifdef WITH_THREAD
PyGILState_STATE threadstate;
threadstate = PyGILState_Ensure();
+#endif
aggregate_class = (PyObject*)sqlite3_user_data(context);
@@ -708,7 +719,9 @@
Py_XDECREF(*aggregate_instance);
Py_XDECREF(function_result);
+#ifdef WITH_THREAD
PyGILState_Release(threadstate);
+#endif
}
void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)
@@ -803,9 +816,11 @@
{
PyObject *ret;
int rc;
+#ifdef WITH_THREAD
PyGILState_STATE gilstate;
gilstate = PyGILState_Ensure();
+#endif
ret = PyObject_CallFunction((PyObject*)user_arg, "issss", action, arg1, arg2, dbname, access_attempt_source);
if (!ret) {
@@ -825,7 +840,9 @@
Py_DECREF(ret);
}
+#ifdef WITH_THREAD
PyGILState_Release(gilstate);
+#endif
return rc;
}
@@ -833,9 +850,11 @@
{
int rc;
PyObject *ret;
+#ifdef WITH_THREAD
PyGILState_STATE gilstate;
gilstate = PyGILState_Ensure();
+#endif
ret = PyObject_CallFunction((PyObject*)user_arg, "");
if (!ret) {
@@ -852,7 +871,9 @@
Py_DECREF(ret);
}
+#ifdef WITH_THREAD
PyGILState_Release(gilstate);
+#endif
return rc;
}
@@ -907,6 +928,7 @@
int pysqlite_check_thread(pysqlite_Connection* self)
{
+#ifdef WITH_THREAD
if (self->check_same_thread) {
if (PyThread_get_thread_ident() != self->thread_ident) {
PyErr_Format(pysqlite_ProgrammingError,
@@ -917,7 +939,7 @@
}
}
-
+#endif
return 1;
}
@@ -1139,12 +1161,14 @@
PyObject* callback = (PyObject*)context;
PyObject* string1 = 0;
PyObject* string2 = 0;
+#ifdef WITH_THREAD
PyGILState_STATE gilstate;
-
+#endif
PyObject* retval = NULL;
int result = 0;
-
+#ifdef WITH_THREAD
gilstate = PyGILState_Ensure();
+#endif
if (PyErr_Occurred()) {
goto finally;
@@ -1173,9 +1197,9 @@
Py_XDECREF(string1);
Py_XDECREF(string2);
Py_XDECREF(retval);
-
+#ifdef WITH_THREAD
PyGILState_Release(gilstate);
-
+#endif
return result;
}
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index cd28609..c16b7c7 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -445,7 +445,9 @@
* threads have already been initialized.
* (see pybsddb-users mailing list post on 2002-08-07)
*/
+#ifdef WITH_THREAD
PyEval_InitThreads();
+#endif
error:
if (PyErr_Occurred())