Issue1034

classification
Title: can't supply dict() for globals in FunctionType()
Type: behaviour Severity: normal
Components: Core Versions: Deferred
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jek, pjenvey
Priority: Keywords:

Created on 2008-05-08.04:07:58 by jek, last changed 2008-05-13.21:54:08 by pjenvey.

Files
File name Uploaded Description Edit Remove
func_globals.py jek, 2008-05-08.04:07:57 test case
Messages
msg3186 (view) Author: jason kirtland (jek) Date: 2008-05-08.04:07:57
FunctionType(code, {'dict': 'for globals'}) fails with:

TypeError: _new_impl(): 2nd arg can't be coerced to
org.python.core.PyObject[]

I get the same exception with a stringmap, too.
msg3187 (view) Author: jason kirtland (jek) Date: 2008-05-08.15:54:53
Seems to be something deeper- can't clone a function with FunctionType
either.  Maybe the 'arg 2' is internal and the type of globals mapping
is a red herring.

Jython 2.3a0 on java1.6.0_04
Type "copyright", "credits" or "license" for more information.
>>> import types
>>> a = lambda: None
>>> types.FunctionType(a.func_code, a.func_globals, a.func_name)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: _new_impl(): 2nd arg can't be coerced to
org.python.core.PyObject[]
msg3189 (view) Author: Philip Jenvey (pjenvey) Date: 2008-05-13.21:54:08
fixed in r4394, with your test added as Lib/test/test_func_jy. Thanks 
Jason
History
Date User Action Args
2008-05-13 21:54:08pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg3189
nosy: + pjenvey
2008-05-08 15:54:55jeksetmessages: + msg3187
2008-05-08 04:07:58jekcreate