bpo-30465: Fix C downcast warning on Windows in ast.c#6593
bpo-30465: Fix C downcast warning on Windows in ast.c#6593ambv merged 1 commit intopython:masterfrom vstinner:fix_ast_win_warn
Conversation
|
I don't understand why this is necessary. Where is the downcast happening? |
|
I'm sorry, I forgot to copy the compiler warning. I looked at a recent AMD64 build on Windows buildbots: ast.c:4316: |
|
The warning is because Rather than change If you'd rather keep |
ast.c: fstring_fix_node_location() downcasts a pointer difference to a C int. Replace int with Py_ssize_t to fix the compiler warning.
I looked again at the code, and I think that using Py_ssize_t is wrong because node uses int: I modified my PR to explicitly downcast to int. |
|
@ambv: Please replace |
|
Exactly! Thanks! ✨ 🍰 ✨ |
* bpo-9566: Fix compiler warnings in gcmodule.c (GH-11010) Change PyDTrace_GC_DONE() argument type from int to Py_ssize_t. (cherry picked from commit edad38e) * bpo-30465: Fix C downcast warning on Windows in ast.c (#6593) ast.c: fstring_fix_node_location() downcasts a pointer difference to a C int. Replace int with Py_ssize_t to fix the compiler warning. (cherry picked from commit fb7e799) * bpo-9566: Fix compiler warnings in peephole.c (GH-10652) (cherry picked from commit 028f0ef) * bpo-27645, sqlite: Fix integer overflow on sleep (#6594) Use the _PyTime_t type and round away from zero (ROUND_UP, _PyTime_ROUND_TIMEOUT) the sleep duration, when converting a Python object to seconds and then to milliseconds. Raise an OverflowError in case of overflow. Previously the (int)double conversion rounded towards zero (ROUND_DOWN). (cherry picked from commit ca40501)
ast.c: fstring_fix_node_location() downcasts a pointer difference to
a C int. Replace int with Py_ssize_t to fix the compiler warning.
https://bugs.python.org/issue30465