genoobish n00b
Joined: 18 Feb 2015 Posts: 73
|
Posted: Mon Feb 27, 2017 12:47 am Post subject: pypy3 - sharedctypes: global name 'buffer' is not defined |
|
|
Hi, all.
I wrote a program that uses multiprocessing.sharedctypes.RawValue to increment two variables that are shared between n-procs.
It runs well with python{2,3_4,3_5,3_6} and pypy, but with pypy3 it fails in the variable assignment with the following error message:
Code: | pypy3 monty_hall.py p=8
Traceback (most recent call last):
File "monty_hall.py", line 102, in <module>
results = {k: RawValue(typecode_or_type='i') for k in sims.keys()}
File "monty_hall.py", line 102, in <dictcomp>
results = {k: RawValue(typecode_or_type='i') for k in sims.keys()}
File "/usr/lib64/pypy3/lib-python/3/multiprocessing/sharedctypes.py", line 45, in RawValue
obj = _new_value(type_)
File "/usr/lib64/pypy3/lib-python/3/multiprocessing/sharedctypes.py", line 38, in _new_value
return rebuild_ctype(type_, wrapper, None)
File "/usr/lib64/pypy3/lib-python/3/multiprocessing/sharedctypes.py", line 133, in rebuild_ctype
obj = type_.from_buffer(buf)
File "/usr/lib64/pypy3/lib_pypy/_ctypes/basics.py", line 88, in from_buffer
buf = buffer(obj, offset, size)
NameError: global name 'buffer' is not defined
|
At first I thought there might be some problem with pypy3 or with missing libraries I needed, so I went to the pypy irc, and they ran the test on the pypy3 nightly build without a hitch .
I got pypy3-9999, as they also said that 5.5.0 (the other possible version in the portage tree) was very outdated and it might be a bug in that. However, after installing pypy3-9999 from portage I got the same error.
So then I started thinking it could be one of the gentoo patches that break it (there are a couple of patches being applied before compiling), but I was afraid of simply removing all the patches from the ebuild and trying again.
(I'm not posting the ebuild and the patches because I haven't modified neither, I'm working with the gentoo version from the portage tree, and everybody here probably has them in their portage tree copy -- but if somebody thinks it might be useful I'll post them later)
emerge pypy3 --info:
https://paste.pound-python.org/show/ycRPOgMmwqFKNL4bugXI/
To reproduce the error:
Code: | pypy3 -c 'from multiprocessing.sharedctypes import RawValue; a = RawValue(typecode_or_type="i"); print("success =)")' |
[strike]Should I be opening a bug report? [/strike] edit: bug report was filed
Should I try installing it without any of the patches (just commenting them out on the ebuild --- I have no idea what they do in the current moment)?
Is there something else I can try?
All help is welcome
Thanks!
edit:
I have just tried it with pypy3-bin to see if it would work, and got the same error.
edit2:
So I got the nightly build from http://buildbot.pypy.org/nightly/py3.5/pypy-c-jit-latest-linux64.tar.bz2 and it worked as expected. |
|