From 3c4971c40eb97ac69a49ab53d04b22b9d80c0ef9 Mon Sep 17 00:00:00 2001 From: Alexandre Vassalotti Date: Fri, 16 May 2008 19:14:31 +0000 Subject: [PATCH] Added Python 3.0 warning to cPickle. --- Lib/test/test_py3kwarn.py | 2 +- Modules/cPickle.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index c6160dac97c..2c8f509e605 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -155,7 +155,7 @@ class TestStdlibRemovals(unittest.TestCase): 'sunos5' : ('sunaudiodev', 'SUNAUDIODEV'), } optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev', 'imageop', - 'sv') + 'sv', 'cPickle') def check_removal(self, module_name, optional=False): """Make sure the specified module, when imported, raises a diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 1dd35be645d..06726eed9c5 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -5710,6 +5710,12 @@ initcPickle(void) PyObject *format_version; PyObject *compatible_formats; + /* XXX: Should mention that the pickle module will include the C + XXX: optimized implementation automatically. */ + if (PyErr_WarnPy3k("the cPickle module has been removed in " + "Python 3.0", 2) < 0) + return; + Py_TYPE(&Picklertype) = &PyType_Type; Py_TYPE(&Unpicklertype) = &PyType_Type; Py_TYPE(&PdataType) = &PyType_Type;