|
1 | 1 | use super::{
|
2 |
| - set::PySetInner, IterStatus, PositionIterInternal, PyBaseExceptionRef, PyGenericAlias, PySet, |
3 |
| - PyStrRef, PyTupleRef, PyType, PyTypeRef, PyMappingProxy, |
| 2 | + set::PySetInner, IterStatus, PositionIterInternal, PyBaseExceptionRef, PyGenericAlias, |
| 3 | + PyMappingProxy, PySet, PyStrRef, PyTupleRef, PyType, PyTypeRef, |
4 | 4 | };
|
5 | 5 | use crate::{
|
6 | 6 | builtins::{
|
@@ -1095,6 +1095,10 @@ impl PyDictItems {
|
1095 | 1095 | let found = PyDict::getitem(zelf.dict().clone(), key, vm)?;
|
1096 | 1096 | vm.identical_or_equal(&found, &value)
|
1097 | 1097 | }
|
| 1098 | + #[pyproperty] |
| 1099 | + fn mapping(zelf: PyRef<Self>) -> PyMappingProxy { |
| 1100 | + PyMappingProxy::from(zelf.dict().clone()) |
| 1101 | + } |
1098 | 1102 | }
|
1099 | 1103 | impl Unconstructible for PyDictItems {}
|
1100 | 1104 |
|
@@ -1123,7 +1127,12 @@ impl AsSequence for PyDictItems {
|
1123 | 1127 | }
|
1124 | 1128 |
|
1125 | 1129 | #[pyimpl(with(DictView, Constructor, Iterable, AsSequence))]
|
1126 |
| -impl PyDictValues {} |
| 1130 | +impl PyDictValues { |
| 1131 | + #[pyproperty] |
| 1132 | + fn mapping(zelf: PyRef<Self>) -> PyMappingProxy { |
| 1133 | + PyMappingProxy::from(zelf.dict().clone()) |
| 1134 | + } |
| 1135 | +} |
1127 | 1136 | impl Unconstructible for PyDictValues {}
|
1128 | 1137 |
|
1129 | 1138 | impl AsSequence for PyDictValues {
|
|
0 commit comments