@@ -5,7 +5,11 @@ use serde::de::{DeserializeSeed, Visitor};
5
5
use serde:: ser:: { SerializeMap , SerializeSeq } ;
6
6
use serde_json;
7
7
8
- use crate :: obj:: { objbool, objdict, objfloat, objint, objsequence, objstr, objtype} ;
8
+ use crate :: obj:: {
9
+ objbool, objdict, objfloat, objint, objsequence,
10
+ objstr:: { self , PyString } ,
11
+ objtype,
12
+ } ;
9
13
use crate :: pyobject:: {
10
14
create_type, DictProtocol , PyContext , PyFuncArgs , PyObjectPayload , PyObjectRef , PyResult ,
11
15
TypeProtocol ,
@@ -167,9 +171,8 @@ impl<'de> Visitor<'de> for PyObjectDeserializer<'de> {
167
171
// than wrapping the given object up and then unwrapping it to determine whether or
168
172
// not it is a string
169
173
while let Some ( ( key_obj, value) ) = access. next_entry_seed ( self . clone ( ) , self . clone ( ) ) ? {
170
- let key: String = match key_obj. payload {
171
- // FIXME
172
- // PyObjectPayload::String { ref value } => value.clone(),
174
+ let key: String = match key_obj. payload :: < PyString > ( ) {
175
+ Some ( PyString { ref value } ) => value. clone ( ) ,
173
176
_ => unimplemented ! ( "map keys must be strings" ) ,
174
177
} ;
175
178
self . vm . ctx . set_item ( & dict, & key, value) ;
0 commit comments