Module imp
[hide private]
[frames] | no frames]

Module imp

This module provides the components needed to build your own __import__ function. Undocumented functions are obsolete.

Classes [hide private]
  NullImporter
Null importer object
Functions [hide private]
None
acquire_lock()
Acquires the interpreter's import lock for the current thread.
 
find_module(...)
find_module(name, [path]) -> (file, filename, (suffix, mode, type)) Search for a module.
 
get_frozen_object(...)
string
get_magic()
Return the magic number for .pyc or .pyo files.
[(suffix, mode, type), ...]
get_suffixes()
Return a list of (suffix, mode, type) tuples describing the files that find_module() looks for.
 
init_builtin(...)
 
init_frozen(...)
 
is_builtin(...)
 
is_frozen(...)
 
load_compiled(...)
 
load_dynamic(...)
 
load_module(...)
load_module(name, file, filename, (suffix, mode, type)) -> module Load a module, given information returned by find_module().
 
load_package(...)
 
load_source(...)
boolean
lock_held()
Return True if the import lock is currently held, else False.
module
new_module(name)
Create a new module.
None
release_lock()
Release the interpreter's import lock.
Variables [hide private]
  C_BUILTIN = 6
  C_EXTENSION = 3
  IMP_HOOK = 9
  PKG_DIRECTORY = 5
  PY_CODERESOURCE = 8
  PY_COMPILED = 2
  PY_FROZEN = 7
  PY_RESOURCE = 4
  PY_SOURCE = 1
  SEARCH_ERROR = 0
Function Details [hide private]

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. On platforms without threads, this function does nothing.

Returns: None

find_module(...)

 

find_module(name, [path]) -> (file, filename, (suffix, mode, type)) Search for a module. If path is omitted or None, search for a built-in, frozen or special module and continue search in sys.path. The module name cannot contain '.'; to search for a submodule of a package, pass the submodule name and the package's __path__.

load_module(...)

 

load_module(name, file, filename, (suffix, mode, type)) -> module Load a module, given information returned by find_module(). The module name must include the full package name, if any.

lock_held()

 

Return True if the import lock is currently held, else False. On platforms without threads, return False.

Returns: boolean

new_module(name)

 

Create a new module. Do not enter it in sys.modules. The module name must include the full package name, if any.

Returns: module

release_lock()

 

Release the interpreter's import lock. On platforms without threads, this function does nothing.

Returns: None