@@ -182,7 +182,6 @@ impl fmt::Debug for PyObject {
182182
183183type RustPyFunc = fn ( rt : & mut Executor , Vec < PyObjectRef > ) -> PyResult ;
184184
185- // #[derive(Debug)]
186185pub enum PyObjectKind {
187186 String {
188187 value : String ,
@@ -241,8 +240,22 @@ pub enum PyObjectKind {
241240impl fmt:: Debug for PyObjectKind {
242241 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
243242 match self {
244- & PyObjectKind :: String { ref value } => write ! ( f, "str[{}]" , value) ,
245- _ => write ! ( f, "Some kind of python obj" ) ,
243+ & PyObjectKind :: String { ref value } => write ! ( f, "str \" {}\" " , value) ,
244+ & PyObjectKind :: Integer { ref value } => write ! ( f, "int {}" , value) ,
245+ & PyObjectKind :: Float { ref value } => write ! ( f, "float {}" , value) ,
246+ & PyObjectKind :: Boolean { ref value } => write ! ( f, "boolean {}" , value) ,
247+ & PyObjectKind :: List { ref elements } => write ! ( f, "list" ) ,
248+ & PyObjectKind :: Tuple { ref elements } => write ! ( f, "tuple" ) ,
249+ & PyObjectKind :: Dict { ref elements } => write ! ( f, "dict" ) ,
250+ & PyObjectKind :: Iterator { ref position, ref iterated_obj } => write ! ( f, "iterator" ) ,
251+ & PyObjectKind :: Slice { ref start, ref stop, ref step } => write ! ( f, "slice" ) ,
252+ & PyObjectKind :: NameError { ref name } => write ! ( f, "NameError" ) ,
253+ & PyObjectKind :: Code { ref code } => write ! ( f, "code: {:?}" , code) ,
254+ & PyObjectKind :: Function { ref code } => write ! ( f, "function" ) ,
255+ & PyObjectKind :: Module { ref name, ref dict } => write ! ( f, "module" ) ,
256+ & PyObjectKind :: None => write ! ( f, "None" ) ,
257+ & PyObjectKind :: Class { ref name } => write ! ( f, "class" ) ,
258+ & PyObjectKind :: RustFunction { ref function } => write ! ( f, "rust function" ) ,
246259 }
247260 }
248261}
0 commit comments