summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-03-06 17:11:18 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-03-06 17:11:18 (GMT)
commit0e02530a798807db572968ba914ae3694d71eb91 (patch)
tree9e7fad6916145181df1cc9ee59eba394eb753989 /Lib/os.py
parentce358e3015bc8cafdf949dee624b01f4a38bfad2 (diff)
downloadcpython-0e02530a798807db572968ba914ae3694d71eb91.zip
cpython-0e02530a798807db572968ba914ae3694d71eb91.tar.gz
cpython-0e02530a798807db572968ba914ae3694d71eb91.tar.bz2
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.
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 42812aa..f411f1f 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -602,3 +602,23 @@ if _exists("fork"):
stdout, stdin = popen2.popen4(cmd, bufsize)
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)