Client._transport
may not exist during Client.__del__()
or Client.close()
#1540
Unanswered
j178
asked this question in
Potential Issue
Replies: 1 comment
-
Gotcha. Surprised me slightly that there was actually a client instance in scope there, that got garbage collected, because we never actually get to the point of returning one from Presumably the local exception context is hanging onto a reference to a partially instantiated client. Pull request #1541 neatens up this behaviour, and have confirmed in the console that it resolves this issue. I don't particularly want to futz around with a test case for it because it's a bit of a weird fiddly edge case, and the change in behaviour feels self-evidently correct enough that I'm personally okay without one. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
httpx/httpx/_client.py
Lines 609 to 620 in c75ddc2
Since the error occured in
_get_proxy_map()
, before_transport
was created, soClient._transport
does not exist actuallly.Then in
__del__
andclose()
, access to_transport
will causeAttributeError
:httpx/httpx/_client.py
Lines 1108 to 1118 in c75ddc2
Beta Was this translation helpful? Give feedback.
All reactions