Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling socket.stop() causes an AttributeError #60

Closed
oughtotrade opened this issue Apr 30, 2017 · 2 comments
Closed

Calling socket.stop() causes an AttributeError #60

oughtotrade opened this issue Apr 30, 2017 · 2 comments

Comments

@oughtotrade
Copy link
Contributor

When I call stop() on the listener socket I get the following AttributeError.

<snip>
  File "/home/anon/.virtualenvs/anon/local/lib/python2.7/site-packages/betfairlightweight/streaming/betfairstream.py", line 56, in stop
    if self._socket is not None and not self._socket._closed:
AttributeError: 'SSLSocket' object has no attribute '_closed'

I can't find this _closed attribute in any of the Python documentation or else I'd try and file a PR for you!

@liampauling
Copy link
Member

Thanks, _closed is a protected member which I assume py2.7 doesn't have, will just remove so that the shutdown is attempted regardless.

Just reviewed the source code for socket and _socket, it looks as though shutdown actually calls close() so this can be cleaned up as well.

https://github.com/python/cpython/blob/3.6/Lib/socket.py
https://github.com/biosbits/bits/blob/master/python/_socket.py

liampauling added a commit that referenced this issue Apr 30, 2017
Removal of _closed use and close() as shutdown calls close()
@oughtotrade
Copy link
Contributor Author

Thanks, good result. I'd patched it locally in the same way you modified it and it was working fine (for py2.7 anyway).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants