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
6ffe852f
Commit
6ffe852f
authored
Mar 18, 2009
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix strange errors when setting attributes on tracebacks #4034
parent
7c33bd5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
23 deletions
+22
-23
Lib/test/test_traceback.py
Lib/test/test_traceback.py
+0
-8
Misc/NEWS
Misc/NEWS
+3
-0
Objects/frameobject.c
Objects/frameobject.c
+11
-1
Python/traceback.c
Python/traceback.c
+8
-14
No files found.
Lib/test/test_traceback.py
View file @
6ffe852f
...
...
@@ -111,14 +111,6 @@ def test():
os
.
unlink
(
os
.
path
.
join
(
testdir
,
f
))
os
.
rmdir
(
testdir
)
def
test_members
(
self
):
# Covers Python/structmember.c::listmembers()
try
:
1
/
0
except
:
import
sys
sys
.
exc_traceback
.
__members__
def
test_base_exception
(
self
):
# Test that exceptions derived from BaseException are formatted right
e
=
KeyboardInterrupt
()
...
...
Misc/NEWS
View file @
6ffe852f
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
Core and Builtins
-----------------
- Issue #4034: Fix weird attribute error messages of the traceback object. (As a
result traceback.__members__ no longer exists.)
- Issue #4474: PyUnicode_FromWideChar now converts characters outside
the BMP to surrogate pairs, on systems with sizeof(wchar_t) == 4
and sizeof(Py_UNICODE) == 2.
...
...
Objects/frameobject.c
View file @
6ffe852f
...
...
@@ -604,7 +604,17 @@ static PyObject *builtin_object;
int
_PyFrame_Init
()
{
builtin_object
=
PyString_InternFromString
(
"__builtins__"
);
return
(
builtin_object
!=
NULL
);
if
(
builtin_object
==
NULL
)
return
0
;
/*
Traceback objects are not created the normal way (through calling the
type), so PyType_Ready has to be called here.
*/
if
(
PyType_Ready
(
&
PyTraceBack_Type
))
{
Py_DECREF
(
builtin_object
);
return
0
;
}
return
1
;
}
PyFrameObject
*
...
...
Python/traceback.c
View file @
6ffe852f
...
...
@@ -11,20 +11,14 @@
#define OFF(x) offsetof(PyTracebackObject, x)
static
struct
memberlist
tb_memberlist
[]
=
{
{
"tb_next"
,
T_OBJECT
,
OFF
(
tb_next
)},
{
"tb_frame"
,
T_OBJECT
,
OFF
(
tb_frame
)},
{
"tb_lasti"
,
T_INT
,
OFF
(
tb_lasti
)},
{
"tb_lineno"
,
T_INT
,
OFF
(
tb_lineno
)},
static
PyMemberDef
tb_memberlist
[]
=
{
{
"tb_next"
,
T_OBJECT
,
OFF
(
tb_next
)
,
READONLY
},
{
"tb_frame"
,
T_OBJECT
,
OFF
(
tb_frame
)
,
READONLY
},
{
"tb_lasti"
,
T_INT
,
OFF
(
tb_lasti
)
,
READONLY
},
{
"tb_lineno"
,
T_INT
,
OFF
(
tb_lineno
)
,
READONLY
},
{
NULL
}
/* Sentinel */
};
static
PyObject
*
tb_getattr
(
PyTracebackObject
*
tb
,
char
*
name
)
{
return
PyMember_Get
((
char
*
)
tb
,
tb_memberlist
,
name
);
}
static
void
tb_dealloc
(
PyTracebackObject
*
tb
)
{
...
...
@@ -58,7 +52,7 @@ PyTypeObject PyTraceBack_Type = {
0
,
(
destructor
)
tb_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
tb_getattr
,
/*tp_getattr*/
0
,
/*tp_getattr*/
0
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
...
...
@@ -80,8 +74,8 @@ PyTypeObject PyTraceBack_Type = {
0
,
/* tp_iter */
0
,
/* tp_iternext */
0
,
/* tp_methods */
0
,
/* tp_members */
0
,
/* tp_getset */
tb_memberlist
,
/* tp_members */
0
,
/* tp_getset */
0
,
/* tp_base */
0
,
/* tp_dict */
};
...
...
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