Title: can't supply dict() for globals in FunctionType()
Type: behaviour Severity: normal
Components: Core Versions: Deferred
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.

File name Uploaded Description Edit Remove jek, 2008-05-08.04:07:57 test case
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

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
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 
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