[pypy-issue] Issue #1970: PyObject_IsInstance(dictionary variable, collections.Mapping) is False? (pypy/pypy)

Anthony Sottile issues-reply at bitbucket.org
Tue Feb 3 21:51:24 CET 2015


New issue 1970: PyObject_IsInstance(dictionary variable, collections.Mapping) is False?
https://bitbucket.org/pypy/pypy/issue/1970/pyobject_isinstance-dictionary-variable

Anthony Sottile:

however `isinstance(dict_variable, collections.Mapping)` returns `True`

```
$ pypy --version
Python 2.7.8 (f5dcc2477b97, Sep 18 2014, 11:33:30)
[PyPy 2.4.0 with GCC 4.6.3]
```

```
    PyObject* collections_mod = PyImport_ImportModule("collections");
    PyObject* mapping_t = PyObject_GetAttrString(collections_mod, "Mapping");
    if (PyObject_IsInstance(value, mapping_t)) {
        printf("is a mapping\n");
    } else {
        printf("is not a mapping\n");
    }
```







More information about the pypy-issue mailing list