The setter of _ssl._SSLContext._msg_callback clears the current callback before validating the new value, so a rejected assignment or a deletion loses it.
Deleting the attribute should raise AttributeError, like for keylog_filename (gh-156099) and row_factory (gh-149738), and neither a failed deletion nor a failed assignment should change the value.
ssl.SSLContext wraps the attribute in a property which checks the value and has no deleter, so this is only reachable through the C type.
Activity
gh-156166: Fix setting and deleting SSLContext._msg_callback (GH-156167)
[3.14] gh-156166: Fix setting and deleting SSLContext._msg_callback (G…
[3.13] gh-156166: Fix setting and deleting SSLContext._msg_callback (G…
[3.15] gh-156166: Fix setting and deleting SSLContext._msg_callback (G…