-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -254,6 +254,16 @@ | |||||||||||||||
.. versionchanged:: 3.5 | ||||||||||||||||
Affects also comparisons of :class:`bytes` with :class:`int`. | ||||||||||||||||
|
||||||||||||||||
.. deprecated-removed:: 3.15 3.17 | ||||||||||||||||
|
||||||||||||||||
Deprecate :option:`-b` and :option:`-bb` | ||||||||||||||||
and schedule them for removal in Python 3.17. | ||||||||||||||||
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. | ||||||||||||||||
Comment on lines
+261
to
+264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on MAL and Stan's good suggestions:
Suggested change
|
||||||||||||||||
|
||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggested improved wording:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest slightly simpler;
|
||||||||||||||||
|
||||||||||||||||
.. option:: -B | ||||||||||||||||
|
||||||||||||||||
If given, Python won't try to write ``.pyc`` files on the | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -206,6 +206,18 @@ module_name | |||||||||||||||
Deprecated | ||||||||||||||||
========== | ||||||||||||||||
|
||||||||||||||||
CLI | ||||||||||||||||
--- | ||||||||||||||||
|
||||||||||||||||
* Deprecate :option:`-b` and :option:`!-bb` | ||||||||||||||||
and schedule them for removal in Python 3.17. | ||||||||||||||||
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. | ||||||||||||||||
Comment on lines
+214
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
|
||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same suggestion as above. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, Github's UI is a nightmare. Added it again. |
||||||||||||||||
(Contributed by Nikita Sobolev in :gh:`136355`.) | ||||||||||||||||
|
||||||||||||||||
hashlib | ||||||||||||||||
------- | ||||||||||||||||
|
||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Deprecate :option:`-b` and :option:`!-bb` and schedule them | ||
for removal in the future versions of Python. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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\ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
-B : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x\n\ | ||||||
-c cmd : program passed in as string (terminates option list)\n\ | ||||||
-d : turn on parser debugging output (for experts only, only works on\n\ | ||||||
|
@@ -2944,6 +2945,11 @@ config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions, | |||||
return _PyStatus_EXIT(0); | ||||||
|
||||||
case 'b': | ||||||
if (!config->bytes_warning) { | ||||||
fprintf(stderr, | ||||||
"-b option is deprecated since Python 3.15 " | ||||||
"and will be removed in Python 3.17\n"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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 |
||||||
} | ||||||
config->bytes_warning++; | ||||||
break; | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.