Message260893
because,
PyObject_GetAttr(PyObject *v, PyObject *name)
have this code
if (!PyString_Check(name)) {
and
PyDict_GetItem(PyObject *op, PyObject *key)
have this code
if (!PyString_CheckExact(key) ||
(hash = ((PyStringObject *) key)->ob_shash) == -1)
{
hash = PyObject_Hash(key);
next
lookdict_string(PyDictObject *mp, PyObject *key, register long hash)
if (!PyString_CheckExact(key)) {
#ifdef SHOW_CONVERSION_COUNTS
++converted;
#endif
mp->ma_lookup = lookdict;
return lookdict(mp, key, hash);
}
next
PyObject_RichCompare(PyObject *v, PyObject *w, int op)
and
try_rich_compare(PyObject *v, PyObject *w, int op)
we have this code
if ((f = RICHCOMPARE(v->ob_type)) != NULL) {
res = (*f)(v, w, op);
if (res != Py_NotImplemented)
return res;
Py_DECREF(res);
}
if ((f = RICHCOMPARE(w->ob_type)) != NULL) {
return (*f)(w, v, _Py_SwappedOp[op]);
}
v - PyStringObject
w - MyType
MyType have Py_TPFLAGS_HAVE_RICHCOMPARE and correct test with PyStringObject
but string_richcompare incorrect test type for object, and this code
a->ob_sval
may cause "access violation" and crach!
if i replace PyString_Check on PyString_CheckExact, all work fine and correct! |
|
Date |
User |
Action |
Args |
2016-02-26 12:03:48 | yuriy_levchenko | set | recipients:
+ yuriy_levchenko, serhiy.storchaka |
2016-02-26 12:03:48 | yuriy_levchenko | set | messageid: <1456488228.54.0.0179672395776.issue26421@psf.upfronthosting.co.za> |
2016-02-26 12:03:48 | yuriy_levchenko | link | issue26421 messages |
2016-02-26 12:03:47 | yuriy_levchenko | create | |
|