appnexus / pyrobuf

A Cython alternative to Google's Python Protobuf library
Other
554 stars 76 forks source link

memoryview with Int64List produces unexpected result #139

Open wrobell opened 5 years ago

wrobell commented 5 years ago

Please consider

from pyrobuf_list import Int64List

data = Int64List()
data.extend(range(10))
print(list(memoryview(data)))

On my machine above prints

[0, 72057594037927936, 281474976710656, 1099511627776, 4294967296, 16777216, 65536, 256, 1, 144115188075855872]

Python 3.7 (https://docs.python.org/3/library/array.html), the signed 64-bit int shall be represented by 'q' format, not 'L'. This was introduced in Python 3.3.

wrobell commented 5 years ago

Changing setup.py to use proper format character and setting strides to null in pyrobuf_list_pyx.tmp solves the issue.