Message45207
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
|
|
Date |
User |
Action |
Args |
2007-08-23 15:31:42 | admin | link | issue872326 messages |
2007-08-23 15:31:42 | admin | create | |
|