yuriy_levchenko added the comment: 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! ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26421> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com