Skip to content

Conversation

keflavich
Copy link
Contributor

This error:

E       TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

arises if turning internet off and then creating a new socket.

I haven't figured out how to MWE this; it was happening in astroquery.gaia, but the source of the connection is buried behind so many abstraction layers that I'm just lost. I've tried hard. I would possibly recommend not merging this until/unless we have a MWE.

@pllim pllim requested a review from bsipocz June 11, 2025 16:42
@pllim pllim added the bug label Jun 11, 2025
@pllim
Copy link
Member

pllim commented Jun 11, 2025

if isinstance(args[0], socket.socket)

It is saying socket.socket is neither a type, a tuple of types, nor a union. Then what is it in your case?

@keflavich
Copy link
Contributor Author

it was a very weird thing. It claimed to be a socket class, but wasn't registering as such with isinstance. I... I am not sure now. I really need an MWE to test this. Within the gaia-related failures, it looked like it might have been a monkeypatch instance or something like that.... but that seems not to be the case; turn_off_internet doesn't replace socket.socket, it just patches its methods.

tl;dr: I'm confused.

@bsipocz
Copy link
Member

bsipocz commented Jun 11, 2025

we're also ignoring a bunch of socket warnings in the astroquery test suite, those may mess up your debug when done via pytest. Given this is a not sure problem and solution yet I switch this PR to be a draft, so we won't accidentally merge it, until at least there is a clear MWE snippet.

@bsipocz bsipocz marked this pull request as draft June 11, 2025 19:47
@keflavich
Copy link
Contributor Author

Thanks @bsipocz, I forgot I could do that. Yes, this should be draft for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants