This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients barry, christian.heimes, georg.brandl, serhiy.storchaka, vstinner
Date 2013-10-10.08:09:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381392562.72.0.908170886531.issue19209@psf.upfronthosting.co.za>
In-reply-to
Content
> Can't we modify the qualified name instead?

Attached os_stat_statvfs_pickle.patch implements this idea. IMO it's much simpler because it removes completly the need of the copyreg module.

Example with the patch on Linux:

$ ./python
Python 3.4.0a3+ (default:63a1ee94b3ed+, Oct 10 2013, 10:03:45) 
>>> import os, pickletools, pickle
>>> s=os.stat('.')
>>> pickletools.dis(pickle.dumps(s))
    0: \x80 PROTO      3
    2: c    GLOBAL     'os stat_result'
...
>>> pickle.loads(pickle.dumps(s))
os.stat_result(st_mode=16893, st_ino=19792207, st_dev=64772, st_nlink=17, st_uid=1000, st_gid=1000, st_size=28672, st_atime=1381392226, st_mtime=1381392226, st_ctime=1381392226)
>>> 
>>> v=os.statvfs('.')
>>> pickletools.dis(pickle.dumps(v))
    0: \x80 PROTO      3
    2: c    GLOBAL     'os statvfs_result'
...
>>> pickle.loads(pickle.dumps(v))
os.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=125958458, f_bfree=124095595, f_bavail=117695595, f_files=32006144, f_ffree=31792079, f_favail=31792079, f_flag=4096, f_namemax=255)
History
Date User Action Args
2013-10-10 08:09:22vstinnersetrecipients: + vstinner, barry, georg.brandl, christian.heimes, serhiy.storchaka
2013-10-10 08:09:22vstinnersetmessageid: <1381392562.72.0.908170886531.issue19209@psf.upfronthosting.co.za>
2013-10-10 08:09:22vstinnerlinkissue19209 messages
2013-10-10 08:09:22vstinnercreate