Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
runpy._TempModule Class Reference
Inheritance diagram for runpy._TempModule:
Inheritance graph
Collaboration diagram for runpy._TempModule:
Collaboration graph

List of all members.

Public Member Functions

def __init__
def __enter__
def __exit__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Attributes


Detailed Description

Temporarily replace a module in sys.modules with an empty namespace

Definition at line 24 of file

Constructor & Destructor Documentation

def runpy._TempModule.__init__ (   self,

Definition at line 26 of file

00027     def __init__(self, mod_name):
00028         self.mod_name = mod_name
00029         self.module = imp.new_module(mod_name)
00030         self._saved_module = []

Here is the caller graph for this function:

Member Function Documentation

Definition at line 31 of file

00032     def __enter__(self):
00033         mod_name = self.mod_name
00034         try:
00035             self._saved_module.append(sys.modules[mod_name])
00036         except KeyError:
00037             pass
00038         sys.modules[mod_name] = self.module
00039         return self

def runpy._TempModule.__exit__ (   self,

Definition at line 40 of file

00041     def __exit__(self, *args):
00042         if self._saved_module:
00043             sys.modules[self.mod_name] = self._saved_module[0]
00044         else:
00045             del sys.modules[self.mod_name]
00046         self._saved_module = []

Here is the caller graph for this function:

Member Data Documentation

Definition at line 29 of file

Definition at line 27 of file

Definition at line 28 of file

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

The documentation for this class was generated from the following file: