[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Fix evaluate().explore() on Python 3 #2337

Merged
merged 1 commit into from
Sep 24, 2019
Merged

Fix evaluate().explore() on Python 3 #2337

merged 1 commit into from
Sep 24, 2019

Conversation

znation
Copy link
Contributor
@znation znation commented Sep 21, 2019
  • Always flush explicitly when writing to the subprocess. In Python 2,
    newline characters cause flushes, and in Python 3 they don't seem to.
  • Always convert to JSON and add a newline to responses while still in
    Python 2 or 3's native string type.
  • Always encode('utf-8'). In Python 2, this is a no-op (str is already
    utf-8 encoded bytes) and in Python 3, this creates utf-8 encoded
    bytes from a unicode object.

Fixes evaluate().explore() hanging on Python 3 due to
newline characters not flushing the I/O buffer, and subsequent crashes
due to improperly encoded string objects after fixing the hang.

* Always convert to JSON and add a newline to responses while still in
  Python 2 or 3's native string type.
* Always encode('utf-8'). In Python 2, this is a no-op (str is already
  utf-8 encoded bytes) and in Python 3, this creates utf-8 encoded
  bytes from a unicode object.

Fixes `evaluate().explore()` hanging on Python 3 due to
newline characters not flushing the I/O buffer, and subsequent crashes
due to improperly encoded string objects after fixing the hang.
@znation znation merged commit 6ee5c4a into apple:master Sep 24, 2019
@znation znation deleted the evaluation_explore_python3 branch September 24, 2019 04:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants