On Tue, May 21, 2019 at 10:47 AM Janne Blomqvist
<blomqvist.ja...@gmail.com> wrote:
>
> On Tue, May 21, 2019 at 10:32 AM Martin Liška <mli...@suse.cz> wrote:
> >
> > Hi.
> >
> > There's a regression I see after the transition to python3:
> >
> > $ cat /tmp/patch
> > diff --git a/gcc/testsuite/gcc.dg/pr90263.c b/gcc/testsuite/gcc.dg/pr90263.c
> > index acf3db16640..3222a5331c1 100644
> > --- a/gcc/testsuite/gcc.dg/pr90263.c
> > +++ b/gcc/testsuite/gcc.dg/pr90263.c
> > @@ -1,5 +1,6 @@
> >  /* PR middle-end/90263 */
> >  /* { dg-do compile } */
> > +/* { dg-options "-O2" } */
> >  /* { dg-require-effective-target glibc } */
> >
> >  int *f (int *p, int *q, long n)
> >
> > $ ~/Programming/gcc/contrib/mklog /tmp/patch
> > Traceback (most recent call last):
> >   File "/home/marxin/Programming/gcc/contrib/mklog", line 470, in <module>
> >     main()
> >   File "/home/marxin/Programming/gcc/contrib/mklog", line 388, in main
> >     diffs = parse_patch(contents)
> >   File "/home/marxin/Programming/gcc/contrib/mklog", line 273, in 
> > parse_patch
> >     lines = contents.split('\n')
> > TypeError: a bytes-like object is required, not 'str'
> >
> > Thanks,
> > Martin
>
> Oof, thanks for the report, looking into it!
>
>
> --
> Janne Blomqvist

Committed r271459 as obvious:

diff --git a/contrib/mklog b/contrib/mklog
index 125f52ef11c..be1dc3a27fc 100755
--- a/contrib/mklog
+++ b/contrib/mklog
@@ -380,7 +380,7 @@ def main():
   if len(args) == 1 and args[0] == '-':
     input = sys.stdin
   elif len(args) == 1:
-    input = open(args[0], 'rb')
+    input = open(args[0])
   else:
     error("too many arguments; for more details run with -h")

@@ -442,7 +442,7 @@ def main():
     shutil.copymode(args[0], tmp)

     # Open the temp file, clearing contents.
-    out = open(tmp, 'wb')
+    out = open(tmp, 'w')
   else:
     tmp = None
     out = sys.stdout


-- 
Janne Blomqvist

Reply via email to