This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Arfrever, Jim.Jewett, eric.araujo, eric.snow, georg.brandl, giampaolo.rodola, gvanrossum, michael.foord, pitrou, poq, r.david.murray, rhettinger, skrah, vstinner
Date 2012-03-29.11:52:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333021950.86.0.90353592993.issue14386@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-03-29 11:52:30vstinnersetrecipients: + vstinner, gvanrossum, georg.brandl, rhettinger, pitrou, giampaolo.rodola, eric.araujo, Arfrever, r.david.murray, michael.foord, skrah, eric.snow, poq, Jim.Jewett
2012-03-29 11:52:30vstinnersetmessageid: <1333021950.86.0.90353592993.issue14386@psf.upfronthosting.co.za>
2012-03-29 11:52:30vstinnerlinkissue14386 messages
2012-03-29 11:52:30vstinnercreate