Commit: 5a761a47e1ccb4f6760d2b556b481ef9cc5938ca
Author: Campbell Barton
Date:   Sun Dec 18 14:18:01 2022 +1100
Branches: master
https://developer.blender.org/rB5a761a47e1ccb4f6760d2b556b481ef9cc5938ca

Cleanup: replace StringIO seek() & read() with a call to getvalue()

===================================================================

M       release/scripts/modules/bl_ui_utils/bug_report_url.py
M       release/scripts/modules/console_python.py
M       tests/python/bl_pyapi_idprop_datablock.py

===================================================================

diff --git a/release/scripts/modules/bl_ui_utils/bug_report_url.py 
b/release/scripts/modules/bl_ui_utils/bug_report_url.py
index 6755c2bad9d..37a52a5141c 100644
--- a/release/scripts/modules/bl_ui_utils/bug_report_url.py
+++ b/release/scripts/modules/bl_ui_utils/bug_report_url.py
@@ -59,10 +59,8 @@ def url_prefill_from_blender(*, addon_info=None):
         "\n"
     )
 
-    fh.seek(0)
-
     form_number = 2 if addon_info else 1
     return (
         
"https://developer.blender.org/maniphest/task/edit/form/%i?description="; % 
form_number +
-        urllib.parse.quote(fh.read())
+        urllib.parse.quote(fh.getvalue())
     )
diff --git a/release/scripts/modules/console_python.py 
b/release/scripts/modules/console_python.py
index 5cf55d3c3b5..a0feceabb3d 100644
--- a/release/scripts/modules/console_python.py
+++ b/release/scripts/modules/console_python.py
@@ -156,11 +156,8 @@ def execute(context, is_interactive):
     if _BPY_MAIN_OWN:
         sys.modules["__main__"] = main_mod_back
 
-    stdout.seek(0)
-    stderr.seek(0)
-
-    output = stdout.read()
-    output_err = stderr.read()
+    output = stdout.getvalue()
+    output_err = stderr.getvalue()
 
     # cleanup
     sys.last_traceback = None
diff --git a/tests/python/bl_pyapi_idprop_datablock.py 
b/tests/python/bl_pyapi_idprop_datablock.py
index ba545aee151..b72b205ad9e 100644
--- a/tests/python/bl_pyapi_idprop_datablock.py
+++ b/tests/python/bl_pyapi_idprop_datablock.py
@@ -65,8 +65,7 @@ def expect_output_or_abort(*, fn, match_stderr=None, 
match_stdout=None):
     for (handle, match) in ((stdout, match_stdout), (stderr, match_stderr)):
         if not match:
             continue
-        handle.seek(0)
-        output = handle.read()
+        output = handle.getvalue()
         if not re.match(match, output):
             print_fail_msg_and_exit("%r not found in %r" % (match, output))

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to