Mercurial > cpython-lru_cache-weakref
comparison Python/codecs.c @ 41587:15b810e21fe9
Get rid of all #ifdef Py_USING_UNICODE (it is always present now).
(With the help of unifdef from freshmeat.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 03 May 2007 17:49:24 +0000 |
| parents | 654c380cf8b9 |
| children | 089f449a20cd |
comparison
equal
deleted
inserted
replaced
| 41586:368fed9af761 | 41587:15b810e21fe9 |
|---|---|
| 466 PyErr_SetString(PyExc_TypeError, "codec must pass exception instance"); | 466 PyErr_SetString(PyExc_TypeError, "codec must pass exception instance"); |
| 467 return NULL; | 467 return NULL; |
| 468 } | 468 } |
| 469 | 469 |
| 470 | 470 |
| 471 #ifdef Py_USING_UNICODE | |
| 472 PyObject *PyCodec_IgnoreErrors(PyObject *exc) | 471 PyObject *PyCodec_IgnoreErrors(PyObject *exc) |
| 473 { | 472 { |
| 474 Py_ssize_t end; | 473 Py_ssize_t end; |
| 475 if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { | 474 if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { |
| 476 if (PyUnicodeEncodeError_GetEnd(exc, &end)) | 475 if (PyUnicodeEncodeError_GetEnd(exc, &end)) |
| 727 else { | 726 else { |
| 728 wrong_exception_type(exc); | 727 wrong_exception_type(exc); |
| 729 return NULL; | 728 return NULL; |
| 730 } | 729 } |
| 731 } | 730 } |
| 732 #endif | |
| 733 | 731 |
| 734 static PyObject *strict_errors(PyObject *self, PyObject *exc) | 732 static PyObject *strict_errors(PyObject *self, PyObject *exc) |
| 735 { | 733 { |
| 736 return PyCodec_StrictErrors(exc); | 734 return PyCodec_StrictErrors(exc); |
| 737 } | 735 } |
| 738 | 736 |
| 739 | 737 |
| 740 #ifdef Py_USING_UNICODE | |
| 741 static PyObject *ignore_errors(PyObject *self, PyObject *exc) | 738 static PyObject *ignore_errors(PyObject *self, PyObject *exc) |
| 742 { | 739 { |
| 743 return PyCodec_IgnoreErrors(exc); | 740 return PyCodec_IgnoreErrors(exc); |
| 744 } | 741 } |
| 745 | 742 |
| 758 | 755 |
| 759 static PyObject *backslashreplace_errors(PyObject *self, PyObject *exc) | 756 static PyObject *backslashreplace_errors(PyObject *self, PyObject *exc) |
| 760 { | 757 { |
| 761 return PyCodec_BackslashReplaceErrors(exc); | 758 return PyCodec_BackslashReplaceErrors(exc); |
| 762 } | 759 } |
| 763 #endif | |
| 764 | 760 |
| 765 static int _PyCodecRegistry_Init(void) | 761 static int _PyCodecRegistry_Init(void) |
| 766 { | 762 { |
| 767 static struct { | 763 static struct { |
| 768 char *name; | 764 char *name; |
| 775 "strict_errors", | 771 "strict_errors", |
| 776 strict_errors, | 772 strict_errors, |
| 777 METH_O | 773 METH_O |
| 778 } | 774 } |
| 779 }, | 775 }, |
| 780 #ifdef Py_USING_UNICODE | |
| 781 { | 776 { |
| 782 "ignore", | 777 "ignore", |
| 783 { | 778 { |
| 784 "ignore_errors", | 779 "ignore_errors", |
| 785 ignore_errors, | 780 ignore_errors, |
| 808 "backslashreplace_errors", | 803 "backslashreplace_errors", |
| 809 backslashreplace_errors, | 804 backslashreplace_errors, |
| 810 METH_O | 805 METH_O |
| 811 } | 806 } |
| 812 } | 807 } |
| 813 #endif | |
| 814 }; | 808 }; |
| 815 | 809 |
| 816 PyInterpreterState *interp = PyThreadState_GET()->interp; | 810 PyInterpreterState *interp = PyThreadState_GET()->interp; |
| 817 PyObject *mod; | 811 PyObject *mod; |
| 818 unsigned i; | 812 unsigned i; |
