summaryrefslogtreecommitdiff
path: root/jsonschema
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-08-24 14:39:42 +0100
committerJulian Berman <Julian@GrayVines.com>2021-08-24 14:39:42 +0100
commitaaafa1e43af5104da23c49cb8576aaeb5895a4ad (patch)
tree5610423b325748a26dc61c9bc168f8c062569d03 /jsonschema
parent998a7c53667941fb77520d30a58a9b263edafa9d (diff)
downloadjsonschema-aaafa1e43af5104da23c49cb8576aaeb5895a4ad.tar.gz
Minor local variable tweaking.v4.0.0a5
Diffstat (limited to 'jsonschema')
-rw-r--r--jsonschema/_validators.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/jsonschema/_validators.py b/jsonschema/_validators.py
index 4adc3c2..0cfc8c0 100644
--- a/jsonschema/_validators.py
+++ b/jsonschema/_validators.py
@@ -67,11 +67,12 @@ def items(validator, items, instance, schema):
return
prefix = len(schema.get("prefixItems", []))
- if items is False and len(instance) > prefix:
- message = f"Expected at most {prefix} items, but found {len(instance)}"
+ total = len(instance)
+ if items is False and total > prefix:
+ message = f"Expected at most {prefix} items, but found {total}"
yield ValidationError(message)
else:
- for index in range(prefix, len(instance)):
+ for index in range(prefix, total):
yield from validator.descend(
instance=instance[index],
schema=items,