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

bpo-43950: Add option to opt-out of PEP-657 #27023

Merged
merged 1 commit into from
Jul 7, 2021

Conversation

ammaraskar
Copy link
Member

@ammaraskar ammaraskar commented Jul 4, 2021

To be merged after #26958

This adds the opt-out option and disables the compiler's column information and traceback printing.

https://bugs.python.org/issue43950

Lib/test/test_zipimport.py Outdated Show resolved Hide resolved
@ammaraskar ammaraskar force-pushed the pep657-config branch 2 times, most recently from 1a555a1 to 0268bfe Compare July 5, 2021 06:06
Lib/test/test_code.py Outdated Show resolved Hide resolved
Python/sysmodule.c Outdated Show resolved Hide resolved
@pablogsal
Copy link
Member

Btw, do we have a test that checks that the flag works?

@ammaraskar
Copy link
Member Author

Btw, do we have a test that checks that the flag works?

Not yet :)

@ammaraskar
Copy link
Member Author

ammaraskar commented Jul 5, 2021

@pablogsal After making these changes, I am a little worried about the sys.flags.no_debug_ranges conditionals, I fear that without it being automatically tested somewhere we could end up with code-rot in the test suite. Would it be possible to run a buildbot with -X no_debug_ranges just to ensure that no bugs in the opted-out code paths pop up.

@pablogsal
Copy link
Member

Would it be possible to run a buildbot with -X no_debug_ranges just to ensure that no bugs in the opted-out code paths pop up.

Hmmm, is possible, but I would prefer to explicitly test that the flag + env work in some specific tests using a subprocess and that would only left the skip() as conditional. Is true that that could break, but adding an entire buildbot is a bit of a big deal, although we can explore that.

@ammaraskar
Copy link
Member Author

Btw, do we have a test that checks that the flag works?

Just added some, please take a look.

Hmmm, is possible, but I would prefer to explicitly test that the flag + env work in some specific tests using a subprocess

For example running test_traceback.py with the flag set? That would certainly work too, I like that approach.

The last remaining component for this PR is to make marshal.c replace the tables with None if the config option is set and test that.

@pablogsal
Copy link
Member

The last remaining component for this PR is to make marshal.c replace the tables with None if the config option is set and test that.

Maybe we should do the logic in the code object constructor and that way we don't need to deal with marshal.c and the compiler.

@ammaraskar
Copy link
Member Author

ammaraskar commented Jul 5, 2021

Maybe we should do the logic in the code object constructor and that way we don't need to deal with marshal.c and the compiler.

Great idea, did this in the common code path in codeobject.c :)
That makes the code a lot simpler.

Added tests to make sure de-marshaling with the flag results in None for the endlinetable and columntable.

Hmmm, is possible, but I would prefer to explicitly test that the flag + env work in some specific tests using a subprocess

Going back to this, do you know if there is an example of such a test that already exists in the suite? Where should it go? A new test_traceback_no_debug_range.py or similar?

@ammaraskar ammaraskar marked this pull request as ready for review July 5, 2021 21:42
@pablogsal
Copy link
Member

We need more rebasing :(

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
@ammaraskar
Copy link
Member Author

Rebased!

@ammaraskar ammaraskar added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 7, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @ammaraskar for commit d34f7a9 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 7, 2021
@ammaraskar
Copy link
Member Author

buildbot/AMD64 Ubuntu Shared PR has a weird failure...

/srv/buildbot/buildarea/pull_request.bolen-ubuntu/build/python: error while loading shared libraries: libpython3.11d.so.1.0: cannot open shared object file: No such file or directory

I wonder if we need a @requires_* on it or if it's just a buildbot problem?

@ammaraskar
Copy link
Member Author

Nope, no @requires annotation is needed to use assert_python_ok and assert_python_failure. This seems to just be a problem with the buildbot.

@ammaraskar
Copy link
Member Author

@pablogsal all lights are green, anything else for this one?

@pablogsal pablogsal merged commit 4823d9a into python:main Jul 7, 2021
@pablogsal
Copy link
Member

@pablogsal all lights are green, anything else for this one?

Nop. Great job! 👌

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 FreeBSD Shared 3.x has failed when building commit 4823d9a.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/483/builds/469) and take a look at the build logs.
  4. Check if the failure is related to this commit (4823d9a) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/483/builds/469

Failed tests:

  • test_marshal
  • test_traceback
  • test_code

Failed subtests:

  • test_endline_and_columntable_none_when_no_debug_ranges_env - test.test_code.CodeTest
  • test_endline_and_columntable_none_when_no_debug_ranges - test.test_code.CodeTest
  • test_no_caret_with_no_debug_ranges_flag - test.test_traceback.TracebackCases
  • test_no_columntable_and_endlinetable_with_no_debug_ranges - test.test_marshal.CodeTestCase
  • test_no_caret_with_no_debug_ranges_flag_python_traceback - test.test_traceback.TracebackCases

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

404 tests OK.

