[Python-3000] Heaptypes (original) (raw)
Guido van Rossum guido at python.org
Wed Jul 11 16:47:47 CEST 2007
- Previous message: [Python-3000] Heaptypes
- Next message: [Python-3000] Heaptypes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 7/11/07, Thomas Heller <theller at ctypes.org> wrote:
Let me explain it in other words. This code creates a new type:
>>> ht = type("name", (object,), {}) [47054 refs] >>> ht <class '_main_.name'> [47093 refs] The 'name' attribute is a (unicode) string: >>> ht.name 'name' [47121 refs] >>> But I can also create a type in this way: >>> ht = type(str8(b"name"), (object,), {}) [47208 refs] The name attribute is a str8 instance: >>> ht.name s'name' [47236 refs] Printing the type triggers an assertion: >>> ht Assertion failed: obj && PyUnicodeCheck(obj), file \svn\py3k-struni\Objects\unicodeobject.c, line 630 C:\svn\py3k-struni\PCbuild> because parts of the code assume that the 'name' is a (unicode) string.
Hm. I guess the creation must insist that name is a unicode. Can you fix this yourself?
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-3000] Heaptypes
- Next message: [Python-3000] Heaptypes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]