Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 46389bd

Browse files
Merge pull request #9 from myselfhimself/patch-1
Exceptions doc: add Py_INCREF after creating new exception types
2 parents 9d253e5 + 2422870 commit 46389bd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎doc/sphinx/source/exceptions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ Often you need to create an Exception class that is specialised to a particular
178178
if (! ExceptionBase) {
179179
return NULL;
180180
} else {
181+
Py_INCREF(ExceptionBase);
181182
PyModule_AddObject(m, "ExceptionBase", ExceptionBase);
182183
}
183184
/* Now a sub-class exception that inherits from the base exception above.
@@ -193,6 +194,7 @@ Often you need to create an Exception class that is specialised to a particular
193194
if (! SpecialisedError) {
194195
return NULL;
195196
} else {
197+
Py_INCREF(SpecialisedError);
196198
PyModule_AddObject(m, "SpecialisedError", SpecialisedError);
197199
}
198200
/* END: Initialise exceptions here. */

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /