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 codecs search function to only match 'symbol' #22

Merged
merged 1 commit into from Jul 25, 2014

Conversation

somakrdas
Copy link
Contributor

The current search function matches all encodings, which break other packages that use the codecs registry like cssutils. According to the codecs documentation:

In case a search function cannot find a given encoding, it should return None.

This pull request fixes the search function to only match 'symbol'.

Before:

>>> from pyth.plugins.rtf15.reader import Rtf15Reader
>>> import codecs
>>> print codecs.getdecoder('symbol')
<function symbol_decode at 0x109774140>
>>> print codecs.getdecoder('<some_encoding>')
<function symbol_decode at 0x109774140>

After:

>>> from pyth.plugins.rtf15.reader import Rtf15Reader
>>> import codecs
>>> print codecs.getdecoder('symbol')
<function symbol_decode at 0x1043b3140>
>>> print codecs.getdecoder('<some_encoding>')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/somakrdas/.envs/work/lib/python2.7/codecs.py", line 946, in getdecoder
    return lookup(encoding).decode
LookupError: unknown encoding: <some_encoding>

@somakrdas
Copy link
Contributor Author

@brendonh, could you take a look and, when possible, release to PyPI? (pyth still conflicts with other packages that use codecs for us.)

@brendonh
Copy link
Owner

Seems reasonable!

brendonh added a commit that referenced this pull request Jul 25, 2014
Fix codecs search function to only match 'symbol'
@brendonh brendonh merged commit cc05989 into brendonh:master Jul 25, 2014
@somakrdas
Copy link
Contributor Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants