# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1689862565 -7200
# Node ID a95b5ee1a0ea93bab86e4cfce379d94907528730
# Parent  d311880b9d159045af9b0de8b0231c18379642f5
Runtime: py3 fix forcing of STRING

diff -r d311880b9d15 -r a95b5ee1a0ea runtime/typemapping.py
--- a/runtime/typemapping.py	Tue Jun 20 15:05:21 2023 +0200
+++ b/runtime/typemapping.py	Thu Jul 20 16:16:05 2023 +0200
@@ -43,7 +43,7 @@
     "BYTE":       _t(c_uint8),
     "STRING":     (IEC_STRING,
                    lambda x: x.body[:x.len],
-                   lambda t, x: t(len(x), x)),
+                   lambda t, x: t(len(x), x.encode() if type(x)==str else x)),
     "INT":        _t(c_int16),
     "UINT":       _t(c_uint16),
     "WORD":       _t(c_uint16),