[issue3805] sslobj.read py3k takes odd arguments

Gregory P. Smith report at bugs.python.org
Mon Sep 8 23:59:55 CEST 2008

Gregory P. Smith <greg at krypto.org> added the comment:

i only had a brief look when i was going through code looking for
potentially incorrect uses of PyByteArray_*.

I've got a patch that i believe cleans it up a little but its sitting on
a machine i don't have remote access to at the moment.  i'll attach it
when i get a chance.

Looking at Lib/ssl.py it appears that recv_into needs this functionality.

I'd still suggest changing the order to be "|iO" to simplify the code a
little.  The PyLong_Check(buf) could go away.  I do not see any calls to
_sslobj.read() within Lib.ssl.py that only pass in a buffer without
passing in a length.

When no bytearray is passed in, the code internally uses a temporary
bytearray object which is later freed after being copied into a bytes
object.  I think it would be better to just use
PyBytes_FromStringAndSize(0, len) and replace the "if (!buf_passed)"
conversion data copy with a _PyBytes_Resize?  The latter will only
realloc and copy if needed.

regardless, thanks for lowering the priority.  looking over the code
again I believe whats there is functionally correct even if a bit odd

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list