[issue29138] No __hash__() inheritance warning with -Werror

Martin Panter report at bugs.python.org
Tue Jan 3 01:27:46 EST 2017


New submission from Martin Panter:

Normally there is a Python 3 compatibility warning emitted when a class is based on object, implements __eq__(), but does not define __hash__():

$ python -3 -c 'class C(object): __eq__ = lambda self, other: True'
-c:1: DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x

But when warnings are raised as exceptions, this warning seems to be suppressed:

$ python -3 -Werror -c 'class C(object): __eq__ = lambda self, other: True'

Perhaps there is bad exception handling at the warn() call site.

----------
messages: 284539
nosy: martin.panter
priority: normal
severity: normal
stage: needs patch
status: open
title: No __hash__() inheritance warning with -Werror
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29138>
_______________________________________


More information about the Python-bugs-list mailing list