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
927a7dbf
Commit
927a7dbf
authored
Sep 18, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix exception handling on updating cypclass dict
parent
d965b9a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-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
+19
-0
No files found.
Cython/Includes/libcythonplus/dict.pxd
View file @
927a7dbf
...
...
@@ -170,7 +170,7 @@ cdef cypclass cypdict[K, V]:
self
.
_items
[
index
]
=
self
.
_items
[
self
.
_indices
.
size
()
-
1
]
self
.
_items
.
pop_back
()
void
update
(
self
,
const
cypdict
[
K
,
V
]
other
):
void
update
(
self
,
const
cypdict
[
K
,
V
]
other
)
except
~
:
for
item
in
other
.
items
():
self
[
item
.
first
]
=
item
.
second
...
...
tests/run/cypclass_builtin_dict.pyx
View file @
927a7dbf
...
...
@@ -377,6 +377,25 @@ def test_clear_iterator_invalidation():
print
(
e
)
return
0
def
test_update_iterator_invalidation
():
"""
>>> test_update_iterator_invalidation()
Modifying a dictionary with active iterators
0
"""
d
=
cypdict
[
Index
,
Value
]()
d2
=
cypdict
[
Index
,
Value
]()
d2
[
Index
(
1
)]
=
Value
(
1
)
iterator
=
d
.
begin
()
try
:
with
nogil
:
d
.
update
(
d2
)
with
gil
:
return
-
1
except
RuntimeError
as
e
:
print
(
e
)
return
0
def
test_modification_after_dict_iterator
():
"""
>>> test_modification_after_dict_iterator()
...
...
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