Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Invalid escape sequences raise SyntaxWarning #119458

Closed as not planned
Closed as not planned

Description

@Okarin99

PEP 701 introduced with python version 3.12.3 claims to be backwards compatible.
But in python version 3.12.2 the string "\.00" gives \\.00 and since python version 3.12.3 I get the follwing error:
<stdin>:1: SyntaxWarning: invalid escape sequence '\.'
'\\.00'

Activity

  1. transferred this issue frompython/pepson May 23, 2024
  2. pablogsal commented on May 23, 2024

    @pablogsal
    Member

    That has nothing to be with PEP 701. PEP 701 is about f-strings, not about strings in general. That change was introduced here:

    3483299a24e4

  3. terryjreedy commented on May 23, 2024

    @terryjreedy
    Member

    The referenced commit is about octal sequences above 0o377. The warning results from changing the invalid escape sequence warning from DeprecationWarning (usually invisible) to SyntaxWarning (usually visible, but not currently in IDLE and other possible circumstances) in 3.12 in issue #98401, PR #99011. The same warning occurs with '\.a' and '\.'.

    The change was in 3.12.0 and noted in What' New 3.12:

    A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning.

    If you want a single backslash in the string, either double it or precede the string with 'r': '\\.00' == r'\.00' is True.

  4. changed the title [-]PEP 701 is not backwards compatible[/-] [+]Invalid escape sequences raise SyntaxWarning[/+] on May 23, 2024
  5. Okarin99 commented on May 23, 2024

    @Okarin99
    Author

    Ahh ok that explains everything. I got this Error because Mathematica’s ExternalEvaluate uses an invalid escape sequence and I knew that in march all was working fine. I regularly update my system so I thought I was using python version 3.12.2 in march. But it turns out that Archlinux doesn’t update their python package that often, therefore I was using version 3.11.8 instead.

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

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions