STINNER Victor <victor.stin...@gmail.com> added the comment:

Patch version 4, it is ready for a review. Summary of the patch:

 - expose the internal dict_proxy() type (used for __dict__ of user classes) as 
types.MappingViewType (it was exposed a types.DictProxyType in Python 2)
 - repr(types.MappingViewType) returns 'mappingview(...)' instead of 
'dict_proxy(...)'
 - implement mappingview.__new__()
 - mappingview constructors (mappingview.__new__() and PyDictProxy_New) rejects 
sequences
 - Keep PyDictProxy_New() and PyDictProxy_Type names for backward compatibility
 - mappingview_contains() calls PySequence_Contains() for types other than dict 
(instead of PyDict_Contains)
 - Write a doc and a lot of tests
 - Rename the internal "dict" attribute to "mapping" (this change may be 
reverted if it impacts backward compatibility)

I added the new tests to test_descr. Is test_types a better place for these 
types (the type is exposed in the types module, but implemented in 
descrobject.c)? I leaved the object implementation in descrobject.c to not have 
to add a new short file and to keep the Mercurial history. The file does still 
contain this funny comment:

/* This has no reason to be in this file except that adding new files is a
   bit of a pain */

MappingViewType constructor accepts any mapping: dict, collections.ChainMap, 
... Sequences are rejected: tuple, list, dict_view, etc.

----------
Added file: http://bugs.python.org/file25063/mappingview-4.patch

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

Reply via email to