Bugs item #1149798, was opened at 2005-02-23 13:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1149798&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jurjen N.E. Bos (jneb)
Assigned to: Nobody/Anonymous (nobody)
Summary: hotshot.runctx: builtins missing

Initial Comment:
We start with a boring example.
>>> import profile
>>> profile.Profile().runctx('print len',{},{})
<built-in function len>
<profile.Profile instance at 0x3c9ccd8>

No news here. But if we do exactly the same using hotshot, we 
get:
>>> import hotshot
>>> hotshot.Profile('/tmp/hs').runctx('print len',{},{})
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/hotshot/__init__.py", line 65, in runctx
    self._prof.runcode(code, globals, locals)
  File "<string>", line 1, in ?
NameError: name 'len' is not defined

The following workaround works:
>>> hotshot.Profile('/tmp/hs').runctx('print len',{'__builtins__':
__builtins__},{})
<built-in function len>
<hotshot.Profile instance at 0x3cba6e8>
But I don't believe this is the way hotshot is supposed to work.

This is on Mac Python, IDE, both 2.3 and 2.4, but I think that 
doesn't matter at all!
- Jurjen

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1149798&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to