atomics icon indicating copy to clipboard operation
atomics copied to clipboard

UnsupportedWidthException on long byte array

Open starkgate opened this issue 1 year ago • 0 comments

Hi, I am using your library to atomically store data in a shared memory buffer. This works fine when I store just a few bytes (for example I have a struct with 2 integers and 2 floats). However, I recently wanted to store a struct with 100 characters along with 10 integers. I received the error below. I cannot find much information on the error in the code or the documentation. Am I doing something wrong or is this a limitation of the library? Are there any workarounds I could implement?

File "venv\Lib\site-packages\atomics\_impl\atomic\funcs.py", line 109, in atomicview
    return AtomicBytesViewContext(buffer=buffer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\atomics\_impl\atomic\bytes.py", line 22, in __init__
    super().__init__(buffer=buffer, is_integral=False, is_signed=False)
  File "venv\Lib\site-packages\atomics\_impl\atomic\base.py", line 79, in __init__
    raise UnsupportedWidthException(width, readonly=ro)
atomics._impl.exceptions.UnsupportedWidthException: No operations are supported on objects with a width of 110.

starkgate avatar Apr 13 '23 13:04 starkgate