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
b31358b0
Commit
b31358b0
authored
Sep 26, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28194: Clean up some checks in dict implementation.
Patch by Xiang Zhang.
parent
edfc83d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
Objects/dictobject.c
Objects/dictobject.c
+11
-10
No files found.
Objects/dictobject.c
View file @
b31358b0
...
...
@@ -710,13 +710,14 @@ top:
}
else
{
ep
=
&
ep0
[
ix
];
assert
(
ep
->
me_key
!=
NULL
);
if
(
ep
->
me_key
==
key
)
{
*
value_addr
=
&
ep
->
me_value
;
if
(
hashpos
!=
NULL
)
*
hashpos
=
i
;
return
ix
;
}
if
(
ep
->
me_
key
!=
NULL
&&
ep
->
me_
hash
==
hash
)
{
if
(
ep
->
me_hash
==
hash
)
{
startkey
=
ep
->
me_key
;
Py_INCREF
(
startkey
);
cmp
=
PyObject_RichCompareBool
(
startkey
,
key
,
Py_EQ
);
...
...
@@ -755,6 +756,7 @@ top:
continue
;
}
ep
=
&
ep0
[
ix
];
assert
(
ep
->
me_key
!=
NULL
);
if
(
ep
->
me_key
==
key
)
{
if
(
hashpos
!=
NULL
)
{
*
hashpos
=
i
;
...
...
@@ -762,7 +764,7 @@ top:
*
value_addr
=
&
ep
->
me_value
;
return
ix
;
}
if
(
ep
->
me_hash
==
hash
&&
ep
->
me_key
!=
NULL
)
{
if
(
ep
->
me_hash
==
hash
)
{
startkey
=
ep
->
me_key
;
Py_INCREF
(
startkey
);
cmp
=
PyObject_RichCompareBool
(
startkey
,
key
,
Py_EQ
);
...
...
@@ -822,9 +824,9 @@ lookdict_unicode(PyDictObject *mp, PyObject *key,
}
else
{
ep
=
&
ep0
[
ix
];
/* only split table can be ix != DKIX_DUMMY && me_key == NULL */
assert
(
ep
->
me_key
!=
NULL
);
if
(
ep
->
me_key
==
key
||
(
ep
->
me_hash
==
hash
&&
unicode_eq
(
ep
->
me_key
,
key
)))
{
if
(
ep
->
me_key
==
key
||
(
ep
->
me_hash
==
hash
&&
unicode_eq
(
ep
->
me_key
,
key
)))
{
if
(
hashpos
!=
NULL
)
*
hashpos
=
i
;
*
value_addr
=
&
ep
->
me_value
;
...
...
@@ -849,10 +851,9 @@ lookdict_unicode(PyDictObject *mp, PyObject *key,
continue
;
}
ep
=
&
ep0
[
ix
];
assert
(
ep
->
me_key
!=
NULL
);
if
(
ep
->
me_key
==
key
||
(
ep
->
me_hash
==
hash
&&
ep
->
me_key
!=
NULL
&&
unicode_eq
(
ep
->
me_key
,
key
)))
{
||
(
ep
->
me_hash
==
hash
&&
unicode_eq
(
ep
->
me_key
,
key
)))
{
*
value_addr
=
&
ep
->
me_value
;
if
(
hashpos
!=
NULL
)
{
*
hashpos
=
i
;
...
...
@@ -962,7 +963,7 @@ lookdict_split(PyDictObject *mp, PyObject *key,
}
assert
(
ix
>=
0
);
ep
=
&
ep0
[
ix
];
assert
(
ep
->
me_key
==
NULL
||
PyUnicode_CheckExact
(
ep
->
me_key
));
assert
(
ep
->
me_key
!=
NULL
&&
PyUnicode_CheckExact
(
ep
->
me_key
));
if
(
ep
->
me_key
==
key
||
(
ep
->
me_hash
==
hash
&&
unicode_eq
(
ep
->
me_key
,
key
)))
{
if
(
hashpos
!=
NULL
)
...
...
@@ -981,7 +982,7 @@ lookdict_split(PyDictObject *mp, PyObject *key,
}
assert
(
ix
>=
0
);
ep
=
&
ep0
[
ix
];
assert
(
ep
->
me_key
==
NULL
||
PyUnicode_CheckExact
(
ep
->
me_key
));
assert
(
ep
->
me_key
!=
NULL
&&
PyUnicode_CheckExact
(
ep
->
me_key
));
if
(
ep
->
me_key
==
key
||
(
ep
->
me_hash
==
hash
&&
unicode_eq
(
ep
->
me_key
,
key
)))
{
if
(
hashpos
!=
NULL
)
...
...
@@ -2881,7 +2882,7 @@ dict_traverse(PyObject *op, visitproc visit, void *arg)
{
PyDictObject
*
mp
=
(
PyDictObject
*
)
op
;
PyDictKeysObject
*
keys
=
mp
->
ma_keys
;
PyDictKeyEntry
*
entries
=
DK_ENTRIES
(
mp
->
ma_
keys
);
PyDictKeyEntry
*
entries
=
DK_ENTRIES
(
keys
);
Py_ssize_t
i
,
n
=
keys
->
dk_nentries
;
if
(
keys
->
dk_lookup
==
lookdict
)
{
...
...
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