- Notifications
You must be signed in to change notification settings - Fork538
Commita60f7a1
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 (andin particular, loading `reader.py`) caused a UnicodeDecodeError. Thispatch works around this through a clever use of `eval` to deferevaluation of the string containing the lone surrogates, only doing iton 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 pointsover 0xFFFF becomes as it was before0716ae2. It still does not pass all theunit tests on Jython (passes 1275, fails 3, errors on 1); all thefailing tests are related to unicode. Still, this is better than simplycrashing upon `import yaml`.With this patch, all tests continue to pass on Python 2 / Python 3.1 parentee98abd commita60f7a1
1 file changed
+7
-2
lines changedLines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
140 |
| - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
141 | 144 |
| |
142 |
| - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 |
| |
144 | 149 |
| |
145 | 150 |
| |
|
0 commit comments
Comments
(0)