From a5ee0f2819031dfcec188e81c33eb510e5dd453a Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Wed, 26 Oct 2016 17:44:11 -0400 Subject: [PATCH 1/2] handle edge case where prior character is an escaped backslash --- pandas/lib.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/lib.pyx b/pandas/lib.pyx index b09a1c2755a06..d6e24bd6ad055 100644 --- a/pandas/lib.pyx +++ b/pandas/lib.pyx @@ -1111,7 +1111,7 @@ def convert_json_to_lines(object arr): length = narr.shape[0] for i in range(length): v = narr[i] - if v == quote and i > 0 and narr[i - 1] != backslash: + if v == quote and i > 0 and narr[i - 1] != backslash and narr[i - 2] != backslash: in_quotes = ~in_quotes if v == comma: # commas that should be \n if num_open_brackets_seen == 0 and not in_quotes: From 2d06e250366d9891f6601940ca52ab948e1cc4c0 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Wed, 26 Oct 2016 17:47:57 -0400 Subject: [PATCH 2/2] avoid out of bounds --- pandas/lib.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/lib.pyx b/pandas/lib.pyx index d6e24bd6ad055..5489338c5d174 100644 --- a/pandas/lib.pyx +++ b/pandas/lib.pyx @@ -1111,7 +1111,7 @@ def convert_json_to_lines(object arr): length = narr.shape[0] for i in range(length): v = narr[i] - if v == quote and i > 0 and narr[i - 1] != backslash and narr[i - 2] != backslash: + if v == quote and i > 0 and narr[i - 1] != backslash and i > 1 and narr[i - 2] != backslash: in_quotes = ~in_quotes if v == comma: # commas that should be \n if num_open_brackets_seen == 0 and not in_quotes: