@@ -716,29 +716,30 @@ def walkCodeObject(code):
716716
717717 return (createFunctionWithLocalsAndGlobals , args , representation )
718718
719- if not isinstance (inst , type ) and hasattr (type (inst ), '__reduce_ex__' ):
720- res = inst .__reduce_ex__ (4 )
721-
722- # pickle supports a protocol where __reduce__ can return a string
723- # giving a global name. We'll already find that separately, so we
724- # don't want to handle it here. We ought to look at this in more detail
725- # however
726- if isinstance (res , str ):
727- return None
728-
729- return res
730-
731- if not isinstance (inst , type ) and hasattr (type (inst ), '__reduce__' ):
732- res = inst .__reduce__ ()
733-
734- # pickle supports a protocol where __reduce__ can return a string
735- # giving a global name. We'll already find that separately, so we
736- # don't want to handle it here. We ought to look at this in more detail
737- # however
738- if isinstance (res , str ):
739- return None
740-
741- return res
719+ if not isinstance (inst , type ) and not isinstance (inst , Type ):
720+ if hasattr (type (inst ), '__reduce_ex__' ):
721+ res = inst .__reduce_ex__ (4 )
722+
723+ # pickle supports a protocol where __reduce__ can return a string
724+ # giving a global name. We'll already find that separately, so we
725+ # don't want to handle it here. We ought to look at this in more detail
726+ # however
727+ if isinstance (res , str ):
728+ return None
729+
730+ return res
731+
732+ if hasattr (type (inst ), '__reduce__' ):
733+ res = inst .__reduce__ ()
734+
735+ # pickle supports a protocol where __reduce__ can return a string
736+ # giving a global name. We'll already find that separately, so we
737+ # don't want to handle it here. We ought to look at this in more detail
738+ # however
739+ if isinstance (res , str ):
740+ return None
741+
742+ return res
742743
743744 return None
744745
0 commit comments