Author eryksun
Recipients eryksun, hosford42, r.david.murray, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Date 2014-10-24.21:46:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When appending to a singly-referenced string, the interpreter tries to reallocate the string in place. This applies to both `s += 'text'` and `s = s + 'text'`. Storing to a temp variable is adding a 2nd reference, so a new string gets allocated instead. If the former is the case (i.e. the object id is the same after appending), use ctypes to check the string's cached wide-string (wchar_t *) representation:

    from ctypes import *
    pythonapi.PyUnicode_AsUnicode.argtypes = [py_object]
    pythonapi.PyUnicode_AsUnicode.restype = c_wchar_p


The wstr cache should be cleared when the string is reallocated in place, so this is probably a dead end.
Date User Action Args
2014-10-24 21:46:42eryksunsetrecipients: + eryksun, tim.golden, r.david.murray, zach.ware, serhiy.storchaka, steve.dower, hosford42
2014-10-24 21:46:42eryksunsetmessageid: <>
2014-10-24 21:46:42eryksunlinkissue22719 messages
2014-10-24 21:46:42eryksuncreate