[issue12610] Fatal Python error: non-string found in code slot

Albert Zeyer report at bugs.python.org
Fri Jul 22 15:49:50 CEST 2011


New submission from Albert Zeyer <albzey at googlemail.com>:

Code:

```
from ast import *

globalsDict = {}

body = [
	Assign(targets=[Name(id=u'argc', ctx=Store())],
		   value=Name(id=u'None', ctx=Load())),
	]

exprAst = Interactive(body=[
	FunctionDef(
		name='foo',
		args=arguments(args=[Name(id=u'argc', ctx=Param()), Name(id=u'argv', ctx=Param())],
					   vararg=None, kwarg=None, defaults=[]),
		body=body,
		decorator_list=[])])

fix_missing_locations(exprAst)
compiled = compile(exprAst, "<foo>", "single")
eval(compiled, {}, globalsDict)

f = globalsDict["foo"]
print(f)
```

CPython 2.7.1: Fatal Python error: non-string found in code slot
PyPy 1.5: <function foo at 0x0000000103114430>

----------
messages: 140877
nosy: Albert.Zeyer
priority: normal
severity: normal
status: open
title: Fatal Python error: non-string found in code slot
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12610>
_______________________________________


More information about the Python-bugs-list mailing list