Nick Coghlan added the comment:

Passing var_decl was based on not knowing the answer to two questions:

* do we ever declare non-statics this way? (OTOH, if we do, this could be an 
opportunity to hide them behind read-only accessor functions)
* do we ever declare more specific types than PyObject * this way? (OTOH, if 
that's the uncommon case, requiring a cast to the more specific type probably 
wouldn't hurt)

As far as stack usage goes, all _Py_OnceVar instances should be in the data 
segment when using the linked list approach, so they shouldn't impact stack 
usage, and doing so retains the benefit of avoiding dynamic memory allocation 
just to track the static variable declarations. Since the macro is 
dereferencing the address of a static variable in the initialiser of another 
static variable, that shouldn't require any runtime stack space either. OTOH, I 
haven't actually ever tried compiling a macro like that, so it's entirely 
possible compilers won't like it.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29881>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to