[issue13290] get vars for object with __slots__

João Bernardo report at bugs.python.org
Sat Nov 5 00:11:17 CET 2011


João Bernardo <jbvsmo at gmail.com> added the comment:

Oh, sorry for the full file. Yes, I only changed after 

        d = PyObject_GetAttrString(v, "__dict__");
        if (d == NULL) {

I was searching for uses of slots other than __slots__ = (a, b) and I saw a guy saying that dicts may have special meaning the future. So, something like

      __slots__ = {'my_var': int}

could be an annotation (or hint for IDE's). In the present implementation, the value of each key is just ignored.

If slots is just "a_single_string" it should not be treated as an iterable, so I used PyUnicode_Check because I didn't knew a better method.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13290>
_______________________________________


More information about the Python-bugs-list mailing list