diff options
author | Simon Glass <sjg@chromium.org> | 2018-06-06 13:58:12 -0600 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-06-08 13:43:52 +1000 |
commit | 64a69d123935511f35da1a6101e32d4276f57cd3 (patch) | |
tree | 1c9fd1cc8d21932f6dd91aa960a5b7082e529d17 /pylibfdt | |
parent | 4d09a83420df9b971415133b1904bcd9cc4f6fdd (diff) | |
download | device-tree-compiler-64a69d123935511f35da1a6101e32d4276f57cd3.tar.gz |
pylibfdt: Return string instead of bytearray from getprop()
The return value is not actually mutable, so it seems more correct to
return bytes rather than a bytearray.
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pylibfdt')
-rw-r--r-- | pylibfdt/libfdt.i | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i index 2c104ac..170005f 100644 --- a/pylibfdt/libfdt.i +++ b/pylibfdt/libfdt.i @@ -365,7 +365,7 @@ class Fdt: quiet: Errors to ignore (empty to raise on all errors) Returns: - Value of property as a bytearray, or -ve error number + Value of property as a string of bytes, or -ve error number Raises: FdtError if any error occurs (e.g. the property is not found) @@ -374,7 +374,8 @@ class Fdt: quiet) if isinstance(pdata, (int)): return pdata - return bytearray(pdata[0]) + # Use bytes() rather than string(). This works on both Python 2 and 3 + return bytes(pdata[0]) def get_phandle(self, nodeoffset): """Get the phandle of a node |