diff options
author | Guido van Rossum <guido@python.org> | 2002-05-24 19:01:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-05-24 19:01:59 (GMT) |
commit | cacfc07d083286e80b6f86939d466e186f7ea3c0 (patch) | |
tree | 87e5221791901acdca69ef823d93d470679fa49c /Objects/unicodeobject.c | |
parent | 9ee4b94f51d19a37db3b93222b5e15c8379db78d (diff) | |
download | cpython-cacfc07d083286e80b6f86939d466e186f7ea3c0.zip cpython-cacfc07d083286e80b6f86939d466e186f7ea3c0.tar.gz cpython-cacfc07d083286e80b6f86939d466e186f7ea3c0.tar.bz2 |
- 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.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 5cc8455..0ac4941 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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 */ |