ctypes structure with custom __new__ which takes argument does not support construction by "from_buffer_copy"
This is a case where ctypes lib in CPython and PyPy give different result. I would say this issue is minor.
Code snippet run in PyPy:
/usr/bin/pypy3
Python 3.6.9 (?, Apr 17 2020, 09:36:06)
[PyPy 7.3.1 with GCC 9.3.0]
#!pypy3
>>>> from ctypes import *
>>>> class test(Structure):
.... _fields_ = [('test', c_ubyte)]
.... def __new__(cls, buffer):
.... return cls.from_buffer_copy(buffer)
.... def __init__(self, buffer):
.... pass
....
>>>> a = test(b'A')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in __new__
File "/opt/pypy3/lib_pypy/_ctypes/basics.py", line 127, in from_buffer_copy
result = self._newowninstance_()
File "/opt/pypy3/lib_pypy/_ctypes/basics.py", line 139, in _newowninstance_
result = self.__new__(self)
TypeError: __new__() missing 1 required positional argument: 'buffer'
#!python3
>>> from ctypes import *
>>> class test(Structure):
... _fields_ = [("test", c_ubyte)]
... def __new__(cls, buffer):
... return cls.from_buffer_copy(buffer)
... def __init__(self, buffer):
... pass
...
>>> a = test(b'A')
>>>
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information