Skip to content

Conversation

@lysnikolaou
Copy link
Member

@lysnikolaou lysnikolaou commented May 3, 2020

Due to backwards compatibility concerns, that keywords immediately
followed by a string without whitespace between them
(like in bg="#d00" if clear else"#fca") will fail to parse,
GH-19476 has to be reverted.

https://bugs.python.org/issue40246

@lysnikolaou lysnikolaou requested a review from pablogsal as a code owner May 3, 2020 20:30
@lysnikolaou lysnikolaou changed the title bpo-40426: Revert reporting of invalid string prefixes bpo-40246: Revert reporting of invalid string prefixes May 3, 2020
Due to backwards compatibility concerns, that keywords immediately
followed by a string without whitespace between them
(like in `bg="#d00" if clear else"#fca"`) will fail to parse,
PR19476 has to be reverted.
@lysnikolaou lysnikolaou force-pushed the revert-invalid-string-prefixes branch from 5f002af to 1c3eeaa Compare May 3, 2020 20:32
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also delete the NEWS item of the reverted change (Misc/NEWS.d/next/Core and Builtins/2020-04-11-17-52-03.bpo-40246.vXPze5.rst).

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@lysnikolaou
Copy link
Member Author

lysnikolaou commented May 3, 2020

Can't find the news file. There is no file on master with bpo-40246 in the filename according to Github and to my local clone.

@hroncok
Copy link
Contributor

hroncok commented May 3, 2020

That news file has already been merged to the changelog when 3.9.0a6 was released. I think this should explicitly add a new entry about the revert.

@@ -0,0 +1 @@
Reporting a specialised error message for invalid string prefixes, which was introduced in #19888, is being reverted due to backwards compatibility concerns for strings that immediately follow a reserved keyword without whitespace between them. Constructs like `bg="#d00" if clear else"#fca"` were failing to parse, which is not an acceptable breakage on such short notice. No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

19888 is this one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Thanks for the catch!

@lysnikolaou
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@gvanrossum: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from gvanrossum May 3, 2020 23:38
@@ -0,0 +1 @@
Reporting a specialised error message for invalid string prefixes, which was introduced in GH-19476, is being reverted due to backwards compatibility concerns for strings that immediately follow a reserved keyword without whitespace between them. Constructs like `bg="#d00" if clear else"#fca"` were failing to parse, which is not an acceptable breakage on such short notice.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, mention the bpo number instead of the PR number (GH-19476)

@hroncok
Copy link
Contributor

hroncok commented May 4, 2020

I've backported this PR to Fedora's build of 3.9.0a6 and I still see:

  File "/usr/lib/python3.9/site-packages/dnf/comps.py", line 111
    return'.'.join(lcl)
         ^
SyntaxError: invalid string prefix

I will double check the patch was actually applied.

@hroncok
Copy link
Contributor

hroncok commented May 4, 2020

It was a cache issue, it used an older, unpatched build. Sorry for the noise.

In fact, this PR makes the problem go away, as ecpected.

@lysnikolaou
Copy link
Member Author

lysnikolaou commented May 4, 2020

I'm not getting a SyntaxError when building this branch locally.

╰─ ./python.exe
Python 3.9.0a6+ (heads/master-dirty:64224a4727, May  3 2020, 23:23:39)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
...     return'.'.join(lcl)
...
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
NameError: name 'lcl' is not defined

@pablogsal pablogsal merged commit 846d8b2 into python:master May 4, 2020
@lysnikolaou lysnikolaou deleted the revert-invalid-string-prefixes branch May 7, 2020 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants