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-33809: add the TracebackException.print() method #24231

Merged
merged 7 commits into from
May 22, 2021

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jan 16, 2021

Move the content of the module-level traceback.print_exception() into a new print() method on TracebackException so that people can do

TracebackException(exc, various configuration options ... ).print()

https://bugs.python.org/issue33809

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Feb 16, 2021
@iritkatriel iritkatriel changed the title bpo-33809: added print() method to TracebackException bpo-33809: add print() method to TracebackException May 12, 2021
@iritkatriel iritkatriel changed the title bpo-33809: add print() method to TracebackException bpo-33809: add the print() method to TracebackException May 14, 2021
@iritkatriel iritkatriel changed the title bpo-33809: add the print() method to TracebackException bpo-33809: add the TracebackException.print() method May 14, 2021
@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 21, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 4abf619 🤖

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 May 21, 2021
Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

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

Approved after adding default to doc. And when you do, no re-review needed ;-).

The PR factors print code out of print_exception and moves it to the class so it can be used with any class instance, however created. I agree with this solution to the bpo request.

Doc/library/traceback.rst Outdated Show resolved Hide resolved
iritkatriel and others added 2 commits May 22, 2021 17:11
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@iritkatriel
Copy link
Member Author

Thanks @terryjreedy !

@iritkatriel
Copy link
Member Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@iritkatriel
Copy link
Member Author

I know you said no need for re-review, but I'm trying to keep the bot happy.

@iritkatriel iritkatriel removed the request for review from terryjreedy May 22, 2021 16:18
@iritkatriel iritkatriel added the type-feature A feature request or enhancement label May 22, 2021
@iritkatriel iritkatriel merged commit 220dd80 into python:main May 22, 2021
@bedevere-bot
Copy link

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

Hi! The buildbot PPC64LE Fedora Stable Clang 3.x has failed when building commit 220dd80.

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/435/builds/176) and take a look at the build logs.
  4. Check if the failure is related to this commit (220dd80) 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/435/builds/176

Failed tests:

  • test_asyncio
  • test_concurrent_futures

Failed subtests:

  • test_crash_at_task_unpickle - test.test_concurrent_futures.ProcessPoolForkserverExecutorDeadlockTest

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

==

Click to see traceback logs
Traceback:
 Thread 0x00007fff8f1ef0f0 (most recent call first):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/threading.py", line 320 in wait
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/multiprocessing/queues.py", line 233 in _feed
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/threading.py", line 943 in run
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/threading.py", line 1006 in _bootstrap_inner
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/threading.py", line 963 in _bootstrap


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_concurrent_futures.py", line 1155, in test_crash_at_task_unpickle
    self._check_crash(BrokenProcessPool, id, CrashAtUnpickle())
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_concurrent_futures.py", line 1137, in _check_crash
    self._fail_on_deadlock(executor)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_concurrent_futures.py", line 1114, in _fail_on_deadlock
    self.fail(f"Executor deadlock:\n\n{tb}")
AssertionError: Executor deadlock:


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_concurrent_futures.py", line 1133, in _check_crash
    res.result(timeout=self.TIMEOUT)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/concurrent/futures/_base.py", line 447, in result
    raise TimeoutError()
concurrent.futures._base.TimeoutError

@bedevere-bot
Copy link

bedevere-bot commented May 22, 2021

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

Hi! The buildbot AMD64 Arch Linux TraceRefs 3.x has failed when building commit 220dd80.

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/484/builds/157) and take a look at the build logs.
  4. Check if the failure is related to this commit (220dd80) 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/484/builds/157

Failed tests:

  • test_asyncio

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

==

