[Python-checkins] CVS: python/dist/src/Lib os.py,1.51,1.52

Michael Hudson mwh@users.sourceforge.net
Wed, 06 Mar 2002 09:11:20 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv22847

Modified Files:
	os.py 
Log Message:
Special support for pickling os.stat and os.stat_vfs results portably
(the types come from different modules on different platforms).

Added tests for pickling these types.

May be a bugfix candidate.



Index: os.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** os.py	24 Feb 2002 05:32:32 -0000	1.51
--- os.py	6 Mar 2002 17:11:17 -0000	1.52
***************
*** 603,604 ****
--- 603,624 ----
              return stdin, stdout
          __all__.append("popen4")
+ 
+ import copy_reg as _copy_reg
+ 
+ def _make_stat_result(tup, dict):
+     return stat_result(tup, dict)
+ 
+ def _pickle_stat_result(sr):
+     (type, args) = sr.__reduce__()
+     return (_make_stat_result, args)
+ 
+ _copy_reg.pickle(stat_result, _pickle_stat_result,_make_stat_result)
+ 
+ def _make_statvfs_result(tup, dict):
+     return statvfs_result(tup, dict)
+ 
+ def _pickle_statvfs_result(sr):
+     (type, args) = sr.__reduce__()
+     return (_make_statvfs_result, args)
+ 
+ _copy_reg.pickle(statvfs_result, _pickle_statvfs_result,_make_statvfs_result)