Message6188

Author bpedman
Recipients akruis, bpedman, zyasoft
Date 2010-10-18.23:11:14
SpamBayes Score 2.0317081e-14
Marked as misclassified No
Message-id <1287443476.04.0.719746643069.issue1648@psf.upfronthosting.co.za>
In-reply-to
Content
hmm, why is there no ability to re-open a bug? hopefully someone sees this comment...

I am getting an exception using 2.5.2b2 with this code. Specifically the cahnges to __builtin__.java where if the level is -1 (or < 0) it is not sending the full list of arguments to the import function. This may not cause problems with the built-in import but I am overriding the built-in __import__ function. 

When the cPickle module is loaded, it calls importModule("copy_reg") and  when this calls my import function I am missing the globals variable somehow because I get:

UnboundLocalError: local variable 'globals' referenced before assignment

Even though my import function is defined as:
def import_hook(name, globals=None, locals=None, fromlist=None, level= -1):

If I modify __builtins__.java to always pass the level argument I do not get this exception.
History
Date User Action Args
2010-10-18 23:11:16bpedmansetmessageid: <1287443476.04.0.719746643069.issue1648@psf.upfronthosting.co.za>
2010-10-18 23:11:16bpedmansetrecipients: + bpedman, zyasoft, akruis
2010-10-18 23:11:15bpedmanlinkissue1648 messages
2010-10-18 23:11:14bpedmancreate