Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 34af3e74292d by Victor Stinner in branch 'default':
Close #14386: Register types.MappingProxyType as a Mapping
http://hg.python.org/cpython/rev/34af3e74292d
--
resolution: - fixed
stage: -
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset c3a0197256ee by Victor Stinner in branch 'default':
Issue #14386: Expose the dict_proxy internal type as types.MappingProxyType
http://hg.python.org/cpython/rev/c3a0197256ee
--
nosy: +python-dev
STINNER Victor victor.stin...@gmail.com added the comment:
Summary: The collections.abc module is fine as-is.
Ok, but there is still an issue: issubclass(types.MappingProxyType,
collections.abc.Mapping) is False. Attached registers MappingProxyType as a
Mapping. Is it correct?
The patch
Changes by STINNER Victor victor.stin...@gmail.com:
--
title: Expose dict_proxy internal type as types.MappingViewType - Expose
dict_proxy internal type as types.MappingProxyType
___
Python tracker rep...@bugs.python.org
Raymond Hettinger raymond.hettin...@gmail.com added the comment:
[Victor]
'''Oh, collections.abc contains also the mappingview type exposed with the name
dict_proxy: dict_proxy = type(type.__dict__)
It was exposed as _abcoll.dict_proxy in Python 3.2.
It is not documented. Should we keep it for
STINNER Victor victor.stin...@gmail.com added the comment:
You can ignore those.
You mean that I can remove it?
It's a little bit surprising to find a concrete class in collections.abc. So I
think that it's better to expose dict_proxy in types than in collections.abc.
--
Raymond Hettinger raymond.hettin...@gmail.com added the comment:
[Victor]
You mean that I can remove it?
No, it needs to stay there.
Those concrete types aren't exposed to users
but they are used inside to collections.abcs
to register the types so that isinstance()
will work as expected.