From: Noel Power Date: Mon, 28 May 2018 15:22:25 +0000 (+0100) Subject: python/samba: Py2|Py3 compat, fix more missed exception tuple issues X-Git-Tag: tevent-0.9.37~259 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9650deee03501a4b7f49872ff9917a118de6e7c3;p=thirdparty%2Fsamba.git python/samba: Py2|Py3 compat, fix more missed exception tuple issues --- diff --git a/python/samba/drs_utils.py b/python/samba/drs_utils.py index 7fab4802522..aa4605e0767 100644 --- a/python/samba/drs_utils.py +++ b/python/samba/drs_utils.py @@ -319,7 +319,7 @@ class drs_Replicate(object): schema=schema, req_level=req_level, req=req) except WERRORError as e: # Check if retrying with the GET_TGT flag set might resolve this error - if self._should_retry_with_get_tgt(e[0], req): + if self._should_retry_with_get_tgt(e.args[0], req): print("Missing target object - retrying with DRS_GET_TGT") req.more_flags |= drsuapi.DRSUAPI_DRS_GET_TGT diff --git a/python/samba/emulate/traffic_packets.py b/python/samba/emulate/traffic_packets.py index 3f5db4317a3..bc52de06ff0 100644 --- a/python/samba/emulate/traffic_packets.py +++ b/python/samba/emulate/traffic_packets.py @@ -47,7 +47,7 @@ def check_runtime_error(runtime, val): if runtime is None: return False - err32 = uint32(runtime[0]) + err32 = uint32(runtime.args[0]) if err32 == val: return True diff --git a/python/samba/tests/net_join_no_spnego.py b/python/samba/tests/net_join_no_spnego.py index 09a2856c9b5..85c6f888d44 100644 --- a/python/samba/tests/net_join_no_spnego.py +++ b/python/samba/tests/net_join_no_spnego.py @@ -55,7 +55,7 @@ class NetJoinNoSpnegoTests(samba.tests.TestCaseInTempDir): self.domain, netbios_name, LIBNET_JOIN_AUTOMATIC, machinepass=machinepass) except NTSTATUSError as e: - code = ctypes.c_uint32(e[0]).value + code = ctypes.c_uint32(e.args[0]).value if code == ntstatus.NT_STATUS_CONNECTION_DISCONNECTED: self.fail("Connection failure") elif code == ntstatus.NT_STATUS_ACCESS_DENIED: @@ -82,7 +82,7 @@ class NetJoinNoSpnegoTests(samba.tests.TestCaseInTempDir): self.domain, netbios_name, LIBNET_JOIN_AUTOMATIC, machinepass=machinepass) except NTSTATUSError as e: - code = ctypes.c_uint32(e[0]).value + code = ctypes.c_uint32(e.args[0]).value if code == ntstatus.NT_STATUS_CONNECTION_DISCONNECTED: self.fail("Connection failure") raise diff --git a/python/samba/tests/py_credentials.py b/python/samba/tests/py_credentials.py index 2f5a7d61a12..c29afd1cf70 100644 --- a/python/samba/tests/py_credentials.py +++ b/python/samba/tests/py_credentials.py @@ -123,7 +123,7 @@ class PyCredentialsTests(TestCase): validation_level, netr_flags) except NTSTATUSError as e: - enum = ctypes.c_uint32(e[0]).value + enum = ctypes.c_uint32(e.args[0]).value if enum == ntstatus.NT_STATUS_WRONG_PASSWORD: self.fail("got wrong password error") else: @@ -150,7 +150,7 @@ class PyCredentialsTests(TestCase): validation_level, netr_flags) except NTSTATUSError as e: - enum = ctypes.c_uint32(e[0]).value + enum = ctypes.c_uint32(e.args[0]).value if enum == ntstatus.NT_STATUS_WRONG_PASSWORD: self.fail("got wrong password error") else: @@ -176,7 +176,7 @@ class PyCredentialsTests(TestCase): validation_level, netr_flags) except NTSTATUSError as e: - enum = ctypes.c_uint32(e[0]).value + enum = ctypes.c_uint32(e.args[0]).value if enum == ntstatus.NT_STATUS_WRONG_PASSWORD: self.fail("got wrong password error") else: @@ -204,7 +204,7 @@ class PyCredentialsTests(TestCase): validation_level, netr_flags) except NTSTATUSError as e: - enum = ctypes.c_uint32(e[0]).value + enum = ctypes.c_uint32(e.args[0]).value if enum == ntstatus.NT_STATUS_WRONG_PASSWORD: self.fail("got wrong password error") else: