From ca63d31ec214125aea1e4990f11c5ecd25fac29b Mon Sep 17 00:00:00 2001 From: lovetox Date: Sun, 30 Jan 2022 20:01:20 +0100 Subject: 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. --- src/OpenSSL/crypto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py index 894d5fa..8d24742 100644 --- a/src/OpenSSL/crypto.py +++ b/src/OpenSSL/crypto.py @@ -620,7 +620,7 @@ class X509Name: _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: -- cgit v1.2.1