Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
0071c4e2
Commit
0071c4e2
authored
Sep 21, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cypclass dict __delitem__ implementation
parent
8f09af4d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
Cython/Includes/libcythonplus/dict.pxd
Cython/Includes/libcythonplus/dict.pxd
+1
-1
tests/run/cypclass_builtin_dict.pyx
tests/run/cypclass_builtin_dict.pyx
+33
-0
No files found.
Cython/Includes/libcythonplus/dict.pxd
View file @
0071c4e2
...
...
@@ -167,7 +167,7 @@ cdef cypclass cypdict[K, V]:
index
=
dereference
(
it
).
second
self
.
_indices
.
erase
(
it
)
if
index
<
self
.
_items
.
size
()
-
1
:
self
.
_items
[
index
]
=
self
.
_items
[
self
.
_i
ndice
s
.
size
()
-
1
]
self
.
_items
[
index
]
=
self
.
_items
[
self
.
_i
tem
s
.
size
()
-
1
]
self
.
_items
.
pop_back
()
void
update
(
self
,
const
cypdict
[
K
,
V
]
other
)
except
~
:
...
...
tests/run/cypclass_builtin_dict.pyx
View file @
0071c4e2
...
...
@@ -147,6 +147,39 @@ def test_len():
return
-
2
return
0
def
test_delitem
():
"""
>>> test_delitem()
(1, 10)
(2, 20)
(3, 30)
(4, 40)
(5, 50)
-------
(1, 10)
(2, 20)
(5, 50)
(4, 40)
-------
(4, 40)
(2, 20)
(5, 50)
"""
d
=
cypdict
[
int
,
int
]()
for
i
in
range
(
1
,
7
):
d
[
i
]
=
i
*
10
del
d
[
6
]
for
item
in
d
.
items
():
print
(
item
)
print
(
"-------"
)
del
d
[
3
]
for
item
in
d
.
items
():
print
(
item
)
print
(
"-------"
)
del
d
[
1
]
for
item
in
d
.
items
():
print
(
item
)
def
test_clear
():
"""
>>> test_clear()
...
...
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