[issue13855] Add qualname support to types.FunctionType

Meador Inge report at bugs.python.org
Tue Jan 24 21:14:47 CET 2012

New submission from Meador Inge <meadori at gmail.com>:

As mentioned in issue13672 currently there is no way to specify a 
qualname on types.FunctionType:

>>> def f():
...    def g():
...       pass
...    return g
>>> g = f()
>>> g
<function f.<locals>.g at 0x7f1dac4d8ba0>
>>> types.FunctionType(f.__code__, {})
<function f at 0x7f1dac4dfae0>
>>> types.FunctionType(g.__code__, {})

If issue13672 is fixed, then the qualname can be derived from the passed
in code object like name is.  We can also add an optional parameter to
the FunctionType constructor for qualname.

I am working on a patch relative to the one I just posted for 

components: Library (Lib)
messages: 151925
nosy: meador.inge, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Add qualname support to types.FunctionType
type: behavior
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list