Issue #21073: explain why Py_ReprEnter() allows for a missing thread state.

This commit is contained in:
Antoine Pitrou 2014-03-31 22:04:38 +02:00
parent 809ee902c4
commit 04d17d30b4
1 changed files with 2 additions and 0 deletions

View File

@ -1849,6 +1849,8 @@ Py_ReprEnter(PyObject *obj)
Py_ssize_t i;
dict = PyThreadState_GetDict();
/* Ignore a missing thread-state, so that this function can be called
early on startup. */
if (dict == NULL)
return 0;
list = _PyDict_GetItemId(dict, &PyId_Py_Repr);