[New-bugs-announce] [issue25961] Disallow the null character in type name

Serhiy Storchaka report at bugs.python.org
Sun Dec 27 09:28:00 EST 2015


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 <report at bugs.python.org>
<http://bugs.python.org/issue25961>
_______________________________________


More information about the New-bugs-announce mailing list