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 — bpo-39562: Prevent collision of future and compiler flags by isidentical · Pull Request #19230 · python/cpython

Conversation

@isidentical

@isidentical isidentical commented Mar 30, 2020 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

https://bugs.python.org/issue39562

Sorry, something went wrong.

Uh oh!

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

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 30, 2020
@bedevere-bot bedevere-bot added the awaiting review label Mar 30, 2020
@isidentical isidentical added the skip news label Mar 30, 2020
pablogsal
pablogsal reviewed Mar 30, 2020
View reviewed changes
Comment thread Lib/test/test_future.py Resolved

Uh oh!

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

Comment thread Lib/__future__.py Resolved

Uh oh!

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

@pablogsal
pablogsal requested a review from serhiy-storchaka March 30, 2020 19:16
vstinner
vstinner reviewed Apr 20, 2020
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

Would it be possible to pass future and compiler flags as two different variables to avoid of global unicity? I don't think so, but I ask, just in case :-)

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Include/code.h Resolved

Uh oh!

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

Comment thread Include/code.h Resolved

Uh oh!

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

Comment thread Lib/test/test_future.py Resolved

Uh oh!

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

Comment thread Lib/test/test_future.py Resolved

Uh oh!

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

Comment thread Include/compile.h Outdated

@vstinner vstinner Apr 20, 2020

Copy link
Copy Markdown
Member

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.

How many bits are free for incoming compiler flags? Two? 0x4000 and 0x8000?

Sorry, something went wrong.

Uh oh!

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

All reactions

@isidentical isidentical Apr 20, 2020

Copy link
Copy Markdown
Member Author

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.

and 0x10000 (now that we removed that old macro)

Sorry, something went wrong.

Uh oh!

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

All reactions
@isidentical

isidentical commented Apr 20, 2020

Copy link
Copy Markdown
Member Author

Would it be possible to pass future and compiler flags as two different variables to avoid of global unicity? I don't think so, but I ask, just in case :-)

