Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #From lib-python/3/test/_test_multiprocessing.py
- class _Foo(Structure):
- _fields_ = [
- ('x', c_int),
- ('y', c_double)
- ]
- def test_copy(self):
- foo = _Foo(2, 5.0)
- bar = copy(foo)
- foo.x = 0
- foo.y = 0
- self.assertEqual(bar.x, 2)
- self.assertAlmostEqual(bar.y, 5.0)
- #This goes to the sharedctypes of multiprocessing
- def copy(obj):
- new_obj = _new_value(type(obj))
- ctypes.pointer(new_obj)[0] = obj
- return new_obj
- #Which then breaks here
- def __setitem__(self, index, value):
- cobj = self._type_.from_param(value)
- if ensure_objects(cobj) is not None:
- store_reference(self, index, cobj._objects)
- self._subarray(index)[0] = cobj._get_buffer_value()
- #At this last line
- The error:
- ERROR: test_copy (test.test_multiprocessing_forkserver.WithProcessesTestSharedCTypes)
- ----------------------------------------------------------------------
- Traceback (most recent call last):
- File "/extra1/home/buildslave/buildslave/pypy-c-app-level-linux-x86-64/build/lib-python/3/test/_test_multiprocessing.py", line 2876, in test_copy
- bar = copy(foo)
- File "/extra1/home/buildslave/buildslave/pypy-c-app-level-linux-x86-64/build/lib-python/3/multiprocessing/sharedctypes.py", line 99, in copy
- ctypes.pointer(new_obj)[0] = obj
- File "/extra1/home/buildslave/buildslave/pypy-c-app-level-linux-x86-64/build/lib_pypy/_ctypes/pointer.py", line 116, in __setitem__
- self._subarray(index)[0] = cobj._get_buffer_value()
- TypeError: 'StructureInstance' object does not support item assignment
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement