Skip to content

'_posixshmem' has no attribute 'shm_open' #502

Open
@sunnyguan

Description

@sunnyguan

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions