[issue46051] Make @atexit.register work for functions with arguments

2021-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It cannot work this way. atexit.register() as a function allows you to specify arguments which will be passed to the registered function, but if it is used as a decorator, only one argument (the function itself) is passed to atexit.register() (it is how

[issue46051] Make @atexit.register work for functions with arguments

2021-12-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: Yes, that is the list. Serhiy, can you comment on using atexit.register and classmethod decorators together? Or suggest someone else? -- nosy: +serhiy.storchaka ___ Python tracker

[issue46051] Make @atexit.register work for functions with arguments

2021-12-20 Thread quapka
quapka added the comment: Hi @terry.reedy, are you talking about this https://mail.python.org/mailman3/lists/python-ideas.python.org/ mailing list? Thanks for the tip. However, I don't understand why this isn't just buggy/unexpected behavior, because the 3) example seems to work without any

[issue46051] Make @atexit.register work for functions with arguments

2021-12-17 Thread Terry J. Reedy
Terry J. Reedy added the comment: You might post on python-ideas list to get comments from other possible users. -- nosy: +terry.reedy ___ Python tracker ___

[issue46051] Make @atexit.register work for functions with arguments

2021-12-12 Thread quapka
quapka added the comment: I'm adding the tests I've written for this issue. First, the tests that do pass already: https://github.com/quapka/cpython/commit/913055932be4be1c61ac8383615045f8bceee4e8 Secondly, the ones that I'd expect to pass as well, but fail atm:

[issue46051] Make @atexit.register work for functions with arguments

2021-12-11 Thread quapka
New submission from quapka : Hi folks! Let me first present an example that motivated this issue. Imagine a script that builds Docker images and later starts them as Docker containers. To avoid having to stop the containers "manually" (in code and potentially forgot) I had an idea to