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
578c76d8
Commit
578c76d8
authored
Sep 01, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for cypclass dict delitem invalidating iterators
parent
63711818
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
tests/run/cypclass_builtin_dict.pyx
tests/run/cypclass_builtin_dict.pyx
+31
-4
No files found.
tests/run/cypclass_builtin_dict.pyx
View file @
578c76d8
...
...
@@ -283,6 +283,25 @@ def test_setitem_items_iterator_invalidation():
print
(
e
)
return
1
def
test_delitem_iterator_invalidation
():
"""
>>> test_delitem_iterator_invalidation()
Modifying a dictionary with active iterators
1
"""
d
=
cypdict
[
Index
,
Value
]()
index
=
Index
(
0
)
d
[
index
]
=
Value
(
0
)
iterator
=
d
.
begin
()
try
:
with
nogil
:
del
d
[
index
]
with
gil
:
return
0
except
RuntimeError
as
e
:
print
(
e
)
return
1
def
test_clear_iterator_invalidation
():
"""
>>> test_clear_iterator_invalidation()
...
...
@@ -310,7 +329,9 @@ def test_modification_after_dict_iterator():
pass
try
:
with
nogil
:
d
[
Index
()]
=
Value
()
index
=
Index
(
0
)
d
[
index
]
=
Value
(
0
)
del
d
[
index
]
d
.
clear
()
with
gil
:
return
1
...
...
@@ -328,7 +349,9 @@ def test_modification_after_dict_keys_iterator():
pass
try
:
with
nogil
:
d
[
Index
()]
=
Value
()
index
=
Index
(
0
)
d
[
index
]
=
Value
(
0
)
del
d
[
index
]
d
.
clear
()
with
gil
:
return
1
...
...
@@ -346,7 +369,9 @@ def test_modification_after_dict_values_iterator():
pass
try
:
with
nogil
:
d
[
Index
()]
=
Value
()
index
=
Index
(
0
)
d
[
index
]
=
Value
(
0
)
del
d
[
index
]
d
.
clear
()
with
gil
:
return
1
...
...
@@ -364,7 +389,9 @@ def test_modification_after_dict_items_iterator():
pass
try
:
with
nogil
:
d
[
Index
()]
=
Value
()
index
=
Index
(
0
)
d
[
index
]
=
Value
(
0
)
del
d
[
index
]
d
.
clear
()
with
gil
:
return
1
...
...
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