10 slowest tests:

  • test_smtpnet: 6 min 6 sec
  • test_nntplib: 3 min 45 sec
  • test_concurrent_futures: 3 min 33 sec
  • test_multiprocessing_spawn: 2 min 2 sec
  • test_multiprocessing_forkserver: 2 min 2 sec
  • test_unparse: 2 min 2 sec
  • test_urllib2: 2 min 1 sec
  • test_tokenize: 1 min 42 sec
  • test_multiprocessing_fork: 1 min 34 sec
  • test_asyncio: 1 min 23 sec

3 tests failed:
test_code test_marshal test_traceback

20 tests skipped:
test_dbm_gnu test_devpoll test_epoll test_idle test_ioctl
test_msilib test_ossaudiodev test_readline test_spwd
test_startfile test_tcl test_tix test_tk test_ttk_guionly
test_ttk_textonly test_turtle test_winconsoleio test_winreg
test_winsound test_zipfile64

3 re-run tests:
test_code test_marshal test_traceback

Total duration: 14 min 59 sec

Click to see traceback logs
TracebackErrorCaretTests) ... ok


TracebackCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_traceback.py", line 110, in test_no_caret_with_no_debug_ranges_flag_python_traceback
    _, _, stderr = assert_python_ok(
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '@test_77265_tmpæ']


TracebackCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_traceback.py", line 110, in test_no_caret_with_no_debug_ranges_flag_python_traceback
    _, _, stderr = assert_python_ok(
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '@test_80109_tmpæ']


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_marshal.py", line 150, in test_no_columntable_and_endlinetable_with_no_debug_ranges
    assert_python_ok('-X', 'no_debug_ranges',
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '-c', "\nimport sys\nimport marshal\nwith open(sys.argv[1], 'rb') as f:\n    co = marshal.load(f)\n\n    assert co.co_endlinetable is None\n    assert co.co_columntable is None\n", '@test_77265_tmpæ']


TracebackFormatTests) ... ok


TracebackCases) ... ok


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_code.py", line 398, in test_endline_and_columntable_none_when_no_debug_ranges_env
    assert_python_ok('-c', code, PYTHONNODEBUGRANGES='1', __cleanenv=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/python', '-X', 'faulthandler', '-c', '\ndef f():\n    pass\n\nassert f.__code__.co_endlinetable is None\nassert f.__code__.co_columntable is None\n']


TracebackErrorLocationCaretTests) ... ok


TracebackException) ... ok


TracebackCases) ... FAIL


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_code.py", line 387, in test_endline_and_columntable_none_when_no_debug_ranges
    assert_python_ok('-X', 'no_debug_ranges', '-c', code, __cleanenv=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '-c', '\ndef f():\n    pass\n\nassert f.__code__.co_endlinetable is None\nassert f.__code__.co_columntable is None\n']


TracebackCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_traceback.py", line 90, in test_no_caret_with_no_debug_ranges_flag
    self.assertEqual(len(lines), 4)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1 != 4


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_marshal.py", line 150, in test_no_columntable_and_endlinetable_with_no_debug_ranges
    assert_python_ok('-X', 'no_debug_ranges',
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '-c', "\nimport sys\nimport marshal\nwith open(sys.argv[1], 'rb') as f:\n    co = marshal.load(f)\n\n    assert co.co_endlinetable is None\n    assert co.co_columntable is None\n", '@test_82013_tmpæ']

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Ubuntu Shared 3.x has failed when building commit 4823d9a.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/506/builds/502) and take a look at the build logs.
  4. Check if the failure is related to this commit (4823d9a) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/506/builds/502

Failed tests:

  • test_marshal
  • test_traceback
  • test_code

Failed subtests:

  • test_endline_and_columntable_none_when_no_debug_ranges_env - test.test_code.CodeTest
  • test_endline_and_columntable_none_when_no_debug_ranges - test.test_code.CodeTest
  • test_no_caret_with_no_debug_ranges_flag - test.test_traceback.TracebackCases
  • test_no_columntable_and_endlinetable_with_no_debug_ranges - test.test_marshal.CodeTestCase
  • test_no_caret_with_no_debug_ranges_flag_python_traceback - test.test_traceback.TracebackCases

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

407 tests OK.

10 slowest tests:

  • test_concurrent_futures: 4 min 6 sec
  • test_gdb: 3 min 30 sec
  • test_peg_generator: 3 min 6 sec
  • test_capi: 2 min 42 sec
  • test_multiprocessing_spawn: 2 min 34 sec
  • test_asyncio: 1 min 56 sec
  • test_unparse: 1 min 48 sec
  • test_lib2to3: 1 min 33 sec
  • test_multiprocessing_forkserver: 1 min 28 sec
  • test_tokenize: 1 min 16 sec

3 tests failed:
test_code test_marshal test_traceback

17 tests skipped:
test_devpoll test_idle test_ioctl test_kqueue test_msilib
test_ossaudiodev test_startfile test_tcl test_tix test_tk
test_ttk_guionly test_ttk_textonly test_turtle test_winconsoleio
test_winreg test_winsound test_zipfile64

