You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@gvanrossum we have a lot of special-casing around this feature in tests. I guess it is used by someone, otherwise, it would not be here at all.
My usecase was to check that subinterpreters don't have any magic assert statements that are required as the part of the main logic. -OO allows me to disable them and run tests again to be sure that everything still works.
I am not sure that this is a common use-case, though.
Let's first discuss whether this is worth doing, because clearly Guido has more context than me. If this is a waste of time, I will just close the issue.
Reacted by kodsurfer, Ilya Solin and Kirill Podoprigora
I don't actually have more context except that given what -OO does I would expect failures and think nothing of it (I have no desire to fix any of these).
Moreover, I presume we're not going to make CI even slower or more expensive by running all tests with all three "optimization" levels, so even if you fix the failures above, there won't be any guarantee that in the future other tests won't break with -O or -OO.
You could think of -OO as an unsupported platform.
Then again, if a particular test failure with -OO bothers you and is easy to fix I won't stop you. It just doesn't feel like an important thing to care about.
It has been almost six months since this issue was opened, and during that time most of the test failures were fixed. However, new problematic spots in the test suite have appeared since then.
I have identified issues at least in the following tests:
This seems to suggest that keeping this issue open may not be very effective unless there is an intention to actively monitor and enforce it in CI, as such cases tend to reappear and proliferate over time.
Activity
gvanrossum commentedon Jul 8, 2025
Does anybody actually care about running the tests with
-OO?sobolevn commentedon Jul 8, 2025
@gvanrossum we have a lot of special-casing around this feature in tests. I guess it is used by someone, otherwise, it would not be here at all.
My usecase was to check that subinterpreters don't have any magic
assertstatements that are required as the part of the main logic.-OOallows me to disable them and run tests again to be sure that everything still works.I am not sure that this is a common use-case, though.
kodsurfer commentedon Jul 8, 2025
@sobolevn should we wait your example PR or find another way?
sobolevn commentedon Jul 8, 2025
@kodsurfer there's no rush :)
Let's first discuss whether this is worth doing, because clearly Guido has more context than me. If this is a waste of time, I will just close the issue.
picnixz commentedon Jul 8, 2025
FTR, I use -OO to remove expensive assertions when doing numerical optimizations so I would be interested in features working even in -OO.
Now, I don't think it's useful to run tests in -OO but it is useful to know that what we test works in -OO as well.
gvanrossum commentedon Jul 8, 2025
I don't actually have more context except that given what
-OOdoes I would expect failures and think nothing of it (I have no desire to fix any of these).Moreover, I presume we're not going to make CI even slower or more expensive by running all tests with all three "optimization" levels, so even if you fix the failures above, there won't be any guarantee that in the future other tests won't break with
-Oor-OO.You could think of
-OOas an unsupported platform.Then again, if a particular test failure with
-OObothers you and is easy to fix I won't stop you. It just doesn't feel like an important thing to care about.pythongh-136438: Make sure `test_builtins` pass with all optimization…
gh-136438: Make sure `test_builtins` pass with all optimization levels (
pythongh-136438: Make sure `test_builtins` pass with all optimization…
[3.14] gh-136438: Make sure `test_builtins` pass with all optimizatio…
pythongh-136438: Make sure `test_interpreters` pass with all optimiza…
[3.13] pythongh-136438: Make sure `test_builtins` pass with all optim…
20 remaining items
pythongh-136438: Make sure `test_dis` pass with all optimization leve…
gh-136438: Make sure `test_compile` pass with all optimization levels (…
[3.14] pythongh-136438: Make sure `test_builtins` pass with all optim…
[3.14] pythongh-136438: Make sure `test_remote_pdb` pass with all opt…
pythongh-136438: Make sure `test_compile` pass with all optimization …
gh-136438: Make sure test.test_pydoc.test_pydoc pass with all optimiz…
donbarbos commentedon Dec 25, 2025
It has been almost six months since this issue was opened, and during that time most of the test failures were fixed. However, new problematic spots in the test suite have appeared since then.
I have identified issues at least in the following tests:
This seems to suggest that keeping this issue open may not be very effective unless there is an intention to actively monitor and enforce it in CI, as such cases tend to reappear and proliferate over time.
gh-136438: Make sure `test_interpreters` pass with all optimization l…
StanFromIreland commentedon Jan 9, 2026
I'm afraid I agree with Dan, we are fighting a loosing battle, currently on Linux I see:
test.test_inspect.test_inspecttest_dataclassestest_dis-- We already fixed this one in gh-136438: Make suretest_dispass with all optimization levels #136593, these were introduced shortly after :-(test_pyrepltest_importlibtest_sys_settracetest_unparseThis feels like a futile effort if the tests we fix are failing the following month.
pythongh-136438: Make sure `test_interpreters` pass with all optimiza…
pythongh-136438: Make sure `test_interpreters` pass with all optimiza…
StanFromIreland commentedon May 30, 2026
Little ping @sobolevn, can this be closed?