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
f13adf40
Commit
f13adf40
authored
Jan 23, 2008
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turn three recently fixed crashers into regular tests.
parent
98b09a09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
1 deletion
+70
-1
Lib/test/test_descr.py
Lib/test/test_descr.py
+70
-1
No files found.
Lib/test/test_descr.py
View file @
f13adf40
# Test enhancements related to descriptors and new-style classes
# XXX Please, please, please, someone convert this to unittest style!
from
test.test_support
import
verify
,
vereq
,
verbose
,
TestFailed
,
TESTFN
,
get_original_stdout
from
copy
import
deepcopy
import
warnings
...
...
@@ -4427,6 +4429,8 @@ def test_assign_slice():
# ceval.c's assign_slice used to check for
# tp->tp_as_sequence->sq_slice instead of
# tp->tp_as_sequence->sq_ass_slice
if
verbose
:
print
"Testing assign_slice..."
class
C
(
object
):
def
__setslice__
(
self
,
start
,
stop
,
value
):
...
...
@@ -4436,8 +4440,70 @@ def test_assign_slice():
c
[
1
:
2
]
=
3
vereq
(
c
.
value
,
3
)
def
test_weakref_in_del_segfault
():
# This used to segfault until r60057
if
verbose
:
print
"Testing weakref in del segfault..."
import
weakref
global
ref
class
Target
():
def
__del__
(
self
):
global
ref
ref
=
weakref
.
ref
(
self
)
w
=
Target
()
del
w
del
ref
def
test_borrowed_ref_3_segfault
():
# This used to segfault until r60224
if
verbose
:
print
"Testing borrowed ref 3 segfault..."
class
KeyFunc
(
object
):
def
__call__
(
self
,
n
):
del
d
[
'key'
]
return
1
d
=
{
'key'
:
KeyFunc
()}
try
:
min
(
range
(
10
),
**
d
)
except
:
pass
def
test_borrowed_ref_4_segfault
():
# This used to segfault until r60224
if
verbose
:
print
"Testing borrowed ref 4 segfault..."
import
types
import
__builtin__
class
X
(
object
):
def
__getattr__
(
self
,
name
):
# this is called with name == '__bases__' by PyObject_IsInstance()
# during the unbound method call -- it frees the unbound method
# itself before it invokes its im_func.
del
__builtin__
.
__import__
return
()
pseudoclass
=
X
()
class
Y
(
object
):
def
__call__
(
self
,
*
args
):
# 'self' was freed already
return
(
self
,
args
)
# make an unbound method
__builtin__
.
__import__
=
types
.
MethodType
(
Y
(),
None
,
(
pseudoclass
,
str
))
import
spam
def
test_main
():
weakref_segfault
()
# Must be first, somehow
#XXX
weakref_segfault() # Must be first, somehow
wrapper_segfault
()
do_this_first
()
class_docstrings
()
...
...
@@ -4535,6 +4601,9 @@ def test_main():
methodwrapper
()
notimplemented
()
test_assign_slice
()
test_weakref_in_del_segfault
()
test_borrowed_ref_3_segfault
()
test_borrowed_ref_4_segfault
()
if
verbose
:
print
"All OK"
...
...
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