This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arigo
Recipients
Date 2004-05-21.08:05:51
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=4771

Note that FOR_ITER segfaults if it is passed a non-iterable.  This gives us a dangerous code object without invoking the 'new' module.  A compiler-produced code object should probably not allow us to do the following:

>>> def f(): (a for b in c)
>>> f.func_code.co_consts
(None, <code object <generator expression> at xxx>, ...)
>>> co = f.func_code.co_consts[1]
>>> dis.dis(co)
  1         0 SETUP_LOOP         17 (to 20)
            3 LOAD_FAST           0 ([outmost-iterable])
       >>   6 FOR_ITER           10 (to 20)
              ...
>>> f.func_code = co
>>> f(5).next()
Segmentation fault
History
Date User Action Args
2007-08-23 15:31:42adminlinkissue872326 messages
2007-08-23 15:31:42admincreate