Skip to content

Commit ca63d31

Browse files
authored
X509Name: Raise AttributeError correctly (#1088)
X509Name does only inherit from object, which has no __getattr__() method. By accident this also raised an AttributeError but the error message is confusing. This commit now raises the AttributeError with a descriptive message.
1 parent c3cdcfd commit ca63d31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/OpenSSL/crypto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ def __getattr__(self, name):
620620
_raise_current_error()
621621
except Error:
622622
pass
623-
return super(X509Name, self).__getattr__(name)
623+
raise AttributeError("No such attribute")
624624

625625
entry_index = _lib.X509_NAME_get_index_by_NID(self._name, nid, -1)
626626
if entry_index == -1:

0 commit comments

Comments
 (0)