Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 42894:6b4781dc81ff
Fix refleaks in test_unicode and test_string related to the new format code.
Stop polluting namespace.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 27 Aug 2007 07:24:17 +0000 |
| parents | 5fd65e250843 |
| children | 7bf8f2339ec6 |
comparison
equal
deleted
inserted
replaced
| 42893:2c02ba72714b | 42894:6b4781dc81ff |
|---|---|
| 661 } | 661 } |
| 662 | 662 |
| 663 /* sys_formatter_iterator is used to implement | 663 /* sys_formatter_iterator is used to implement |
| 664 string.Formatter.vformat. it parses a string and returns tuples | 664 string.Formatter.vformat. it parses a string and returns tuples |
| 665 describing the parsed elements. see unicodeobject.c's | 665 describing the parsed elements. see unicodeobject.c's |
| 666 _unicodeformatter_iterator for details */ | 666 _PyUnicode_FormatterIterator for details */ |
| 667 static PyObject * | 667 static PyObject * |
| 668 sys_formatter_iterator(PyObject *self, PyObject *args) | 668 sys_formatter_iterator(PyObject *self, PyObject *args) |
| 669 { | 669 { |
| 670 /* in 2.6, check type and dispatch to unicode or string | 670 /* in 2.6, check type and dispatch to unicode or string |
| 671 accordingly */ | 671 accordingly */ |
| 678 PyErr_SetString(PyExc_TypeError, | 678 PyErr_SetString(PyExc_TypeError, |
| 679 "_formatter_iterator expects unicode object"); | 679 "_formatter_iterator expects unicode object"); |
| 680 return NULL; | 680 return NULL; |
| 681 } | 681 } |
| 682 | 682 |
| 683 return _unicodeformatter_iterator(str); | 683 return _PyUnicode_FormatterIterator(str); |
| 684 } | 684 } |
| 685 | 685 |
| 686 /* sys_formatter_field_name_split is used to implement | 686 /* sys_formatter_field_name_split is used to implement |
| 687 string.Formatter.vformat. it takes an PEP 3101 "field name", and | 687 string.Formatter.vformat. it takes an PEP 3101 "field name", and |
| 688 returns a tuple of (first, rest): "first", the part before the | 688 returns a tuple of (first, rest): "first", the part before the |
| 689 first '.' or '['; and "rest", an iterator for the rest of the field | 689 first '.' or '['; and "rest", an iterator for the rest of the field |
| 690 name. see unicodeobjects' _unicode_formatter_field_name_split for | 690 name. see unicodeobjects' _PyUnicode_FormatterFieldNameSplit for |
| 691 details */ | 691 details */ |
| 692 static PyObject * | 692 static PyObject * |
| 693 sys_formatter_field_name_split(PyObject *self, PyObject *args) | 693 sys_formatter_field_name_split(PyObject *self, PyObject *args) |
| 694 { | 694 { |
| 695 PyObject *field_name; | 695 PyObject *field_name; |
| 702 PyErr_SetString(PyExc_TypeError, "_formatter_field_name_split " | 702 PyErr_SetString(PyExc_TypeError, "_formatter_field_name_split " |
| 703 "expects unicode object"); | 703 "expects unicode object"); |
| 704 return NULL; | 704 return NULL; |
| 705 } | 705 } |
| 706 | 706 |
| 707 return _unicodeformatter_field_name_split(field_name); | 707 return _PyUnicode_FormatterFieldNameSplit(field_name); |
| 708 } | 708 } |
| 709 | 709 |
| 710 | 710 |
| 711 PyDoc_STRVAR(call_tracing_doc, | 711 PyDoc_STRVAR(call_tracing_doc, |
| 712 "call_tracing(func, args) -> object\n\ | 712 "call_tracing(func, args) -> object\n\ |
