[issue27035] Cannot set exit code in atexit callback

2021-08-19 Thread Mike Hommey
Mike Hommey added the comment: > In 2.7 the only exception that _did_ change the exit code was SystemExit. (and only if it was the last thrown exception) -- ___ Python tracker

[issue27035] Cannot set exit code in atexit callback

2021-08-19 Thread Mike Hommey
Mike Hommey added the comment: > I think we should change the documentation to expand the parenthetical " > (unless SystemExit is raised)" to a complete explanation of that special case. That would not be enough, since the case for other exceptions would still be ambiguous, as the described

[issue27035] Cannot set exit code in atexit callback

2021-07-26 Thread wyz23x2
Change by wyz23x2 : -- versions: +Python 3.10, Python 3.11 -Python 3.6, Python 3.7 ___ Python tracker ___ ___ Python-bugs-list

[issue27035] Cannot set exit code in atexit callback

2020-05-03 Thread Glyph Lefkowitz
Glyph Lefkowitz added the comment: gwk, I absolutely agree; at this point that's the main thing I'm looking for. But it would be great if whoever adds that documentation could include the rationale for this behavior too. It still seems "obvious" to me that it should change the exit code,

[issue27035] Cannot set exit code in atexit callback

2020-05-03 Thread George King
George King added the comment: I think we should change the documentation to expand the parenthetical " (unless SystemExit is raised)" to a complete explanation of that special case. -- ___ Python tracker

[issue27035] Cannot set exit code in atexit callback

2020-05-03 Thread Glyph Lefkowitz
Glyph Lefkowitz added the comment: This bug has been filed several times: issue1257 issue11654 and it's tempting to simply close this as a dup, but this ticket mentions the documentation, which is slightly confusing: https://docs.python.org/3.8/library/atexit.html#atexit.register It's

[issue27035] Cannot set exit code in atexit callback

2019-01-24 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: You can always set the exit code calling sys.exit from outside the atexit handlers. I concur with R. David Murray in that calling sys.exit and expect anything sounds like a bad idea and an abuse if the atexit system. A normal application would call

[issue27035] Cannot set exit code in atexit callback

2019-01-24 Thread Miroslav Matějů
Miroslav Matějů added the comment: I completely support @gwk’s opinion expressed in his comments. My original intention has been to set the exit code in an atexit callback. I tried a way and found that it was working in Python 2.7 but not in 3.x (without notice), so I filed this bug report.

[issue27035] Cannot set exit code in atexit callback

2019-01-23 Thread George King
George King added the comment: I agree that regardless of the underlying issue, the docs should match the behavior. Additionally, I hope the docs will note the exact release at which the behavior changed. @serhiy-storchaka do you have any opinion on this? I took a brief look at your commit

[issue27035] Cannot set exit code in atexit callback

2019-01-23 Thread Kumar Akshay
Kumar Akshay added the comment: Sure, I would love to! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27035] Cannot set exit code in atexit callback

2019-01-22 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: @ Kumar Do you want to make a PR fixing the docs? -- ___ Python tracker ___ ___

[issue27035] Cannot set exit code in atexit callback

2019-01-22 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: The behaviour regarding printing SytemExit was changed by Serhiy in 3fd54d4a7e604067e2bc0f8cfd58bdbdc09fa7f4 and in bpo-28994. -- ___ Python tracker

[issue27035] Cannot set exit code in atexit callback

2019-01-22 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think this is a documentation issue today. The docs say: >If an exception is raised during execution of the exit handlers, a traceback >is printed (unless SystemExit is raised) and the exception >information is saved. After all exit handlers have

[issue27035] Cannot set exit code in atexit callback

2019-01-22 Thread Kumar Akshay
Kumar Akshay added the comment: Can I work on this? I noticed the same behaviour as python3.7 in python3.8 from master branch. -- nosy: +kakshay ___ Python tracker ___

[issue27035] Cannot set exit code in atexit callback

2019-01-21 Thread Christopher Hunt
Change by Christopher Hunt : -- nosy: +chrahunt versions: +Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue27035] Cannot set exit code in atexit callback

2017-11-27 Thread Torsten Landschoff
Torsten Landschoff added the comment: As this bug report clearly states this worked as documented in Python 2.7 and stopped working sometime in the Python 3 series. I just ran into this while porting some code to Python 3 which uses an atexit handler to wind down some

[issue27035] Cannot set exit code in atexit callback

2017-03-06 Thread Glyph Lefkowitz
Glyph Lefkowitz added the comment: I just bumped into this myself. If this really is only fixable in a major release, there ought to at least be a minor release for the *documentation* to update it to be correct. -- nosy: +glyph ___ Python tracker

[issue27035] Cannot set exit code in atexit callback

2016-07-31 Thread R. David Murray
Changes by R. David Murray : -- type: behavior -> enhancement ___ Python tracker ___

[issue27035] Cannot set exit code in atexit callback

2016-07-31 Thread R. David Murray
R. David Murray added the comment: Well, changing something like this in 2.7 is off the table in any case. This would be a "feature release only" type of change if there is agreement that it is a good idea. -- components: +Interpreter Core versions: +Python 3.6 -Python 3.5

[issue27035] Cannot set exit code in atexit callback

2016-07-31 Thread George King
George King added the comment: The documentation for atexit.register clearly states that a SystemExit raised inside of the registered function is a special case: ''' If an exception is raised during execution of the exit handlers, a traceback is printed (unless SystemExit is raised) and the

[issue27035] Cannot set exit code in atexit callback

2016-05-16 Thread R. David Murray
R. David Murray added the comment: Calling sys.exit in an atexit function strikes me as a really bad idea. It feels to me like it breaks the contract of what atexit is designed for, which is to run multiple handlers at exit. If you call sys.exit you are in some sense restarting the exit

[issue27035] Cannot set exit code in atexit callback

2016-05-16 Thread Miroslav Matějů
New submission from Miroslav Matějů: I want to set exit code of my script in a function registered in the atexit module. (See https://stackoverflow.com/q/37178636/711006.) Calling sys.exit() in that function results in the following error: Error in atexit._run_exitfuncs: Traceback (most