All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Frey <dpfrey@gmail.com>
To: backports@vger.kernel.org
Cc: David Frey <dpfrey@gmail.com>
Subject: [PATCH] pycocci: fix error when python is python3
Date: Wed,  6 Nov 2019 14:02:48 -0800	[thread overview]
Message-ID: <20191106220248.214650-1-dpfrey@gmail.com> (raw)

When running under an Arch Linux system where python is python3, the
following error was observed:

  Traceback (most recent call last):
    File "/home/dfrey/projects/backports-linux/devel/pycocci", line 172, in <module>
      ret = _main()
    File "/home/dfrey/projects/backports-linux/devel/pycocci", line 158, in _main
      if args.jobs > 0:
  TypeError: '>' not supported between instances of 'NoneType' and 'int'

The problem is that args.jobs is None in the case that the -j or --jobs
argument wasn't passed to the command. In python3, an exception is
generated when performing a comparison between different types.

Signed-off-by: David Frey <dpfrey@gmail.com>
---
 devel/pycocci | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/pycocci b/devel/pycocci
index 4aa1d363..eb072a7d 100755
--- a/devel/pycocci
+++ b/devel/pycocci
@@ -155,7 +155,7 @@ def _main():
     if args.profile_cocci:
         extra_spatch_args.append('--profile')
     jobs = 0
-    if args.jobs > 0:
+    if args.jobs is not None and args.jobs > 0:
         jobs = args.jobs
 
     output = threaded_spatch(args.cocci_file,
-- 
2.23.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in

                 reply	other threads:[~2019-11-06 22:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20191106220248.214650-1-dpfrey@gmail.com \
    --to=dpfrey@gmail.com \
    --cc=backports@vger.kernel.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.