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
[legend]
Collaboration diagram for runpy._TempModule:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __enter__
def __exit__

Public Attributes

 mod_name
 module
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Attributes

 _saved_module

Detailed Description

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

Definition at line 24 of file runpy.py.


Constructor & Destructor Documentation

def runpy._TempModule.__init__ (   self,
  mod_name 
)

Definition at line 26 of file runpy.py.

00026 
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 runpy.py.

00031 
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,
  args 
)

Definition at line 40 of file runpy.py.

00040 
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 runpy.py.

Definition at line 27 of file runpy.py.

Definition at line 28 of file runpy.py.

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: