Cython 0.28, enums.pyx "OverflowError: Python int too large to convert to C long"
Created by: tshirtman
I could pip install pyav on linux arm with cython 0.28, but when i try to import it i get:
>>> import av
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/tangible/.local/lib/python2.7/site-packages/av/__init__.py", line 15, in <module>
from av.audio.fifo import AudioFifo
File "/home/tangible/.local/lib/python2.7/site-packages/av/audio/__init__.py", line 1, in <module>
from .frame import AudioFrame
File "av/audio/frame.pyx", line 1, in init av.audio.frame
File "av/codec/codec.pxd", line 6, in init av.frame
File "/home/tangible/.local/lib/python2.7/site-packages/av/codec/__init__.py", line 1, in <module>
from .codec import Codec, codecs_available, codec_descriptor
File "av/descriptor.pxd", line 4, in init av.codec.codec
File "av/option.pxd", line 4, in init av.descriptor
File "av/option.pyx", line 18, in init av.option
File "av/enums.pyx", line 225, in av.enums.define_enum
File "av/enums.pyx", line 28, in av.enums.EnumType._init
File "av/enums.pyx", line 32, in av.enums.EnumType._create
File "av/enums.pyx", line 145, in av.enums.EnumItem.__cinit__
OverflowError: Python int too large to convert to C long
i can see that it's from this bit of code.
# Establish a hash that doesn't collide with anything that would return
# true from __eq__.
hash_ = id(self)
name_hash = hash(name)
value_hash = hash(value)
while hash_ == name_hash or hash_ == value_hash:
hash_ += 1
self._hash = hash_
the last one being 145.
If i change _hash
declaration to.
cdef unsigned long _hash
Then i can import it correctly.
Doing a PR.