Skip Montanaro wrote:
Yes, you'll have to pass in locals to exec.
Exec changed between python 2 and 3. It used to be treated specially by the compiler so that it could see and modify the locals where it was used. But now it's just an ordinary function, so you can't expect it to magically know about anything that's not passed into it.