Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-81548: Deprecate octal sequences with value larger than 0o377#91668

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@serhiy-storchaka
Copy link
Member

Closes#81548.

@gvanrossum
Copy link
Member

I'm glad you're doing this!

@serhiy-storchaka
Copy link
MemberAuthor

Interesting, you posted your comment just between two commits which I have pushed with onegit push.

gvanrossum, JulienPalard, and baseplate-admin reacted with laugh emojiezio-melotti reacted with eyes emoji

@serhiy-storchakaserhiy-storchaka merged commit3483299 intopython:mainApr 30, 2022
@serhiy-storchakaserhiy-storchaka deleted the deprecate-invalid-octal-escape branchApril 30, 2022 10:16
@slateny
Copy link
Contributor

I thinkthis line should be:gh: instead of:issue: - got a failed CIhere

serhiy-storchaka reacted with thumbs up emoji

@disconnect3d
Copy link
Contributor

disconnect3d commentedFeb 22, 2023
edited
Loading

If possible, I would suggest extending the information about this deprecation warning as it is not obvious for people reading this why is this made and when does the deprecation warning fires off.

  1. The former could be something like:

This is done because high octal escape values may give unexpected results. For example the b'\407' literal is b'\x07' as the 0o407 (263) value is treated as a single byte and 263 % 256 = 7.

  1. The latter issue, when the deprecation warning fires off, can be seen here:
$ cat a.pyprint("\407", b"\407")$ python3.11 a.pyć b'\x07'$ python3.11 -W default a.py//a.py:1: DeprecationWarning: invalid octal escape sequence'\407'  print("\407", b"\407")//a.py:1: DeprecationWarning: invalid octal escape sequence'\407'  print("\407", b"\407")ć b'\x07'

I believe this comes from thedefault warning filter. Idk if we really want it described there, but imho it never hurts to provide more information.

cc:@serhiy-storchaka

tomek7667 reacted with thumbs up emoji

@pablogsal
Copy link
Member

If possible, I would suggest extending the information about this deprecation warning as it is not obvious for people reading this why is this made and when does the deprecation warning fires off.

  1. The former could be something like:

This is done because high octal escape values may give unexpected results. For example the b'\407' literal is b'\x07' as the 0o407 (263) value is treated as a single byte and 263 % 256 = 7.

  1. The latter issue, when the deprecation warning fires off, can be seen here:
$ cat a.pyprint("\407", b"\407")$ python3.11 a.pyć b'\x07'$ python3.11 -W default a.py//a.py:1: DeprecationWarning: invalid octal escape sequence'\407'  print("\407", b"\407")//a.py:1: DeprecationWarning: invalid octal escape sequence'\407'  print("\407", b"\407")ć b'\x07'

I believe this comes from thedefault warning filter. Idk if we really want it described there, but imho it never hurts to provide more information.

cc:@serhiy-storchaka

Will give this a go soon 👍

@arhadthedev
Copy link
Member

Will give this a go soon 👍

@pablogsal

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pablogsalpablogsalAwaiting requested review from pablogsalpablogsal is a code owner

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

Assignees

No one assigned

Labels

type-featureA feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

octal escapes applied inconsistently throughout the interpreter and lib

7 participants

@serhiy-storchaka@gvanrossum@slateny@disconnect3d@pablogsal@arhadthedev@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp