File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2551,12 +2551,14 @@ _Py_DumpExtensionModules(int fd, PyInterpreterState *interp)
25512551 // memory cannot be allocated on the heap in a signal handler.
25522552 // Iterate on the dict instead.
25532553 PyObject * stdlib_module_names = NULL ;
2554- pos = 0 ;
2555- while (PyDict_Next (interp -> sysdict , & pos , & key , & value )) {
2556- if (PyUnicode_Check (key )
2557- && PyUnicode_CompareWithASCIIString (key , "stdlib_module_names" ) == 0 ) {
2558- stdlib_module_names = value ;
2559- break ;
2554+ if (interp -> sysdict != NULL ) {
2555+ pos = 0 ;
2556+ while (PyDict_Next (interp -> sysdict , & pos , & key , & value )) {
2557+ if (PyUnicode_Check (key )
2558+ && PyUnicode_CompareWithASCIIString (key , "stdlib_module_names" ) == 0 ) {
2559+ stdlib_module_names = value ;
2560+ break ;
2561+ }
25602562 }
25612563 }
25622564 // If we failed to get sys.stdlib_module_names or it's not a frozenset,
You can’t perform that action at this time.
0 commit comments