thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James E. King III (JIRA)" <>
Subject [jira] [Commented] (THRIFT-4002) Thrift exceptions are not hashable in Python 3
Date Fri, 01 Feb 2019 05:32:00 GMT


James E. King III commented on THRIFT-4002:

Could you submit your patch as a pull request?  Thanks.

> Thrift exceptions are not hashable in Python 3
> ----------------------------------------------
>                 Key: THRIFT-4002
>                 URL:
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Compiler
>            Reporter: Jelle Zijlstra
>            Priority: Major
>              Labels: compiler, python
>         Attachments: thrift-hashable-exc.patch
> The Thrift-to-Python compiler generates `__eq__` but not `__hash__` for Thrift exception
classes, which makes them not hashable in Python 3. Due to,
this can lead the Python standard library to throw an error while printing tracebacks involving
Thrift exceptions.
> The attached patch generates `__hash__` for Thrift exceptions. This can technically be
incorrect since Thrift exceptions are mutable (compare,
but in practice it seems unlikely that people would mutate exception instances other than
directly after creating them, and without this patch some Thrift exceptions cannot be displayed
by the standard library.

This message was sent by Atlassian JIRA

View raw message