Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce passing in an instance of the aiohttp resolver, not a class #906

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions aiobotocore/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import copy
import inspect

import botocore.client
from botocore.exceptions import ParamValidationError
Expand Down Expand Up @@ -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))
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_connector_args():

# Test valid config:
AioConfig({
"resolver": aiohttp.resolver.DefaultResolver
"resolver": aiohttp.resolver.DefaultResolver()
})

# test merge
Expand Down