3 re-run tests:
test_code test_marshal test_traceback

Total duration: 26 min 47 sec

Click to see traceback logs
TracebackErrorCaretTests) ... ok


Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_marshal.py", line 150, in test_no_columntable_and_endlinetable_with_no_debug_ranges
    assert_python_ok('-X', 'no_debug_ranges',
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 127
command line: ['/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '-c', "\nimport sys\nimport marshal\nwith open(sys.argv[1], 'rb') as f:\n    co = marshal.load(f)\n\n    assert co.co_endlinetable is None\n    assert co.co_columntable is None\n", '@test_15164_tmpæ']


TracebackCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_traceback.py", line 110, in test_no_caret_with_no_debug_ranges_flag_python_traceback
    _, _, stderr = assert_python_ok(
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 127
command line: ['/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '@test_15685_tmpæ']


TracebackCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_traceback.py", line 90, in test_no_caret_with_no_debug_ranges_flag
    self.assertEqual(len(lines), 4)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1 != 4


Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_marshal.py", line 150, in test_no_columntable_and_endlinetable_with_no_debug_ranges
    assert_python_ok('-X', 'no_debug_ranges',
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 127
command line: ['/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '-c', "\nimport sys\nimport marshal\nwith open(sys.argv[1], 'rb') as f:\n    co = marshal.load(f)\n\n    assert co.co_endlinetable is None\n    assert co.co_columntable is None\n", '@test_29458_tmpæ']


TracebackFormatTests) ... ok


TracebackCases) ... ok


TracebackCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_traceback.py", line 110, in test_no_caret_with_no_debug_ranges_flag_python_traceback
    _, _, stderr = assert_python_ok(
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 127
command line: ['/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '@test_29458_tmpæ']


Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_code.py", line 398, in test_endline_and_columntable_none_when_no_debug_ranges_env
    assert_python_ok('-c', code, PYTHONNODEBUGRANGES='1', __cleanenv=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 127
command line: ['/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python', '-X', 'faulthandler', '-c', '\ndef f():\n    pass\n\nassert f.__code__.co_endlinetable is None\nassert f.__code__.co_columntable is None\n']


TracebackErrorLocationCaretTests) ... ok


TracebackException) ... ok


TracebackCases) ... FAIL


Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_code.py", line 387, in test_endline_and_columntable_none_when_no_debug_ranges
    assert_python_ok('-X', 'no_debug_ranges', '-c', code, __cleanenv=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 160, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 145, in _assert_python
    res.fail(cmd_line)
    ^^^^^^^^^^^^^^^^^^
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/script_helper.py", line 72, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 127
command line: ['/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python', '-X', 'faulthandler', '-X', 'no_debug_ranges', '-c', '\ndef f():\n    pass\n\nassert f.__code__.co_endlinetable is None\nassert f.__code__.co_columntable is None\n']

@pablogsal
Copy link
Member

@ammaraskar @isidentical Hummm, have we bumped the magic number? This buildbot failure seems quite related. I'm in some meetings right now and cannot check but may need to revert:(

@isidentical
Copy link
Member

AFAIK we did. Checking the failures now...

@ammaraskar
Copy link
Member Author

The errors on both are:

/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python: error while loading shared libraries: libpython3.11d.so.1.0: cannot open shared object file: No such file or directory
stderr:
---
ld-elf.so.1: Shared object "libpython3.11d.so.1.0" not found, required by "python"
---

when running assert_python_ok and assert_python_failure and both buildbots have "Shared" in the name.

@ammaraskar
Copy link
Member Author

The confusing thing is, it only happens with the new tests, existing assert_python_ok tests are working just fine.

@isidentical
Copy link
Member

To reproduce locally;

$ git clean -fxd
$ ./configure --with-pydebug --enable-shared -C
$ make -j
$ LD_LIBRARY_PATH=$PWD ./python -m test -v test_traceback

@isidentical
Copy link
Member

We don't preserve the original environment, so shared builds fail. See here:

else:
# Need to preserve the original environment, for in-place testing of
# shared library builds.
env = os.environ.copy()

@isidentical
Copy link
Member

I can confirm that setting __cleanenv to False fixes the issue

@ammaraskar
Copy link
Member Author

Aah, let's remove __cleanenv in that case. I set it primarily because I thought it would avoid propagation of the testing Interpreter's config.

@isidentical
Copy link
Member

Also see this example usage of how it is used (it creates a new env based on the existing one) if you want to isolate these;

    def get_hash(self, repr_, seed=None):
        env = os.environ.copy()
        env['__cleanenv'] = True  # signal to assert_python not to do a copy
                                  # of os.environ on its own
        if seed is not None:
            env['PYTHONHASHSEED'] = str(seed)
        else:
            env.pop('PYTHONHASHSEED', None)
        out = assert_python_ok(
            '-c', self.get_hash_command(repr_),
            **env)
        stdout = out[1].strip()
        return int(stdout)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants