[issue34136] Del on class __annotations__ regressed, failing test

Kay Hayen report at bugs.python.org
Tue Jul 17 08:19:47 EDT 2018


Kay Hayen <kay.hayen at gmail.com> added the comment:

Thanks for pointing out, where it comes from, Serhiy.

So, should the test case be removed then. I still am not so sure about
the bug nature.

Because using the standard mechanism will do this:

x : int

class C:
    del __annotations__
    x : float
    y : int

print(__annotations__)

This will give float for x, and int for y, both of which are wrong for the module.

I do agree that "del" on "__annotations__" might not have a use case, or does it? I think
it's optimized away if not used for classes anyway, isn't it?

Maybe you want make "del" on __annotations__ a syntax error then?

Yours,
Kay

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34136>
_______________________________________


More information about the Python-bugs-list mailing list