Skip to content

Commit 08ac089

Browse files
committed
Version bump to v2.0.0-beta.27
+ CodeIntel OOP: Binary/Unicode from stdin
1 parent 669ebf0 commit 08ac089

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

codeintel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.0-beta.26'
1+
__version__ = '2.0.0-beta.27'

codeintel/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ def do_oop(self, subcmd, opts):
308308
return
309309

310310
else:
311-
# force unbuffered stdout
312-
fd_in = sys.stdin
311+
# force binary unbuffered stdin and stdout
312+
fd_in = os.fdopen(sys.stdin.fileno(), 'rb', 0)
313313
fd_out = os.fdopen(sys.stdout.fileno(), 'wb', 0)
314314

315315
if not os.path.exists(opts.database_dir):

codeintel/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,10 +883,12 @@ def run(self):
883883
response = json.loads(buf.decode('utf-8'))
884884
self.handle(response) # handle runs asynchronously and shouldn't raise exceptions
885885
buf = b''
886-
else:
887-
if ch not in b'0123456789':
888-
raise ValueError("Invalid frame length character: %r" % ch)
886+
elif ch in b'0123456789':
889887
buf += ch
888+
elif ch in b' \t\r\n':
889+
pass
890+
else:
891+
raise ValueError("Invalid frame length character: %r" % ch)
890892

891893
except Exception as e:
892894
if self.state in (CodeIntelManager.STATE_QUITTING, CodeIntelManager.STATE_DESTROYED):

codeintel/codeintel2/oop/driver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def start(self):
503503
log.debug("Failed to read frame length, assuming connection died")
504504
self.quit = True
505505
break
506-
if len(ch) == 0:
506+
if not ch:
507507
log.debug("Input was closed")
508508
self.quit = True
509509
break
@@ -540,8 +540,10 @@ def start(self):
540540
self.queue_cv.notify()
541541
elif ch in b'0123456789':
542542
buf += ch
543+
elif ch in b' \t\r\n':
544+
pass
543545
else:
544-
raise ValueError("Invalid request data: %s" % hex(ch))
546+
raise ValueError("Invalid frame length character: %r" % ch)
545547

546548
log.info("Codeintel driver ended")
547549

0 commit comments

Comments
 (0)