Using weakref with execfile?

W

William Trenker

I'm trying to use a weak reference with execfile, if that even makes sense. The following snippet produces an execption:

Python 2.3.2 (#1, Oct 27 2003, 10:19:56)
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: execfile() argument 2 must be dict, not instance

I've read the weakref docs. I thought maybe the weakref.ref or weakref.proxy functions might be needed but they also return their own types which are, of course, not "dict" and so make execfile unhappy.

Am I doing something wrong with weakref, or is it even possible to use a weak reference dict with execfile?

Thank you,
Bill
 
M

Martin v. Loewis

William said:
Am I doing something wrong with weakref, or is it even possible to use a weak reference dict with execfile?

No. You currently must pass genuine dictionaries to execfile (and exec
and eval).

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top