[Python-bugs-list] [ python-Bugs-732299 ] Doctest chokes on '\x00'

SourceForge.net noreply@sourceforge.net
Sun, 04 May 2003 12:23:28 -0700


Bugs item #732299, was opened at 2003-05-04 15:23
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=732299&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Francis Avila (francisga)
Assigned to: Nobody/Anonymous (nobody)
Summary: Doctest chokes on '\x00'

Initial Comment:
$ cat ./dtbug.py
"""Demonstrate a python doctest bug."""

def main():
        """See here, I can't include any string literals with 
nulls in them:

        >>> x = '\x00'
        >>>

        """
        pass

if __name__ == '__main__':
        import doctest, dtbug
        doctest.testmod(dtbug)

$ python ./dtbug.py
*******************************************************
**********
Failure in example: x = ''
from line #2 of dtbug.main
Exception raised:
Traceback (most recent call last):
  File "/usr/lib/python2.2/doctest.py", line 499, in 
_run_examples_inner
    exec compile(source, "<string>", "single") in globs
TypeError: compile() argument 1 must be string 
without null bytes, not string
*******************************************************
**********
1 items had failures:
   1 of   1 in dtbug.main
***Test Failed*** 1 failures.


I'm not actually certain this is really a bug, but it 
certainly makes it impossible to demonstrate the use 
of functions that operate on binary data.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=732299&group_id=5470