summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-05-14 15:12:27 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-05-14 15:12:27 (GMT)
commite1e04ad8aac819941948b994937f1d42d83a564b (patch)
tree971a16b95e08f942c596829e1630087b34a8b985
parentb78c448f4bad3afee409129337709e5fb110e5f3 (diff)
downloadcpython-e1e04ad8aac819941948b994937f1d42d83a564b.zip
cpython-e1e04ad8aac819941948b994937f1d42d83a564b.tar.gz
cpython-e1e04ad8aac819941948b994937f1d42d83a564b.tar.bz2
Backed out changeset 6ceedbd88b5f
-rw-r--r--Lib/test/test_codecs.py12
-rw-r--r--Modules/_codecsmodule.c16
2 files changed, 6 insertions, 22 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 5aa2140..9b62d5b 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1600,12 +1600,6 @@ class CodecsModuleTest(unittest.TestCase):
self.assertEqual(codecs.decode(b'abc'), 'abc')
self.assertRaises(UnicodeDecodeError, codecs.decode, b'\xff', 'ascii')
- # test keywords
- self.assertEqual(codecs.decode(obj=b'\xe4\xf6\xfc', encoding='latin-1'),
- '\xe4\xf6\xfc')
- self.assertEqual(codecs.decode(b'[\xff]', 'ascii', errors='ignore'),
- '[]')
-
def test_encode(self):
self.assertEqual(codecs.encode('\xe4\xf6\xfc', 'latin-1'),
b'\xe4\xf6\xfc')
@@ -1614,12 +1608,6 @@ class CodecsModuleTest(unittest.TestCase):
self.assertEqual(codecs.encode('abc'), b'abc')
self.assertRaises(UnicodeEncodeError, codecs.encode, '\xffff', 'ascii')
- # test keywords
- self.assertEqual(codecs.encode(obj='\xe4\xf6\xfc', encoding='latin-1'),
- b'\xe4\xf6\xfc')
- self.assertEqual(codecs.encode('[\xff]', 'ascii', errors='ignore'),
- b'[]')
-
def test_register(self):
self.assertRaises(TypeError, codecs.register)
self.assertRaises(TypeError, codecs.register, 42)
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index 1b21300..0b093ab 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -89,15 +89,13 @@ a ValueError. Other possible values are 'ignore', 'replace' and\n\
codecs.register_error that can handle ValueErrors.");
static PyObject *
-codec_encode(PyObject *self, PyObject *args, PyObject *kwargs)
+codec_encode(PyObject *self, PyObject *args)
{
- static char *kwlist[] = {"obj", "encoding", "errors", NULL};
const char *encoding = NULL;
const char *errors = NULL;
PyObject *v;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:encode", kwlist,
- &v, &encoding, &errors))
+ if (!PyArg_ParseTuple(args, "O|ss:encode", &v, &encoding, &errors))
return NULL;
if (encoding == NULL)
@@ -118,15 +116,13 @@ as well as any other name registered with codecs.register_error that is\n\
able to handle ValueErrors.");
static PyObject *
-codec_decode(PyObject *self, PyObject *args, PyObject *kwargs)
+codec_decode(PyObject *self, PyObject *args)
{
- static char *kwlist[] = {"obj", "encoding", "errors", NULL};
const char *encoding = NULL;
const char *errors = NULL;
PyObject *v;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:decode", kwlist,
- &v, &encoding, &errors))
+ if (!PyArg_ParseTuple(args, "O|ss:decode", &v, &encoding, &errors))
return NULL;
if (encoding == NULL)
@@ -1124,9 +1120,9 @@ static PyMethodDef _codecs_functions[] = {
register__doc__},
{"lookup", codec_lookup, METH_VARARGS,
lookup__doc__},
- {"encode", (PyCFunction)codec_encode, METH_VARARGS|METH_KEYWORDS,
+ {"encode", codec_encode, METH_VARARGS,
encode__doc__},
- {"decode", (PyCFunction)codec_decode, METH_VARARGS|METH_KEYWORDS,
+ {"decode", codec_decode, METH_VARARGS,
decode__doc__},
{"escape_encode", escape_encode, METH_VARARGS},
{"escape_decode", escape_decode, METH_VARARGS},