File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -705,24 +705,29 @@ static PyStatus
705
705
pycore_interp_init (PyThreadState * tstate )
706
706
{
707
707
PyStatus status ;
708
+ PyObject * sysmod = NULL ;
708
709
709
710
status = pycore_init_types (tstate );
710
711
if (_PyStatus_EXCEPTION (status )) {
711
- return status ;
712
+ goto done ;
712
713
}
713
714
714
- PyObject * sysmod ;
715
715
status = _PySys_Create (tstate , & sysmod );
716
716
if (_PyStatus_EXCEPTION (status )) {
717
- return status ;
717
+ goto done ;
718
718
}
719
719
720
720
status = pycore_init_builtins (tstate );
721
721
if (_PyStatus_EXCEPTION (status )) {
722
- return status ;
722
+ goto done ;
723
723
}
724
724
725
- return pycore_init_import_warnings (tstate , sysmod );
725
+ status = pycore_init_import_warnings (tstate , sysmod );
726
+
727
+ done :
728
+ /* sys.modules['sys'] contains a strong reference to the module */
729
+ Py_XDECREF (sysmod );
730
+ return status ;
726
731
}
727
732
728
733
You can’t perform that action at this time.
0 commit comments