| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -150,13 +150,6 @@ Unless otherwise stated, buffers are not NUL-terminated. | |||
| 150 | 150 | any conversion. Raises :exc:`TypeError` if the object is not a Unicode | |
| 151 | 151 | object. The C variable may also be declared as :ctype:`PyObject\*`. | |
| 152 | 152 | ||
| 153 | - ``t#`` (:class:`bytes`, :class:`bytearray` or read-only character buffer) [char \*, int] | ||
| 154 | - Like ``s#``, but accepts any object which implements the read-only buffer | ||
| 155 | - interface. The :ctype:`char\*` variable is set to point to the first byte of | ||
| 156 | - the buffer, and the :ctype:`int` is set to the length of the buffer. Only | ||
| 157 | - single-segment buffer objects are accepted; :exc:`TypeError` is raised for all | ||
| 158 | - others. | ||
| 159 | - | ||
| 160 | 153 | ``w`` (:class:`bytearray` or read-write character buffer) [char \*] | |
| 161 | 154 | Similar to ``s``, but accepts any object which implements the read-write buffer | |
| 162 | 155 | interface. The caller must determine the length of the buffer by other means, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -173,4 +173,7 @@ that may require changes to your code: | |||
| 173 | 173 | ||
| 174 | 174 | * bytearray objects cannot be used anymore as filenames: convert them to bytes | |
| 175 | 175 | ||
| 176 | + * "t#" format of PyArg_Parse*() functions has been removed: use "s#" or "s*" | ||
| 177 | + instead | ||
| 178 | + | ||
| 176 | 179 | * Stub | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,7 +72,6 @@ def check_partial(self, input, partialresults): | |||
| 72 | 72 | # check that there's nothing left in the buffers | |
| 73 | 73 | self.assertEqual(r.read(), "") | |
| 74 | 74 | self.assertEqual(r.bytebuffer, b"") | |
| 75 | - self.assertEqual(r.charbuffer, "") | ||
| 76 | 75 | ||
| 77 | 76 | # do the check again, this time using a incremental decoder | |
| 78 | 77 | d = codecs.getincrementaldecoder(self.encoding)() | |
@@ -628,18 +627,6 @@ def test_bad_args(self): | |||
| 628 | 627 | self.assertRaises(TypeError, codecs.readbuffer_encode) | |
| 629 | 628 | self.assertRaises(TypeError, codecs.readbuffer_encode, 42) | |
| 630 | 629 | ||
| 631 | - class CharBufferTest(unittest.TestCase): | ||
| 632 | - | ||
| 633 | - def test_string(self): | ||
| 634 | - self.assertEqual(codecs.charbuffer_encode(b"spam"), (b"spam", 4)) | ||
| 635 | - | ||
| 636 | - def test_empty(self): | ||
| 637 | - self.assertEqual(codecs.charbuffer_encode(b""), (b"", 0)) | ||
| 638 | - | ||
| 639 | - def test_bad_args(self): | ||
| 640 | - self.assertRaises(TypeError, codecs.charbuffer_encode) | ||
| 641 | - self.assertRaises(TypeError, codecs.charbuffer_encode, 42) | ||
| 642 | - | ||
| 643 | 630 | class UTF8SigTest(ReadTest): | |
| 644 | 631 | encoding = "utf-8-sig" | |
| 645 | 632 | ||
@@ -1663,7 +1650,6 @@ def test_main(): | |||
| 1663 | 1650 | UTF7Test, | |
| 1664 | 1651 | UTF16ExTest, | |
| 1665 | 1652 | ReadBufferTest, | |
| 1666 | - CharBufferTest, | ||
| 1667 | 1653 | RecodingTest, | |
| 1668 | 1654 | PunycodeTest, | |
| 1669 | 1655 | UnicodeInternalTest, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,13 @@ What's New in Python 3.2 Alpha 1? | |||
| 12 | 12 | Core and Builtins | |
| 13 | 13 | ----------------- | |
| 14 | 14 | ||
| 15 | + - Issue #8838: Remove codecs.charbuffer_encode() function. The buffer protocol | ||
| 16 | + doesn't support "char buffer" anymore in Python3. | ||
| 17 | + | ||
| 18 | + - Issue #8339: Remove "t#" format of PyArg_Parse*() functions, use "s#" or "s*" | ||
| 19 | + instead. codecs.charbuffer_encode() now accepts modifiable buffer objects | ||
| 20 | + like bytearray. | ||
| 21 | + | ||
| 15 | 22 | - Issue #8837: Remove "O?" format of PyArg_Parse*() functions. The format is no | |
| 16 | 23 | used anymore and it was never documented. | |
| 17 | 24 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -638,21 +638,6 @@ readbuffer_encode(PyObject *self, | |||
| 638 | 638 | return codec_tuple(result, size); | |
| 639 | 639 | } | |
| 640 | 640 | ||
| 641 | - static PyObject * | ||
| 642 | - charbuffer_encode(PyObject *self, | ||
| 643 | - PyObject *args) | ||
| 644 | - { | ||
| 645 | - const char *data; | ||
| 646 | - Py_ssize_t size; | ||
| 647 | - const char *errors = NULL; | ||
| 648 | - | ||
| 649 | - if (!PyArg_ParseTuple(args, "t#|z:charbuffer_encode", | ||
| 650 | - &data, &size, &errors)) | ||
| 651 | - return NULL; | ||
| 652 | - | ||
| 653 | - return codec_tuple(PyBytes_FromStringAndSize(data, size), size); | ||
| 654 | - } | ||
| 655 | - | ||
| 656 | 641 | static PyObject * | |
| 657 | 642 | unicode_internal_encode(PyObject *self, | |
| 658 | 643 | PyObject *args) | |
@@ -1116,7 +1101,6 @@ static PyMethodDef _codecs_functions[] = { | |||
| 1116 | 1101 | {"charmap_decode", charmap_decode, METH_VARARGS}, | |
| 1117 | 1102 | {"charmap_build", charmap_build, METH_VARARGS}, | |
| 1118 | 1103 | {"readbuffer_encode", readbuffer_encode, METH_VARARGS}, | |
| 1119 | - {"charbuffer_encode", charbuffer_encode, METH_VARARGS}, | ||
| 1120 | 1104 | #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) | |
| 1121 | 1105 | {"mbcs_encode", mbcs_encode, METH_VARARGS}, | |
| 1122 | 1106 | {"mbcs_decode", mbcs_decode, METH_VARARGS}, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -864,7 +864,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, | |||
| 864 | 864 | break; | |
| 865 | 865 | } | |
| 866 | 866 | ||
| 867 | - /* XXX WAAAAH! 's', 'y', 'z', 'u', 'Z', 'e', 'w', 't' codes all | ||
| 867 | + /* XXX WAAAAH! 's', 'y', 'z', 'u', 'Z', 'e', 'w' codes all | ||
| 868 | 868 | need to be cleaned up! */ | |
| 869 | 869 | ||
| 870 | 870 | case 's': {/* text string */ | |
@@ -1362,45 +1362,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, | |||
| 1362 | 1362 | break; | |
| 1363 | 1363 | } | |
| 1364 | 1364 | ||
| 1365 | - /*TEO: This can be eliminated --- here only for backward | ||
| 1366 | - compatibility */ | ||
| 1367 | - case 't': { /* 8-bit character buffer, read-only access */ | ||
| 1368 | - char **p = va_arg(*p_va, char **); | ||
| 1369 | - PyBufferProcs *pb = arg->ob_type->tp_as_buffer; | ||
| 1370 | - Py_ssize_t count; | ||
| 1371 | - Py_buffer view; | ||
| 1372 | - | ||
| 1373 | - if (*format++ != '#') | ||
| 1374 | - return converterr( | ||
| 1375 | - "invalid use of 't' format character", | ||
| 1376 | - arg, msgbuf, bufsize); | ||
| 1377 | - if (pb == NULL || pb->bf_getbuffer == NULL) | ||
| 1378 | - return converterr( | ||
| 1379 | - "bytes or read-only character buffer", | ||
| 1380 | - arg, msgbuf, bufsize); | ||
| 1381 | - | ||
| 1382 | - if (PyObject_GetBuffer(arg, &view, PyBUF_SIMPLE) != 0) | ||
| 1383 | - return converterr("string or single-segment read-only buffer", | ||
| 1384 | - arg, msgbuf, bufsize); | ||
| 1385 | - | ||
| 1386 | - count = view.len; | ||
| 1387 | - *p = view.buf; | ||
| 1388 | - if (pb->bf_releasebuffer) | ||
| 1389 | - return converterr( | ||
| 1390 | - "string or pinned buffer", | ||
| 1391 | - arg, msgbuf, bufsize); | ||
| 1392 | - | ||
| 1393 | - PyBuffer_Release(&view); | ||
| 1394 | - | ||
| 1395 | - if (count < 0) | ||
| 1396 | - return converterr("(unspecified)", arg, msgbuf, bufsize); | ||
| 1397 | - { | ||
| 1398 | - FETCH_SIZE; | ||
| 1399 | - STORE_SIZE(count); | ||
| 1400 | - } | ||
| 1401 | - break; | ||
| 1402 | - } | ||
| 1403 | - | ||
| 1404 | 1365 | default: | |
| 1405 | 1366 | return converterr("impossible<bad format char>", arg, msgbuf, bufsize); | |
| 1406 | 1367 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments