diff --git a/CHANGES.rst b/CHANGES.rst index 10090349..1530b4f1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,10 @@ Changes ------- +1.0.6 (2020-06-04) +^^^^^^^^^^^^^^^^^^ +* revert __getattr__ fix as it breaks ddtrace + 1.0.5 (2020-06-03) ^^^^^^^^^^^^^^^^^^ * Fixed AioSession.get_service_data emit call #811 via #812 diff --git a/aiobotocore/__init__.py b/aiobotocore/__init__.py index a39376ea..8fedf0dd 100644 --- a/aiobotocore/__init__.py +++ b/aiobotocore/__init__.py @@ -1,4 +1,4 @@ from .session import get_session, AioSession __all__ = ['get_session', 'AioSession'] -__version__ = '1.0.5' +__version__ = '1.0.6' diff --git a/aiobotocore/client.py b/aiobotocore/client.py index 6690f361..25b94162 100644 --- a/aiobotocore/client.py +++ b/aiobotocore/client.py @@ -1,5 +1,3 @@ -import asyncio - from botocore.awsrequest import prepare_request_dict from botocore.client import logger, PaginatorDocstring, ClientCreator, \ BaseClient, ClientEndpointBridge @@ -71,36 +69,6 @@ def _get_client_args(self, service_model, region_name, is_secure, verify, credentials, scoped_config, client_config, endpoint_bridge) -class _AsyncAttrAdapter: - def __init__(self, coro): - self._coro = coro - self._args = None - self._kwargs = None - - def __call__(self, *args, **kwargs): - # bind args - self._args = args - self._kwargs = kwargs - return self - - async def _resolve(self): - event_response = await self._coro - if asyncio.iscoroutinefunction(event_response): - result = await event_response(*self._args, **self._kwargs) - return result - - if callable(event_response): - result = event_response(*self._args, **self._kwargs) - if asyncio.iscoroutine(result): - result = await result - return result - - return event_response - - def __await__(self): - return self._resolve().__await__() - - class AioBaseClient(BaseClient): async def _async_getattr(self, item): event_name = 'getattr.%s.%s' % ( @@ -112,7 +80,11 @@ async def _async_getattr(self, item): return event_response def __getattr__(self, item): - return _AsyncAttrAdapter(self._async_getattr(item)) + # NOTE: we can not reliably support this because if we were to make this a + # deferred attrgetter (See #803), it would resolve in hasattr always returning + # true. This ends up breaking ddtrace for example when it tries to set a pin. + raise AttributeError( + "'%s' object has no attribute '%s'" % (self.__class__.__name__, item)) async def _make_api_call(self, operation_name, api_params): operation_model = self._service_model.operation_model(operation_name) diff --git a/tests/test_mturk.py b/tests/test_mturk.py index 66962559..1e6ad676 100644 --- a/tests/test_mturk.py +++ b/tests/test_mturk.py @@ -20,7 +20,8 @@ # Unfortunately moto does not support mturk yet -@pytest.mark.moto +# Also looks like we won't be able to support this (see notes from 1.0.6 release) +# @pytest.mark.moto @pytest.mark.asyncio async def test_mturk_stubber(session): async with session.create_client('mturk', region_name='us-east-1') as client: