classification
Title: Markup with_traceback code example
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.11, Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, iritkatriel, miguendes, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2021-05-04 10:24 by terry.reedy, last changed 2021-05-13 00:27 by iritkatriel. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25929 merged miguendes, 2021-05-05 21:11
PR 26086 merged miss-islington, 2021-05-13 00:11
Messages (3)
msg392871 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-04 10:24
.../Doc/library/exceptions.rst, lines 99-105 has

      original ``SomeException`` had we allowed it to propagate to the caller.

         try:
             ...
         except SomeException:
             tb = sys.exc_info()[2]
             raise OtherException(...).with_traceback(tb)

The code example with no markup except indents does not work because without a new indent, the last line is merged with the preceding one as part of the same paragraph.

https://docs.python.org/3.10/library/exceptions.html#BaseException.with_traceback

        traceback of the original SomeException had we allowed it to propagate to the caller.

            try:

                …
            except SomeException:

                tb = sys.exc_info()[2] raise OtherException(…).with_traceback(tb)

Note also the uneven line spacing, which is different for me here with Firefox that in the web page (also with Firefox).  Something different is needed, but I do not know what.
msg393043 - (view) Author: Miguel Brito (miguendes) * Date: 2021-05-05 21:11
If we make it a code snippet it works. Just adding a `::` after the paragraph.

Here's a print on Firefox locally: https://imgur.com/a/g2vsqf2

I created a PR for that if you think it's a good solution, feel free to merge :)
msg393552 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-13 00:27
New changeset 6275ea02825731fd23f523058ac87aac53888740 by Miss Islington (bot) in branch '3.10':
bpo-44030: Fix formatting error in exceptions docs (GH-25929) (GH-26086)
https://github.com/python/cpython/commit/6275ea02825731fd23f523058ac87aac53888740
History
Date User Action Args
2021-05-13 00:27:29iritkatrielsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-05-13 00:27:15iritkatrielsetnosy: + iritkatriel
messages: + msg393552
2021-05-13 00:11:53miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request24725
2021-05-07 19:01:35iritkatrielsetversions: - Python 3.9
2021-05-05 21:11:55miguendessetmessages: + msg393043
2021-05-05 21:11:05miguendessetkeywords: + patch
nosy: + miguendes

pull_requests: + pull_request24596
stage: needs patch -> patch review
2021-05-04 10:24:38terry.reedycreate