FirebirdSQL / fdb

Firebird Driver for Python
https://www.firebirdsql.org/en/devel-python-driver/
Other
60 stars 26 forks source link

TypeError on connect() [PYFB74] #44

Open firebird-automations opened 6 years ago

firebird-automations commented 6 years ago

Submitted by: Thomas Aichinger (taich-boy)

Votes: 1

I think I found an error in fdb. Here is the error message when using con.cursor()

LI-V6.3.4.26856 Firebird 2.5 2.5.4.26856 The server is currently using 1791368 bytes of memory. Exception ignored in: <bound method Cursor.__del__ of <fdb.fbcore.Cursor object at 0x7f5f7eccd780>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/fdb/fbcore.py", line 3830, in __del__ File "/usr/local/lib/python3.5/dist-packages/fdb/fbcore.py", line 3572, in close File "/usr/local/lib/python3.5/dist-packages/fdb/fbcore.py", line 431, in is_dead_proxy TypeError: isinstance() arg 2 must be a type or tuple of types

This is the code:

⁠!/usr/bin/env python3

import sys import fdb dbh = fdb.connect(host='127.0.0.1', database='test', user='SYSDBA', password='masterkey', charset='ISO8859_1') print(dbh.server_version) print(dbh.version) bytesInUse = dbh.database_info(fdb.isc_info_current_memory, 'i') print('The server is currently using %d bytes of memory.' % bytesInUse)

⁠ ===> following line produces sometimes error

cur = dbh.cursor() dbh.close()

If you call this code 3-5 several times you get this error. Sometimes you get it on first run. I tried this on serveral different linux servers and with different databases. It's everywhere the same.

Maybe because def is_dead_proxy isinstance should return isinstance(obj, type(weakref.proxytype)) ???

Please help Thomas