Skip to content

Commit 4a6b7f1

Browse files
committed
Add comment to explain why we're using id() for caching
1 parent 1ebcb23 commit 4a6b7f1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/graphql/execution/execute.py

+2
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,8 @@ def collect_subfields(
987987
subfields are not repeatedly calculated, which saves overhead when resolving
988988
lists of values.
989989
"""
990+
# Use id(field_nodes) as key, since a list cannot be hashed and
991+
# (after conversion to a tuple) hashing nodes would be too slow:
990992
cache_key = return_type, id(field_nodes)
991993
sub_field_nodes = self._subfields_cache.get(cache_key)
992994
if sub_field_nodes is None:

0 commit comments

Comments
 (0)