thrift icon indicating copy to clipboard operation
thrift copied to clipboard

THRIFT-5693 - fix bug in serialization of enum default values

Open andrewcunnin opened this issue 2 years ago • 4 comments

This change fixes a bug where the default values set in enum fields were unable to be serialized. Previously default enum values were being stored as enum objects upon initialization, where Thrift generally expects I32 values. With the changes in this pull request, serialization and deserialization are fixed and the python 3.4 style enums continue to work as expected.

JIRA ticket here: https://issues.apache.org/jira/browse/THRIFT-5693

  • [x] Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • [x] Did you squash your changes to a single commit? (not required, but preferred)
  • [x] Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • [x] If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

andrewcunnin avatar Apr 13 '23 17:04 andrewcunnin

we actually don't have python set up in github actions yet so this is not really tested (we only tested that it did not break other languages that's setup in github actions)

can you show the diff between old and new compiler generated python code?

fishy avatar Apr 13 '23 20:04 fishy

Gotcha, here's a diff of the ThriftTest.thrift generated Python: https://gist.github.com/andrewcunnin/802f4d8fa779c181e2272b5219b52a07

andrewcunnin avatar Apr 14 '23 16:04 andrewcunnin

For the testing, is running the cross test and running make -k check in test/py sufficient? Or were you referring to a different set of tests that I should be running separately?

andrewcunnin avatar Apr 18 '23 16:04 andrewcunnin

For the testing, is running the cross test and running make -k check in test/py sufficient? Or were you referring to a different set of tests that I should be running separately?

we have tests under both test/py and lib/py/test, and then we also have cross tests between different language libraries.

fishy avatar Apr 18 '23 16:04 fishy