diff options
author | Michael W. Hudson <mwh@python.net> | 2002-03-07 10:12:11 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2002-03-07 10:12:11 (GMT) |
commit | 2b85b37410ccead36dd687204ef9a76765c21546 (patch) | |
tree | 929bafb06c96ddf7cddf83836eaf7177774589db /Lib | |
parent | 77771c3194e1347e5c27b2884b05a3025861b30d (diff) | |
download | cpython-2b85b37410ccead36dd687204ef9a76765c21546.zip cpython-2b85b37410ccead36dd687204ef9a76765c21546.tar.gz cpython-2b85b37410ccead36dd687204ef9a76765c21546.tar.bz2 |
backport my checkin of
revision 1.52 of os.py
revision 1.52
date: 2002/03/06 17:11:17; author: mwh; state: Exp; lines: +20 -0
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')
-rw-r--r-- | Lib/os.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -591,3 +591,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) |