[python-sybase] FreeTDS + Sybase Module = MS SQL 2000

Kevin Jacobs jacobs at penguin.theopalgroup.com
Wed, 10 Jul 2002 11:20:29 -0400 (EDT)


On Wed, 10 Jul 2002, Kevin Jacobs wrote:
> Here is the current issue I'm working on.  My app is single-threaded, so I'm
> a little confused as to why this happens:
> 
> Traceback:
>       Traceback (most recent call last):
[...]
>       AssertionError: release() of un-acquire()d lock

Never mind -- after looking at the code, it is clear why it is blowing up. 
Can you explain what the unlock in the try-except block is supposed to be
doing?  Can that if-statement be safely deleted?

    def close(self):
        '''DB-API Cursor.close()
        '''
        self._lock()
        try:
            if self._state == _CUR_CLOSED:
                self._raise_error(Error, 'cursor is closed')
            if self._state != _CUR_IDLE:
                status = self._cmd.ct_cancel(CS_CANCEL_ALL)
                if status == CS_SUCCEED:
                    self._unlock()
            self._cmd = None
            self._state = _CUR_CLOSED
        finally:
            self._unlock()

Thanks,
-Kevin

--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com