Click to see traceback logs
remote: Enumerating objects: 26, done.        
remote: Counting objects:   3% (1/26)        
remote: Counting objects:   7% (2/26)        
remote: Counting objects:  11% (3/26)        
remote: Counting objects:  15% (4/26)        
remote: Counting objects:  19% (5/26)        
remote: Counting objects:  23% (6/26)        
remote: Counting objects:  26% (7/26)        
remote: Counting objects:  30% (8/26)        
remote: Counting objects:  34% (9/26)        
remote: Counting objects:  38% (10/26)        
remote: Counting objects:  42% (11/26)        
remote: Counting objects:  46% (12/26)        
remote: Counting objects:  50% (13/26)        
remote: Counting objects:  53% (14/26)        
remote: Counting objects:  57% (15/26)        
remote: Counting objects:  61% (16/26)        
remote: Counting objects:  65% (17/26)        
remote: Counting objects:  69% (18/26)        
remote: Counting objects:  73% (19/26)        
remote: Counting objects:  76% (20/26)        
remote: Counting objects:  80% (21/26)        
remote: Counting objects:  84% (22/26)        
remote: Counting objects:  88% (23/26)        
remote: Counting objects:  92% (24/26)        
remote: Counting objects:  96% (25/26)        
remote: Counting objects: 100% (26/26)        
remote: Counting objects: 100% (26/26), done.        
remote: Compressing objects:   7% (1/14)        
remote: Compressing objects:  14% (2/14)        
remote: Compressing objects:  21% (3/14)        
remote: Compressing objects:  28% (4/14)        
remote: Compressing objects:  35% (5/14)        
remote: Compressing objects:  42% (6/14)        
remote: Compressing objects:  50% (7/14)        
remote: Compressing objects:  57% (8/14)        
remote: Compressing objects:  64% (9/14)        
remote: Compressing objects:  71% (10/14)        
remote: Compressing objects:  78% (11/14)        
remote: Compressing objects:  85% (12/14)        
remote: Compressing objects:  92% (13/14)        
remote: Compressing objects: 100% (14/14)        
remote: Compressing objects: 100% (14/14), done.        
remote: Total 14 (delta 12), reused 1 (delta 0), pack-reused 0        
From https://github.com/python/cpython
 * branch                  main       -> FETCH_HEAD
