Skip to content

gh-136355: Deprecate -b and -bb CLI flags in 3.15 #136363

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jul 7, 2025

Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

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

This should be added to pending-removal-in-3.17.rst?

Also, -bb is not documented and must be unliked/escaped (I don't know what to call: !) to stop errors.

@@ -254,6 +254,16 @@ Miscellaneous options
.. versionchanged:: 3.5
Affects also comparisons of :class:`bytes` with :class:`int`.

.. deprecated-removed:: 3.15 3.17

Deprecate :option:`-b` and :option:`-bb`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Deprecate :option:`-b` and :option:`-bb`
Deprecate :option:`-b` and :option:`!-bb`

@@ -256,6 +256,7 @@ static const char usage_help[] = "\
Options (and corresponding environment variables):\n\
-b : issue warnings about converting bytes/bytearray to str and comparing\n\
bytes/bytearray with str or bytes with int. (-bb: issue errors)\n\
deprecated since 3.15 and will be removed in 3.17\n\
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
deprecated since 3.15 and will be removed in 3.17\n\
deprecated since 3.15 and will be removed in 3.17.\n\

if (!config->bytes_warning) {
fprintf(stderr,
"-b option is deprecated since Python 3.15 "
"and will be removed in Python 3.17\n");
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to move this code at the end of pyinit_core() (before done: label). Example:

    if (_Py_GetConfig()->bytes_warning) {
        fprintf(stderr,
                "-b option is deprecated since Python 3.15 "
                "and will be removed in Python 3.17\n");
    }

So it deprecates indirectly the PyConfig.bytes_warning member.

Copy link
Member

@malemburg malemburg left a comment

Choose a reason for hiding this comment

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

Apart from the wording changes, this LGTM.

In 3.17 no :exc:`BytesWarning` won't be raised for these cases.
If you want to check for the same things in the future,
use any type-checker of your choice.

Copy link
Member

Choose a reason for hiding this comment

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

Same suggestion as above.

Copy link
Member

@StanFromIreland StanFromIreland Jul 7, 2025

Choose a reason for hiding this comment

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

You must have forgotten to add the other suggestion, only one (this) appears for me.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, Github's UI is a nightmare. Added it again.

@bedevere-app
Copy link

bedevere-app bot commented Jul 7, 2025

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

In 3.17 no :exc:`BytesWarning` won't be raised for these cases.
If you want to check for the same things in the future,
use any type-checker of your choice.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested improved wording:

      and schedule them for removal in Python 3.17.
      They were mainly meant as transition helpers for Python2 -> Python3 era.
      Starting with 3.17, the :exc:`BytesWarning` will be dropped for these cases.
      If you want to check for the same things in the future,
      please use a type-checker of your choice.

Copy link
Member

@StanFromIreland StanFromIreland Jul 7, 2025

Choose a reason for hiding this comment

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

I suggest slightly simpler;

      and schedule them for removal in Python 3.17.
      These were primarily helpers for the Python2 -> Python3 transition.
      Starting with 3.17, no :exc:`BytesWarning` will be raised for these cases.
      If you want to check for the same things in the future, use a type-checker.

Comment on lines +261 to +264
They were mainly a transition helpers for Python2 -> Python3 era.
In 3.17 no :exc:`BytesWarning` won't be raised for these cases.
If you want to check for the same things in the future,
use any type-checker of your choice.
Copy link
Member

Choose a reason for hiding this comment

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

Based on MAL and Stan's good suggestions:

Suggested change
They were mainly a transition helpers for Python2 -> Python3 era.
In 3.17 no :exc:`BytesWarning` won't be raised for these cases.
If you want to check for the same things in the future,
use any type-checker of your choice.
These were primarily helpers for the Python 2 -> 3 transition.
Starting with Python 3.17, no :exc:`BytesWarning` will be raised
for these cases; use a type checker instead.

Comment on lines +214 to +217
They were mainly a transition helpers for Python2 -> Python3 era.
In 3.17 no :exc:`BytesWarning` won't be raised for these cases.
If you want to check for the same things in the future,
use any type-checker of your choice.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
They were mainly a transition helpers for Python2 -> Python3 era.
In 3.17 no :exc:`BytesWarning` won't be raised for these cases.
If you want to check for the same things in the future,
use any type-checker of your choice.
These were primarily helpers for the Python 2 -> 3 transition.
Starting with Python 3.17, no :exc:`BytesWarning` will be raised
for these cases; use a type checker instead.

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy