AutumnSun1996 commented on issue #28372:
URL: https://github.com/apache/superset/issues/28372#issuecomment-2136893931

   it seems that simplejson will handle bytes itself, and will not use logic in 
'default' function:
   ```python
   import simplejson
   
   
   def convert_bytes(val):
       if isinstance(val, bytes):
           return 'converted-' + repr(val)
       return val
   
   
   print(simplejson.__version__)
   # 3.17.3
   
   print(simplejson.dumps({'a': b'b'}, default=convert_bytes))
   # {"a": "b"}
   
   print(simplejson.dumps({'a': b'\x00\x85'}, default=convert_bytes))
   # raises UnicodeDecodeError
   ```
   
   so bytes should be handled before they goes into the `dumps` function.


-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to