#227 type-checking error in io.Input.decode

closed-invalid
nobody
None
5
2013-03-04
2013-03-03
Philip
No

In the mothod 'decode' of docutils.io.Input (of docutils.io.py):

if self.encoding and self.encoding.lower() == 'unicode':
assert isinstance(data, unicode), (
'input encoding is "unicode" '
'but input is not a unicode object')

if I understand correctly, that assert statement should be:

assert not isinstance(data, unicode), (

Discussion

  • Günter Milde

    Günter Milde - 2013-03-04

    The assertment is correct: if the `encoding` of the input instance is "unicode", the input data must be an unicode string instance. I added a test case to test_io.py to check the intended behaviour.

     
  • Günter Milde

    Günter Milde - 2013-03-04
    • status: open --> closed-invalid
     
  • Philip

    Philip - 2013-03-05

    After I re-read my report today, I figured that I somehow mistakenly read that error message in assertion.
    You are right, milde. That was my fault, I'm sorry for any trouble that may cause.

    The moral of the story: I should not debug code when get tired, and check thrice before creating a new report.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks