Commit 88d63f36 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge commit '34ab5e' into refcounting

parents ddb51c9b 34ab5edb
# skip-if: True
# expected: fail
# this test gets stuck in an infinite loop(?) in test_replace (from string_tests)
import unittest, string
from test import test_support, string_tests
from UserList import UserList
......
......@@ -23,6 +23,22 @@ PyObject * _do_string_format(PyObject *self, PyObject *args, PyObject *kwargs) {
return do_string_format(self, args, kwargs);
}
void _string_init() {
if (PyType_Ready(&PyFieldNameIter_Type) < 0)
Py_FatalError("Can't initialize field name iterator type");
if (PyType_Ready(&PyFormatterIter_Type) < 0)
Py_FatalError("Can't initialize formatter iter type");
}
PyObject * _formatter_parser(STRINGLIB_OBJECT *self) {
return formatter_parser(self);
}
PyObject * _formatter_field_name_split(STRINGLIB_OBJECT *self) {
return formatter_field_name_split(self);
}
PyObject *
string_count(PyStringObject *self,
PyObject *sub_obj, PyObject* obj_start, PyObject** args)
......
......@@ -45,6 +45,8 @@ extern "C" PyObject* string_rfind(PyStringObject* self, PyObject* args) noexcept
extern "C" PyObject* string_replace(PyStringObject* self, PyObject* args) noexcept;
extern "C" PyObject* string_splitlines(PyStringObject* self, PyObject* args) noexcept;
extern "C" PyObject* string__format__(PyObject* self, PyObject* args) noexcept;
extern "C" PyObject* _formatter_parser(PyStringObject* self) noexcept;
extern "C" PyObject* _formatter_field_name_split(PyStringObject* self) noexcept;
// from cpython's stringobject.c:
#define LEFTSTRIP 0
......@@ -2806,6 +2808,8 @@ static PyMethodDef string_methods[] = {
{ "splitlines", (PyCFunction)string_splitlines, METH_VARARGS, NULL },
{ "zfill", (PyCFunction)string_zfill, METH_VARARGS, NULL },
{ "__format__", (PyCFunction)string__format__, METH_VARARGS, NULL },
{ "_formatter_parser", (PyCFunction)_formatter_parser, METH_NOARGS, NULL },
{ "_formatter_field_name_split", (PyCFunction)_formatter_field_name_split, METH_NOARGS, NULL },
};
void setupStr() {
......
......@@ -78,6 +78,7 @@ extern "C" void initzlib();
extern "C" void init_codecs();
extern "C" void init_socket();
extern "C" void _PyUnicode_Init();
extern "C" void _string_init();
extern "C" void initunicodedata();
extern "C" void init_weakref();
extern "C" void initcStringIO();
......@@ -4067,6 +4068,7 @@ void setupRuntime() {
_PyUnicode_Init();
unicode_cls->is_constant = true;
unicode_cls->is_user_defined = false;
_string_init();
setupDescr();
setupTraceback();
setupCode();
......
......@@ -200,7 +200,6 @@ test_sort argument specification issue in listSort?
test_sqlite [unknown]
test_ssl [unknown]
test_startfile [unknown]
test_string infinite loops in test_replace
test_str memory leak?
test_strtod [unknown]
test_structmembers [unknown]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment