thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duru Can Celasun (Jira)" <j...@apache.org>
Subject [jira] [Resolved] (THRIFT-4002) Thrift exceptions are not hashable in Python 3
Date Thu, 12 Dec 2019 13:52:00 GMT

     [ https://issues.apache.org/jira/browse/THRIFT-4002?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Duru Can Celasun resolved THRIFT-4002.
--------------------------------------
    Fix Version/s: 0.14.0
       Resolution: Fixed

> Thrift exceptions are not hashable in Python 3
> ----------------------------------------------
>
>                 Key: THRIFT-4002
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4002
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Compiler
>            Reporter: Jelle Zijlstra
>            Priority: Major
>              Labels: compiler, python
>             Fix For: 0.14.0
>
>         Attachments: thrift-hashable-exc.patch
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> The Thrift-to-Python compiler generates `__eq__` but not `__hash__` for Thrift exception
classes, which makes them not hashable in Python 3. Due to http://bugs.python.org/issue28603,
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 https://issues.apache.org/jira/browse/THRIFT-162),
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
(v8.3.4#803005)

Mime
View raw message