Skip to content
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
11 changes: 8 additions & 3 deletions python-packages/smithy-http/smithy_http/aio/crt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import asyncio
from collections.abc import AsyncGenerator, AsyncIterable, Awaitable
from concurrent.futures import Future
from copy import deepcopy
from io import BytesIO
from threading import Lock
from typing import TYPE_CHECKING, Any
Expand Down Expand Up @@ -178,9 +179,7 @@ def __init__(
client.
"""
_assert_crt()
self._config = (
AWSCRTHTTPClientConfig() if client_config is None else client_config
)
self._config = client_config or AWSCRTHTTPClientConfig()
if eventloop is None:
eventloop = _AWSCRTEventLoop()
self._eventloop = eventloop
Expand Down Expand Up @@ -334,3 +333,9 @@ async def _consume_body_async(
dest.write(chunk)
# Should we call close here? Or will that make the crt unable to read the last
# chunk?

def __deepcopy__(self, memo: Any) -> "AWSCRTHTTPClient":
return AWSCRTHTTPClient(
eventloop=self._eventloop,
client_config=deepcopy(self._config),
)
8 changes: 8 additions & 0 deletions python-packages/smithy-http/tests/unit/aio/test_crt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from copy import deepcopy

from smithy_http.aio.crt import AWSCRTHTTPClient


def test_deepcopy_client() -> None:
client = AWSCRTHTTPClient()
deepcopy(client)
Loading