On 01/03/2018 09:57, Thomas Nyberg wrote: > Hello, > > I was playing around with cpython and noticed the following. The > `_PyFrame_Init()` and `PyByteArray_Init()` functions are called in these > two locations: > > https://github.com/python/cpython/blob/master/Python/pylifecycle.c#L693-L694 > https://github.com/python/cpython/blob/master/Python/pylifecycle.c#L699-L700 > > But here are their function definitions and they appear to do nothing: > > https://github.com/python/cpython/blob/master/Objects/frameobject.c#L555-L561 > https://github.com/python/cpython/blob/master/Objects/bytearrayobject.c#L24-L28 > > I can understand leaving the functions in the source for > backwards-compatibility, but why are they still being called in > `_Py_InitializeCore()`? Seems like it just adds noise for those new to > the cpython internals. Is there some consistency doc that requires this > or something? If they're only called once, then it probably doesn't matter too much in terms of harming performance. As for leaving them in, there might be a number of reasons. One, if one day some special initialisation does need to be done, then this gives a place to put it. I quite often have an initialisation routine for a module, that sometimes ends up empty, but I keep it in anyway as often things can get added back. (Old CPython source I have does do something in those functions. For example: int _PyFrame_Init() { builtin_object = PyUnicode_InternFromString("__builtins__"); if (builtin_object == NULL) return 0; return 1; } ) -- Bartc