Skip to content
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

FAIL: test_quickened_static_code_gets_unquickened_at_Py_FINALIZE #100225

Open
fabiounixpi opened this issue Dec 13, 2022 · 2 comments
Open

FAIL: test_quickened_static_code_gets_unquickened_at_Py_FINALIZE #100225

fabiounixpi opened this issue Dec 13, 2022 · 2 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@fabiounixpi
Copy link

fabiounixpi commented Dec 13, 2022

Bug report

Compiling Python 3.11.1 from source code, on AlmaLinux 8.7 (fully updated), issuing
$ make test
it stop with

...
stderr:
--- Loop #1 ---
Traceback (most recent call last):
  File "<string>", line 8, in <module>
AssertionError

------
FAIL

======================================================================
FAIL: test_quickened_static_code_gets_unquickened_at_Py_FINALIZE (test.test_embed.EmbeddingTests.test_quickened_static_code_gets_unquickened_at_Py_FINALIZE)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/sorgenti/Python-3.11.1/Lib/test/test_embed.py", line 381, in test_quickened_static_code_gets_unquickened_at_Py_FINALIZE
    out, err = run("test_repeated_init_exec", code)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/sorgenti/Python-3.11.1/Lib/test/test_embed.py", line 115, in run_embedded_interpreter
    self.assertEqual(p.returncode, returncode,
AssertionError: 1 != 0 : bad returncode 1, stderr is '--- Loop #1 ---\nTraceback (most recent call last):\n  File "<string>", line 8, in <module>\nAssertionError\n'

----------------------------------------------------------------------
Ran 1 test in 0.021s

FAILED (failures=1)
test test_embed failed
0:02:21 load avg: 2.47 Re-running test_tools in verbose mode (matching: test_freeze_simple_script)
test_freeze_simple_script (test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script) ... creating the script to be frozen at /tmp/tmp7zgf8ru6/app.py
copying the source tree into /tmp/tmp7zgf8ru6/cpython...
configuring python in /tmp/tmp7zgf8ru6/python-build...
building python in /tmp/tmp7zgf8ru6/python-build...
installing python into /tmp/tmp7zgf8ru6/python-installation...
freezing /tmp/tmp7zgf8ru6/app.py...
ok

----------------------------------------------------------------------
Ran 1 test in 86.208s

OK
1 test failed again:
    test_embed

== Tests result: FAILURE then FAILURE ==

418 tests OK.

1 test failed:
    test_embed

15 tests skipped:
    test_devpoll test_gdb test_ioctl test_kqueue test_launcher
    test_msilib test_ossaudiodev test_startfile test_tix test_tk
    test_ttk_guionly test_winconsoleio test_winreg test_winsound
    test_zipfile64

2 re-run tests:
    test_embed test_tools

Total duration: 3 min 48 sec
Tests result: FAILURE then FAILURE
make: *** [Makefile:1815: test] Error 2

Your environment

  • CPython versions tested on: Python 3.11.1
  • Operating system and architecture: AlmaLinux 8.7 x86_64
  • Build options: ./configure --enable-shared --enable-optimizations
@fabiounixpi fabiounixpi added the type-bug An unexpected behavior, bug, or error label Dec 13, 2022
@sobolevn
Copy link
Member

sobolevn commented Jan 8, 2023

This test is now removed in 3.12
But, the problem might actually still exist or it might be just a flaky test.

Source for the removed failing test:

def test_quickened_static_code_gets_unquickened_at_Py_FINALIZE(self):
# https://github.com/python/cpython/issues/92031
# Do these imports outside of the code string to avoid using
# importlib too much from within the code string, so that
# _handle_fromlist doesn't get quickened until we intend it to.
from dis import _all_opmap
resume = _all_opmap["RESUME"]
resume_quick = _all_opmap["RESUME_QUICK"]
from test.test_dis import QUICKENING_WARMUP_DELAY
code = textwrap.dedent(f"""\
import importlib._bootstrap
func = importlib._bootstrap._handle_fromlist
code = func.__code__
# Assert initially unquickened.
# Use sets to account for byte order.
if set(code._co_code_adaptive[:2]) != set([{resume}, 0]):
raise AssertionError()
for i in range({QUICKENING_WARMUP_DELAY}):
func(importlib._bootstrap, ["x"], lambda *args: None)
# Assert quickening worked
if set(code._co_code_adaptive[:2]) != set([{resume_quick}, 0]):
raise AssertionError()
print("Tests passed")
""")
run = self.run_embedded_interpreter
out, err = run("test_repeated_init_exec", code)
self.assertEqual(out, 'Tests passed\n' * INIT_LOOPS)

@fabiounixpi can you please try main branch? Will it still fail for you?

@brandtbucher
Copy link
Member

The test wasn't really removed, we just renamed it and updated it for changes to how quickening works. The old test isn't valid anymore, and likely raises on line 8 (like the issue shows) if run under 3.12.

@iritkatriel iritkatriel added the tests Tests in the Lib/test dir label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants