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 compatibility with Jython #378

Merged
merged 1 commit into from Jan 13, 2021
Merged

Fix compatibility with Jython #378

merged 1 commit into from Jan 13, 2021

Commits on Jan 22, 2020

  1. Fix compatibility with Jython

    This patch was taken from
    #369 (comment),
    authored by Pekka Klärck <peke@iki.fi>.
    
    In short, Jython doesn't support lone surrogates, so importing yaml (and
    in particular, loading `reader.py`) caused a UnicodeDecodeError. This
    patch works around this through a clever use of `eval` to defer
    evaluation of the string containing the lone surrogates, only doing it
    on non-Jython platforms.
    
    This is only done in `lib/yaml/reader.py` and not `lib3/yaml/reader.py`
    because Jython does not support Python 3.
    
    With this patch, Jython's behavior with respect to Unicode code points
    over 0xFFFF becomes as it was before
    0716ae2. It still does not pass all the
    unit tests on Jython (passes 1275, fails 3, errors on 1); all the
    failing tests are related to unicode. Still, this is better than simply
    crashing upon `import yaml`.
    
    With this patch, all tests continue to pass on Python 2 / Python 3.
    anishathalye committed Jan 22, 2020
    Copy the full SHA
    91a4976 View commit details
    Browse the repository at this point in the history