Serhiy Storchaka added the comment: Definitely there is a bug. The code of timeit is written to support string stmt and callable setup. Expected that locals available when the function is created, would be available when the function is executed. But this doesn't work. May be it worked in the earlier Python, I don't know. Due to the lack of tests this was unnoticed.
Here is simpler patch that fixes the support of callable setup with string stmt. But I like Tim's approach (compile testing function using the single template), it makes the implementation simpler. I'll try to adapt it for current sources. ---------- nosy: +serhiy.storchaka stage: -> patch review versions: +Python 2.7, Python 3.4, Python 3.5 -Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5633> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com