Daniel Moisset added the comment:

As a description of the idea I'm attaching a rough patch with an 
implementation. Some tests fail because of the following:

1) I didn't find a good place to register the Buffer ABC for mmap.mmap, and 
array.mmap; the modeules themselves are C extensions (and it's possible but 
weird to register the ABC from the C API); I could import those in typing.py 
but then I'd make typing depend from mmap and array which also feels wrong; so 
I didn't do that and the related tests that I added fail.

2) I had a similar situation with io.BytesIO. In that case there's a python 
module and I'm doing the abc.register there, but now io imports typing, and the 
test_site fails because many new modules (typing and its dependencies) are 
imported on startup. The alternative is to make typing depend on io (in this 
case it could be a reasonable idea)

After these, I'm feeling that typing.py may not be the best place for this (but 
given that collections.abc isn't either, I'm not sure where's the right place)

----------
keywords: +patch
Added file: http://bugs.python.org/file43719/buffer.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27501>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to