[PATCH] pycocci: fix error when python is python3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux