Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-32043: Rephrase -X dev documentation #4478

Merged
merged 1 commit into from
Nov 21, 2017
Merged

bpo-32043: Rephrase -X dev documentation #4478

merged 1 commit into from
Nov 21, 2017

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 20, 2017

  • should not be more verbose if the code is correct
  • enabled checks can be "expensive"

https://bugs.python.org/issue32043

when an isuse is detected. In short, ``python3 -X dev ...`` behaves as
``PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python3 -W default -X faulthandler ...``,
except that the :envvar:`PYTHONMALLOC` and :envvar:`PYTHONASYNCIODEBUG`
environment variables are not set in practice. Effect of the developer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speaking of which, perhaps it would be nice to set those environment variables so that child processes launched using subprocess inherit them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or perhaps let people set them themselves if they want to...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a deliberate choice to not inherit the "developer mode" to child processes. If someone would like an inherited mode, I would prefer to add a new PYTHONDEVMODE=1 environment variable, since it's more natural to inherit environment modes.

It's the same for -W ignore vs PYTHONWARNINGS=ignore.

Copy link
Member Author

@vstinner vstinner Nov 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that PYTHONDEVMODE=1 is needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps PYTHONXOPTIONS=dev? That way it would more directly parallel the -W vs PYTHONWARNINGS arrangement.

Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor suggestions inline, but generally looks good to me.

The PYTHONXOPTIONS/PYTHONDEVMODE question should be split out to a separate tracker issue.

and :envvar:`PYTHONASYNCIODEBUG` environment variables are not set in
practice. Developer mode:
* ``-X dev``: enable the "developer mode", enable runtime debug checks which
are too expensive to be enabled by default. It should not be more verbose
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable CPython's "developer mode", introducing additional runtime checks which are ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* ``-X dev``: enable the "developer mode", enable runtime debug checks which
are too expensive to be enabled by default. It should not be more verbose
than the default if the code is correct: new warnings are only emitted
when an isuse is detected. In short, ``python3 -X dev ...`` behaves as
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: isuse -> issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

* should not be more verbose if the code is correct
* enabled checks can be "expensive"
@vstinner
Copy link
Member Author

I created bpo-32101: Add PYTHONDEVMODE=1 to enable the developer mode.

@vstinner vstinner merged commit bc9b6e2 into python:master Nov 21, 2017
@vstinner vstinner deleted the xdev_doc branch November 21, 2017 02:59
@vstinner
Copy link
Member Author

Thank you for the review @pitrou and @ncoghlan :-) I merged my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants