GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-81548: Deprecate octal sequences with value larger than 0o377 by serhiy-storchaka · Pull Request #91668 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Apr 18, 2022

Copy link
Copy Markdown
Member

Closes #81548.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka
pythongh-81548: Deprecate octal sequences with value larger than 0o377
906049a
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Apr 18, 2022
@serhiy-storchaka
serhiy-storchaka requested review from lysnikolaou and pablogsal as code owners April 18, 2022 17:27
@bedevere-bot bedevere-bot added the awaiting core review label Apr 18, 2022
@serhiy-storchaka serhiy-storchaka mentioned this pull request Apr 18, 2022
octal escapes applied inconsistently throughout the interpreter and lib #81548
Closed
@serhiy-storchaka
Fix warnings and errors messages.
402c256
@gvanrossum

gvanrossum commented Apr 18, 2022

Copy link
Copy Markdown
Member

I'm glad you're doing this!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
Include the octal escape sequence itself in messages.
c2f186c
@serhiy-storchaka

serhiy-storchaka commented Apr 18, 2022

Copy link
Copy Markdown
Member Author

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

gvanrossum, JulienPalard, and baseplate-admin reacted with laugh emoji ezio-melotti reacted with eyes emoji
All reactions
  • 😄 3 reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
serhiy-storchaka merged commit 3483299 into python:main Apr 30, 2022
@bedevere-bot bedevere-bot removed the awaiting core review label Apr 30, 2022
@serhiy-storchaka
serhiy-storchaka deleted the deprecate-invalid-octal-escape branch April 30, 2022 10:16
@slateny

slateny commented Apr 30, 2022

Copy link
Copy Markdown
Contributor

I think this line should be :gh: instead of :issue: - got a failed CI here

serhiy-storchaka reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@disconnect3d

disconnect3d commented Feb 22, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.py
print("\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 the default 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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Feb 22, 2023

Copy link
Copy Markdown
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.py
print("\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 the default 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 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev

arhadthedev commented Apr 1, 2023

Copy link
Copy Markdown
Member

Will give this a go soon 👍

@pablogsal

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka serhiy-storchaka mentioned this pull request Dec 1, 2023
bpo-37367: octal escapes applied inconsistently throughout the interpreter and lib #14654
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal Awaiting requested review from pablogsal pablogsal is a code owner
@lysnikolaou lysnikolaou Awaiting requested review from lysnikolaou lysnikolaou is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

type-feature A 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

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@serhiy-storchaka @gvanrossum @slateny @disconnect3d @pablogsal @arhadthedev @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.