From c176cf7371e6c4a205755c44a82197d67f1a6434 Mon Sep 17 00:00:00 2001 From: Zac Hatfield-Dodds Date: Sun, 3 Mar 2024 01:03:57 -0800 Subject: [PATCH] Avoid mutating schema argument Closes #87 (eventually...) --- src/hypothesis_jsonschema/_from_schema.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hypothesis_jsonschema/_from_schema.py b/src/hypothesis_jsonschema/_from_schema.py index 7ab9036..0eb581d 100644 --- a/src/hypothesis_jsonschema/_from_schema.py +++ b/src/hypothesis_jsonschema/_from_schema.py @@ -5,6 +5,7 @@ import operator import re import warnings +from copy import deepcopy from fractions import Fraction from functools import partial from typing import Any, Callable, Dict, List, NoReturn, Optional, Set, Union @@ -135,7 +136,7 @@ def from_schema( """ try: return __from_schema( - schema, + deepcopy(schema), custom_formats=custom_formats, alphabet=CharStrategy.from_args(allow_x00=allow_x00, codec=codec), )