Message151924
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. |
|
Date |
User |
Action |
Args |
2012-01-24 20:09:56 | meador.inge | set | recipients:
+ meador.inge, jcea, pitrou, Arfrever, eric.snow |
2012-01-24 20:09:55 | meador.inge | set | messageid: <1327435795.91.0.886840574793.issue13672@psf.upfronthosting.co.za> |
2012-01-24 20:09:55 | meador.inge | link | issue13672 messages |
2012-01-24 20:09:55 | meador.inge | create | |
|