| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -173,6 +173,7 @@ _PyType_HasFeature(PyTypeObject *type, unsigned long feature) { | |||
| 173 | 173 | ||
| 174 | 174 | extern void _PyType_InitCache(PyInterpreterState *interp); | |
| 175 | 175 | ||
| 176 | + extern void _PyObject_InitState(PyInterpreterState *interp); | ||
| 176 | 177 | ||
| 177 | 178 | /* Inline functions trading binary compatibility for speed: | |
| 178 | 179 | _PyObject_Init() is the fast version of PyObject_Init(), and | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -162,6 +162,14 @@ _PyDebug_PrintTotalRefs(void) { | |||
| 162 | 162 | ||
| 163 | 163 | #define REFCHAIN(interp) &interp->object_state.refchain | |
| 164 | 164 | ||
| 165 | + static inline void | ||
| 166 | + init_refchain(PyInterpreterState *interp) | ||
| 167 | + { | ||
| 168 | + PyObject *refchain = REFCHAIN(interp); | ||
| 169 | + refchain->_ob_prev = refchain; | ||
| 170 | + refchain->_ob_next = refchain; | ||
| 171 | + } | ||
| 172 | + | ||
| 165 | 173 | /* Insert op at the front of the list of all objects. If force is true, | |
| 166 | 174 | * op is added even if _ob_prev and _ob_next are non-NULL already. If | |
| 167 | 175 | * force is false amd _ob_prev or _ob_next are non-NULL, do nothing. | |
@@ -2019,6 +2027,18 @@ PyObject _Py_NotImplementedStruct = { | |||
| 2019 | 2027 | &_PyNotImplemented_Type | |
| 2020 | 2028 | }; | |
| 2021 | 2029 | ||
| 2030 | + | ||
| 2031 | + void | ||
| 2032 | + _PyObject_InitState(PyInterpreterState *interp) | ||
| 2033 | + { | ||
| 2034 | + #ifdef Py_TRACE_REFS | ||
| 2035 | + if (!_Py_IsMainInterpreter(interp)) { | ||
| 2036 | + init_refchain(interp); | ||
| 2037 | + } | ||
| 2038 | + #endif | ||
| 2039 | + } | ||
| 2040 | + | ||
| 2041 | + | ||
| 2022 | 2042 | extern PyTypeObject _Py_GenericAliasIterType; | |
| 2023 | 2043 | extern PyTypeObject _PyMemoryIter_Type; | |
| 2024 | 2044 | extern PyTypeObject _PyLineIterator; | |
@@ -2326,7 +2346,7 @@ _Py_GetObjects(PyObject *self, PyObject *args) | |||
| 2326 | 2346 | ||
| 2327 | 2347 | #undef REFCHAIN | |
| 2328 | 2348 | ||
| 2329 | - #endif | ||
| 2349 | + #endif /* Py_TRACE_REFS */ | ||
| 2330 | 2350 | ||
| 2331 | 2351 | ||
| 2332 | 2352 | /* Hack to force loading of abstract.o */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2075,6 +2075,8 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config) | |||
| 2075 | 2075 | } | |
| 2076 | 2076 | has_gil = 1; | |
| 2077 | 2077 | ||
| 2078 | + /* No objects have been created yet. */ | ||
| 2079 | + | ||
| 2078 | 2080 | status = pycore_interp_init(tstate); | |
| 2079 | 2081 | if (_PyStatus_EXCEPTION(status)) { | |
| 2080 | 2082 | goto error; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -674,6 +674,7 @@ init_interpreter(PyInterpreterState *interp, | |||
| 674 | 674 | _obmalloc_pools_INIT(interp->obmalloc.pools); | |
| 675 | 675 | memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp)); | |
| 676 | 676 | } | |
| 677 | + _PyObject_InitState(interp); | ||
| 677 | 678 | ||
| 678 | 679 | _PyEval_InitState(interp, pending_lock); | |
| 679 | 680 | _PyGC_InitState(&interp->gc); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments