Skip to content

Include __future__ information on Code, allowing division future to be implemented #123

Description

@alanjds

tl;dr: Code objects should receive the __future__ imports information applied to it.

Today the __future__ imports information is available only to the importer/compiler. No import occur really occur nor code is generated for it. This by itself already violates some of the __future__ documented semantics, but more important, the information is not forwarded to the Code object.

Having no clue of what __future__ flags are imported/activated and what are not, a Code cannot change its behaviors. This makes harder the possiblity of func intDiv() to change its operation in presence __future__.division (#37).

I explored the possibility of this flag to just change the transpiled code. It could fix code like print 1 / 2, but would not work for non-literal integers like a = 1; b = 2; print a / b or more complex ones.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions