Skip to content

Commit d0628f5

Browse files
committed
make it an error to mutate after using a context
1 parent 3d5a759 commit d0628f5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/OpenSSL/SSL.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -835,13 +835,9 @@ def _require_not_used(f: F) -> F:
835835
@wraps(f)
836836
def inner(self: Context, *args: Any, **kwargs: Any) -> Any:
837837
if self._used:
838-
warnings.warn(
839-
(
840-
"Attempting to mutate a Context after a Connection was "
841-
"created. In the future, this will raise an exception"
842-
),
843-
DeprecationWarning,
844-
stacklevel=2,
838+
raise ValueError(
839+
"Context has already been used to create a Connection, it "
840+
"cannot be mutated again"
845841
)
846842
return f(self, *args, **kwargs)
847843

0 commit comments

Comments
 (0)