Discussion:
[python-win32] adodbapi transaction counter
Jure Erznožnik
2014-11-12 14:32:18 UTC
Permalink
I just installed this on Python 2.7 and immediately ran into a possible bug:

When connection.rollback() is called, a new transaction wasn't immediately started.
I traced the bug to line 382 in adodbapi.py where transaction_level is checked against 0. However, the COM routine called a bit above this line actually returns None as current level.

Adding the check for None solves the issue:

adodbapi.py
def _rollback(self):
# original statement didn't check for None
if self.transaction_level == 0 or self.transaction_level is None: # line 382


Is it possible to add this to project source / PyPI?

LP,
Jure
Vernon D. Cole
2014-11-13 21:35:52 UTC
Permalink
if self.transaction_level == 0 *or self.transaction_level is None*
Rats! That's what I get for copying code that I don't really understand. My
simple tests passed this as okay.

I have changed the test to "if not self.transaction_level:" in order to fix
the bug and avoid the "or" operation at the same time. That's pretty
obscure, so I use your version as the comment. This bug fix will define
version 2.6.1.2 -- to be pushed to pypi after testing.
--
Vernon
Jure Erznožnik
2014-11-14 07:18:38 UTC
Permalink
Thanks. And thanks for this nice lib. It was the final thing I needed to finally run 2to3 on my projects :D

LP,
Jure

From: Vernon D. Cole [mailto:***@gmail.com]
Sent: Thursday, November 13, 2014 10:36 PM
To: Jure ErznoÅŸnik
Cc: python-***@python.org
Subject: Re: [python-win32] adodbapi transaction counter


On Wed, Nov 12, 2014 at 7:32 AM, Jure ErznoÅŸnik <***@perftech.si<mailto:***@perftech.si>> wrote:
if self.transaction_level == 0 or self.transaction_level is None

Rats! That's what I get for copying code that I don't really understand. My simple tests passed this as okay.
I have changed the test to "if not self.transaction_level:" in order to fix the bug and avoid the "or" operation at the same time. That's pretty obscure, so I use your version as the comment. This bug fix will define version 2.6.1.2 -- to be pushed to pypi after testing.
--
Vernon
Loading...