提交 1ce831cf 编写于 作者: P Pierre Fersing

Remove support for on_callback with 3 arguments

上级 e661ffb1
......@@ -4,6 +4,8 @@ v1.3.x - 2017-xx-xx
- **BREAKING** Requires Python 2.7 or 3.4+. Closes #163.
- **BREAKING** Remove support for SSL without SSLContext (Requires Python 2.7.9+ or 3.2+).
Closes #115.
- **BREAKING** on_connect callback is now always called flags. Previously this
callback could accepts 3 OR 4 arguments, now it must accepts 4. Closes #197.
- **BREAKING** tls_insecure_set() must now be called *after* tls_set()
- Allow username and password to be zero length (as opposed to not being
present). Closes #80.
......
......@@ -2333,19 +2333,10 @@ class Client(object):
with self._callback_mutex:
if self.on_connect:
if sys.version_info[0] < 3:
argcount = self.on_connect.func_code.co_argcount
else:
argcount = self.on_connect.__code__.co_argcount
if argcount == 3:
with self._in_callback:
self.on_connect(self, self._userdata, result)
else:
flags_dict = {}
flags_dict['session present'] = flags & 0x01
with self._in_callback:
self.on_connect(self, self._userdata, flags_dict, result)
flags_dict = {}
flags_dict['session present'] = flags & 0x01
with self._in_callback:
self.on_connect(self, self._userdata, flags_dict, result)
if result == 0:
rc = 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册