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-39429: Add a new "Python Development Mode" doc page #18132

Merged
merged 5 commits into from Jan 24, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jan 23, 2020

@vstinner
Copy link
Member Author

vstinner commented Jan 23, 2020

cc @pablogsal @JulienPalard

Copy link
Member

@aeros aeros left a comment

Here's some suggestions, mostly minor grammatical fixes. The line width on some of them may need to be adjusted.

I'll go over it again later when I get the chance, to see if I missed anything.

Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/devmode.rst Outdated Show resolved Hide resolved
* Add ``default`` :ref:`warning filter <describing-warning-filters>`, as
:option:`-W default <-W>` command line option. The following warnings are
shown, whereas they are ignored by the default warning filters:

* :exc:`DeprecationWarning`;
* :exc:`ImportWarning`;
* :exc:`PendingDeprecationWarning`;
* :exc:`ResourceWarning`.
Copy link
Member

@aeros aeros Jan 23, 2020

Choose a reason for hiding this comment

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

Hmm, the wording of this section isn't entirely clear to me. Is it explaining that the listed warnings are not filtered in development mode, so they're shown instead of hidden? Also, that to re-use the default warning filters, a new command-line option "-W default" has been added?

I had to read over this part a few times, and I'm still not 100% certain that I'm quite getting it.

If I'm correctly understanding it, I'd recommend restructuring it a bit to make that more clear (might need to adjust line width):

Normally, the following warnings are filtered by the default 
:ref:`warning filters <describing-warning-filters>`:

  * :exc:`DeprecationWarning`;
  * :exc:`ImportWarning`;
  * :exc:`PendingDeprecationWarning`;
  * :exc:`ResourceWarning`.

In development mode, these warnings are no longer filtered. To re-enable the default
warning filters, use the new :option:`-W default <-W>` command line option.

(Correct me if I'm misunderstanding the section)

Copy link
Member Author

@vstinner vstinner Jan 23, 2020

Choose a reason for hiding this comment

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

I rewrote this section.


* Enable :ref:`asyncio debug mode <asyncio-debug-mode>`. Similar to setting
:envvar:`PYTHONASYNCIODEBUG` environment variable to ``1``.
* Check *encoding* and *errors* arguments on string encoding and decoding
Copy link
Member

@aeros aeros Jan 23, 2020

Choose a reason for hiding this comment

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

Suggested change
* Check *encoding* and *errors* arguments on string encoding and decoding
* Check the *encoding* and *errors* arguments for string encoding and decoding

Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/sys.rst Outdated Show resolved Hide resolved
Include/cpython/initconfig.h Outdated Show resolved Hide resolved
Doc/library/stdtypes.rst Outdated Show resolved Hide resolved
Doc/library/stdtypes.rst Outdated Show resolved Hide resolved
Doc/c-api/init_config.rst Show resolved Hide resolved
@aeros
Copy link
Member

aeros commented Jan 23, 2020

Also, thanks for adding this highly informative section, @vstinner! I actually learned a decent amount about the development mode that I wasn't previously aware of while proofreading it.


The Python Development Mode introduces additional runtime 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 issue is
Copy link
Contributor

@csabella csabella Jan 23, 2020

Choose a reason for hiding this comment

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

The colon should probably be a semi-colon.

Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/devmode.rst Outdated Show resolved Hide resolved
@csabella
Copy link
Contributor

csabella commented Jan 23, 2020

This is amazing. Thank you! Big +1.

Copy link
Member Author

@vstinner vstinner left a comment

@aeros @csabella: I tried to address all comments, but I also made a few more minor changes. Would you mind to review my PR again?

* Add ``default`` :ref:`warning filter <describing-warning-filters>`, as
:option:`-W default <-W>` command line option. The following warnings are
shown, whereas they are ignored by the default warning filters:

* :exc:`DeprecationWarning`;
* :exc:`ImportWarning`;
* :exc:`PendingDeprecationWarning`;
* :exc:`ResourceWarning`.
Copy link
Member Author

@vstinner vstinner Jan 23, 2020

Choose a reason for hiding this comment

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

I rewrote this section.

Doc/library/devmode.rst Outdated Show resolved Hide resolved
Copy link
Member

@aeros aeros left a comment

I tried to address all comments, but I also made a few more minor changes. Would you mind to review my PR again?

No problem. It looks significantly improved with the latest round of changes. Here's a few additional suggestions (some from new areas, others from existing ones I didn't see before):

Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/devmode.rst Outdated Show resolved Hide resolved
Doc/library/devmode.rst Outdated Show resolved Hide resolved
aeros
aeros approved these changes Jan 23, 2020
Copy link
Member

@aeros aeros left a comment

One last remaining change in L92-L93 of Doc/library/devmode.rst:

The Python Development Mode does not prevent the :option:`-O` command line option to
remove :keyword:`assert` statements nor to set :const:`__debug__` to ``False``.

to

The Python Development Mode does not prevent the :option:`-O` command line
option from removing :keyword:`assert` statements nor from setting
:const:`__debug__` to ``False``.

(Grammar and line width fix)

Other than that, LGTM! Thanks @vstinner.

@vstinner
Copy link
Member Author

vstinner commented Jan 24, 2020

One last remaining change in L92-L93 of Doc/library/devmode.rst: (...) (Grammar and line width fix)

fixed

@vstinner vstinner merged commit b9783d2 into python:master Jan 24, 2020
@vstinner vstinner deleted the devmode_doc branch Jan 24, 2020
@vstinner
Copy link
Member Author

vstinner commented Jan 24, 2020

Thanks @aeros and @csabella for your reviews!

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
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.

None yet

6 participants