Skip to content

Commit 5400262

Browse files
authored
make it an error to mutate after using a context
1 parent 62a0f50 commit 5400262

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
@@ -834,13 +834,9 @@ def _require_not_used(f: F) -> F:
834834
@wraps(f)
835835
def inner(self: Context, *args: Any, **kwargs: Any) -> Any:
836836
if self._used:
837-
warnings.warn(
838-
(
839-
"Attempting to mutate a Context after a Connection was "
840-
"created. In the future, this will raise an exception"
841-
),
842-
DeprecationWarning,
843-
stacklevel=2,
837+
raise ValueError(
838+
"Context has already been used to create a Connection, it "
839+
"cannot be mutated again"
844840
)
845841
return f(self, *args, **kwargs)
846842

0 commit comments

Comments
 (0)