Summary:
For compatibility reasons, the thrift-py3 map sorts keys when printing, to mimic the same ordering as thrift-py3 when the backing type was `std::map`. However, this doesn't work when a customer is deserializing maps with `BadEnum`, which doesn't define `__lt__`. This may occur, e.g., due to deploying packages with out-of-sync enums.
While I generally prefer being strict with type checking, it's reasonable to expect `__repr__` to succeed even with invalid data.
I also considered implementing `__lt__` on `BadEnum`, but prefer the fix in this diff because it avoids adding surface area to thrift-python that silences buggy user behavior.
Reviewed By: fried, yoney
Differential Revision: D70069362
fbshipit-source-id: 3d03d5626e7122df662191e944a955f2d961ee09