From 8c0adce6e2ea6d8875e41c383f17c45c8044cc09 Mon Sep 17 00:00:00 2001 From: Tom Forbes Date: Fri, 10 Dec 2021 15:07:17 +0000 Subject: [PATCH] Enforce passing in an instance of the aiohttp resolver, not a class --- aiobotocore/config.py | 5 ++--- tests/test_config.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/aiobotocore/config.py b/aiobotocore/config.py index 2e512c85..d5acdf7c 100644 --- a/aiobotocore/config.py +++ b/aiobotocore/config.py @@ -1,5 +1,4 @@ import copy -import inspect import botocore.client from botocore.exceptions import ParamValidationError @@ -55,9 +54,9 @@ def _validate_connector_args(connector_args): report='{} must be an SSLContext instance'.format(k)) elif k == "resolver": from aiohttp.abc import AbstractResolver - if not inspect.isclass(v) or not issubclass(v, AbstractResolver): + if not isinstance(v, AbstractResolver): raise ParamValidationError( - report='{} must be an AbstractResolver subclass'.format(k)) + report='{} must be an instance of a AbstractResolver'.format(k)) else: raise ParamValidationError( report='invalid connector_arg:{}'.format(k)) diff --git a/tests/test_config.py b/tests/test_config.py index ed386e05..5d4b70f6 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -45,7 +45,7 @@ def test_connector_args(): # Test valid config: AioConfig({ - "resolver": aiohttp.resolver.DefaultResolver + "resolver": aiohttp.resolver.DefaultResolver() }) # test merge