Skip to content

Commit

Permalink
X509Name: Raise AttributeError correctly (#1088)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lovetox authored Jan 30, 2022
1 parent c3cdcfd commit ca63d31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/OpenSSL/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def __getattr__(self, name):
_raise_current_error()
except Error:
pass
return super(X509Name, self).__getattr__(name)
raise AttributeError("No such attribute")

entry_index = _lib.X509_NAME_get_index_by_NID(self._name, nid, -1)
if entry_index == -1:
Expand Down

0 comments on commit ca63d31

Please sign in to comment.