Dennis Sweeney wrote:
> I don't know if there's anything specifically stopping this, but from what I 
> understand, the precise moment that a finalizer gets called is unspecified, 
> so relying on any sort of behavior there is undefined and non-portable. 
> Implementations like PyPy don't always use reference counting, so their 
> garbage collection might get called some unspecified amount of time later.

It's unspecified of course for the language as such, but in the specific case 
of CPython (which we're targeting), I think the refcounting logic is here to 
stay and generally speaking, can be relied on. Of course some version may come 
along to break expectations and I suppose we might cross that bridge when we 
get to it.

> I'm not familiar with Airflow, but would you be able to decorate the create() 
> function to check for good return values?

We could but for the most part, people don't define DAGs inside functions – it 
happens, but it is not the most simple usage pattern. It's not so much about 
the function itself, but about being able to determine if a DAG was dropped at 
the top-level of the module.

If the frame clearing behavior was changed so that locals were reclaimed before 
popping the frame, I think the line number (i.e. `f_lineno`) would have to be 
that of the function definition, i.e. `def test():` in the examples above.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/FWRP3RPCGXXDQT2IVO7HQBCUQFHGTCRM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to