codeant-ai-for-open-source[bot] commented on code in PR #45614:
URL: https://github.com/apache/superset/pull/45614#discussion_r4408812032


##########
superset/utils/csv.py:
##########
@@ -115,7 +116,13 @@ def escape_values(v: Any) -> Union[str, Any]:
                 if isinstance(value, str):
                     df.at[label, name] = escape_value(value)
 
-    return df.to_csv(escapechar="\\", **kwargs)
+    # An escape character makes the writer double every backslash in the data
+    # (C:\Users becomes C:\\Users). Only QUOTE_NONE, which cannot quote a
+    # delimiter or a line break, needs one; Python 3.10's writer also wanted 
one
+    # for a NUL character (#28755), which Python 3.11 writes without it.
+    if kwargs.get("quoting") == QUOTE_NONE:
+        kwargs.setdefault("escapechar", "\\")

Review Comment:
   ✅ **CodeAnt verified this suggestion was addressed in subsequent commits and 
marked this thread resolved** as of `9a02b2c`.
   
   When `quoting` is `QUOTE_NONE` and `escapechar` is missing or explicitly 
`None`, the code now sets it to a backslash before calling `to_csv`.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it 
open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to