Class _imp

java.lang.Object
org.python.modules._imp

public class _imp extends Object
  • Field Details

  • Constructor Details

    • _imp

      public _imp()
  • Method Details

    • load_dynamic

      public static PyObject load_dynamic(String name, String pathname)
    • load_dynamic

      public static PyObject load_dynamic(String name, String pathname, PyObject file)
    • load_source

      public static PyObject load_source(String modname, String filename)
    • load_source

      public static PyObject load_source(String modname, String filename, PyObject file)
    • reload

      public static PyObject reload(PyObject module)
    • load_compiled

      public static PyObject load_compiled(String name, PyString pathname)
      Return a module with the given name, the result of executing the compiled code at the given pathname. If this path is a PyUnicode, it is used exactly; if it is a PyString it is taken to be file-system encoded.
      Parameters:
      name - the module name
      pathname - to the compiled module (becomes __file__)
      Returns:
      the module called name
    • load_compiled

      public static PyObject load_compiled(String name, PyString pathname, PyObject file)
      Return a module with the given name, the result of executing the compiled code in the given file stream.
      Parameters:
      name - the module name
      pathname - a file path that is not null (becomes __file__)
      file - stream from which the compiled code is taken
      Returns:
      the module called name
    • find_module

      public static PyObject find_module(String name)
    • find_module

      public static PyObject find_module(String name, PyObject path)
    • load_module

      public static PyObject load_module(String name, PyObject file, PyObject filename, PyTuple data)
    • makeCompiledFilename

      public static PyString makeCompiledFilename(PyString filename)
      Variant of imp.makeCompiledFilename(String) dealing with encoded bytes. In the context where this is used from Python, a result in encoded bytes is preferable.
    • get_magic

      public static PyObject get_magic()
    • get_suffixes

      public static PyObject get_suffixes()
    • new_module

      public static PyModule new_module(String name)
    • is_builtin

      public static boolean is_builtin(String name)
    • is_frozen

      public static boolean is_frozen(String name)
    • acquire_lock

      public static void acquire_lock()
      Acquires the interpreter's import lock for the current thread. This lock should be used by import hooks to ensure thread-safety when importing modules.
    • release_lock

      public static void release_lock()
      Release the interpreter's import lock.
    • lock_held

      public static boolean lock_held()
      Return true if the import lock is currently held, else false.
      Returns:
      true if the import lock is currently held, else false.