Jim sent this to me when the python-dev list was down for maintenance.
Can anyone with Python 2.5 who knows something about function internals
enlighten us about what may have changed here. Previously the names
of nested functions appeared in func_code.co_names but that doesn't
appear to be the case in Python 2.5.

The code to support this is actually quite dodgy and you can see my
comments about it previously at:

  http://issues.apache.org/jira/browse/MODPYTHON-43#action_62042

Personally I think it would be good if this feature of publisher went away,
unfortunately, some amount of code is guaranteed to rely on it.

So anyone got any ideas of how we can do the same thing in Python 2.5?

Thanks.

Graham

Jim Gallacher wrote ..
> Jim Gallacher wrote:
> > Fresh Debian unstable installation seems to have done the trick. My test
> > results:
> > 
> > +1 Apache 2.3.3 (mpm-worker), Python 2.3.5
> > +1 Apache 2.3.3 (mpm-worker), Python 2.4.4c1
> > -1 Apache 2.3.3 (mpm-worker), Python 2.5.0
> > 
> > With python 2.5 I get 2 failures:
> > 
> >     test_publisher_auth_nested
> >     test_publisher_auth_method_nested
> > 
> > which seems odd given that 2.4.4 passes, but I'll dig into it to isolate
> > the problem.
> 
> It looks like something has changed in python 2.5 introspection that is
> messing up publisher.
> 
> Test script testme.py
> ---------------------
> 
> def testfunc():
>      print 'stuff'
>      def __auth__():
>          print '__auth__ called'
>      def __access__():
>          print '__access__ called'
> 
> def main():
>      func_obj = testfunc
> 
>      func_code = func_obj.func_code
>      print func_code.co_names
> 
> if __name__ == '__main__':
>      main()
> 
> Results
> -------
> 
> $ python2.3 testme.py
> ('__auth__', '__access__')
> $ python2.4 testme.py
> ('__auth__', '__access__')
> $ python2.5 testme.py
> ()

Reply via email to