GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — timeit setup is affected by test statement · Issue #114665 · python/cpython Open Labels stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug description:In #114664, I've stumbled on an unexpected behavior in the timeit module. According to the docs, the "setup" function is run once before repeating the statement under test, but that's not what I'm observing: ~ @ py -m timeit --setup 'import sys; assert "csv" not in sys.modules' 'import csv' Traceback (most recent call last): File "/opt/homebrew/Cellar/[email protected]/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/timeit.py", line 330, in main number, _ = t.autorange(callback) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/timeit.py", line 226, in autorange time_taken = self.timeit(number) ^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/timeit.py", line 180, in timeit timing = self.inner(it, self.timer) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<timeit-src>", line 3, in inner import sys; assert "csv" not in sys.modules ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError Compared with In the first, the assertion fails in the setup. But why should it fail? If it's run before the CPython versions tested on:3.12 Operating systems tested on:macOS Activity
MetadataMetadataAssigneesLabelsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |