%run must not change what the __builtins__ object is

Bug #364853 reported by Fernando Perez
2
Affects Status Importance Assigned to Milestone
IPython
Fix Released
Critical
Fernando Perez

Bug Description

This should work:

    In [1]: import tempfile

    In [2]: bid1 = id(__builtins__)

    In [3]: f = tempfile.NamedTemporaryFile()

    In [4]: f.write('pass\\n')

    In [5]: f.flush()

    In [6]: print 'B1:',type(__builtins__)
    B1: <type 'module'>

    In [7]: %run $f.name

    In [8]: bid2 = id(__builtins__)

    In [9]: print 'B2:',type(__builtins__)
    B2: <type 'module'> # right now, this prints 'dict' instead of 'module'. BUG.

There's a test already for this in my branch, but I don't have a fix yet.

Related branches

Revision history for this message
Fernando Perez (fdo.perez) wrote :

Messing with __builtins__ is majorly problematic. I'm working on understanding why this is happening..

Changed in ipython:
assignee: nobody → fdo.perez
importance: Undecided → Critical
milestone: none → 0.10
status: New → Confirmed
Revision history for this message
Fernando Perez (fdo.perez) wrote :

Fix committed in my branch.

Changed in ipython:
status: Confirmed → Fix Committed
Changed in ipython:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.