[Python-checkins] r61878 - in python/trunk: Lib/test/test_py3kwarn.py Misc/NEWS Objects/bufferobject.c
georg.brandl
python-checkins at python.org
Tue Mar 25 08:56:28 CET 2008
Author: georg.brandl
Date: Tue Mar 25 08:56:27 2008
New Revision: 61878
Modified:
python/trunk/Lib/test/test_py3kwarn.py
python/trunk/Misc/NEWS
python/trunk/Objects/bufferobject.c
Log:
#2355: py3k warning for buffer().
Modified: python/trunk/Lib/test/test_py3kwarn.py
==============================================================================
--- python/trunk/Lib/test/test_py3kwarn.py (original)
+++ python/trunk/Lib/test/test_py3kwarn.py Tue Mar 25 08:56:27 2008
@@ -118,6 +118,11 @@
with catch_warning() as w:
self.assertWarning(set(), w, expected)
+ def test_buffer(self):
+ expected = 'buffer will be removed in 3.x'
+ with catch_warning() as w:
+ self.assertWarning(buffer('a'), w, expected)
+
def test_main():
run_unittest(TestPy3KWarnings)
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Tue Mar 25 08:56:27 2008
@@ -11,7 +11,9 @@
Core and builtins
-----------------
-
+
+- Issue #2355: add Py3k warning for buffer().
+
- Issue #1477: With narrow Unicode builds, the unicode escape sequence
\Uxxxxxxxx did not accept values outside the Basic Multilingual Plane. This
affected raw unicode literals and the 'raw-unicode-escape' codec. Now
Modified: python/trunk/Objects/bufferobject.c
==============================================================================
--- python/trunk/Objects/bufferobject.c (original)
+++ python/trunk/Objects/bufferobject.c Tue Mar 25 08:56:27 2008
@@ -229,6 +229,11 @@
static PyObject *
buffer_new(PyTypeObject *type, PyObject *args, PyObject *kw)
{
+ if (Py_Py3kWarningFlag &&
+ PyErr_WarnEx(PyExc_DeprecationWarning,
+ "buffer will be removed in 3.x", 1) < 0)
+ return NULL;
+
PyObject *ob;
Py_ssize_t offset = 0;
Py_ssize_t size = Py_END_OF_BUFFER;
More information about the Python-checkins
mailing list