Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
656aee7c
Commit
656aee7c
authored
Sep 27, 2006
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make examples do error checking on Py_InitModule
parent
43889c0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
Doc/ext/extending.tex
Doc/ext/extending.tex
+10
-4
No files found.
Doc/ext/extending.tex
View file @
656aee7c
...
...
@@ -221,6 +221,8 @@ initspam(void)
PyObject *m;
m = Py
_
InitModule("spam", SpamMethods);
if (m == NULL)
return;
SpamError = PyErr
_
NewException("spam.error", NULL, NULL);
Py
_
INCREF(SpamError);
...
...
@@ -365,9 +367,9 @@ is inserted in the dictionary \code{sys.modules} under the key
created module based upon the table (an array of
\ctype
{
PyMethodDef
}
structures) that was passed as its second argument.
\cfunction
{
Py
_
InitModule()
}
returns a pointer to the module object
that it creates (which is unused here). It
aborts
with a fatal error
if the module could not be initialized satisfactorily, so the caller
doesn't need to check for errors
.
that it creates (which is unused here). It
may abort
with a fatal error
for certain errors, or return
\NULL
{}
if the module could not be
initialized satisfactorily
.
When embedding Python, the
\cfunction
{
initspam()
}
function is not
called automatically unless there's an entry in the
...
...
@@ -1276,6 +1278,8 @@ initspam(void)
PyObject *c
_
api
_
object;
m = Py
_
InitModule("spam", SpamMethods);
if (m == NULL)
return;
/* Initialize the C API pointer array */
PySpam
_
API[PySpam
_
System
_
NUM] = (void *)PySpam
_
System;
...
...
@@ -1362,7 +1366,9 @@ initclient(void)
{
PyObject *m;
Py
_
InitModule("client", ClientMethods);
m = Py
_
InitModule("client", ClientMethods);
if (m == NULL)
return;
if (import
_
spam() < 0)
return;
/* additional initialization can happen here */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment