[New-bugs-announce] [issue26401] Error in documentation for "compile" built-in function

Raúl Núñez de Arenas report at bugs.python.org
Sun Feb 21 10:35:43 EST 2016

New submission from Raúl Núñez de Arenas:

According to the documentation, if the 'compile' built-in function encounters NUL bytes in the compiled source, it raises TypeError, but this is not true:

>>> source = '\u0000'
>>> compile(source, '', 'single')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: source code string cannot contain null bytes

It raises ValueError, not TypeError. And IMHO, it's the proper exception to raise...

assignee: docs at python
components: Documentation
messages: 260613
nosy: Raúl Núñez de Arenas, docs at python
priority: normal
severity: normal
status: open
title: Error in documentation for "compile" built-in function
type: enhancement
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list