Skip to content

Commit fffaa8a

Browse files
committed
make it an error to mutate after using a context
1 parent f46314f commit fffaa8a

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
@@ -840,13 +840,9 @@ def _require_not_used(f: F) -> F:
840840
@wraps(f)
841841
def inner(self: Context, *args: Any, **kwargs: Any) -> Any:
842842
if self._used:
843-
warnings.warn(
844-
(
845-
"Attempting to mutate a Context after a Connection was "
846-
"created. In the future, this will raise an exception"
847-
),
848-
DeprecationWarning,
849-
stacklevel=2,
843+
raise ValueError(
844+
"Context has already been used to create a Connection, it "
845+
"cannot be mutated again"
850846
)
851847
return f(self, *args, **kwargs)
852848

0 commit comments

Comments
 (0)