Skip to content

Commit e55a2b6

Browse files
committed
fix tests
1 parent eebdb97 commit e55a2b6

File tree

1 file changed

+141
-1
lines changed

1 file changed

+141
-1
lines changed

mypyc/test-data/irbuild-generics.test

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,146 @@ def identity_decorator(f: T) -> T:
785785
def gen() -> Iterator[int]:
786786
yield 1
787787
[out]
788+
def identity_decorator(f):
789+
f :: object
790+
L0:
791+
return f
792+
def gen_gen.__mypyc_generator_helper__(__mypyc_self__, type, value, traceback, arg, stop_iter_ptr):
793+
__mypyc_self__ :: __main__.gen_gen
794+
type, value, traceback, arg :: object
795+
stop_iter_ptr :: object_ptr
796+
r0 :: i32
797+
r1 :: object
798+
r2 :: bit
799+
r3 :: object
800+
r4 :: bool
801+
r5 :: object
802+
r6 :: bit
803+
r7 :: object
804+
r8 :: bool
805+
r9, r10 :: bit
806+
r11 :: bool
807+
L0:
808+
r0 = __mypyc_self__.__mypyc_next_label__
809+
goto L10
810+
L1:
811+
r1 = load_address _Py_NoneStruct
812+
r2 = type != r1
813+
if r2 goto L2 else goto L3 :: bool
814+
L2:
815+
CPyErr_SetObjectAndTraceback(type, value, traceback)
816+
unreachable
817+
L3:
818+
r3 = object 1
819+
__mypyc_self__.__mypyc_next_label__ = 1; r4 = is_error
820+
return r3
821+
L4:
822+
r5 = load_address _Py_NoneStruct
823+
r6 = type != r5
824+
if r6 goto L5 else goto L6 :: bool
825+
L5:
826+
CPyErr_SetObjectAndTraceback(type, value, traceback)
827+
unreachable
828+
L6:
829+
r7 = box(None, 1)
830+
__mypyc_self__.__mypyc_next_label__ = -1; r8 = is_error
831+
L7:
832+
if is_error(stop_iter_ptr) goto L8 else goto L9
833+
L8:
834+
CPyGen_SetStopIterationValue(r7)
835+
unreachable
836+
L9:
837+
set_mem stop_iter_ptr, r7 :: builtins.object*
838+
return 0
839+
L10:
840+
r9 = r0 == 0
841+
if r9 goto L1 else goto L11 :: bool
842+
L11:
843+
r10 = r0 == 1
844+
if r10 goto L4 else goto L12 :: bool
845+
L12:
846+
r11 = raise StopIteration
847+
unreachable
848+
def gen_gen.__next__(__mypyc_self__):
849+
__mypyc_self__ :: __main__.gen_gen
850+
r0, r1 :: object
851+
L0:
852+
r0 = load_address _Py_NoneStruct
853+
r1 = gen_gen.__mypyc_generator_helper__(__mypyc_self__, r0, r0, r0, r0, 0)
854+
return r1
855+
def gen_gen.send(__mypyc_self__, arg):
856+
__mypyc_self__ :: __main__.gen_gen
857+
arg, r0, r1 :: object
858+
L0:
859+
r0 = load_address _Py_NoneStruct
860+
r1 = gen_gen.__mypyc_generator_helper__(__mypyc_self__, r0, r0, r0, arg, 0)
861+
return r1
862+
def gen_gen.__iter__(__mypyc_self__):
863+
__mypyc_self__ :: __main__.gen_gen
864+
L0:
865+
return __mypyc_self__
866+
def gen_gen.throw(__mypyc_self__, type, value, traceback):
867+
__mypyc_self__ :: __main__.gen_gen
868+
type, value, traceback, r0, r1 :: object
869+
L0:
870+
r0 = load_address _Py_NoneStruct
871+
if is_error(value) goto L1 else goto L2
872+
L1:
873+
value = r0
874+
L2:
875+
if is_error(traceback) goto L3 else goto L4
876+
L3:
877+
traceback = r0
878+
L4:
879+
r1 = gen_gen.__mypyc_generator_helper__(__mypyc_self__, type, value, traceback, r0, 0)
880+
return r1
881+
def gen_gen.close(__mypyc_self__):
882+
__mypyc_self__ :: __main__.gen_gen
883+
r0 :: object
884+
r1 :: str
885+
r2, r3, r4, r5 :: object
886+
r6 :: tuple[object, object, object]
887+
r7 :: object
888+
r8 :: str
889+
r9 :: object
890+
r10 :: tuple[object, object]
891+
r11 :: object
892+
r12 :: bit
893+
r13 :: object
894+
r14 :: bool
895+
L0:
896+
L1:
897+
r0 = builtins :: module
898+
r1 = 'GeneratorExit'
899+
r2 = CPyObject_GetAttr(r0, r1)
900+
r3 = load_address _Py_NoneStruct
901+
r4 = load_address _Py_NoneStruct
902+
r5 = __mypyc_self__.throw(r2, r3, r4)
903+
goto L5
904+
L2: (handler for L1)
905+
r6 = CPy_CatchError()
906+
r7 = builtins :: module
907+
r8 = 'StopIteration'
908+
r9 = CPyObject_GetAttr(r7, r8)
909+
r10 = (r2, r9)
910+
r11 = box(tuple[object, object], r10)
911+
r12 = CPy_ExceptionMatches(r11)
912+
if r12 goto L3 else goto L4 :: bool
913+
L3:
914+
CPy_RestoreExcInfo(r6)
915+
r13 = load_address _Py_NoneStruct
916+
return r13
917+
L4:
918+
CPy_Reraise()
919+
unreachable
920+
L5:
921+
r14 = raise RuntimeError('generator ignored GeneratorExit')
922+
unreachable
788923
def gen():
789-
r0 = CPyGen_Create(...)
924+
r0 :: __main__.gen_gen
925+
r1 :: bool
926+
L0:
927+
r0 = gen_gen()
928+
r0.__mypyc_next_label__ = 0; r1 = is_error
790929
return r0
930+

0 commit comments

Comments
 (0)