I can confirm this issue with Python 2.7. There is a bug report for Python 3 which suggests a workaround: interact at the pdb prompt drops you into an interactive session which is populated with globals()andlocals() and your lambda should work as expected.