mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
Possibly the end of SF [#460020] bug or feature: unicode() and subclasses.
Changed unicode(i) to return a true Unicode object when i is an instance of a unicode subclass. Added PyUnicode_CheckExact macro.
This commit is contained in:
parent
0ebeb584a4
commit
78e0fc74bc
3 changed files with 16 additions and 6 deletions
|
@ -61,6 +61,7 @@ Copyright (c) Corporation for National Research Initiatives.
|
|||
#ifndef Py_USING_UNICODE
|
||||
|
||||
#define PyUnicode_Check(op) 0
|
||||
#define PyUnicode_CheckExact(op) 0
|
||||
|
||||
#else
|
||||
|
||||
|
@ -373,6 +374,7 @@ typedef struct {
|
|||
extern DL_IMPORT(PyTypeObject) PyUnicode_Type;
|
||||
|
||||
#define PyUnicode_Check(op) PyObject_TypeCheck(op, &PyUnicode_Type)
|
||||
#define PyUnicode_CheckExact(op) ((op)->ob_type == &PyUnicode_Type)
|
||||
|
||||
/* Fast access macros */
|
||||
#define PyUnicode_GET_SIZE(op) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue