Skip to content

bpo-40366: Remove support for passing obsolete flags into compile #19660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

isidentical
Copy link
Member

@isidentical isidentical commented Apr 22, 2020

This PR also removes a case related CO_GENERATOR_ALLOWED (which was also unusable, and totally purged in #19230)

https://bugs.python.org/issue40366

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

If CO_NESTED is no longer useful, why not removing the flag rather than adding a complicated deprecated code path? Passing flags to compile() is uncommon.

@serhiy-storchaka: Do you think that a deprecation period is needed?

Since how long CO_NESTED does nothing?

@isidentical
Copy link
Member Author

Since how long CO_NESTED does nothing?

2.2

@vstinner
Copy link
Member

Oh. If CO_NESTED is useless since Python 2.2 which was released 19 years ago, it's maybe time to remove it.

@isidentical
Copy link
Member Author

Does this removal will cover disallowing from __future__ import nested_functions (and probably generators, which was from 2.1)? I can convert this patch to that way

@vstinner
Copy link
Member

Does this removal will cover disallowing from future import nested_functions

I don't see any benefit from removing this import: it doesn't reduce the Python maintenance burden, it just breaks existing applications for free.

Most __future__ imports simply do nothing. Extract of Python/future.c:

        } else if (strcmp(feature, FUTURE_DIVISION) == 0) {
            continue;
        } else if (strcmp(feature, FUTURE_ABSOLUTE_IMPORT) == 0) {
            continue;
        } else if (strcmp(feature, FUTURE_WITH_STATEMENT) == 0) {
            continue;
        } else if (strcmp(feature, FUTURE_PRINT_FUNCTION) == 0) {
            continue;
        } else if (strcmp(feature, FUTURE_UNICODE_LITERALS) == 0) {
            continue;

@isidentical isidentical changed the title bpo-40366: Deprecate passing obsoleted flags to compile bpo-40366: Remove support for passing obsolete flags into compile Apr 22, 2020
@furkanonder
Copy link
Contributor

@isidentical Could you resolve the conflicts?

@carljm
Copy link
Member

carljm commented May 10, 2023

FWIW, removal of CO_NESTED was discussed in #96811 and rejected, since it is still useful (to detect nested functions) and used in third-party code, and setting it doesn't cause any problems.

@furkanonder
Copy link
Contributor

FWIW, removal of CO_NESTED was discussed in #96811 and rejected, since it is still useful (to detect nested functions) and used in third-party code, and setting it doesn't cause any problems.

In that case, I think we can close the PR. @isidentical What are your thoughts on this?

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

Successfully merging this pull request may close these issues.

7 participants