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