[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None
Joe Borg
report at bugs.python.org
Mon May 12 18:08:22 CEST 2014
New submission from Joe Borg:
See example:
>>> import argparse
>>> a = argparse.ArgumentParser()
>>> b = a.parse_args([])
>>> if b != None:
... print "hey"
File "<stdin>", line 2
print "hey"
^
SyntaxError: invalid syntax
>>>
>>> if b != None:
... print("hey")
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/cfd/software/Python/340/lib/python3.4/argparse.py", line 1202, in __ne__
return not (self == other)
File "/cfd/software/Python/340/lib/python3.4/argparse.py", line 1199, in __eq__
return vars(self) == vars(other)
TypeError: vars() argument must have __dict__ attribute
----------
components: Library (Lib)
messages: 218326
nosy: Joe.Borg
priority: normal
severity: normal
status: open
title: Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21481>
_______________________________________
More information about the Python-bugs-list
mailing list