Better exceptions.

This commit is contained in:
sforman 2023-08-28 20:46:19 -07:00
parent 7285ebb8da
commit 6674fdffb6
1 changed files with 3 additions and 3 deletions

View File

@ -1340,7 +1340,7 @@ def pick(stack, n):
try: try:
item, stack = stack item, stack = stack
except ValueError: except ValueError:
raise IndexError raise IndexError from None
n -= 1 n -= 1
if n < 0: if n < 0:
break break
@ -1405,7 +1405,7 @@ def drop(stack):
try: try:
_, Q = Q _, Q = Q
except ValueError: except ValueError:
raise StackUnderflowError raise StackUnderflowError from None
n -= 1 n -= 1
return Q, stack return Q, stack
@ -1430,7 +1430,7 @@ def take(stack):
try: try:
item, Q = Q item, Q = Q
except ValueError: except ValueError:
raise StackUnderflowError raise StackUnderflowError from None
x = item, x x = item, x
n -= 1 n -= 1
return x, stack return x, stack