##// END OF EJS Templates
Update version numbers for 0.10 dev
Update version numbers for 0.10 dev

File last commit:

r1916:7b7637de
r1921:9827fc7b
Show More
refbug.py
38 lines | 1.1 KiB | text/x-python | PythonLexer
"""Minimal script to reproduce our nasty reference counting bug.
The problem is related to https://bugs.launchpad.net/ipython/+bug/269966
The original fix for that appeared to work, but JD Hunter found a matplotlib
example which, when run twice in a row, would break. The problem were
references held by open figures to internals of Tkinter.
This code reproduces the problem that John saw, without matplotlib. We can
thus use it for our test suite.
"""
#-----------------------------------------------------------------------------
# Module imports
#-----------------------------------------------------------------------------
import sys
from IPython import ipapi
#-----------------------------------------------------------------------------
# Globals
#-----------------------------------------------------------------------------
ip = ipapi.get()
if not '_refbug_cache' in ip.user_ns:
ip.user_ns['_refbug_cache'] = []
aglobal = 'Hello'
def f():
return aglobal
cache = ip.user_ns['_refbug_cache']
cache.append(f)
def call_f():
for func in cache:
print 'lowercased:',func().lower()