[Python-checkins] r52812 - in python/branches/release25-maint: Lib/bsddb/test/test_dbobj.py Misc/NEWS Modules/_bsddb.c
neal.norwitz
python-checkins at python.org
Tue Nov 21 06:29:36 CET 2006
Author: neal.norwitz
Date: Tue Nov 21 06:29:34 2006
New Revision: 52812
Modified:
python/branches/release25-maint/Lib/bsddb/test/test_dbobj.py
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Modules/_bsddb.c
Log:
Backport of 52811:
Bug #1599782: Fix segfault on bsddb.db.DB().type().
The problem is that _DB_get_type() can't be called without the GIL
because it calls a bunch of PyErr_* APIs when an error occurs.
There were no other cases in this file that it was called without the GIL.
Removing the BEGIN/END THREAD around _DB_get_type() made everything work.
Modified: python/branches/release25-maint/Lib/bsddb/test/test_dbobj.py
==============================================================================
--- python/branches/release25-maint/Lib/bsddb/test/test_dbobj.py (original)
+++ python/branches/release25-maint/Lib/bsddb/test/test_dbobj.py Tue Nov 21 06:29:34 2006
@@ -69,6 +69,10 @@
self.db.close()
self.env.close()
+ def test03_dbobj_type_before_open(self):
+ # Ensure this doesn't cause a segfault.
+ self.assertRaises(db.DBInvalidArgError, db.DB().type)
+
#----------------------------------------------------------------------
def test_suite():
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Tue Nov 21 06:29:34 2006
@@ -276,6 +276,8 @@
Extension Modules
-----------------
+- Bug #1599782: fix segfault on bsddb.db.DB().type().
+
- Fix bugs in ctypes:
- anonymous structure fields that have a bit-width specified did not work
- cast function did not accept c_char_p or c_wchar_p instances as first arg
Modified: python/branches/release25-maint/Modules/_bsddb.c
==============================================================================
--- python/branches/release25-maint/Modules/_bsddb.c (original)
+++ python/branches/release25-maint/Modules/_bsddb.c Tue Nov 21 06:29:34 2006
@@ -1779,9 +1779,7 @@
return NULL;
CHECK_DB_NOT_CLOSED(self);
- MYDB_BEGIN_ALLOW_THREADS;
type = _DB_get_type(self);
- MYDB_END_ALLOW_THREADS;
if (type == -1)
return NULL;
return PyInt_FromLong(type);
More information about the Python-checkins
mailing list