Antoine Pitrou added the comment:

> This would allow constructs like the following where self can be used
> within the callback. Example:
> 
>         def cb_sni(ssl_sock, server_name, self):
>             self.sniname = server_name
> 
>         self.context.set_servername_callback(cb_sni, self)
> 
> The original functionality can still occur with:
> 
>         self.context.set_servername_callback(cb_sni, self.context)

But you could simply use a closure:

        def cb_sni(ssl_sock, server_name):
            self.sniname = server_name

        self.context.set_servername_callback(cb_sni)

----------
title: SSLContext.set_servername_callback should be able to set argument -> 
SSLContext.set_servername_callback should be able to set    argument

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17181>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to