Skip to content

turtledemo/__main__.py: SyntaxError: invalid string prefix else"#fca" #84611

Closed

Description

@hroncok
mannequin
BPO 40431
Nosy @terryjreedy, @vstinner, @encukou, @hroncok, @miss-islington, @aeros
PRs
  • bpo-40431: Fix syntax typo in turtledemo #19777
  • [3.8] bpo-40431: Fix syntax typo in turtledemo (GH-19777) #19784
  • [3.7] [3.8] bpo-40431: Fix syntax typo in turtledemo (GH-19777) (GH-19784) #19789
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-04-29.03:15:51.848>
    created_at = <Date 2020-04-28.23:29:18.609>
    labels = ['3.8', '3.9']
    title = 'turtledemo/__main__.py: SyntaxError: invalid string prefix else"#fca"'
    updated_at = <Date 2020-05-17.22:38:35.100>
    user = 'https://github.com/hroncok'

    bugs.python.org fields:

    activity = <Date 2020-05-17.22:38:35.100>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-29.03:15:51.848>
    closer = 'aeros'
    components = ['Demos and Tools']
    creation = <Date 2020-04-28.23:29:18.609>
    creator = 'hroncok'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40431
    keywords = ['patch']
    message_count = 12.0
    messages = ['367575', '367581', '367583', '367585', '367590', '367607', '367609', '367612', '367618', '367638', '367648', '369154']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'vstinner', 'petr.viktorin', 'hroncok', 'miss-islington', 'aeros']
    pr_nums = ['19777', '19784', '19789']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40431'
    versions = ['Python 3.8', 'Python 3.9']

    Activity

    1. hroncok commented on Apr 28, 2020

      hroncokmannequin
      MannequinAuthor

      With Python 3.9.0a6 we get the following syntax error when bytecompiling the standard library in Fedora:

      Compiling '/usr/lib64/python3.9/turtledemo/main.py'...
      *** File "/usr/lib64/python3.9/turtledemo/main.py", line 275
      bg="#d00" if clear == NORMAL else"#fca")
      ^
      SyntaxError: invalid string prefix

      I've looked and the bad code is there for all branches, but only with 3.9.0a6 I get the SyntaxError.

      I wonder whether this is a know new SyntaxError or not. This "worked" with 3.9.0a5:

      >>> "yes" if False else"no"
      'no'

      Happy to submit a PR for turtledemo.

    2. vstinner commented on Apr 29, 2020

      @vstinner
      Member

      New changeset 49f70db by Miro Hrončok in branch 'master':
      bpo-40431: Fix syntax typo in turtledemo (GH-19777)
      49f70db

    3. vstinner commented on Apr 29, 2020

      @vstinner
      Member

      I don't think that it's worth it to backport the change to 3.7 and 3.8: in Python 3.7 and 3.8, the code is accepted.

      I also reported the issue to: https://bugs.python.org/issue40334#msg367580

      Miro: are you ok to close the issue (not backport)?

    4. hroncok commented on Apr 29, 2020

      hroncokmannequin
      MannequinAuthor

      I am OK. I don't see why not to backport it, but I don't care much.

    5. vstinner commented on Apr 29, 2020

      @vstinner
      Member

      I am OK. I don't see why not to backport it, but I don't care much.

      Python 3.7 and 3.8 are not broken, so there is no need to fix them :-) Thanks for the fix.

      I reported the issue to:
      https://bugs.python.org/issue40246#msg367587

    6. 5 remaining items

    7. reopened this on Apr 29, 2020
    8. reopened this on Apr 29, 2020
    9. vstinner commented on Apr 29, 2020

      @vstinner
      Member

      If you backport the change, please remove the NEWS entry, since it's not a SyntaxError in 3.7 and 3.8.

    10. aeros commented on Apr 29, 2020

      @aeros
      Contributor

      Victor Stinner wrote:

      If you backport the change, please remove the NEWS entry, since it's not a SyntaxError in 3.7 and 3.8.

      Good point. In that case, I'll do a manual backport of the PR just to 3.8 and skip the news entry. As mentioned above, I think most of the value in fixing it when the SyntaxError isn't present is mainly just for providing a good example in the latest stable version of the stdlib, so I don't think there would be much additional value in also backporting it to 3.7.

    11. aeros commented on Apr 29, 2020

      @aeros
      Contributor

      New changeset cc011b5 by Kyle Stanley in branch '3.8':
      [3.8] bpo-40431: Fix syntax typo in turtledemo (GH-19777) (bpo-19784)
      cc011b5

    12. miss-islington commented on Apr 29, 2020

      @miss-islington
      Contributor

      New changeset adb1f85 by Miss Islington (bot) in branch '3.7':
      [3.8] bpo-40431: Fix syntax typo in turtledemo (GH-19777) (GH-19784)
      adb1f85

    13. vstinner commented on Apr 29, 2020

      @vstinner
      Member

      Ok, the typo is now fixed in 3.7, 3.8 and master branches ;-) Thanks Miro for the bug reportand Kyle for the backport.

    14. terryjreedy commented on May 17, 2020

      @terryjreedy
      Member

      I believe the file was synchronized across versions as new features have not recently been added. Backporting the fix to my typo should keep it that way. This is an example of why code review even of patches that 'work' is a good thing.

    15. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions