<div dir="ltr">On Tue, Jul 26, 2016 at 8:47 AM, Matěj Cepl <span dir="ltr"><<a href="mailto:mcepl@cepl.eu" target="_blank">mcepl@cepl.eu</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br></span>
I believe I have fixed all I can do without actually understanding Twisted in <a href="https://gitlab.com/mcepl/m2crypto/commit/6cd5f87b31e50016ebb7e44f3f2ae46610bc24e0" rel="noreferrer" target="_blank">https://gitlab.com/mcepl/m2crypto/commit/6cd5f87b31e50016ebb7e44f3f2ae46610bc24e0</a>.  So now, if Twisted is so transparent and perfectly understandable, could you please suggest, what I do wrong, that the test ends in the endless loop (<a href="https://travis-ci.org/mcepl/M2Crypto/builds/147175901" rel="noreferrer" target="_blank">https://travis-ci.org/mcepl/M2Crypto/builds/147175901</a>)?<br>
<br></blockquote><div><br><br></div><div>In your initial e-mail, it would have been useful if you could have provided reproduction steps<br></div><div>for your problem.<br><br></div><div>Can you provide reproduction steps?<br></div><div><br></div><div>Since I wasn't sure, I took a guess.<br><br></div><div>I did the following inside a Python 3.6 virtual environment under OS X:<br><br></div><div>git clone <a href="https://gitlab.com/mcepl/m2crypto.git">https://gitlab.com/mcepl/m2crypto.git</a> m2crypto_test<br></div><div>cd m2crypto_test<br></div><div>git checkout python3<br></div><div>python setup.py build --openssl=/usr/local/opt/openssl<br></div><div>python setup.py bdist<br></div><div>python setup.py develop<br><br></div><div>py.test -v -s -k test_twisted_wrapper tests/test_ssl.py<br><br></div><div>I was able to reproduce the problem with something looping around:<br><br>DEBUG:_encrypt:self.data = "b'GET / HTTP/1.0\n\n\r\n'"<br>DEBUG:_decrypt:self.encrypted = "b''"<br>DEBUG:_encrypt:self.data = "b'GET / HTTP/1.0\n\n\r\n'"<br>DEBUG:_decrypt:self.encrypted = "b''"<br>DEBUG:_encrypt:self.data = "b'GET / HTTP/1.0\n\n\r\n'"<br>DEBUG:_decrypt:self.encrypted = "b''"<br>DEBUG:_encrypt:self.data = "b'GET / HTTP/1.0\n\n\r\n'"<br>DEBUG:_decrypt:self.encrypted = "b''"<br><br></div><div>I took a look in the M2Crypto code which interfaces with<br></div><div>Twisted, and found that the dataReceived() loop was never terminating<br></div><div>because dataReceived() takes bytes, but the code was<br></div><div>comparing to an emptry str.  So, the loop was never terminating.<br><br></div><div>I fixed this and other problems, and now the test_twisted_wrapper<br></div><div>passes on Python 3.  I submitted this merge request:<br><br><a href="https://gitlab.com/mcepl/m2crypto/merge_requests/3/commits">https://gitlab.com/mcepl/m2crypto/merge_requests/3/commits</a><br></div><div><br></div><div><br></div><div>While I was looking at the code, I also saw that the make_certs.py<br></div><div>utility does not work on Python 3.<br><br></div><div>I fixed that, and submitted this merge request:<br><br><a href="https://gitlab.com/mcepl/m2crypto/merge_requests/4/commits">https://gitlab.com/mcepl/m2crypto/merge_requests/4/commits</a><br></div><div><br></div><div>--<br></div><div>Craig<br></div><div><br></div></div></div></div>