Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32a7e7f

Browse files
committed
Change name from string to basestring
1 parent 9b414ac commit 32a7e7f

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Core and builtins
1212
deprecations, use -Walways::PendingDeprecationWarning::
1313
as a command line option or warnings.filterwarnings() in code.
1414

15-
- A new type object, 'string', is added. This is a common base type
15+
- A new type object, 'basestring', is added. This is a common base type
1616
for 'str' and 'unicode', and can be used instead of
1717
types.StringTypes, e.g. to test whether something is "a string":
18-
isinstance(x, string) is True for Unicode and 8-bit strings. This
18+
isinstance(x, basestring) is True for Unicode and 8-bit strings. This
1919
is an abstract base class and cannot be instantiated directly.
2020

2121
- Deprecated features of xrange objects have been removed as

Objects/stringobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,17 +2859,17 @@ static PyObject *
28592859
basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
28602860
{
28612861
PyErr_SetString(PyExc_TypeError,
2862-
"The string type cannot be instantiated");
2862+
"The basestring type cannot be instantiated");
28632863
return NULL;
28642864
}
28652865

28662866
static char basestring_doc[] =
2867-
"Type string cannot be instantiated; it is the base for str and unicode.";
2867+
"Type basestring cannot be instantiated; it is the base for str and unicode.";
28682868

28692869
PyTypeObject PyBaseString_Type = {
28702870
PyObject_HEAD_INIT(&PyType_Type)
28712871
0,
2872-
"string",
2872+
"basestring",
28732873
0,
28742874
0,
28752875
0, /* tp_dealloc */

Python/bltinmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,7 @@ _PyBuiltin_Init(void)
18901890
SETBUILTIN("NotImplemented", Py_NotImplemented);
18911891
SETBUILTIN("False", Py_False);
18921892
SETBUILTIN("True", Py_True);
1893+
SETBUILTIN("basestring", &PyBaseString_Type);
18931894
SETBUILTIN("bool", &PyBool_Type);
18941895
SETBUILTIN("classmethod", &PyClassMethod_Type);
18951896
#ifndef WITHOUT_COMPLEX
@@ -1905,7 +1906,6 @@ _PyBuiltin_Init(void)
19051906
SETBUILTIN("object", &PyBaseObject_Type);
19061907
SETBUILTIN("staticmethod", &PyStaticMethod_Type);
19071908
SETBUILTIN("str", &PyString_Type);
1908-
SETBUILTIN("string", &PyBaseString_Type);
19091909
SETBUILTIN("super", &PySuper_Type);
19101910
SETBUILTIN("tuple", &PyTuple_Type);
19111911
SETBUILTIN("type", &PyType_Type);

0 commit comments

Comments
 (0)