This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients Arfrever, eric.snow, jcea, meador.inge, pitrou
Date 2012-01-24.20:09:53
SpamBayes Score 4.8037987e-09
Marked as misclassified No
Message-id <1327435795.91.0.886840574793.issue13672@psf.upfronthosting.co.za>
In-reply-to
Content
This seems to be a useful feature to me.  Another area where it can help
is with fixing function types.  Currently the qualname can be lost:

>>> 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__, {})

There is no way to specify a qualname when constructing a
'FunctionType'.  The name is derived from the code object.  The
qualname could be too if we fix this issue.  I will open another issue
for the 'FunctionType' problem.

I have attached a WIP patch.  It passes the full test suite.  I am 
somewhat unsure about the CAPI changes, though.  They are a breaking API
change.  Do we need a *_QualName version instead like we did for
'PyFunction_NewWithQualName'?  I think probably so.  I will add doc
updates to the patch once the API stuff gets worked out.
History
Date User Action Args
2012-01-24 20:09:56meador.ingesetrecipients: + meador.inge, jcea, pitrou, Arfrever, eric.snow
2012-01-24 20:09:55meador.ingesetmessageid: <1327435795.91.0.886840574793.issue13672@psf.upfronthosting.co.za>
2012-01-24 20:09:55meador.ingelinkissue13672 messages
2012-01-24 20:09:55meador.ingecreate