Skip to content

Commit c81418e

Browse files
author
stroeder
committed
import ... as
1 parent aab373b commit c81418e

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

Lib/ldap/controls/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def DecodeControlTuples(ldapControlTuples,knownLDAPControls=None):
148148
control.controlType,control.criticality = controlType,criticality
149149
try:
150150
control.decodeControlValue(encodedControlValue)
151-
except PyAsn1Error,e:
151+
except PyAsn1Error as e:
152152
if criticality:
153153
raise e
154154
else:

Lib/ldap/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _ldap_function_call(lock, func, *args, **kwargs):
6464
try: # finally
6565
try: # error / result logging
6666
result = func(*args, **kwargs)
67-
except LDAPError, err:
67+
except LDAPError as err:
6868
if __debug__ and ldap._trace_level >= 2:
6969
ldap._trace_file.write('=> LDAPError: %s\n' % (err))
7070
raise

Lib/ldap/ldapobject/reconnect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def reconnect(self, uri, retry_max=1, retry_delay=60.0):
144144
SimpleLDAPObject.start_tls_s(self)
145145
# Repeat last simple or SASL bind
146146
self._apply_last_bind()
147-
except (ldap.SERVER_DOWN, ldap.TIMEOUT), ldap_error:
147+
except (ldap.SERVER_DOWN, ldap.TIMEOUT) as ldap_error:
148148
if __debug__ and self._trace_level >= 1:
149149
self._trace_file.write('*** %s reconnect to %s failed\n' % (
150150
counter_text, uri

Lib/ldap/ldapobject/simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _ldap_call(self, func, *args, **kwargs):
9494
diagnostic_message_success = self._l.get_option(ldap.OPT_DIAGNOSTIC_MESSAGE)
9595
finally:
9696
self._ldap_object_lock.release()
97-
except LDAPError, e:
97+
except LDAPError as e:
9898
exc_type, exc_value, exc_traceback = sys.exc_info()
9999
try:
100100
if 'info' not in e.args[0] and 'errno' in e.args[0]:

Tests/t_cext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def test_abandon(self):
253253
self.assertNone(ret)
254254
try:
255255
r = l.result4(m, _ldap.MSG_ALL, 0.3) # (timeout /could/ be longer)
256-
except _ldap.TIMEOUT, e:
256+
except _ldap.TIMEOUT as e:
257257
pass
258258
else:
259259
self.fail("expected TIMEOUT, got %r" % r)
@@ -683,7 +683,7 @@ def test_errno107(self):
683683
try:
684684
m = l.simple_bind("", "")
685685
r = l.result4(m, _ldap.MSG_ALL, self.timeout)
686-
except _ldap.SERVER_DOWN, ldap_err:
686+
except _ldap.SERVER_DOWN as ldap_err:
687687
errno = ldap_err.args[0]['errno']
688688
if errno != 107:
689689
self.fail("expected errno=107, got %d" % errno)

Tests/t_ldapobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test004_errno107(self):
159159
try:
160160
m = l.simple_bind_s("", "")
161161
r = l.result4(m, ldap.MSG_ALL, self.timeout)
162-
except ldap.SERVER_DOWN, ldap_err:
162+
except ldap.SERVER_DOWN as ldap_err:
163163
errno = ldap_err.args[0]['errno']
164164
if errno != 107:
165165
self.fail("expected errno=107, got %d" % errno)
@@ -234,7 +234,7 @@ def test103_reconnect_get_state(self):
234234
{}
235235
),
236236
'_options': [(17, 3)],
237-
'_reconnects_done': 0L,
237+
'_reconnects_done': 0,
238238
'_retry_delay': 60.0,
239239
'_retry_max': 1,
240240
'_start_tls': 0,

Tests/t_ldif.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ def test_bad_change_records(self):
662662
ldif_string = textwrap.dedent(bad_ldif_string).lstrip() + '\n'
663663
try:
664664
res = self._parse_records(ldif_string)
665-
except ValueError, value_error:
665+
except ValueError as value_error:
666666
pass
667667
else:
668668
self.fail("should have raised ValueError: %r" % bad_ldif_string)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy