New submission from Serhiy Storchaka: The null character is allowed in __name__ setter (but error message is a little confusing).
>>> class A: pass ... >>> A.__name__ = 'B\0' Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: __name__ must not contain null bytes But is allowed in type constructor. >>> t = type('B\0C', (), {}) >>> t <class '__main__.BC'> >>> t.__name__ 'B\x00C' ---------- components: Interpreter Core messages: 257076 nosy: serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Disallow the null character in type name type: behavior versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25961> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com