Skip to content

Commit

Permalink
scripts/spdxcheck.py: make python3 compliant
Browse files Browse the repository at this point in the history
Without this change the following happens when using Python3 (3.6.6):

	$ echo "GPL-2.0" | python3 scripts/spdxcheck.py -
	FAIL: 'str' object has no attribute 'decode'
	Traceback (most recent call last):
	  File "scripts/spdxcheck.py", line 253, in <module>
	    parser.parse_lines(sys.stdin, args.maxlines, '-')
	  File "scripts/spdxcheck.py", line 171, in parse_lines
	    line = line.decode(locale.getpreferredencoding(False), errors='ignore')
	AttributeError: 'str' object has no attribute 'decode'

So as the line is already a string, there is no need to decode it and
the line can be dropped.

/usr/bin/python on Arch is Python 3.  So this would indeed be worth
going into 4.19.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Uwe Kleine-König <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Joe Perches <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Uwe Kleine-König authored and torvalds committed Nov 18, 2018
1 parent 1a41364 commit 6f4d29d
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion scripts/spdxcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ def parse_lines(self, fd, maxlines, fname):
self.curline = 0
try:
for line in fd:
line = line.decode(locale.getpreferredencoding(False), errors='ignore')
self.curline += 1
if self.curline > maxlines:
break
Expand Down

0 comments on commit 6f4d29d

Please sign in to comment.