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
a22975fb
Commit
a22975fb
authored
Sep 05, 2006
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SF bug #1546288, crash in dict_equal.
parent
c4a70fbb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
Lib/test/test_mutants.py
Lib/test/test_mutants.py
+9
-1
Misc/NEWS
Misc/NEWS
+3
-1
Objects/dictobject.c
Objects/dictobject.c
+3
-0
No files found.
Lib/test/test_mutants.py
View file @
a22975fb
...
...
@@ -91,12 +91,17 @@ class Horrid:
self
.
hashcode
=
random
.
randrange
(
1000000000
)
def
__hash__
(
self
):
return
42
return
self
.
hashcode
def
__cmp__
(
self
,
other
):
maybe_mutate
()
# The point of the test.
return
cmp
(
self
.
i
,
other
.
i
)
def
__eq__
(
self
,
other
):
maybe_mutate
()
# The point of the test.
return
self
.
i
==
other
.
i
def
__repr__
(
self
):
return
"Horrid(%d)"
%
self
.
i
...
...
@@ -132,7 +137,10 @@ def test_one(n):
while
dict1
and
len
(
dict1
)
==
len
(
dict2
):
if
verbose
:
print
"."
,
c
=
cmp
(
dict1
,
dict2
)
if
random
.
random
()
<
0.5
:
c
=
cmp
(
dict1
,
dict2
)
else
:
c
=
dict1
==
dict2
if
verbose
:
print
...
...
Misc/NEWS
View file @
a22975fb
...
...
@@ -17,12 +17,14 @@ Core and builtins
- Patch #1542451: disallow continue anywhere under a finally.
- Patch #1546288: fix seg fault in dict_equal due to ref counting bug.
Library
-------
- Patch #1550886: Fix decimal module context management implementation
to match the localcontext() example from PEP 343
to match the localcontext() example from PEP 343
.
- Bug #1541863: uuid.uuid1 failed to generate unique identifiers
on systems with low clock resolution.
...
...
Objects/dictobject.c
View file @
a22975fb
...
...
@@ -1585,7 +1585,10 @@ dict_equal(dictobject *a, dictobject *b)
/* temporarily bump aval's refcount to ensure it stays
alive until we're done with it */
Py_INCREF
(
aval
);
/* ditto for key */
Py_INCREF
(
key
);
bval
=
PyDict_GetItem
((
PyObject
*
)
b
,
key
);
Py_DECREF
(
key
);
if
(
bval
==
NULL
)
{
Py_DECREF
(
aval
);
return
0
;
...
...
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