[ python-Bugs-1004669 ] Type returned from .keys() is not checked

SourceForge.net noreply at sourceforge.net
Fri Aug 6 17:08:09 CEST 2004


Bugs item #1004669, was opened at 2004-08-06 16:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1004669&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: ben handley (bhandley)
Assigned to: Nobody/Anonymous (nobody)
Summary: Type returned from .keys() is not checked

Initial Comment:
When passing a mapping object as the locals to eval, it
doesn't check that the return value of .keys() is a
tuple early enough, resulting in a SystemError:

>>> class C:
...     def __getitem__(self, item):
...         raise KeyError, item
...     def keys(self):
...         return 'a'
...
>>> c=C()
>>> print eval('dir()', globals(), c)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 0, in ?
SystemError: Objects/listobject.c:2110: bad argument to
internal function



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1004669&group_id=5470


More information about the Python-bugs-list mailing list