@@ -293,6 +293,7 @@ def _hack_namedtuple(cls):
293293 """ Make class generated by namedtuple picklable """
294294 name = cls .__name__
295295 fields = cls ._fields
296+
296297 def __reduce__ (self ):
297298 return (_restore , (name , fields , tuple (self )))
298299 cls .__reduce__ = __reduce__
@@ -301,11 +302,11 @@ def __reduce__(self):
301302
302303def _hijack_namedtuple ():
303304 """ Hack namedtuple() to make it picklable """
304- global _old_namedtuple # or it will put in closure
305+ global _old_namedtuple # or it will put in closure
305306
306307 def _copy_func (f ):
307308 return types .FunctionType (f .func_code , f .func_globals , f .func_name ,
308- f .func_defaults , f .func_closure )
309+ f .func_defaults , f .func_closure )
309310
310311 _old_namedtuple = _copy_func (collections .namedtuple )
311312
@@ -323,9 +324,9 @@ def namedtuple(name, fields, verbose=False, rename=False):
323324 # so only hack those in __main__ module
324325 for n , o in sys .modules ["__main__" ].__dict__ .iteritems ():
325326 if (type (o ) is type and o .__base__ is tuple
326- and hasattr (o , "_fields" )
327- and "__reduce__" not in o .__dict__ ):
328- _hack_namedtuple (o ) # hack inplace
327+ and hasattr (o , "_fields" )
328+ and "__reduce__" not in o .__dict__ ):
329+ _hack_namedtuple (o ) # hack inplace
329330
330331
331332_hijack_namedtuple ()
0 commit comments