File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -810,6 +810,30 @@ def dig(self):
810810 gc_collect () # For PyPy or other GCs.
811811 self .assertIsNone (ref ())
812812
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 )
813837
814838if __name__ == '__main__' :
815839 unittest .main ()
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ intern_strings(PyObject *tuple)
147147 "non-string found in code slot" );
148148 return -1 ;
149149 }
150- _PyUnicode_InternMortal (interp , & _PyTuple_ITEMS (tuple )[i ]);
150+ _PyUnicode_InternImmortal (interp , & _PyTuple_ITEMS (tuple )[i ]);
151151 }
152152 return 0 ;
153153}
You can’t perform that action at this time.
0 commit comments