Message50351
I found following code fails.
PyUnicodeObject *v1 = _PyUnicode_New(0);
PyUnicodeObject *v2 = _PyUnicode_New(0);
_PyUnicode_Resize(&v1, 1);
Py_DECREF(v1);
Py_DECREF(v2);
Error message is...
SystemError:
E:\python-dev\trunk\Objects\unicodeobject.c:335: bad
argument to internal function
This happens because _PyUnicode_New(0) returns
empty_unicode, and its ob_refcnt becomes 2 on second
call. I think refcnt check bellow is not needed. Is
this right fix?
Index: Objects/unicodeobject.c
===================================================================
--- Objects/unicodeobject.c (revision 46192)
+++ Objects/unicodeobject.c (working copy)
@@ -331,7 +331,7 @@
return -1;
}
v = (PyUnicodeObject *)*unicode;
- if (v == NULL || !PyUnicode_Check(v) ||
v->ob_refcnt != 1 || length < 0) {
+ if (v == NULL || !PyUnicode_Check(v) || length < 0) {
PyErr_BadInternalCall();
return -1;
}
|
|
| Date |
User |
Action |
Args |
| 2007-08-23 15:52:16 | admin | link | issue1494487 messages |
| 2007-08-23 15:52:16 | admin | create | |
|