appnexus / pyrobuf

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

Return bool fields as bool, not int #150

Closed alekna closed 4 years ago

alekna commented 4 years ago

Current implementation returns bool fields as int.

Protobuf specification implies it should be bool - https://developers.google.com/protocol-buffers/docs/proto3#json

alekna commented 4 years ago

hi @tburmeister sorry for disturbing again, could you please review this small yet important fix?

tburmeister commented 4 years ago

Hi @alekna, thanks for the PR! I think a cleaner/simpler fix here is to just change the type in the .pxd file to bint (binary integer), then the complied messages should return a boolean automatically. I can make this change or you can take a crack at it if you like; the test you've added is great either way.

tburmeister commented 4 years ago

Hi @alekna I made some changes (used bint for "native" boolean handling and added support for boolean lists as well) and made this available in version 0.9.3.