diff --git a/jsonschema/_validators.py b/jsonschema/_validators.py index 179fec09a..5d987de26 100644 --- a/jsonschema/_validators.py +++ b/jsonschema/_validators.py @@ -257,7 +257,10 @@ def ref(validator, ref, instance, schema): yield error else: scope, resolved = validator.resolver.resolve(ref) - validator.resolver.push_scope(scope) + if "#" in ref: + validator.resolver.push_scope(scope) + else: + validator.resolver.push_scope(str(scope).replace(ref, "")) try: for error in validator.descend(instance, resolved):