Message147972
The documentation for ast says that arguments that are marked with a '?' in the abstract grammar are optional and can therefore be None.
When I try to compile a Module node which contains an ImportFrom node with attribute level=None compile() throws an exception:
Module(body=[ImportFrom(module='time', names=[alias(name='sleep', asname=None), alias(name='time', asname=None)], level=None, lineno=0, col_offset=0)])
Traceback (most recent call last):
File "g0.py", line 423, in <module>
p.main()
File "g0.py", line 65, in main
self.reproduce("g1.pyc")
File "g0.py", line 85, in reproduce
co = self.generate_bytecode(st, genome)
File "g0.py", line 243, in generate_bytecode
co = compile(st, id, "exec")
ValueError: invalid integer value: ��������
So, I tried to set level=0:
Module(body=[ImportFrom(module='time', names=[alias(name='sleep', asname=None), alias(name='time', asname=None)], level=0, lineno=0, col_offset=0)])
and everything worked fine.
BTW: The unprintable bytes in the error message are:
ef bf bd ef bf bd ef bf bd ef bf bd ef bf bd ef bf bd ef bf bd ef bf bd |
|
| Date |
User |
Action |
Args |
| 2011-11-20 00:04:39 | Janosch.Gräf | set | recipients:
+ Janosch.Gräf, docs@python |
| 2011-11-20 00:04:39 | Janosch.Gräf | set | messageid: <1321747479.31.0.688458511993.issue13436@psf.upfronthosting.co.za> |
| 2011-11-20 00:04:38 | Janosch.Gräf | link | issue13436 messages |
| 2011-11-20 00:04:38 | Janosch.Gräf | create | |
|