[issue14803] Add feature to allow code execution prior to __main__ invocation

Nick Coghlan report at bugs.python.org
Tue May 15 11:51:07 CEST 2012


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Actually, there's another use case for you:

export PYTHONRUNFIRST="import faulthandler; faulthandler.enable()"
application.py

All subprocesses launched by the application will now have faulthandler enabled, *without* modifying the application. Doing this in a shell session means that faulthandler will be enabled for all Python processes you launch.

Obviously, care would need to be taken to ensure PYTHONRUNFIRST is ignored for setuid scripts (and it would respect -E as with any other environment variable).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14803>
_______________________________________


More information about the Python-bugs-list mailing list