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)
2551
2551
// memory cannot be allocated on the heap in a signal handler.
2552
2552
// Iterate on the dict instead.
2553
2553
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
+ }
2560
2562
}
2561
2563
}
2562
2564
// 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