Skip to content

BUGFIX: isinstance check is wrong - #88

Draft
keflavich wants to merge 2 commits into
astropy:mainfrom
keflavich:bugfix_socket
Draft

BUGFIX: isinstance check is wrong#88
keflavich wants to merge 2 commits into
astropy:mainfrom
keflavich:bugfix_socket

Conversation

@keflavich

Copy link
Copy Markdown
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

pllim commented Jun 11, 2025

Copy link
Copy Markdown
Member
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
Copy Markdown
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

bsipocz commented Jun 11, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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

@pllim

pllim commented Aug 3, 2026

Copy link
Copy Markdown
Member

Is this still relevant?

@pllim pllim added this to the v0.4.3 milestone Aug 3, 2026
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