thriftrw / thriftrw-python

A Thrift encoding library for Python
MIT License
36 stars 10 forks source link

Fix bug which prevented enum default values from being integers. #59

Closed abhinav closed 9 years ago

abhinav commented 9 years ago

For something like,

enum SomeEnum { X = 1, Y, Z }

struct MyStruct {
    1: optional SomeEnum someEnum = 1
}

We would get the following error upon compliation.

AttributeError: 'TypeReference' object has no attribute 'validate'

This happened because the system was attempting to link and validate the constant value 1 before resolving 'SomeEnum' to its TypeSpec.


Also, I changed const and typedef to not be cythonized since their corresponding objects are eliminated at link time and replaced with the things they point to. 

abhinav commented 9 years ago

CC @breerly @blampe @junchaowu

kriskowal commented 9 years ago

:+1:

HelloGrayson commented 9 years ago

Great testing :shipit: