bito-code-review[bot] commented on PR #44620:
URL: https://github.com/apache/superset/pull/44620#issuecomment-5822060309

   <!-- Bito Reply -->
   The flagged issue is correct. The code uses `str.isdigit()` to check if an 
identifier is numeric before calling `int()`. However, `str.isdigit()` returns 
`True` for certain Unicode characters (like superscript digits) that `int()` 
cannot parse, leading to a `ValueError`. The fix is to use `str.isdecimal()`, 
which only returns `True` for characters that represent base-10 digits, 
ensuring `int()` will succeed.
   
   The pull request already implements this fix across multiple files 
(`superset/daos/base.py`, `superset/daos/datasource.py`, 
`superset/mcp_service/chart/chart_helpers.py`, 
`superset/mcp_service/chart/chart_utils.py`, 
`superset/mcp_service/chart/tool/generate_chart.py`) and includes corresponding 
unit tests in `tests/unit_tests/dao/base_dao_test.py`, 
`tests/unit_tests/datasource/dao_tests.py`, and 
`tests/unit_tests/models/slice_test.py` to verify the behavior for non-decimal 
digits like "²".
   
   **superset/daos/base.py**
   ```
   -        if model_id_or_uuid.isdigit():
   +        if model_id_or_uuid.isdecimal():
                filter = id_column == int(model_id_or_uuid)
   ```


-- 
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