It is hard because of public APIs use it in this way, including python level ones (e.g: compile function). But, I can work on a patch to do this in a period (3.9, add a new parameter to compile for future flags (compile(*args, flags, future_flags)), giving future flags from flags parameter would give a deprecation warning, for distinguishing those we still need this patch;3.10, we'll increase that deprecation's level;3.11 we'll only accept compiler flags from flags and take future flags from future_flags. Just a thought but if seen suitable, I can create a patch before the alpha cut.

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented Apr 20, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

It is hard because of public APIs use it in this way, including python level ones (e.g: compile function). But, I can work on a patch to do this in a period (3.9, add a new parameter to compile for future flags (compile(*args, flags, future_flags)), giving future flags from flags parameter would give a deprecation warning, for distinguishing those we still need this patch;3.10, we'll increase that deprecation's level;3.11 we'll only accept compiler flags from flags and take future flags from future_flags. Just a thought but if seen suitable, I can create a patch before the alpha cut.

That would show the deprecation warning to a lot of people and then it will break them after we deprecate it. Many users have complained before of this exact scenario so I would say is not a good idea to do this.

I think we can certainly add a second parameter to encourage people to separate them in the future but I think we will not be able to deprecate this without many users complaining. :(

All reactions

Sorry, something went wrong.

Uh oh!

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

@isidentical

isidentical commented Apr 20, 2020

Copy link
Copy Markdown
Member Author

Just a guess but I'm not sure much people is using compile with a future flags manually instead of inserting a future statement to first line. Still need to prove it with analyzing some pypi packages (tonight I can share some results)

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented Apr 20, 2020

Copy link
Copy Markdown
Member

Just a guess but I'm not sure much people is using compile with a future flags manually instead of inserting a future statement to first line. Still need to prove it with analyzing some pypi packages (tonight I can share some results)

That would be a good idea 👍

All reactions

Sorry, something went wrong.

Uh oh!

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

isidentical added 5 commits April 20, 2020 21:52
@isidentical
bpo-39562: Prevent collision of future and compiler flags
984c815
@isidentical
Add support to compile for PyCF_ALLOW_TOP_LEVEL_AWAIT
8d6d207
@isidentical
Pack valid compile flags to a mask
ebf0003
@isidentical
automatically discover compiler flags from ast
c14888d
@isidentical
Mention about change, describe tests, remove old macro
7cd943a
vstinner
vstinner reviewed Apr 20, 2020
View reviewed changes
Comment thread Include/code.h Resolved

Uh oh!

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

Comment thread Include/code.h Resolved

Uh oh!

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

Comment thread Lib/test/test_future.py Resolved

Uh oh!

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

Comment thread Lib/test/test_future.py Resolved

Uh oh!

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

vstinner
vstinner reviewed Apr 20, 2020
View reviewed changes
Comment thread Doc/whatsnew/3.9.rst Resolved

Uh oh!

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

vstinner
vstinner reviewed Apr 20, 2020
View reviewed changes
Comment thread Doc/whatsnew/3.9.rst Resolved

Uh oh!

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

isidentical and others added 2 commits April 21, 2020 02:27
@isidentical @vstinner
Apply suggestions
d1094d6
Co-Authored-By: Victor Stinner <[email protected]>
@isidentical
Mention clashing variables, remove old comment
560a100
@isidentical
isidentical force-pushed the bpo-39562-2 branch from e286f29 to 560a100 Compare April 20, 2020 23:29
@isidentical
isidentical requested a review from vstinner April 20, 2020 23:33
vstinner
vstinner reviewed Apr 21, 2020
View reviewed changes
Comment thread Include/code.h Resolved

Uh oh!

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

Comment thread Lib/test/test_future.py Resolved

Uh oh!

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

Comment thread Lib/test/test_future.py Resolved

Uh oh!

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

@isidentical
Add a noticement header, use dicts for tests
5f8018b
vstinner
vstinner reviewed Apr 21, 2020
View reviewed changes
Comment thread Include/compile.h Resolved

Uh oh!

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

@vstinner
Update Include/compile.h
b225c61
vstinner
vstinner approved these changes Apr 21, 2020
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

LGTM.

@pablogsal: Would you mind to double check the PR?

@isidentical: I took the liberty to commit directly my last change request. Thanks for updating your PR multiple times, it now looks better ;-)

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Apr 21, 2020
@vstinner

vstinner commented Apr 22, 2020

Copy link
Copy Markdown
Member

@isidentical: Would you mind to fix the conflict in Doc/whatsnew/3.9.rst? You may rebase your branch on master, or merge master into your branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@isidentical
Merge branch 'master' into bpo-39562-2
0b8936e
@isidentical

isidentical commented Apr 22, 2020

Copy link
Copy Markdown
Member Author

Done @vstinner

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit 4454057 into python:master Apr 22, 2020
@bedevere-bot bedevere-bot removed the awaiting merge label Apr 22, 2020
@isidentical

isidentical commented Apr 22, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

Thank you for merge and reviews @vstinner. Currently working on a PoC implementation to split these 2 flags (will share about my research on usage of flags= with future flags. on the issue)

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Apr 22, 2020

Copy link
Copy Markdown
Member

Thank you for merge and reviews @vstinner. Currently working on a PoC implementation to split these 2 flags (will share about my research on usage of flags= with future flags. on the issue)

Honestly, I don't think that it's worth it. The bug is fixed, there is no need to modify dozens of functions accepting compiler flags, just for that.

All reactions

Sorry, something went wrong.

Uh oh!

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

@isidentical

isidentical commented Apr 22, 2020

Copy link
Copy Markdown
Member Author

Well I dont think it will change that much, but I'm still going to create a PoC to see how much it will change.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Apr 22, 2020

Copy link
Copy Markdown
Member

My attempt to add -X noopt adds a new parameter to compile(): my PR modifies not less than 42 files... I closed my PR because of that, the change was too intrusive.
#13600

@pablogsal suggested me to use the value -1 to mean "disable all optimizations". I didn't try this approach, but I'm no longer interested to work on https://bugs.python.org/issue2506

All reactions

Sorry, something went wrong.

Uh oh!

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

@isidentical isidentical mentioned this pull request Apr 22, 2020
bpo-40366: Remove support for passing obsolete flags into compile #19660
Closed
@pablogsal pablogsal added the needs backport to 3.8 label May 1, 2020
@miss-islington

miss-islington commented May 1, 2020

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington

miss-islington commented May 1, 2020

Copy link
Copy Markdown
Contributor

Sorry, @isidentical and @vstinner, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 4454057269b995341b04d13f0bf97f96080f27d0 3.8

All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington miss-islington assigned vstinner May 1, 2020
@isidentical

isidentical commented May 1, 2020

Copy link
Copy Markdown
Member Author

I'll send a manual cherry pick, tonight.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented May 1, 2020

Copy link
Copy Markdown

GH-19835 is a backport of this pull request to the 3.8 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the needs backport to 3.8 label May 1, 2020
@isidentical

isidentical commented May 1, 2020

Copy link
Copy Markdown
Member Author

Oh, @pablogsal already did one :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented May 1, 2020

Copy link
Copy Markdown
Member

Oh, @pablogsal already did one :)

Fastest gun in this side of the west 🔫

vstinner reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

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

@isidentical

isidentical commented May 1, 2020

Copy link
Copy Markdown
Member Author

🔫 🔫

vstinner reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

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

pablogsal pushed a commit to pablogsal/cpython that referenced this pull request May 1, 2020
@isidentical @pablogsal
[3.8] bpo-39562: Prevent collision of future and compiler flags (pyth…
5131901
…onGH-19230)

The constant values of future flags in the __future__ module
is updated in order to prevent collision with compiler flags.
Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing
with CO_FUTURE_DIVISION..
(cherry picked from commit 4454057)

Co-authored-by: Batuhan Taşkaya <[email protected]>
miss-islington pushed a commit that referenced this pull request May 1, 2020
@pablogsal @isidentical
[3.8] bpo-39562: Prevent collision of future and compiler flags (GH-1…
5055c27
…9230) (GH-19835)

The constant values of future flags in the __future__ module
is updated in order to prevent collision with compiler flags.
Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing
with CO_FUTURE_DIVISION..
(cherry picked from commit 4454057)

Co-authored-by: Batuhan Taşkaya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal left review comments
@vstinner vstinner vstinner approved these changes
@serhiy-storchaka serhiy-storchaka Awaiting requested review from serhiy-storchaka

Uh oh!

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

Assignees

@vstinner vstinner

Labels

skip news

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.

6 participants

@isidentical @pablogsal @vstinner @miss-islington @bedevere-bot @the-knights-who-say-ni
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 01402520 — 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.