File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -324,8 +324,11 @@ gc_visit_thread_stacks(PyInterpreterState *interp)
324
324
_PyInterpreterFrame * curr_frame = p -> current_frame ;
325
325
while (curr_frame != NULL ) {
326
326
PyCodeObject * co = (PyCodeObject * )curr_frame -> f_executable ;
327
- for (int i = 0 ; i < co -> co_nlocalsplus + co -> co_stacksize ; i ++ ) {
328
- gc_visit_stackref (curr_frame -> localsplus [i ]);
327
+ if (co != NULL && PyCode_Check (co )) {
328
+ for (int i = 0 ;
329
+ i < co -> co_nlocalsplus + co -> co_stacksize ; i ++ ) {
330
+ gc_visit_stackref (curr_frame -> localsplus [i ]);
331
+ }
329
332
}
330
333
curr_frame = curr_frame -> previous ;
331
334
}
@@ -585,14 +588,14 @@ deduce_unreachable_heap(PyInterpreterState *interp,
585
588
// incoming references.
586
589
gc_visit_heaps (interp , & update_refs , & state -> base );
587
590
588
- gc_visit_thread_stacks (interp );
589
-
590
591
#ifdef GC_DEBUG
591
592
// Check that all objects are marked as unreachable and that the computed
592
593
// reference count difference (stored in `ob_tid`) is non-negative.
593
594
gc_visit_heaps (interp , & validate_gc_objects , & state -> base );
594
595
#endif
595
596
597
+ gc_visit_thread_stacks (interp );
598
+
596
599
// Transitively mark reachable objects by clearing the
597
600
// _PyGC_BITS_UNREACHABLE flag.
598
601
if (gc_visit_heaps (interp , & mark_heap_visitor , & state -> base ) < 0 ) {
You can’t perform that action at this time.
0 commit comments