Skip to content

socket.{if_nameindex,if_nametoindex,if_indextoname} not exported on PyPy on Windows#11073

Closed
A5rocks wants to merge 2 commits intopython:mainfrom
A5rocks:not-exported-pypy-functions
Closed

socket.{if_nameindex,if_nametoindex,if_indextoname} not exported on PyPy on Windows#11073
A5rocks wants to merge 2 commits intopython:mainfrom
A5rocks:not-exported-pypy-functions

Conversation

@A5rocks
Copy link
Contributor

@A5rocks A5rocks commented Nov 27, 2023

Here:

PS C:\Users\A5rocks\Downloads\pypy3.10-v7.3.13-win64\pypy3.10-v7.3.13-win64> ./pypy.exe
Python 3.10.13 (f1607341da97ff5a1e93430b6e8c4af0ad1aa019, Sep 28 2023, 05:42:24)
[PyPy 7.3.13 with MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>> from socket import if_indextoname
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'if_indextoname' from 'socket' (C:\Users\A5rocks\Downloads\pypy3.10-v7.3.13-win64\pypy3.10-v7.3.13-win64\Lib\socket.py)
>>>> from socket import if_nameindex
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'if_nameindex' from 'socket' (C:\Users\A5rocks\Downloads\pypy3.10-v7.3.13-win64\pypy3.10-v7.3.13-win64\Lib\socket.py)
>>>> from socket import if_nametoindex
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'if_nametoindex' from 'socket' (C:\Users\A5rocks\Downloads\pypy3.10-v7.3.13-win64\pypy3.10-v7.3.13-win64\Lib\socket.py)

I'm going to raise a bug report over at PyPy but for now the stubs are incorrect.

@github-actions

This comment has been minimized.

@A5rocks
Copy link
Contributor Author

A5rocks commented Nov 27, 2023

Actually, looks like none of these functions exist, ever: https://foss.heptapod.net/pypy/pypy/-/issues/3249

@A5rocks
Copy link
Contributor Author

A5rocks commented Nov 27, 2023

Aww I actually assumed that sys.implementation.name was a valid thing to check against :(

Well, guess there's no way to resolve this then.

@A5rocks A5rocks closed this Nov 27, 2023
@A5rocks A5rocks deleted the not-exported-pypy-functions branch November 27, 2023 23:21
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra
Copy link
Member

Yes, the type system has no way to distinguish between CPython and PyPy. We could add it, but I think this is the first time I've seen a need for it, so it may not be worth the trouble.

@A5rocks
Copy link
Contributor Author

A5rocks commented Nov 27, 2023

Yeah I found python/typing#1339 but 0 👍 or issues linking it probably means not much use.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants