Share

KInterbasDB

Tracker: Bugs

5 Exception raised in _close_physical_connection() - ID: 1011513
Last Update: Comment added ( woodsplitter )

When I try to close a database connection, I get the
message:

Exception exceptions.AttributeError: "'NoneType' object
has no attribute 'is_purportedly_open'" in <bound
method Connection.__del__ of <kinterbasdb.Connection
instance at 0x01B73D28>> ignored

This seems to be occuring during a *second* call to
_close_physical_connection() when it is called by the
connection's __del__ method, by which time _k is None.
The following patch seems to prevent it:

E:\PyDevSrc\Dp6_dev>svn diff
Index: 3rdPartyCode/kinterbasdb/__init__.py
===================================================================
--- 3rdPartyCode/kinterbasdb/__init__.py
(revision 43)
+++ 3rdPartyCode/kinterbasdb/__init__.py
(working copy)
@@ -880,7 +880,7 @@
# of that type, so that post-close() method
calls on this connection
# will raise ProgrammingErrors, as required by
the DB API Spec.
if hasattr(self, '_C_con'):
- if _k.is_purportedly_open(self._C_con):
+ if _k and _k.is_purportedly_open(self._C_con):
_k.close_connection(self._C_con)
self._C_con = _k.null_connection
elif raiseExceptionOnError:

Regards,
David Hughes


David Hughes ( forestfield ) - 2004-08-18 15:24

5

Closed

Fixed

David S. Rushby

General problems

None

Public


Comments ( 4 )




Date: 2004-10-25 06:34
Sender: woodsplitterProject Admin

Logged In: YES
user_id=414645

Now incorporated into released version 3.1_pre9, so I'm
closing the bug report.


Date: 2004-10-03 17:58
Sender: woodsplitterProject Admin

Logged In: YES
user_id=414645

I'm going to apply your patch to the official code base.

Previously, I was reluctant to apply it because I didn't
understand why the problem arose. Oleg Deribas's duplicate
bug report
(http://sourceforge.net/tracker/index.php?func=detail&aid=1031132&group_id=9913&atid=109913
) contained some crucial information that set off a light
bulb in my head. I can now imagine a scenario in which _k
would already have been destroyed prior to the
_close_physical_connection call.

Thanks to both David Hughes and Oleg Deribas for their bug
reports.


Date: 2004-08-31 09:13
Sender: forestfield

Logged In: YES
user_id=839533

The problem occurred in several, stand-alone Python scripts
I was using to populate a database and the .Close() was the
last line of the script in each case.

I'll try and produce a minimal program that reproduces this,
but I'll need to unravel several layers of wrappings first.


Date: 2004-08-27 02:09
Sender: woodsplitterProject Admin

Logged In: YES
user_id=414645

This is odd. Does the problem occur only while the Python
process is exiting?

The '_k' referred to in the code above is the C extension
module that underlies the Python module. For the extension
module to be None, I would think the system would have to be
in the process of tearing down the sys.modules container.

Can you post a program that reproduces this error?


Log in to comment.




Attached File

No Files Currently Attached

Changes ( 5 )

Field Old Value Date By
status_id Open 2004-10-25 06:34 woodsplitter
category_id None 2004-10-25 06:34 woodsplitter
close_date - 2004-10-25 06:34 woodsplitter
resolution_id None 2004-10-03 17:58 woodsplitter
assigned_to nobody 2004-08-27 02:09 woodsplitter