[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ba84d1e9a742 by Raymond Hettinger in branch '2.7':
Issue #21481:  Teach argparse equality tests to return NotImplemented when 
comparing to unknown types.
http://hg.python.org/cpython/rev/ba84d1e9a742

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 510c8dc38749 by Raymond Hettinger in branch '3.4':
Issue #21481:  Teach argparse equality tests to return NotImplemented when 
comparing to unknown types.
http://hg.python.org/cpython/rev/510c8dc38749

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The equality and inequality tests need to return NotImplemented when comparing 
to an unknown type.

--
assignee:  - rhettinger
nosy: +bethard, rhettinger
priority: normal - low
stage:  - needs patch
type:  - behavior
versions:  -Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-22 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file35320/fix_argparse_eq.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-12 Thread Joe Borg

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 rep...@bugs.python.org
http://bugs.python.org/issue21481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-12 Thread Joe Borg

Joe Borg added the comment:

I believe this comes from doing vars(None).  But why would this be happening if 
Namespace is empty.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com