Skip to content

Commit 3ac2dfb

Browse files
committed
Fixed invalid conversion of conditional dictionary iterator
The PR that removed the usage of `six` failed to wrap the conditional `environment or {}` in parentheses before calling `.items()` on the resulting value. This would lead to trying to iterate over _either_ `environment` or `{}.items()` which is not the correct behavior.
1 parent fac8119 commit 3ac2dfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

grader_support/gradelib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def invoke_student_function(fn_name, args, environment=None, output_writer=None)
527527
"""
528528
output_writer = output_writer or repr
529529
def doit(submission_module):
530-
for name, value in environment or {}.items():
530+
for name, value in (environment or {}).items():
531531
setattr(submission_module, name, value)
532532
fn = getattr(submission_module, fn_name)
533533
print(output_writer(fn(*args)))

0 commit comments

Comments
 (0)