Skip to content

gh-136438: Make sure test_builtins pass with all optimization levels #136474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jul 9, 2025

Now tests pass with all combinations of -OO and --without-doc-strings.

Before:

======================================================================
FAIL: test_compile (test.test_builtin.BuiltinTest.test_compile) (optval=0)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_builtin.py", line 445, in test_compile
    self.assertEqual(rv, tuple(expected))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (True, None, True, True) != (True, 'doc', True, True)

First differing element 1:
None
'doc'

- (True, None, True, True)
?        ^ ^^

+ (True, 'doc', True, True)
?        ^^ ^^


======================================================================
FAIL: test_compile (test.test_builtin.BuiltinTest.test_compile) (optval=1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_builtin.py", line 445, in test_compile
    self.assertEqual(rv, tuple(expected))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (False, None, False, False) != (False, 'doc', False, False)

First differing element 1:
None
'doc'

- (False, None, False, False)
?         ^ ^^

+ (False, 'doc', False, False)
?         ^^ ^^


======================================================================
FAIL: test_compile_ast (test.test_builtin.BuiltinTest.test_compile_ast)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_builtin.py", line 627, in test_compile_ast
    self.assertEqual(opt_right.value, True)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False != True

----------------------------------------------------------------------
Ran 131 tests in 0.211s

@sobolevn sobolevn requested a review from vstinner July 9, 2025 15:56
@bedevere-app bedevere-app bot mentioned this pull request Jul 9, 2025
8 tasks
@bedevere-app bedevere-app bot added the tests Tests in the Lib/test dir label Jul 9, 2025
@sobolevn sobolevn added skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 9, 2025
Copy link

@blockchainGuru1018 blockchainGuru1018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sobolevn, reviewed and approved this PR

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sobolevn sobolevn merged commit c176543 into python:main Jul 10, 2025
53 checks passed
@miss-islington-app
Copy link

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@sobolevn
Copy link
Member Author

Thanks everyone!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 10, 2025
… levels (pythonGH-136474)

(cherry picked from commit c176543)

Co-authored-by: sobolevn <mail@sobolevn.me>
@miss-islington-app
Copy link

Sorry, @sobolevn, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c17654334946b232aa296696cf70ec93a09d8156 3.13

@bedevere-app
Copy link

bedevere-app bot commented Jul 10, 2025

GH-136496 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jul 10, 2025
sobolevn added a commit that referenced this pull request Jul 10, 2025
…n levels (GH-136474) (#136496)

gh-136438: Make sure `test_builtins` pass with all optimization levels (GH-136474)
(cherry picked from commit c176543)

Co-authored-by: sobolevn <mail@sobolevn.me>
@sobolevn
Copy link
Member Author

Looking at 3.13 backport.

sobolevn added a commit to sobolevn/cpython that referenced this pull request Jul 10, 2025
…ization levels (pythonGH-136474)

(cherry picked from commit c176543)

Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-app
Copy link

bedevere-app bot commented Jul 10, 2025

GH-136502 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 10, 2025
sobolevn added a commit that referenced this pull request Jul 10, 2025
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy