4444import adodbapi .process_connect_string
4545from adodbapi .apibase import ProgrammingError
4646
47- _BaseException = api ._BaseException
48-
4947sys .excepthook = Pyro4 .util .excepthook
5048Pyro4 .config .PREFER_IP_VERSION = 0 # allow system to prefer IPv6
5149Pyro4 .config .COMMTIMEOUT = 40.0 # a bit longer than the default SQL server Gtimeout
5856if verbose :
5957 print (version )
6058
61- # --- define objects to smooth out Python3 <-> Python 2 differences
62- unicodeType = str # this line will be altered by 2to3.py to '= str'
63- longType = int # this line will be altered by 2to3.py to '= int'
64- StringTypes = str
65- makeByteBuffer = bytes
66- memoryViewType = memoryview
6759
6860# -----------------------------------------------------------
6961# conversion functions mandated by PEP 249
70- Binary = makeByteBuffer # override the function from apibase.py
62+ def Binary (aString ):
63+ """This function constructs an object capable of holding a binary (long) string value."""
64+ return bytes (aString )
7165
7266
7367def Date (year , month , day ):
@@ -164,7 +158,7 @@ def connect(*args, **kwargs): # --> a remote db-api connection object
164158 raise api .DatabaseError (
165159 "Pyro error creating connection to/thru=%s" % repr (kwargs )
166160 )
167- except _BaseException as e :
161+ except Exception as e :
168162 raise api .DatabaseError (
169163 "Error creating remote connection to=%s, e=%s, %s"
170164 % (repr (kwargs ), repr (e ), sys .exc_info ()[2 ])
@@ -364,7 +358,7 @@ def fixpickle(x):
364358 # for 'named' paramstyle user will pass a mapping
365359 newargs = {}
366360 for arg , val in list (x .items ()):
367- if isinstance (val , memoryViewType ):
361+ if isinstance (val , memoryview ):
368362 newval = array .array ("B" )
369363 newval .fromstring (val )
370364 newargs [arg ] = newval
@@ -374,7 +368,7 @@ def fixpickle(x):
374368 # if not a mapping, then a sequence
375369 newargs = []
376370 for arg in x :
377- if isinstance (arg , memoryViewType ):
371+ if isinstance (arg , memoryview ):
378372 newarg = array .array ("B" )
379373 newarg .fromstring (arg )
380374 newargs .append (newarg )
@@ -565,7 +559,7 @@ def callproc(self, procname, parameters=None):
565559 def fetchone (self ):
566560 try :
567561 f1 = self .proxy .crsr_fetchone (self .id )
568- except _BaseException as e :
562+ except Exception as e :
569563 self ._raiseCursorError (api .DatabaseError , e )
570564 else :
571565 if f1 is None :
0 commit comments