You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dj...@apache.org on 2020/04/22 19:45:39 UTC

[cassandra] branch trunk updated: Fix CQLSH UTF-8 encoding issue for Python 2/3 compatibility

This is an automated email from the ASF dual-hosted git repository.

djoshi pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ffa05ef  Fix CQLSH UTF-8 encoding issue for Python 2/3 compatibility
ffa05ef is described below

commit ffa05ef24039e5ed8a9c8080ce682e3fda926583
Author: Dinesh A. Joshi <di...@apple.com>
AuthorDate: Sun Apr 19 13:17:13 2020 -0700

    Fix CQLSH UTF-8 encoding issue for Python 2/3 compatibility
    
    This fix also addresses test failures due to cqlsh return code behavior change
    
    Patch by Dinesh Joshi; Reviewed by Jordan West and Mick Semb Wever for CASSANDRA-15739
---
 CHANGES.txt  | 1 +
 NEWS.txt     | 2 ++
 bin/cqlsh.py | 8 ++++----
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 102b1aa..2a3d36c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0-alpha4
+ * Fix CQLSH UTF-8 encoding issue for Python 2/3 compatibility (CASSANDRA-15739)
  * Fix batch statement preparation when multiple tables and parameters are used (CASSANDRA-15730)
  * Fix regression with traceOutgoingMessage printing message size (CASSANDRA-15687)
  * Ensure repaired data tracking reads a consistent amount of data across replicas (CASSANDRA-15601)
diff --git a/NEWS.txt b/NEWS.txt
index 83719f7..8f18659 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -248,6 +248,8 @@ Upgrading
       passed will now need to conform to java.time.format.DateTimeFormatter.
       Most notably, days and months must be two digits, and years exceeding
       four digits need to be prefixed with a plus or minus sign.
+    - cqlsh now returns a non-zero code in case of errors. This is a backward incompatible change so it may
+      break existing scripts that rely on the current behavior. See CASSANDRA-15623 for more details.
 
 
 Materialized Views
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 310a265..c4f38b6 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -860,9 +860,9 @@ class Shell(cmd.Cmd):
     def get_input_line(self, prompt=''):
         if self.tty:
             self.lastcmd = input(prompt)
-            line = self.lastcmd + '\n'
+            line = ensure_text(self.lastcmd) + '\n'
         else:
-            self.lastcmd = self.stdin.readline()
+            self.lastcmd = ensure_text(self.stdin.readline())
             line = self.lastcmd
             if not len(line):
                 raise EOFError
@@ -911,7 +911,7 @@ class Shell(cmd.Cmd):
         Returns true if the statement is complete and was handled (meaning it
         can be reset).
         """
-
+        statementtext = ensure_text(statementtext)
         try:
             statements, endtoken_escaped = cqlruleset.cql_split_statements(statementtext)
         except pylexotron.LexingError as e:
@@ -1007,7 +1007,7 @@ class Shell(cmd.Cmd):
         self.tracing_enabled = tracing_was_enabled
 
     def perform_statement(self, statement):
-        statement = ensure_str(statement)
+        statement = ensure_text(statement)
 
         stmt = SimpleStatement(statement, consistency_level=self.consistency_level, serial_consistency_level=self.serial_consistency_level, fetch_size=self.page_size if self.use_paging else None)
         success, future = self.perform_simple_statement(stmt)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org