Skip to content

Commit 495ee32

Browse files
committed
added unittest to check for unmodifiable storage corner case on dict init
- fixed style
1 parent f462ff5 commit 495ee32

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_dict.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,7 @@ def test_create_seq_and_kw():
285285
d = dict({'a': 1, 'b': 2, 'c': 3}, d=4)
286286
for k in ['a', 'b', 'c', 'd']:
287287
assert k in d
288+
289+
d = dict(dict(a=1, b=2, c=3), d=4)
290+
for k in ['a', 'b', 'c', 'd']:
291+
assert k in d

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/HashingStorageNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public void doPDict(PDict self, PDict iterable, @SuppressWarnings("unused") PKey
302302

303303
@Specialization(guards = {"!isNoValue(iterable)", "!isEmpty(kwargs)"}, rewriteOn = HashingStorage.UnmodifiableStorageException.class)
304304
public void doPDictKwargs(PDict self, PDict iterable, PKeyword[] kwargs,
305-
@Cached("create()") UnionNode unionNode) {
305+
@Cached("create()") UnionNode unionNode) {
306306
HashingStorage dictStorage = unionNode.execute(iterable.getDictStorage(), new KeywordsStorage(kwargs));
307307
self.setDictStorage(dictStorage);
308308
}

0 commit comments

Comments
 (0)