Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cloudpickle/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,7 @@ def extract_code_globals(cls, co):
# PyPy "builtin-code" object
out_names = set()
else:
out_names = set(names[oparg]
for op, oparg in _walk_global_ops(co))
out_names = {names[oparg] for _, oparg in _walk_global_ops(co)}

# see if nested function have any global refs
if co.co_consts:
Expand Down
6 changes: 3 additions & 3 deletions tests/cloudpickle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def g():

def test_unhashable_closure(self):
def f():
s = set((1, 2)) # mutable set is unhashable
s = {1, 2} # mutable set is unhashable

def g():
return len(s)
Expand Down Expand Up @@ -494,7 +494,7 @@ def test_extended_arg(self):
nvars = 65537 + 258
names = ['g%d' % i for i in range(1, nvars)]
r = random.Random(42)
d = dict([(name, r.randrange(100)) for name in names])
d = {name: r.randrange(100) for name in names}
# def f(x):
# x = g1, g2, ...
# return zlib.crc32(bytes(bytearray(x)))
Expand Down Expand Up @@ -693,7 +693,7 @@ def __init__(self, x):
self.assertEqual(depickled3.x, 3)
self.assertEqual(len(weakset), 2)

self.assertEqual(set(weakset), set([depickled1, depickled2]))
self.assertEqual(set(weakset), {depickled1, depickled2})

def test_faulty_module(self):
for module_name in ['_faulty_module', '_missing_module', None]:
Expand Down