Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ignoring of optional whitespace after \bin. #316

Merged
merged 2 commits into from
Jun 13, 2018

Conversation

enkelli
Copy link
Contributor

@enkelli enkelli commented May 31, 2018

The condition is always False because self.data[self.index] returns integer.

Try to put this in code before the condition:

>>> print(type(self.data[self.index]))  # <class 'int'>
>>> print(self.data[self.index])        # 32

Thus even with space at self.index it fails:
>>> 32 == ' ' # False

The condition was always False because self.data[self.index] returns integer.

Try to put this in code before the condition:
>>> print(type(self.data[self.index]))  # <class 'int'>
>>> print(self.data[self.index])        # 32

Thus even with space at self.index it fails:
>>> 32 == ' '  # False
@decalage2
Copy link
Owner

Thanks, this is actually a bug when running rtfobj with python 3.

In my previous commit
decalage2@09d42b4
I fixed this bug for Python3 but I've made a mistake when testing with Python2.

Now, both Python versions should ignore whitespace after \bin correctly.

Python2:
>>> data = b' foo'
>>> index = 0
>>> ord(data[index:index + 1])
32
>>> ord(' ')
32

Python3
>>> data = b' foo'
>>> index = 0
>>> ord(data[index:index + 1])
32
>>> ord(' ')
32
@decalage2 decalage2 self-requested a review June 13, 2018 21:12
@decalage2 decalage2 merged commit 586b585 into decalage2:master Jun 13, 2018
@enkelli enkelli deleted the fix-rtfobj-space-after-bin branch June 14, 2018 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants