Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 6786:bc007cf1d6ba legacy-trunk
Changed the finalization order again so that the reference count
printing (when Py_DEBUG is defined) happens while there's still a
current thread...
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 08 Dec 1997 23:43:45 +0000 |
| parents | 99955b65408d |
| children | f5f305d7a617 |
comparison
equal
deleted
inserted
replaced
| 6785:f4e3a7aeb949 | 6786:bc007cf1d6ba |
|---|---|
| 196 _PyBuiltin_Fini_1(); | 196 _PyBuiltin_Fini_1(); |
| 197 | 197 |
| 198 /* Destroy all modules */ | 198 /* Destroy all modules */ |
| 199 PyImport_Cleanup(); | 199 PyImport_Cleanup(); |
| 200 | 200 |
| 201 /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ | |
| 202 _PyImport_Fini(); | |
| 203 | |
| 204 /* Debugging stuff */ | |
| 205 #ifdef COUNT_ALLOCS | |
| 206 dump_counts(); | |
| 207 #endif | |
| 208 | |
| 209 #ifdef Py_REF_DEBUG | |
| 210 fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); | |
| 211 #endif | |
| 212 | |
| 213 #ifdef Py_TRACE_REFS | |
| 214 if (_Py_AskYesNo("Print left references?")) { | |
| 215 _Py_PrintReferences(stderr); | |
| 216 } | |
| 217 #endif /* Py_TRACE_REFS */ | |
| 218 | |
| 201 /* Delete current thread */ | 219 /* Delete current thread */ |
| 202 PyInterpreterState_Clear(interp); | 220 PyInterpreterState_Clear(interp); |
| 203 PyThreadState_Swap(NULL); | 221 PyThreadState_Swap(NULL); |
| 204 PyInterpreterState_Delete(interp); | 222 PyInterpreterState_Delete(interp); |
| 205 | |
| 206 _PyImport_Fini(); | |
| 207 | 223 |
| 208 /* Now we decref the exception classes. After this point nothing | 224 /* Now we decref the exception classes. After this point nothing |
| 209 can raise an exception. That's okay, because each Fini() method | 225 can raise an exception. That's okay, because each Fini() method |
| 210 below has been checked to make sure no exceptions are ever | 226 below has been checked to make sure no exceptions are ever |
| 211 raised. | 227 raised. |
| 227 | 243 |
| 228 PyGrammar_RemoveAccelerators(&_PyParser_Grammar); | 244 PyGrammar_RemoveAccelerators(&_PyParser_Grammar); |
| 229 | 245 |
| 230 call_ll_exitfuncs(); | 246 call_ll_exitfuncs(); |
| 231 | 247 |
| 232 #ifdef COUNT_ALLOCS | |
| 233 dump_counts(); | |
| 234 #endif | |
| 235 | |
| 236 #ifdef Py_REF_DEBUG | |
| 237 fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); | |
| 238 #endif | |
| 239 | |
| 240 #ifdef Py_TRACE_REFS | 248 #ifdef Py_TRACE_REFS |
| 241 if (_Py_AskYesNo("Print left references?")) { | |
| 242 _Py_PrintReferences(stderr); | |
| 243 } | |
| 244 _Py_ResetReferences(); | 249 _Py_ResetReferences(); |
| 245 #endif /* Py_TRACE_REFS */ | 250 #endif /* Py_TRACE_REFS */ |
| 246 } | 251 } |
| 247 | 252 |
| 248 /* Create and initialize a new interpreter and thread, and return the | 253 /* Create and initialize a new interpreter and thread, and return the |
