[issue14095] type_new() removes __qualname__ from the input dictionary

Meador Inge report at bugs.python.org
Fri Feb 24 16:59:11 CET 2012


Meador Inge <meadori at gmail.com> added the comment:

The change in error handling makes this a bit harder to review, but it otherwise looks OK if this is the intended behavior.  I am not sure that it is.

The original version:

   1. If __qualname__ was present in the original dictionary,
      then it was deleted.
   2. If __qualname__ was present in the original dictionary,
      then the qualname slot in the new type was left unitialized.

Why (1) was done I don't know.  (2) is obviously a bug.

The patched version:

   1. Sets the slot qualname to the __qualname__ from the original
      dictionary (if present).
   2. Copies the __qualname__ attribute from the original dictionary
      to the new dictionary (if present).
   3. Leaves the original dictionary alone.

The deletion and unitiliazed slot problems are gone, but I am not sure if (2) is needed.  Just fixing (1) and (3) seems more reasonable to me.

----------

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


More information about the Python-bugs-list mailing list