Title: [275123] trunk/Tools
Revision
275123
Author
[email protected]
Date
2021-03-26 17:02:13 -0700 (Fri, 26 Mar 2021)

Log Message

Fix TypeError: Can't mix strings and bytes in path components in Tools/Scripts/dump-class-layout
https://bugs.webkit.org/show_bug.cgi?id=223819

Patch by Tyler Wilcock <[email protected]> on 2021-03-26
Reviewed by Jonathan Bedard.

Prior to this patch, I received this error when trying to run the
dump-class-layout script.  This happens because `webkit_build_dir()` returns
bytes rather than a string.

$ dump-class-layout -c Release WebCore Pair
Traceback (most recent call last):
  File "/home/twilco/projects/webkit/Tools/Scripts//dump-class-layout", line 88, in <module>
    main()
  File "/home/twilco/projects/webkit/Tools/Scripts//dump-class-layout", line 80, in main
    target_path = os.path.join(build_dir, args.config, args.framework + ".framework", args.framework);
  File "/usr/lib/python3.9/posixpath.py", line 90, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.9/genericpath.py", line 155, in _check_arg_types
    raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components

* Scripts/dump-class-layout:
Update `webkit_build_dir()` to decode its output into a UTF-8 string.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (275122 => 275123)


--- trunk/Tools/ChangeLog	2021-03-26 23:47:47 UTC (rev 275122)
+++ trunk/Tools/ChangeLog	2021-03-27 00:02:13 UTC (rev 275123)
@@ -1,3 +1,29 @@
+2021-03-26  Tyler Wilcock  <[email protected]>
+
+        Fix TypeError: Can't mix strings and bytes in path components in Tools/Scripts/dump-class-layout
+        https://bugs.webkit.org/show_bug.cgi?id=223819
+
+        Reviewed by Jonathan Bedard.
+
+        Prior to this patch, I received this error when trying to run the
+        dump-class-layout script.  This happens because `webkit_build_dir()` returns
+        bytes rather than a string.
+
+        $ dump-class-layout -c Release WebCore Pair
+        Traceback (most recent call last):
+          File "/home/twilco/projects/webkit/Tools/Scripts//dump-class-layout", line 88, in <module>
+            main()
+          File "/home/twilco/projects/webkit/Tools/Scripts//dump-class-layout", line 80, in main
+            target_path = os.path.join(build_dir, args.config, args.framework + ".framework", args.framework);
+          File "/usr/lib/python3.9/posixpath.py", line 90, in join
+            genericpath._check_arg_types('join', a, *p)
+          File "/usr/lib/python3.9/genericpath.py", line 155, in _check_arg_types
+            raise TypeError("Can't mix strings and bytes in path components") from None
+        TypeError: Can't mix strings and bytes in path components
+
+        * Scripts/dump-class-layout:
+        Update `webkit_build_dir()` to decode its output into a UTF-8 string.
+
 2021-03-26  Jonathan Bedard  <[email protected]>
 
         System installing webkitcorepy can break certain scripts

Modified: trunk/Tools/Scripts/dump-class-layout (275122 => 275123)


--- trunk/Tools/Scripts/dump-class-layout	2021-03-26 23:47:47 UTC (rev 275122)
+++ trunk/Tools/Scripts/dump-class-layout	2021-03-27 00:02:13 UTC (rev 275123)
@@ -44,7 +44,7 @@
 
 def webkit_build_dir():
     scriptpath = os.path.dirname(os.path.realpath(__file__))
-    return subprocess.check_output([os.path.join(scriptpath, "webkit-build-directory"), "--top-level"]).strip()
+    return subprocess.check_output([os.path.join(scriptpath, "webkit-build-directory"), "--top-level"]).decode().strip()
 
 def main():
     parser = argparse.ArgumentParser(description='Dumps the in-memory layout of the given class or classes, showing padding holes.')
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to