@@ -152,16 +152,6 @@ def move_to_end(self, key, last=True):
152152 link .next = first
153153 root .next = first .prev = link
154154
155- def __reduce__ (self ):
156- 'Return state information for pickling'
157- items = [[k , self [k ]] for k in self ]
158- inst_dict = vars (self ).copy ()
159- for k in vars (OrderedDict ()):
160- inst_dict .pop (k , None )
161- if inst_dict :
162- return (self .__class__ , (items ,), inst_dict )
163- return self .__class__ , (items ,)
164-
165155 def __sizeof__ (self ):
166156 sizeof = _sys .getsizeof
167157 n = len (self ) + 1 # number of links including root
@@ -202,6 +192,16 @@ def __repr__(self):
202192 return '%s()' % (self .__class__ .__name__ ,)
203193 return '%s(%r)' % (self .__class__ .__name__ , list (self .items ()))
204194
195+ def __reduce__ (self ):
196+ 'Return state information for pickling'
197+ items = [[k , self [k ]] for k in self ]
198+ inst_dict = vars (self ).copy ()
199+ for k in vars (OrderedDict ()):
200+ inst_dict .pop (k , None )
201+ if inst_dict :
202+ return (self .__class__ , (items ,), inst_dict )
203+ return self .__class__ , (items ,)
204+
205205 def copy (self ):
206206 'od.copy() -> a shallow copy of od'
207207 return self .__class__ (self )
0 commit comments