-
-
Save swtaarrs/1fcac0647bfd90797608c12005076bbd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Lib/test/test_compiler/test_static/primitives.py b/Lib/test/test_compiler/test_static/primitives.py | |
index 2f3d71e61c..936df3e405 100644 | |
--- a/Lib/test/test_compiler/test_static/primitives.py | |
+++ b/Lib/test/test_compiler/test_static/primitives.py | |
@@ -3681,3 +3681,15 @@ def f(): | |
""" | |
with self.in_module(codestr) as mod: | |
self.assertInBytecode(mod.f, "CONVERT_PRIMITIVE") | |
+ | |
+ def test_overflow_while_unboxing(self): | |
+ codestr = """ | |
+ from __static__ import int8, int64, box, unbox | |
+ | |
+ def f(x: int64) -> int8: | |
+ y: int8 = unbox(box(x)) | |
+ return y | |
+ """ | |
+ with self.in_module(codestr) as mod: | |
+ with self.assertRaises(OverflowError): | |
+ mod.f(128) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment