소스 검색

oepydevshell-internal.py: decode only when readdata is valid

fix below problem:
pydevshell raises exception when maximize the python shell window.
when click maximize, rlist of select return ready object, but the
pty.read is None, so throw exception of 'NoneType' object has no
attribute 'decode', change to only decode when readdata is valid.

[YOCTO #11875]

(From OE-Core rev: d598f8d48e9b094af99effa7471d613b16ffa817)

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Changqing Li 6 년 전
부모
커밋
f027576193
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      scripts/oepydevshell-internal.py

+ 3 - 1
scripts/oepydevshell-internal.py

@@ -63,7 +63,9 @@ try:
             (ready, _, _) = select.select([pty, sys.stdin], writers , [], 0)
             (ready, _, _) = select.select([pty, sys.stdin], writers , [], 0)
             try:
             try:
                 if pty in ready:
                 if pty in ready:
-                    i = i + pty.read().decode('utf-8')
+                    readdata = pty.read()
+                    if readdata:
+                        i = i + readdata.decode('utf-8')
                 if i:
                 if i:
                     # Write a page at a time to avoid overflowing output 
                     # Write a page at a time to avoid overflowing output 
                     # d.keys() is a good way to do that
                     # d.keys() is a good way to do that