Don't overwrite name with qualname for slots classes #99
Comments
I’m sure there’s a reason and @Tinche will tell us the reason. :) Seems like there’s some edge case around it. We should definitely add a comment to clear it up. |
The reason is probably I messed it up by accident and there was no test. :) I'll take a look later today. |
Now there is a test, in my second link. :) I tried to run tox and submit this as a pull-request, but tox crashed when it ran pip freeze, which crashed because FreeBSD has a system module named "_sqlite3" (which is used by the stdlib module sqlite3). I later noticed qualname wasn't preserved and figured I had best hold off a PR until I can run tests. |
I noticed and stole your test. :) |
The previous test has a bug: qualname, of course, includes the test class and function. Also, saving and setting qualname seems to be the only other action required. I did get tox -epy24,py34,py35 to run on another machine, and the only failures were slow data generation for hypothesis. I had expected, for no particular reason, for qualname to be included in cls_dict, but I suppose it is implemented as a slot in type. |
Great. How about you submit a pull request and we can switch the discussion to there? We're always eager for new contributors. :) |
For slots classes, attr._make.attributes overwrites name with qualname. This shouldn't happen on Python 3. (Nothing happens on Python 2, as qualname is never set.) I think the correct fix is to change:
To:
However, this doesn't preserve qualname, and I fear I'm missing something else.
The text was updated successfully, but these errors were encountered: