<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>7.5.2 Module Objects </TITLE>
<META NAME="description" CONTENT="7.5.2 Module Objects ">
<META NAME="keywords" CONTENT="api">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="api.css">
<LINK REL="next" HREF="cObjects.html">
<LINK REL="previous" HREF="fileObjects.html">
<LINK REL="up" HREF="otherObjects.html">
<LINK REL="next" HREF="cObjects.html">
</HEAD>
<BODY bgcolor="#ffffff">
<div class=navigation>
<table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="cObjects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="otherObjects.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="fileObjects.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Python/C API Reference Manual</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><img width=32 height=32 align=bottom border=0 alt=""
 src="../icons/blank.gif"></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="cObjects.html">7.5.3 CObjects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="otherObjects.html">7.5 Other Objects</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="fileObjects.html">7.5.1 File Objects</A></span>
<br><hr></div>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION009520000000000000000"></A>
<BR>
7.5.2 Module Objects 
</H2>

<P>
<a name="l2h-273"></a>
There are only a few functions special to module objects.

<P>
<dl><dt>PyObject * <b><a name="l2h-269"><tt class=cfunction>PyModule_New</tt></a></b> (<var>char *name</var>)
<dd>
Return a new module object with the <tt class=member>__name__</tt> attribute set to 
<var>name</var>.  Only the module's <tt class=member>__doc__</tt> and <tt class=member>__name__</tt>
attributes are filled in; the caller is responsible for providing a
<tt class=member>__file__</tt> attribute.
</dl>

<P>
<dl><dt>PyObject * <b><a name="l2h-270"><tt class=cfunction>PyModule_GetDict</tt></a></b> (<var>PyObject *module</var>)
<dd>
Return the dictionary object that implements <var>module</var>'s namespace; 
this object is the same as the <tt class=member>__dict__</tt> attribute of the
module object.  This function never fails.
</dl>

<P>
<dl><dt>char * <b><a name="l2h-271"><tt class=cfunction>PyModule_GetName</tt></a></b> (<var>PyObject *module</var>)
<dd>
Return <var>module</var>'s <tt class=member>__name__</tt> value.  If the module does not 
provide one, <tt class=exception>SystemError</tt> is raised.
</dl>

<P>
<dl><dt>char * <b><a name="l2h-272"><tt class=cfunction>PyModule_GetFilename</tt></a></b> (<var>PyObject *module</var>)
<dd>
Return the name of the file from which <var>module</var> was loaded using
<var>module</var>'s <tt class=member>__file__</tt> attribute.  If this is not defined,
raise <tt class=exception>SystemError</tt>.
</dl>

<P>
<p>
<div class=navigation><hr><table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="cObjects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="otherObjects.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="fileObjects.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Python/C API Reference Manual</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><img width=32 height=32 align=bottom border=0 alt=""
 src="../icons/blank.gif"></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="cObjects.html">7.5.3 CObjects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="otherObjects.html">7.5 Other Objects</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="fileObjects.html">7.5.1 File Objects</A></span>
</div>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>Send comments on this document to <a href="mailto:python-docs@python.org">python-docs@python.org</a>.
</ADDRESS>
</BODY>
</HTML>
