All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: John Snow <jsnow@redhat.com>,
	qemu-devel@nongnu.org, michael.roth@amd.com
Subject: Re: [PATCH 1/1] sphinx/qapidoc: Tidy up pylint warning raise-missing-from
Date: Fri, 03 Nov 2023 17:02:34 +0100	[thread overview]
Message-ID: <878r7en7tx.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFEAcA8KaWXTinOLFitnYuTnqz2yXmgYdyUzE6FVFMvwwbLucA@mail.gmail.com> (Peter Maydell's message of "Fri, 3 Nov 2023 10:31:27 +0000")

Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 3 Nov 2023 at 03:08, John Snow <jsnow@redhat.com> wrote:
>>
>> On Wed, Oct 25, 2023 at 6:10 AM Markus Armbruster <armbru@redhat.com> wrote:
>> >
>> > Pylint advises:
>> >
>> >     docs/sphinx/qapidoc.py:518:12: W0707: Consider explicitly re-raising using 'raise ExtensionError(str(err)) from err' (raise-missing-from)
>> >
>> > From its manual:
>> >
>> >     Python's exception chaining shows the traceback of the current
>> >     exception, but also of the original exception.  When you raise a
>> >     new exception after another exception was caught it's likely that
>> >     the second exception is a friendly re-wrapping of the first
>> >     exception.  In such cases `raise from` provides a better link
>> >     between the two tracebacks in the final error.
>> >
>> > Makes sense, so do it.
>> >
>> > Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>
>> In this case it probably doesn't make a difference because Sphinx has
>> its own formatting for displaying the errors, but it's good hygiene.
>>
>> Reviewed-by: John Snow <jsnow@redhat.com>
>
> Has somebody checked that the error Sphinx shows to the user
> is still the friendly one? The only reason to raise
> this error is so that Sphinx will catch it and display
> the friendly string, so anything about tracebacks is a red
> herring -- if the traceback is shown to the user then we got
> something wrong.

The exception type doesn't change, only the backtrace stored within the
exception.  Can't see how its catching could be affected.

To be sure, stick a '} at the beginning of qapi-schema.json and run
sphinx-build.  Result:

    Extension error:
    /work/armbru/qemu/docs/../qapi/qapi-schema.json:1:1: expected '{', '[', string, or boolean

Satisfied?



  reply	other threads:[~2023-11-03 16:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  9:21 [PATCH 0/1] sphinx/qapidoc: pylint cleanups Markus Armbruster
2023-10-25  9:21 ` [PATCH 1/1] sphinx/qapidoc: Tidy up pylint warning raise-missing-from Markus Armbruster
2023-11-03  3:08   ` John Snow
2023-11-03 10:31     ` Peter Maydell
2023-11-03 16:02       ` Markus Armbruster [this message]
2023-11-03 16:17         ` Peter Maydell
2023-11-03  5:34 ` [PATCH 0/1] sphinx/qapidoc: pylint cleanups Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878r7en7tx.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.