Commit 0851c0d
authored
Fix str/bytes mixup in PythonParser.read_response() (#1324)
Calling str() on a bytes object can result in a BytesWarning being
emitted and usually indicates a mixup between byte and string handling.
Now, in the event of an invalid RESP response, use the repr value of the
raw response in the exception message.
Can further simplify the bytes/str handling by comparing the first byte
as a bytes object instead of converting it to str. The bytes literal is
available on all supported Pythons. This removes the need for the
compatibility function, byte_to_chr().1 parent 5fa3fe5 commit 0851c0d
3 files changed
+26
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 146 | | |
150 | 147 | | |
151 | 148 | | |
| |||
166 | 163 | | |
167 | 164 | | |
168 | 165 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | 166 | | |
173 | 167 | | |
174 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
| 322 | + | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
327 | 327 | | |
328 | | - | |
329 | | - | |
330 | | - | |
| 328 | + | |
| 329 | + | |
331 | 330 | | |
332 | 331 | | |
333 | | - | |
| 332 | + | |
334 | 333 | | |
335 | 334 | | |
336 | 335 | | |
| |||
343 | 342 | | |
344 | 343 | | |
345 | 344 | | |
346 | | - | |
| 345 | + | |
347 | 346 | | |
348 | 347 | | |
349 | | - | |
| 348 | + | |
350 | 349 | | |
351 | 350 | | |
352 | | - | |
| 351 | + | |
353 | 352 | | |
354 | 353 | | |
355 | 354 | | |
356 | 355 | | |
357 | 356 | | |
358 | | - | |
| 357 | + | |
359 | 358 | | |
360 | 359 | | |
361 | 360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments