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
7f7765ce
Commit
7f7765ce
authored
Apr 12, 2010
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8330: Fix expected output in test_gdb.
parent
98431789
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
Lib/test/test_gdb.py
Lib/test/test_gdb.py
+28
-10
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_gdb.py
View file @
7f7765ce
...
...
@@ -226,7 +226,9 @@ class PrettyPrintTests(DebuggerTests):
# This will only work on wide-unicode builds:
self
.
assertGdbRepr
(
unichr
(
0x1D121
))
except
ValueError
,
e
:
if
e
.
message
!=
'unichr() arg not in range(0x10000) (narrow Python build)'
:
# We're probably on a narrow-unicode build; if we're seeing a
# different problem, then re-raise it:
if
e
.
args
!=
(
'unichr() arg not in range(0x10000) (narrow Python build)'
,):
raise
e
def
test_sets
(
self
):
...
...
@@ -321,7 +323,7 @@ print foo''')
self
.
assertTrue
(
m
,
msg
=
'Unexpected new-style class rendering %r'
%
gdb_repr
)
def
assertSane
(
self
,
source
,
corruption
,
exp
_type
=
'unknown'
):
def
assertSane
(
self
,
source
,
corruption
,
exp
value
=
None
,
exptype
=
None
):
'''Run Python under gdb, corrupting variables in the inferior process
immediately before taking a backtrace.
...
...
@@ -335,10 +337,24 @@ print foo''')
gdb_repr
,
gdb_output
=
\
self
.
get_gdb_repr
(
source
,
cmds_after_breakpoint
=
cmds_after_breakpoint
)
self
.
assertTrue
(
re
.
match
(
'<%s at remote 0x[0-9a-f]+>'
%
exp_type
,
gdb_repr
),
'Unexpected gdb representation: %r
\
n
%s'
%
\
(
gdb_repr
,
gdb_output
))
if
expvalue
:
if
gdb_repr
==
repr
(
expvalue
):
# gdb managed to print the value in spite of the corruption;
# this is good (see http://bugs.python.org/issue8330)
return
if
exptype
:
pattern
=
'<'
+
exptype
+
' at remote 0x[0-9a-f]+>'
else
:
# Match anything for the type name; 0xDEADBEEF could point to
# something arbitrary (see http://bugs.python.org/issue8330)
pattern
=
'<.* at remote 0x[0-9a-f]+>'
m
=
re
.
match
(
pattern
,
gdb_repr
)
if
not
m
:
self
.
fail
(
'Unexpected gdb representation: %r
\
n
%s'
%
\
(
gdb_repr
,
gdb_output
))
def
test_NULL_ptr
(
self
):
'Ensure that a NULL PyObject* is handled gracefully'
...
...
@@ -358,18 +374,20 @@ print foo''')
def
test_corrupt_ob_type
(
self
):
'Ensure that a PyObject* with a corrupt ob_type is handled gracefully'
self
.
assertSane
(
'print 42'
,
'set op->ob_type=0xDEADBEEF'
)
'set op->ob_type=0xDEADBEEF'
,
expvalue
=
42
)
def
test_corrupt_tp_flags
(
self
):
'Ensure that a PyObject* with a type with corrupt tp_flags is handled'
self
.
assertSane
(
'print 42'
,
'set op->ob_type->tp_flags=0x0'
,
exp
_type
=
'int'
)
exp
value
=
42
)
def
test_corrupt_tp_name
(
self
):
'Ensure that a PyObject* with a type with corrupt tp_name is handled'
self
.
assertSane
(
'print 42'
,
'set op->ob_type->tp_name=0xDEADBEEF'
)
'set op->ob_type->tp_name=0xDEADBEEF'
,
expvalue
=
42
)
def
test_NULL_instance_dict
(
self
):
'Ensure that a PyInstanceObject with with a NULL in_dict is handled'
...
...
@@ -380,7 +398,7 @@ foo = Foo()
foo.an_int = 42
print foo'''
,
'set ((PyInstanceObject*)op)->in_dict = 0'
,
exp
_
type
=
'Foo'
)
exptype
=
'Foo'
)
def
test_builtins_help
(
self
):
'Ensure that the new-style class _Helper in site.py can be handled'
...
...
Misc/NEWS
View file @
7f7765ce
...
...
@@ -15,6 +15,8 @@ Core and Builtins
Library
-------
- Issue #8330: Fix expected output in test_gdb.
- Issue #8374: Update the internal alias table in the :mod:`locale` module
to cover recent locale changes and additions.
...
...
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