Skip to content
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

Document which Python modules are supported #3

Closed
JukkaL opened this issue Dec 8, 2012 · 1 comment
Closed

Document which Python modules are supported #3

JukkaL opened this issue Dec 8, 2012 · 1 comment

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Dec 8, 2012

Currently there's no documentation about supported Python modules. Users have to manually inspect the stubsdirectory (and that's not documented either).

@JukkaL
Copy link
Collaborator Author

JukkaL commented Dec 14, 2012

There's a list in the wiki: http://www.mypy-lang.org/wiki/SupportedPythonModules

@JukkaL JukkaL closed this as completed Dec 14, 2012
ichard26 added a commit to ichard26/mypy that referenced this issue Mar 17, 2023
Change how imports (not from imports!) are processed so they can be
table-driven and compact. Here's how it works:

Import nodes are divided in groups (in the prebuild visitor). Each group
consists of consecutive Import nodes:

  import mod         <| group python#1
  import mod2         |

  def foo() -> None:
      import mod3    <- group python#2

  import mod4        <- group python#3

Every time we encounter the first import of a group, build IR to call
CPyImport_ImportMany() that will perform all of the group's imports in
one go.

Previously, each module would imported and placed in globals manually
in IR, leading to some pretty verbose code.

The other option to collect all imports and perform them all at once in
the helper would remove even more ops, however, it's problematic for
the same reasons from the previous commit (spoiler: it's not safe).

Implementation notes:

  - I had to add support for loading the address of a static directly,
    so I shoehorned in LoadLiteral support for LoadAddress.

  - Unfortunately by replacing multiple nodes with a single function
    call at the IR level, the traceback line number is static. Even if
    an import several lines down a group fails, the line # of the first
    import in the group would be printed.

    To fix this, I had to make CPyImport_ImportMany() add the traceback
    entry itself on failure (instead of letting codegen handle it
    automatically). This is admittedly ugly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant