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-124960: Fixed `barry_as_FLUFL` future flag does not work in new REPL by Wulian233 · Pull Request #124999 · python/cpython

Conversation

@Wulian233

@Wulian233 Wulian233 commented Oct 5, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

2024-10-06 134537

co-author: nineteendo armv

  • Issue: barry_as_FLUFL future flag does not work in new REPL #124960

Sorry, something went wrong.

Uh oh!

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

All reactions
@Wulian233
Fixed barry_as_FLUFL future flag does not work in new REPL
77cb340
@Wulian233
Wulian233 requested review from ambv, lysnikolaou and pablogsal as code owners October 5, 2024 07:53
@bedevere-app bedevere-app Bot added the awaiting review label Oct 5, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Oct 5, 2024
barry_as_FLUFL future flag does not work in new REPL #124960
Closed
nineteendo
nineteendo reviewed Oct 5, 2024
View reviewed changes
Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

@Wulian233
Wulian233 marked this pull request as draft October 5, 2024 08:06
@bedevere-app bedevere-app Bot removed the awaiting review label Oct 5, 2024
picnixz
picnixz reviewed Oct 5, 2024
View reviewed changes
Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

Wulian233 and others added 2 commits October 5, 2024 17:41
@Wulian233
WIP: warning: can't use pyrepl: from __future__ imports must occur at…
9127c6c
… the beginning of the file (console.py, line 21)
@Wulian233
Update test_interact.py
d0049a3
picnixz
picnixz reviewed Oct 5, 2024
View reviewed changes
Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

Comment thread Misc/NEWS.d/next/Library/2024-10-05-15-49-53.gh-issue-124960.Bol9hT.rst Resolved

Uh oh!

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

Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

@Wulian233
WIP
904c202
sobolevn
sobolevn reviewed Oct 5, 2024
View reviewed changes
Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

@nineteendo

nineteendo commented Oct 5, 2024

Copy link
Copy Markdown
Contributor

You can close this, I have a proper fix.

Wulian233 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.

@Wulian233
Wulian233 force-pushed the barry_as_FLUFL branch from ce801c7 to 904c202 Compare October 6, 2024 05:56
Wulian233 and others added 2 commits October 6, 2024 14:13
@Wulian233 @nineteendo
Co-authored-by: Nice Zombies <[email protected]>
cc807ee
Co-authored-by: Nice Zombies <[email protected]>
@Wulian233
LF
cf96285
@Wulian233

Wulian233 commented Oct 6, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

You can close this, I have a proper fix.

After my testing, your patch solved this bug. I added a co-author, but I need ask your opinion so that we can open one less PR

edit: tests fail.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Wulian233
Wulian233 marked this pull request as ready for review October 6, 2024 06:27
@bedevere-app bedevere-app Bot added the awaiting review label Oct 6, 2024
picnixz
picnixz reviewed Oct 6, 2024
View reviewed changes
Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

nineteendo
nineteendo reviewed Oct 6, 2024
View reviewed changes
Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

Wulian233 and others added 2 commits October 9, 2024 06:41
@Wulian233 @nineteendo
Update Lib/_pyrepl/console.py
2080b24
Co-authored-by: Nice Zombies <[email protected]>
@ambv
Add tests, reformat a little
5dde260
nineteendo
nineteendo reviewed Oct 9, 2024
View reviewed changes
Comment thread Lib/_pyrepl/console.py Resolved

Uh oh!

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

ambv
ambv reviewed Oct 9, 2024
View reviewed changes
Comment thread Lib/test/test_pyrepl/test_interact.py
Comment on lines +148 to +150
with contextlib.redirect_stdout(f):
result = console.runsource("from __future__ import barry_as_FLUFL\n")
result = console.runsource("""print("black" <> 'blue')\n""")

@ambv ambv Oct 9, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is required because the parser can't deal with the future import changing the flags inside a run. This is true now:

❯ ./python.exe -c "from __future__ import barry_as_FLUFL; 1<>0"
  File "<string>", line 1
    from __future__ import barry_as_FLUFL; 1<>0
                                            ^^
SyntaxError: invalid syntax

but was also true in the old parser:

❯ python3.9 -Xoldparser -c "from __future__ import barry_as_FLUFL; 1<>0"
  File "<string>", line 1
    from __future__ import barry_as_FLUFL; 1<>0
                                             ^
SyntaxError: invalid syntax

The consequence of that with PyREPL is that you cannot paste multiline blocks with that future and make them run, because PyREPL executes everything save for the last line in one go.

PyREPL isn't doing anything wrong here, it's just exposing the bug that was always there. Therefore, I'm not sure we should be working around this pasting thing for this one future. Other futures work fine, as you can see in the test added above.

Sorry, something went wrong.

Uh oh!

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

nineteendo reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@ambv
dont_inherit is only relevant to the built-in compile() func
4bc4bdb
@Wulian233 Wulian233 mentioned this pull request Oct 11, 2024
from __future__ import barry_as_FLUFL doesn't work #125331
Closed
@ambv
ambv merged commit 6a08a75 into python:main Oct 14, 2024
@bedevere-app bedevere-app Bot removed the awaiting review label Oct 14, 2024
@ambv ambv added the needs backport to 3.13 only security fixes label Oct 14, 2024
@miss-islington-app

miss-islington-app Bot commented Oct 14, 2024

Copy link
Copy Markdown

Thanks @Wulian233 for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington-app

miss-islington-app Bot commented Oct 14, 2024

Copy link
Copy Markdown

Sorry, @Wulian233 and @ambv, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 6a08a753b702ac63c9b6ac58dd204d1fe9662e9d 3.13
All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington-app miss-islington-app Bot assigned ambv Oct 14, 2024
@nineteendo nineteendo mentioned this pull request Oct 14, 2024
[3.13] gh-124960: Fixed barry_as_FLUFL future flag does not work in new RE… #125475
Merged
@bedevere-app

bedevere-app Bot commented Oct 14, 2024

Copy link
Copy Markdown

GH-125475 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Oct 14, 2024
nineteendo added a commit to nineteendo/cpython that referenced this pull request Oct 14, 2024
@Wulian233 @nineteendo @ambv
pythongh-124960: Fixed barry_as_FLUFL future flag does not work in …
710d586
…new REPL (python#124999)

Co-authored-by: Nice Zombies <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
(cherry picked from commit 6a08a75)
ambv pushed a commit that referenced this pull request Oct 14, 2024
@nineteendo
[3.13] gh-124960: Fixed barry_as_FLUFL future flag does not work in…
d54dbd6
… new REPL (#124999) (#125475)

gh-124960: Fixed `barry_as_FLUFL` future flag does not work in new REPL (#124999)

Co-authored-by: Wulian <[email protected]>
Co-authored-by: Nice Zombies <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
(cherry picked from commit 6a08a75)
@Wulian233
Wulian233 deleted the barry_as_FLUFL branch October 14, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ambv ambv ambv left review comments
@sobolevn sobolevn sobolevn left review comments
@picnixz picnixz picnixz left review comments
@pablogsal pablogsal Awaiting requested review from pablogsal pablogsal is a code owner
@lysnikolaou lysnikolaou Awaiting requested review from lysnikolaou lysnikolaou is a code owner
+1 more reviewer
@nineteendo nineteendo nineteendo left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

@ambv ambv

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

5 participants

@Wulian233 @nineteendo @ambv @sobolevn @picnixz
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.