zhuyifei1999 added a comment.

    def close(self):
        """Send the quit message and close the socket"""
        if self._closed:
            raise err.Error("Already closed")
        self._closed = True
        if self._sock is None:
            return
        send_data = struct.pack('<iB', 1, COMMAND.COM_QUIT)
        try:
            self._write_bytes(send_data)
        except Exception:
            pass
        finally:
            sock = self._sock
            self._sock = None
            self._rfile = None
            sock.close()
  
  `sock.close()` complains about `sock` being None, `sock = self._sock`, so 
`self._sock` must have been None, and `self._sock` was checked in `if 
self._sock is None:` so `self._sock` must not have been None at that time. So 
this status muct have been changed either in another thread (unlikely) or in 
`self._write_bytes`.
  
  In T216741#4972984 <https://phabricator.wikimedia.org/T216741#4972984>, @Xqt 
wrote:
  
  > Can't you try to update the package?
  
  
  No. You have to persuade debian package maintainers to update it. No other 
version is install-able under our current policy.
  
    $ apt-cache policy python-pymysql
    python-pymysql:
      Installed: 0.7.10-1
      Candidate: 0.7.10-1
      Version table:
     *** 0.7.10-1 500
            500 http://deb.debian.org/debian stretch/main amd64 Packages
            100 /var/lib/dpkg/status

TASK DETAIL
  https://phabricator.wikimedia.org/T216741

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: zhuyifei1999
Cc: Xqt, zhuyifei1999, Mpaa, Aklapper, pywikibot-bugs-list, Dvorapa, Wenyi, 
AndyTan, Zylc, 1978Gage2001, aborrero, Chicocvenancio, Tbscho, MayS, 
Freddy2001, Mdupont, JJMC89, Avicennasis, srodlund, Luke081515, mys_721tx, 
Gryllida, jayvdb, Dalba, Masti, scfc, Alchimista, coren, Rxy, Krenair, chasemp
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to