mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts: spdxcheck: resovle decode warning for python3
@ 2018-10-01  8:38 Shubham Singh
  2018-10-01 14:28 ` Jeremy Cline
  0 siblings, 1 reply; 2+ messages in thread
From: Shubham Singh @ 2018-10-01  8:38 UTC (permalink / raw)
  To: tglx; +Cc: akpm, jcline, gregkh, linux-kernel, shubhsherl

From: shubhsherl <dhoni.singh094@gmail.com>

Resolve a warning issue by spdxcheck in Python3
FAIL: 'str' object has no attribute 'decode'

Signed-off-by: Shubham Singh <dhoni.singh094@gmail.com>
---
 scripts/spdxcheck.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 839e190bbd7a..6eea4073f28a 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -168,7 +168,8 @@ class id_parser(object):
         self.curline = 0
         try:
             for line in fd:
-                line = line.decode(locale.getpreferredencoding(False), errors='ignore')
+                if type(line) != str:
+                    line = line.decode(locale.getpreferredencoding(False), errors='ignore')
                 self.curline += 1
                 if self.curline > maxlines:
                     break
-- 
2.18.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] scripts: spdxcheck: resovle decode warning for python3
  2018-10-01  8:38 [PATCH] scripts: spdxcheck: resovle decode warning for python3 Shubham Singh
@ 2018-10-01 14:28 ` Jeremy Cline
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Cline @ 2018-10-01 14:28 UTC (permalink / raw)
  To: Shubham Singh, tglx; +Cc: akpm, gregkh, linux-kernel

Hi Shubham,

On 10/01/2018 04:38 AM, Shubham Singh wrote:
> From: shubhsherl <dhoni.singh094@gmail.com>
> 
> Resolve a warning issue by spdxcheck in Python3
> FAIL: 'str' object has no attribute 'decode'
> 
> Signed-off-by: Shubham Singh <dhoni.singh094@gmail.com>
> ---
>  scripts/spdxcheck.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
> index 839e190bbd7a..6eea4073f28a 100755
> --- a/scripts/spdxcheck.py
> +++ b/scripts/spdxcheck.py
> @@ -168,7 +168,8 @@ class id_parser(object):
>          self.curline = 0
>          try:
>              for line in fd:
> -                line = line.decode(locale.getpreferredencoding(False), errors='ignore')
> +                if type(line) != str:
> +                    line = line.decode(locale.getpreferredencoding(False), errors='ignore')
>                  self.curline += 1
>                  if self.curline > maxlines:
>                      break
> 

This looks to be a fix for the same issue addressed by
"[PATCH] scripts/spdxcheck.py: improve Python 3 compat"[0].

Can you reproduce the warning with that patch?

[0] https://marc.info/?l=linux-kernel&m=153713239404809

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-01 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01  8:38 [PATCH] scripts: spdxcheck: resovle decode warning for python3 Shubham Singh
2018-10-01 14:28 ` Jeremy Cline

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®