summaryrefslogtreecommitdiff
path: root/test/DebugProtoTest.thrift
diff options
context:
space:
mode:
authorElvis Pranskevichus <elvispranskevichus@pinterest.com>2019-03-07 11:00:34 -0500
committerD. Can Celasun <can@dcc.im>2019-12-10 20:44:24 +0000
commitb40f5c227f8db61be523f23ca017519167589d97 (patch)
tree78b38c45fc8cf8104c912e2415eefb6b63103c01 /test/DebugProtoTest.thrift
parent45a9827f0f455d377ae87d9a35349c10181d6893 (diff)
downloadthrift-b40f5c227f8db61be523f23ca017519167589d97.tar.gz
THRIFT-4002: Make generated exception classes immutable by default
Currently, the generated exception classes are not hashable under Python 3 because of the generated `__eq__` method. Exception objects are generally expected to be hashable by the Python standard library. Post-construction mutation of an exception object seems like a very unlikely case, so enable hashing for all exceptions by making them immutable by default. This also adds a way to opt-out of immutability by setting the `python.immutable` annotation to `"false"`.
Diffstat (limited to 'test/DebugProtoTest.thrift')
-rw-r--r--test/DebugProtoTest.thrift4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/DebugProtoTest.thrift b/test/DebugProtoTest.thrift
index de47ea717..1ab0f6aea 100644
--- a/test/DebugProtoTest.thrift
+++ b/test/DebugProtoTest.thrift
@@ -241,6 +241,10 @@ exception ExceptionWithAMap {
2: map<string, string> map_field;
}
+exception MutableException {
+ 1: string msg;
+} (python.immutable = "false")
+
service ServiceForExceptionWithAMap {
void methodThatThrowsAnException() throws (1: ExceptionWithAMap xwamap);
}