File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/snowflake/connector/vendored/urllib3 Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -338,13 +338,22 @@ def connect(self) -> None:
338338 if self ._has_connected_to_proxy :
339339 self .proxy_is_verified = False
340340
341+ # See issue for more context: https://github.com/urllib3/urllib3/issues/1878
342+ # the maintainers know that this issue can be resolve using the change below but
343+ # they have not merged this change because they need to root-cause it. See
344+ # comment: https://github.com/urllib3/urllib3/issues/1878#issuecomment-641548977
345+ # adding the fix in our vendored code so our users get unblocked
346+ def _is_closed_patch_for_invalid_socket_descriptor (self ):
347+ if getattr (self .sock , "fileno" , lambda _ : None )() == - 1 :
348+ return True
349+
341350 @property
342351 def is_closed (self ) -> bool :
343- return self .sock is None
352+ return self .sock is None or self . _is_closed_patch_for_invalid_socket_descriptor ()
344353
345354 @property
346355 def is_connected (self ) -> bool :
347- if self .sock is None :
356+ if self .sock is None or self . _is_closed_patch_for_invalid_socket_descriptor () :
348357 return False
349358 return not wait_for_read (self .sock , timeout = 0.0 )
350359
You can’t perform that action at this time.
0 commit comments