File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -810,6 +810,30 @@ def dig(self):
810
810
gc_collect () # For PyPy or other GCs.
811
811
self .assertIsNone (ref ())
812
812
813
+ def test_multiple_nesting (self ):
814
+ # Regression test for https://github.com/python/cpython/issues/121863
815
+ class MultiplyNested :
816
+ def f1 (self ):
817
+ __arg = 1
818
+ class D :
819
+ def g (self , __arg ):
820
+ return __arg
821
+ return D ().g (_MultiplyNested__arg = 2 )
822
+
823
+ def f2 (self ):
824
+ __arg = 1
825
+ class D :
826
+ def g (self , __arg ):
827
+ return __arg
828
+ return D ().g
829
+
830
+ inst = MultiplyNested ()
831
+ with self .assertRaises (TypeError ):
832
+ inst .f1 ()
833
+
834
+ closure = inst .f2 ()
835
+ with self .assertRaises (TypeError ):
836
+ closure (_MultiplyNested__arg = 2 )
813
837
814
838
if __name__ == '__main__' :
815
839
unittest .main ()
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ intern_strings(PyObject *tuple)
147
147
"non-string found in code slot" );
148
148
return -1 ;
149
149
}
150
- _PyUnicode_InternMortal (interp , & _PyTuple_ITEMS (tuple )[i ]);
150
+ _PyUnicode_InternImmortal (interp , & _PyTuple_ITEMS (tuple )[i ]);
151
151
}
152
152
return 0 ;
153
153
}
You can’t perform that action at this time.
0 commit comments