Note: switching to '220dd80a2671f57486055955d5422163cf73ed33'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 220dd80a26 [bpo-33809](https://bugs.python.org/issue33809): add the TracebackException.print() method (GH-24231)
Switched to and reset branch 'main'

./configure: line 10527: PKG_PROG_PKG_CONFIG: command not found

test_tk skipped -- Tk unavailable due to TclError: couldn't connect to display ":99"
test_tix skipped -- Tk unavailable due to TclError: couldn't connect to display ":99"
test_badargs (__main__.GeneralTest) ... ok
test_bound_methods (__main__.GeneralTest) ... ok
test_clear (__main__.GeneralTest) ... ok
test_exit (__main__.GeneralTest) ... ok
test_order (__main__.GeneralTest) ... ok
test_raise (__main__.GeneralTest) ... ok
test_raise_unnormalized (__main__.GeneralTest) ... ok
test_stress (__main__.GeneralTest) ... ok
test_unregister (__main__.GeneralTest) ... ok

----------------------------------------------------------------------
Ran 9 tests in 0.001s

OK
test_kqueue skipped -- test works only on BSD
test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run
test_winconsoleio skipped -- test only relevant on win32
test_msilib skipped -- No module named '_msi'
test_xxlimited skipped -- No module named 'xxlimited'
test_winsound skipped -- No module named 'winsound'
test_ioctl skipped -- Unable to open /dev/tty
test_startfile skipped -- object <module 'os' from '/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/os.py'> has no attribute 'startfile'
test_ttk_guionly skipped -- Tk unavailable due to TclError: couldn't connect to display ":99"
test_ossaudiodev skipped -- [Errno 2] No such file or directory: '/dev/dsp'
test_winreg skipped -- No module named 'winreg'
test_flock (__main__.FNTLEINTRTest) ... ok
test_lockf (__main__.FNTLEINTRTest) ... ok
test_read (__main__.OSEINTRTest) ... ok
test_wait (__main__.OSEINTRTest) ... ok
test_wait3 (__main__.OSEINTRTest) ... ok
test_wait4 (__main__.OSEINTRTest) ... ok
test_waitpid (__main__.OSEINTRTest) ... ok
test_write (__main__.OSEINTRTest) ... ok
test_devpoll (__main__.SelectEINTRTest) ... skipped 'need select.devpoll'
test_epoll (__main__.SelectEINTRTest) ... ok
test_kqueue (__main__.SelectEINTRTest) ... skipped 'need select.kqueue'
test_poll (__main__.SelectEINTRTest) ... ok
test_select (__main__.SelectEINTRTest) ... ok
test_sigtimedwait (__main__.SignalEINTRTest) ... ok
test_sigwaitinfo (__main__.SignalEINTRTest) ... ok
test_accept (__main__.SocketEINTRTest) ... ok
test_open (__main__.SocketEINTRTest) ... ok
test_os_open (__main__.SocketEINTRTest) ... ok
test_recv (__main__.SocketEINTRTest) ... ok
test_recvmsg (__main__.SocketEINTRTest) ... ok
test_send (__main__.SocketEINTRTest) ... ok
test_sendall (__main__.SocketEINTRTest) ... ok
test_sendmsg (__main__.SocketEINTRTest) ... ok
test_sleep (__main__.TimeEINTRTest) ... ok

----------------------------------------------------------------------
Ran 24 tests in 6.538s

OK (skipped=2)
test_devpoll skipped -- test works only on Solaris OS family
Timeout (0:15:00)!
Thread 0x00007f6cec926740 (most recent call first):
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/selectors.py", line 469 in select
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/asyncio/base_events.py", line 1845 in _run_once
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/asyncio/base_events.py", line 595 in run_forever
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/asyncio/base_events.py", line 628 in run_until_complete
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 442 in test_cancel_make_subprocess_transport_exec
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/case.py", line 549 in _callTestMethod
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/case.py", line 592 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/case.py", line 652 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/runner.py", line 176 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/support/__init__.py", line 959 in _run_suite
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/support/__init__.py", line 1082 in run_unittest
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 210 in _test_module
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 246 in _runtest_inner2
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 282 in _runtest_inner
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 141 in _runtest
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 194 in runtest
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest_mp.py", line 81 in run_tests_worker
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/main.py", line 661 in _main
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/main.py", line 641 in main
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/main.py", line 719 in main
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/regrtest.py", line 43 in _main
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/regrtest.py", line 47 in <module>
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/runpy.py", line 86 in _run_code
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/runpy.py", line 196 in _run_module_as_main
Timeout (0:15:00)!
Thread 0x00007f857cad1740 (most recent call first):
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/selectors.py", line 469 in select
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/asyncio/base_events.py", line 1845 in _run_once
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/asyncio/base_events.py", line 595 in run_forever
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/asyncio/base_events.py", line 628 in run_until_complete
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/test_asyncio/test_subprocess.py", line 442 in test_cancel_make_subprocess_transport_exec
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/case.py", line 549 in _callTestMethod
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/case.py", line 592 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/case.py", line 652 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 122 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/unittest/runner.py", line 176 in run
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/support/__init__.py", line 959 in _run_suite
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/support/__init__.py", line 1082 in run_unittest
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 210 in _test_module
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 246 in _runtest_inner2
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 282 in _runtest_inner
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 154 in _runtest
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/runtest.py", line 194 in runtest
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/main.py", line 321 in rerun_failed_tests
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/main.py", line 698 in _main
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/main.py", line 641 in main
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/libregrtest/main.py", line 719 in main
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/__main__.py", line 2 in <module>
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/runpy.py", line 86 in _run_code
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/runpy.py", line 196 in _run_module_as_main
make: *** [Makefile:1255: buildbottest] Error 1

Cannot open file '/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/test-results.xml' for upload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale PR or inactive for long period of time. type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants