summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_getargs2.py2
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/getargs.c5
3 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 7186f55..5ade2b4 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -325,7 +325,7 @@ class Bytes_TestCase(unittest.TestCase):
from _testcapi import getargs_z
self.assertEqual(getargs_z('abc\xe9'), b'abc\xc3\xa9')
self.assertRaises(TypeError, getargs_z, 'nul:\0')
- self.assertEqual(getargs_z(b'bytes'), b'bytes')
+ self.assertRaises(TypeError, getargs_z, b'bytes')
self.assertRaises(TypeError, getargs_z, bytearray(b'bytearray'))
self.assertRaises(TypeError, getargs_z, memoryview(b'memoryview'))
self.assertIsNone(getargs_z(None))
diff --git a/Misc/NEWS b/Misc/NEWS
index 2c6083d..46583e9 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 3.2 Alpha 1?
Core and Builtins
-----------------
+- Issue #8949: "z" format of PyArg_Parse*() functions doesn't accept bytes
+ objects, as described in the documentation.
+
- Issue #6543: Write the traceback in the terminal encoding instead of utf-8.
Fix the encoding of the modules filename. Patch written by Amaury Forgeot
d'Arc.
diff --git a/Python/getargs.c b/Python/getargs.c
index 20f4814..bce99ae 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1005,11 +1005,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (arg == Py_None)
*p = 0;
- else if (PyBytes_Check(arg)) {
- /* Enable null byte check below */
- uarg = arg;
- *p = PyBytes_AS_STRING(arg);
- }
else if (PyUnicode_Check(arg)) {
uarg = UNICODE_DEFAULT_ENCODING(arg);
if (uarg == NULL)