mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
- A new type object, 'string', is added. This is a common base type
for 'str' and 'unicode', and can be used instead of types.StringTypes, e.g. to test whether something is "a string": isinstance(x, string) is True for Unicode and 8-bit strings. This is an abstract base class and cannot be instantiated directly.
This commit is contained in:
parent
9ee4b94f51
commit
cacfc07d08
6 changed files with 69 additions and 2 deletions
|
@ -5835,7 +5835,7 @@ PyTypeObject PyUnicode_Type = {
|
|||
unicode_methods, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
&PyBaseString_Type, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
|
@ -5859,6 +5859,8 @@ void _PyUnicode_Init(void)
|
|||
strcpy(unicode_default_encoding, "ascii");
|
||||
for (i = 0; i < 256; i++)
|
||||
unicode_latin1[i] = NULL;
|
||||
if (PyType_Ready(&PyUnicode_Type) < 0)
|
||||
Py_FatalError("Can't initialize 'unicode'");
|
||||
}
|
||||
|
||||
/* Finalize the Unicode implementation */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue