Skip to content

Commit 7f945b7

Browse files
committed
Adding in backtraces
1 parent a16f999 commit 7f945b7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Objects/unicodeobject.c

+16
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5353
#include <windows.h>
5454
#endif
5555

56+
#ifdef __wasm__
57+
#include <faasm/host_interface.h>
58+
#endif
59+
5660
/* Uncomment to display statistics on interned strings at exit when
5761
using Valgrind or Insecure++. */
5862
/* #define INTERNED_STATS 1 */
@@ -4938,6 +4942,9 @@ unicode_decode_utf8(const char *s, Py_ssize_t size,
49384942
endinpos = end - starts;
49394943
break;
49404944
case 1:
4945+
#ifdef __wasm__
4946+
__faasm_backtrace(0);
4947+
#endif
49414948
errmsg = "invalid start byte";
49424949
startinpos = s - starts;
49434950
endinpos = startinpos + 1;
@@ -4952,6 +4959,9 @@ unicode_decode_utf8(const char *s, Py_ssize_t size,
49524959
/* fall through */
49534960
case 3:
49544961
case 4:
4962+
#ifdef __wasm__
4963+
__faasm_backtrace(0);
4964+
#endif
49554965
errmsg = "invalid continuation byte";
49564966
startinpos = s - starts;
49574967
endinpos = startinpos + ch - 1;
@@ -5124,10 +5134,16 @@ _Py_DecodeUTF8Ex(const char *s, Py_ssize_t size, wchar_t **wstr, size_t *wlen,
51245134
*reason = "unexpected end of data";
51255135
break;
51265136
case 1:
5137+
#ifdef __wasm__
5138+
__faasm_backtrace(0);
5139+
#endif
51275140
*reason = "invalid start byte";
51285141
break;
51295142
/* 2, 3, 4 */
51305143
default:
5144+
#ifdef __wasm__
5145+
__faasm_backtrace(0);
5146+
#endif
51315147
*reason = "invalid continuation byte";
51325148
break;
51335149
}

0 commit comments

Comments
 (0)