Skip to content

hooks breaks from x import * (0.15.2, Python 2) #238

Open
@itamarst

Description

@itamarst
from future.standard_library import hooks

with hooks():
    from urllib.parse import urlparse, urlencode
    from urllib.request import urlopen, Request
    from urllib.error import HTTPError

This code made from mymodule import * fail. That is, it runs, but nothing gets imported into the module running that, as if mymodule is empty. Later calls to from mymodule import *, e.g. in a debuger, do work. My guess is the issue is something to do with copying and then re-inserting stuff from sys.modules that the install_hooks-related code does; probably modules are being copied at the wrong time, when they're still half-empty or something.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions