diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-01-06 11:27:59 +0100 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2021-01-10 10:14:16 +0100 |
commit | 0de91f9313a4c76445ada1617fff69d97fe12217 (patch) | |
tree | 1e5074682a4996db4d54ac9b6c92e8745f05d753 /pyGHDL/libghdl/errorout_memory.py | |
parent | 015adfc69e63e46c7823524032636faa99106c1f (diff) | |
download | ghdl-0de91f9313a4c76445ada1617fff69d97fe12217.tar.gz ghdl-0de91f9313a4c76445ada1617fff69d97fe12217.tar.bz2 ghdl-0de91f9313a4c76445ada1617fff69d97fe12217.zip |
Make API more pythonic be replacing C-like byte arrays with str. Abstracted utf-8 encoding/decoding.
Diffstat (limited to 'pyGHDL/libghdl/errorout_memory.py')
-rw-r--r-- | pyGHDL/libghdl/errorout_memory.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pyGHDL/libghdl/errorout_memory.py b/pyGHDL/libghdl/errorout_memory.py index f9977ec27..444c53e80 100644 --- a/pyGHDL/libghdl/errorout_memory.py +++ b/pyGHDL/libghdl/errorout_memory.py @@ -79,13 +79,12 @@ def Get_Error_Record(Idx: ErrorIndex): # FIXME: returns Error_Message @export -def Get_Error_Message(Idx: ErrorIndex) -> str: # FIXME: check '*_addr' vs string return value +def Get_Error_Message(Idx: ErrorIndex) -> str: func = libghdl.errorout__memory__get_error_message_addr func.argstype = [c_int32] func.restype = c_char_p - # FIXME: don't we need to encode to utf-8? - return func(Idx) + return func(Idx).decode("utf-8") @export |