Skip to content

Commit 1285cd4

Browse files
committed
skip unnecessary initialization of empty items array (#3962)
Replicates graphql/graphql-js@b12dcff
1 parent f9b19b0 commit 1285cd4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/graphql/execution/incremental_publisher.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,8 @@ def _process_pending(
10171017
if subsequent_result_record.stream_record.errors:
10181018
continue
10191019
incremental_result = IncrementalStreamResult(
1020+
# safe because `items` is always defined
1021+
# when the record is completed
10201022
subsequent_result_record.items,
10211023
# safe because `id` is defined
10221024
# once the stream has been released as pending
@@ -1068,6 +1070,7 @@ def _get_incremental_defer_result(
10681070
sub_path = deferred_grouped_field_set_record.path[len(longest_path) :]
10691071
id_ = record_with_longest_path.id
10701072
return IncrementalDeferResult(
1073+
# safe because `data` is always defined when the record is completed
10711074
data, # type: ignore
10721075
# safe because `id` is defined
10731076
# once the fragment has been released as pending
@@ -1298,7 +1301,6 @@ def __init__(
12981301
self.errors = []
12991302
self.is_completed_async_iterator = self.is_completed = False
13001303
self.is_final_record = self.filtered = False
1301-
self.items = []
13021304

13031305
def __repr__(self) -> str:
13041306
name = self.__class__.__name__

0 commit comments

Comments
 (0)