Skip to content

from __future__ import barry_as_FLUFL doesn't work #125331

Closed
@JelleZijlstra

Description

@JelleZijlstra

Bug report

Bug description:

% ./python.exe -c 'from __future__ import barry_as_FLUFL; print(1 <> 2)'
  File "<string>", line 1
    from __future__ import barry_as_FLUFL; print(1 <> 2)
                                                   ^^
SyntaxError: invalid syntax

But with Barry as the FLUFL, <> is the correct way to test for inequality.

The future works only if you pass the right flag to compile() (as test_flufl.py does), but there's no way to do that in a file.

Obviously this future is a joke so this doesn't matter greatly, but I think it indicates that future imports that affect the parser aren't handled properly. That's something we should fix in case we get other futures in the ... future that also affect the parser. The joke future is also useful as a way to demonstrate how future statements work in general without having to rely on a specific future that will go away in a few releases.

CPython versions tested on:

3.12, CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions