From: Simon Forman Date: Fri, 9 Apr 2021 23:59:06 +0000 (-0700) Subject: Interesting that Nim checks type of first arg... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8c650464209950aeb21f65dc0d3a1fadacfbf899;p=joypy%2FThun.git Interesting that Nim checks type of first arg... ...before stack depth of second arg. --- diff --git a/joy/utils/generated_library.py b/joy/utils/generated_library.py index 8a4acbc..6104979 100644 --- a/joy/utils/generated_library.py +++ b/joy/utils/generated_library.py @@ -1,6 +1,7 @@ # GENERATED FILE. DO NOT EDIT. # The code that generated these functions is in the repo history # at the v0.4.0 tag. +from .errors import NotAListError, StackUnderflowError def _Tree_add_Ee(stack): @@ -65,7 +66,11 @@ def cons(stack): (a1 [...0] -- [a1 ...0]) """ - (s0, (a1, s23)) = stack + try: s0, stack = stack + except ValueError: raise StackUnderflowError + if not isinstance(s0, tuple): raise NotAListError + try: a1, s23 = stack + except ValueError: raise StackUnderflowError return ((a1, s0), s23)