unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matthias Meulien <orontee@gmail.com>
To: Augusto Stoffel <arstoffel@gmail.com>
Cc: 64406@debbugs.gnu.org
Subject: bug#64406: [PATCH] Improve commands to manage Python imports
Date: Fri, 07 Jul 2023 19:46:00 +0200	[thread overview]
Message-ID: <87lefr399j.fsf@gmail.com> (raw)
In-Reply-To: <87pm534puk.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 07 Jul 2023 19:02:27 +0200")

Augusto Stoffel <arstoffel@gmail.com> writes:

> On Sat,  1 Jul 2023 at 22:16, Matthias Meulien wrote:
>
>> -from sys import argv, stdin
>> +from sys import argv, exit, stdin
>
> FWIW, exit is already in the global namespace.

Yes but it isn't meant for use in programs; The documentation says:

    The *note site module (which is imported automatically during startup,
    except if the -S command-line option is given) adds several
    constants to the built-in namespace.  They are useful for the
    interactive interpreter shell and should not be used in programs.


>> -        (unless (eq 0 status)
>> +        (cond
>> +         ((eq 1 status)
>>            (error "%s exited with status %s (maybe isort is missing?)"
>>                   python-interpreter status))
>> +         ((eq 2 status)
>> +          (error "%s exited with status %s (maybe isort version is <5.7.0?)"
>> +                 python-interpreter status)))
>
> This change implies that the "success" branch may run if the exit code
> is nonzero (without knowing all the isort internals, it can't be
> excluded that an exit code > 2 is used somewhere).  I suggest instead a
> (pcase status ...) to construct the " (maybe... ?)" segment of the error
> message.

Thanks, I'll fix this.

> We could also take this opportunity to distinguish between random
> exceptions happening in the script (which likely leads to exit code 1)
> and the ModuleNotFoundError case.

Good point, I'll improve this too.
-- 
Matthias





  reply	other threads:[~2023-07-07 17:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-01 20:16 bug#64406: [PATCH] Improve commands to manage Python imports Matthias Meulien
2023-07-06  7:28 ` Eli Zaretskii
2023-07-07 17:02 ` Augusto Stoffel
2023-07-07 17:46   ` Matthias Meulien [this message]
2023-07-09  6:09     ` Matthias Meulien
2023-07-09  6:32       ` Matthias Meulien
2023-07-09  7:28         ` Eli Zaretskii
2023-07-09  7:54           ` Matthias Meulien
2023-07-13  6:07       ` Eli Zaretskii
2023-07-13 21:07         ` Matthias Meulien
2023-07-15  8:25           ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87lefr399j.fsf@gmail.com \
    --to=orontee@gmail.com \
    --cc=64406@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).