From f69ab79ec8347c1f5ff0c6f31947ec06073fbd52 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 7 Jul 2017 11:47:38 +1000 Subject: py/objgenerator: Allow to hash generators and generator instances. Adds nothing to the code size, since it uses existing empty slots in the type structures. --- tests/basics/builtin_hash_gen.py | 7 +++++++ tests/run-tests | 1 + 2 files changed, 8 insertions(+) create mode 100644 tests/basics/builtin_hash_gen.py (limited to 'tests') diff --git a/tests/basics/builtin_hash_gen.py b/tests/basics/builtin_hash_gen.py new file mode 100644 index 0000000000..d42e5ebfbc --- /dev/null +++ b/tests/basics/builtin_hash_gen.py @@ -0,0 +1,7 @@ +# test builtin hash function, on generators + +def gen(): + yield + +print(type(hash(gen))) +print(type(hash(gen()))) diff --git a/tests/run-tests b/tests/run-tests index f651242862..bd4a1363cb 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -323,6 +323,7 @@ def run_tests(pyb, tests, args, base_path="."): skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support skip_tests.add('basics/array_construct2.py') # requires generators skip_tests.add('basics/bool1.py') # seems to randomly fail + skip_tests.add('basics/builtin_hash_gen.py') # requires yield skip_tests.add('basics/class_bind_self.py') # requires yield skip_tests.add('basics/del_deref.py') # requires checking for unbound local skip_tests.add('basics/del_local.py') # requires checking for unbound local -- cgit v1.2.3