[issue40262] SSL recv_into requires the object to implement __len__ unlike socket one

2020-05-21 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +19579
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20310

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40262] SSL recv_into requires the object to implement __len__ unlike socket one

2020-04-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, it is a bug. __len__ can return a value different from the amount of bytes 
(in array.array, memoryview).

len(buffer) can be replaced with memoryview(buffer).nbytes, but maybe we could 
keep None and let the lower level to handle it.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40262] SSL recv_into requires the object to implement __len__ unlike socket one

2020-04-29 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions:  -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40262] SSL recv_into requires the object to implement __len__ unlike socket one

2020-04-12 Thread tzickel


New submission from tzickel :

I am writing this as a bug, as I have an object which implements the buffer 
protocol but not the __len__.

SSL's recv_into seems to require the buffer object to implement __len__, but 
this is unlike the socket recv_into which uses the buffer protocol length.

Here is the socket.recv_into implementation:
https://github.com/python/cpython/blob/402e1cdb132f384e4dcde7a3d7ec7ea1fc7ab527/Modules/socketmodule.c#L3556

as you can see, the length is optional, and it not given, it takes it from the 
buffer protocol length.

But here is SSL recv_into implementation:
https://github.com/python/cpython/blob/master/Lib/ssl.py#L1233

if length is not given, it tries to call the __len__ of the object itself (not 
it's buffer protocol).

--
assignee: christian.heimes
components: SSL
messages: 366257
nosy: christian.heimes, tzickel
priority: normal
severity: normal
status: open
title: SSL recv_into requires the object to implement __len__ unlike socket one
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com