Package org.python.modules
Class _imp
java.lang.Object
org.python.modules._imp
-
Field Summary
Modifier and TypeFieldDescriptionstatic PyString
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Acquires the interpreter's import lock for the current thread.static PyObject
find_module
(String name) static PyObject
find_module
(String name, PyObject path) static PyObject
static PyObject
static boolean
is_builtin
(String name) static boolean
static PyObject
load_compiled
(String name, PyString pathname) Return a module with the givenname
, the result of executing the compiled code at the givenpathname
.static PyObject
load_compiled
(String name, PyString pathname, PyObject file) Return a module with the givenname
, the result of executing the compiled code in the givenfile
stream.static PyObject
load_dynamic
(String name, String pathname) static PyObject
load_dynamic
(String name, String pathname, PyObject file) static PyObject
load_module
(String name, PyObject file, PyObject filename, PyTuple data) static PyObject
load_source
(String modname, String filename) static PyObject
load_source
(String modname, String filename, PyObject file) static boolean
Return true if the import lock is currently held, else false.static PyString
makeCompiledFilename
(PyString filename) Variant ofimp.makeCompiledFilename(String)
dealing with encoded bytes.static PyModule
new_module
(String name) static void
Release the interpreter's import lock.static PyObject
-
Field Details
-
__doc__
-
PY_SOURCE
public static final int PY_SOURCE- See Also:
-
PY_COMPILED
public static final int PY_COMPILED- See Also:
-
C_EXTENSION
public static final int C_EXTENSION- See Also:
-
PKG_DIRECTORY
public static final int PKG_DIRECTORY- See Also:
-
C_BUILTIN
public static final int C_BUILTIN- See Also:
-
PY_FROZEN
public static final int PY_FROZEN- See Also:
-
IMP_HOOK
public static final int IMP_HOOK- See Also:
-
-
Constructor Details
-
_imp
public _imp()
-
-
Method Details
-
load_dynamic
-
load_dynamic
-
load_source
-
load_source
-
reload
-
load_compiled
Return a module with the givenname
, the result of executing the compiled code at the givenpathname
. If this path is aPyUnicode
, it is used exactly; if it is aPyString
it is taken to be file-system encoded.- Parameters:
name
- the module namepathname
- to the compiled module (becomes__file__
)- Returns:
- the module called
name
-
load_compiled
Return a module with the givenname
, the result of executing the compiled code in the givenfile
stream.- Parameters:
name
- the module namepathname
- 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
-
find_module
-
load_module
-
makeCompiledFilename
Variant ofimp.makeCompiledFilename(String)
dealing with encoded bytes. In the context where this is used from Python, a result in encoded bytes is preferable. -
get_magic
-
get_suffixes
-
new_module
-
is_builtin
-
is_frozen
-
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.
-