-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-32805: Fix compiler warnings in gcmodule.c #11010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is bpo-32805. But changing the signature of |
When compiled with dtrace support (on 64-bits) the signature is already a 64-bit long (see pydtrace.d). This change brings the two definitions in sync. |
Should not it be C |
Only on 64-bit platforms that have |
Do we have DTrace experts around? @ambv maybe? |
For reference (http://dtrace.org/guide/chp-typeopexpr.html#chp-typeopexpr-2), the D programming language uses ILP32 and LP64 data models. This means we need to use a platform-agnostic signed integer type that matches those semantics since the inline functions are also used on LLP64 platforms (Win64). |
This is the last remaining warning when compiling on Windows (64- or 32-bit). It would be great to see it disappear as well. So, to reiterate, the change does nothing to DTrace support proper, but to the dummy functions used when DTrace support is not compiled in. DTrace itself uses empty macros when generating the dummy functions, but since Python is using inline functions the function arguments need to match what is expected of the functions when DTrace is being used. This means that the DTrace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I agree that Py_ssize_t is the right type here:
static Py_ssize_t
collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable,
int nofail)
{
...
Py_ssize_t m = 0; /* # objects collected */
Py_ssize_t n = 0; /* # unreachable objects that couldn't be collected */
...
if (PyDTrace_GC_DONE_ENABLED())
PyDTrace_GC_DONE(n+m);
...
return n+m;
}
FWIW, this PR is an exact duplicate of the open PR #2852. |
Copy of @benjaminp's comment: According to @jkloth, the current "probe gc__done(long);" is fine. I don't know DTrace, so I cannot say. I chose to merge the PR because I really care of warnings, and this issue was the last known warning on Windows. This warning prevents me to more easily detect when I make a mistake (introduce a bug) on Windows. I someone consider that Include/pydtrace.d should be updated to use "probe gc__done(ssize_t);", please go ahead. Sadly, I never used DTrace and I'm not sure if "ssize_t" type is available for DTrace :-( cc @tiran |
* 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)
Use a C data type that matches DTrace's data type size for
long
.https://bugs.python.org/issue32805