{{ message }}
Commit e18facf
authored
Keep escaped generator frames and wrap asyncgen throw (#8697)
* Keep escaped generator frames and wrap asyncgen throw
Mark gi_frame/cr_frame/ag_frame as escaped so locals survive
deallocation, and let frame.clear() drop those locals after
owner finalize. Route throw() through finalize_send_result so
StopAsyncIteration is wrapped like send(). Add ag_suspended
and drop never-started frame locals on close().
Assisted-by: Grok:grok-4.6
* Store escaped on iframe; skip unused cold alloc
Keep the escaped flag on InterpreterFrame so mark_escaped
and has_escaped do not allocate FrameColdData. Clear optional
cold fields only when they exist. Transfer frame owner in
close() the same way send/throw already do.
Assisted-by: Grok:grok-4.6
* Replace escaped flag with take_ownership
gi_frame returns the frame object. Close uses a uniquely-referenced
check to clear locals or take_ownership onto a husk. frame.clear()
finalizes a generator-owned frame and only clears FRAME_OBJECT
frames. close() leaves the generator suspended when it yields on
GeneratorExit.
Assisted-by: Grok:grok-4.6
* Drop frame mutex; steal frame_obj atomically
take_ownership stores None in an atomic slot instead of locking
and swapping a husk. gi_code reads the kept executable. Resume
exclusivity stays on the running claim.
Assisted-by: Grok:grok-4.61 parent f18edb7 commit e18facf
10 files changed
Lines changed: 121 additions & 147 deletions
File tree
- Lib/test
- test_inspect
- crates/vm/src
- builtins
- stdlib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
| |||
721 | 720 | | |
722 | 721 | | |
723 | 722 | | |
724 | | - | |
725 | 723 | | |
726 | 724 | | |
727 | 725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2930 | 2930 | | |
2931 | 2931 | | |
2932 | 2932 | | |
2933 | | - | |
2934 | 2933 | | |
2935 | 2934 | | |
2936 | 2935 | | |
2937 | | - | |
2938 | 2936 | | |
2939 | 2937 | | |
2940 | 2938 | | |
2941 | 2939 | | |
2942 | 2940 | | |
2943 | | - | |
2944 | 2941 | | |
2945 | 2942 | | |
2946 | 2943 | | |
| |||
2949 | 2946 | | |
2950 | 2947 | | |
2951 | 2948 | | |
2952 | | - | |
2953 | 2949 | | |
2954 | 2950 | | |
2955 | 2951 | | |
2956 | 2952 | | |
2957 | 2953 | | |
2958 | | - | |
2959 | 2954 | | |
2960 | 2955 | | |
2961 | 2956 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| |||
718 | 722 | | |
719 | 723 | | |
720 | 724 | | |
721 | | - | |
722 | | - | |
723 | 725 | | |
724 | 726 | | |
725 | 727 | | |
| |||
841 | 843 | | |
842 | 844 | | |
843 | 845 | | |
844 | | - | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
845 | 849 | | |
846 | 850 | | |
847 | 851 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | | - | |
| 781 | + | |
| 782 | + | |
785 | 783 | | |
786 | 784 | | |
787 | 785 | | |
| |||
790 | 788 | | |
791 | 789 | | |
792 | 790 | | |
| 791 | + | |
| 792 | + | |
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
799 | 798 | | |
800 | 799 | | |
801 | 800 | | |
802 | | - | |
803 | | - | |
804 | 801 | | |
805 | 802 | | |
806 | 803 | | |
| |||
822 | 819 | | |
823 | 820 | | |
824 | 821 | | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
846 | 833 | | |
847 | 834 | | |
848 | 835 | | |
| |||
858 | 845 | | |
859 | 846 | | |
860 | 847 | | |
861 | | - | |
862 | 848 | | |
863 | 849 | | |
864 | 850 | | |
| |||
895 | 881 | | |
896 | 882 | | |
897 | 883 | | |
898 | | - | |
899 | 884 | | |
900 | 885 | | |
901 | 886 | | |
| |||
911 | 896 | | |
912 | 897 | | |
913 | 898 | | |
914 | | - | |
915 | 899 | | |
916 | 900 | | |
917 | 901 | | |
| |||
921 | 905 | | |
922 | 906 | | |
923 | 907 | | |
924 | | - | |
925 | 908 | | |
926 | 909 | | |
927 | 910 | | |
| |||
936 | 919 | | |
937 | 920 | | |
938 | 921 | | |
939 | | - | |
940 | 922 | | |
941 | 923 | | |
942 | 924 | | |
943 | 925 | | |
944 | 926 | | |
945 | | - | |
946 | 927 | | |
947 | 928 | | |
948 | 929 | | |
| |||

0 commit comments