Skip to content

workspace should provide a way to detect already-initialized modules #16467

@stevengj

Description

@stevengj

For some C libraries (see JuliaIO/Blosc.jl#19), it is not safe to initialize them more than once, nor do we want to register an atexit hook more than once. However, if you do a workspace() then re-import the module, its __init__ is called a second time. It would be good to have a documented way to check whether a module was already initialized in a previous workspace.

(It's not sufficient to look at LastMain because the user could call workspace() twice.)

For example, there could be some kind of module_init_called(modulename) function that looks up a module in a global list of initialized modules that persists across workspace calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIndicates that a maintainer wants help on an issue or pull requestmodules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions