Skip to content

'_posixshmem' has no attribute 'shm_open' #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sunnyguan opened this issue May 6, 2025 · 2 comments
Open

'_posixshmem' has no attribute 'shm_open' #502

sunnyguan opened this issue May 6, 2025 · 2 comments

Comments

@sunnyguan
Copy link

I am encountering some issues when using shared memory:

$ cat test.py
from multiprocessing.shared_memory import SharedMemory
a = SharedMemory("a", create=True, size=1)
a.unlink()

$ /usr/bin/python3 test.py

$ graalpy test.py
Traceback (most recent call last):
  File <...>, line 2, in <module>
    a = SharedMemory("a", create=True, size=1)
  File "/home/ubuntu/.local/graalpy-24.2.1-linux-amd64/lib/python3.11/multiprocessing/shared_memory.py", line 104, in __init__
    self._fd = _posixshmem.shm_open(
AttributeError: module '_posixshmem' has no attribute 'shm_open'

It is indeed missing when looking at dir(_posixshmem), but it exists for CPython.

$ graalpy
>>> import _posixshmem; dir(_posixshmem)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'shm_unlink']

Will this be supported in the future?

@msimacek
Copy link
Contributor

msimacek commented May 7, 2025

Currently, the module is just a skeleton to let things import, but we didn't have time to actually implement it. We don't have any concrete plans for implementing it, since we haven't really encountered anything using it. What is your use case?

@sunnyguan
Copy link
Author

I see, I can try to work around it for now then, not a major use case.

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

No branches or pull requests

2 participants