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
658d5133
Commit
658d5133
authored
May 23, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PyErr_NewException now accepts a tuple of base classes as its
"base" parameter.
parent
da89b995
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
Doc/api/exceptions.tex
Doc/api/exceptions.tex
+2
-1
Misc/NEWS
Misc/NEWS
+3
-0
Python/errors.c
Python/errors.c
+10
-3
No files found.
Doc/api/exceptions.tex
View file @
658d5133
...
...
@@ -341,7 +341,8 @@ for each thread.
The
\member
{__
module
__}
attribute of the new class is set to the
first part (up to the last dot) of the
\var
{
name
}
argument, and the
class name is set to the last part (after the last dot). The
\var
{
base
}
argument can be used to specify an alternate base class.
\var
{
base
}
argument can be used to specify alternate base classes;
it can either be only one class or a tuple of classes.
The
\var
{
dict
}
argument can be used to specify a dictionary of class
variables and methods.
\end{cfuncdesc}
...
...
Misc/NEWS
View file @
658d5133
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.5 alpha 3?
Core and builtins
-----------------
- PyErr_NewException now accepts a tuple of base classes as its
"base" parameter.
- Patch #876206: function call speedup by retaining allocated frame
objects.
...
...
Python/errors.c
View file @
658d5133
...
...
@@ -527,6 +527,7 @@ PyErr_Format(PyObject *exception, const char *format, ...)
}
PyObject
*
PyErr_NewException
(
char
*
name
,
PyObject
*
base
,
PyObject
*
dict
)
{
...
...
@@ -559,9 +560,15 @@ PyErr_NewException(char *name, PyObject *base, PyObject *dict)
classname
=
PyString_FromString
(
dot
+
1
);
if
(
classname
==
NULL
)
goto
failure
;
bases
=
PyTuple_Pack
(
1
,
base
);
if
(
bases
==
NULL
)
goto
failure
;
if
(
PyTuple_Check
(
base
))
{
bases
=
base
;
/* INCREF as we create a new ref in the else branch */
Py_INCREF
(
bases
);
}
else
{
bases
=
PyTuple_Pack
(
1
,
base
);
if
(
bases
==
NULL
)
goto
failure
;
}
result
=
PyClass_New
(
bases
,
dict
,
classname
);
failure:
Py_XDECREF
(
bases
);
...
...
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