Project

General

Profile

Actions

Bug #21718

open

regression calling decode() on memoryview returned by ArvFile

Added by Peter Amstutz 10 days ago. Updated 2 days ago.

Status:
New
Priority:
Normal
Assigned To:
Category:
CWL
Story points:
-

Description

Unfortunately there seems to be a regression in the 2.7.2 release that wasn't caught by our tests.

What seems to have happened is that the data type returned by the Python SDK when reading from Keep changed to avoid copying a buffer (as an optimization), but the methods available on the new type are slightly different. Specifically throwing an exception on the call to "decode()":

            if "cwl.output.json" in outc:
                with outc.open("cwl.output.json", "rb") as f:
                    if f.size() > 0:
                        outputs = json.loads(f.read().decode())

Subtasks 1 (1 open0 closed)

Task #21727: ReviewNewTom CleggActions
Actions #1

Updated by Peter Amstutz 10 days ago

  • Description updated (diff)
  • Subject changed from regression calling encode() on memoryview returned by ArvFile to regression calling decode() on memoryview returned by ArvFile
Actions #2

Updated by Peter Amstutz 9 days ago

  • Assigned To set to Peter Amstutz
Actions #5

Updated by Claudio Lorenzi 2 days ago

Hi!
If it can help, here https://github.com/K0lb3/UnityPy/pull/24/files#diff-6251546231e080376d5bd106e7470c7bde8a672c4af32703fd362b239857eebe they solved by adding a check before the decoding. In this case it would be something like:

if "cwl.output.json" in outc:
   with outc.open("cwl.output.json", "rb") as f:
     if f.size() > 0:
       out_bytes = f.read()
       if isinstance(name, memoryview):
           out_bytes = name.tobytes()
       outputs = json.loads(out_bytes.decode())

Actions

Also available in: Atom PDF