-
-
Notifications
You must be signed in to change notification settings - Fork 34k
[tracemalloc] initialize gil_state in functions to stop -Wmaybe-uninitialized warnings #144341
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
base: main
Are you sure you want to change the base?
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Initialize PyGILState_STATE gil_state to PyGILState_UNLOCKED in PyTraceMalloc_Track, tracemalloc_alloc, tracemalloc_realloc to stop -Wmaybe-uninitialized warnings on GCC. Behavior is unchanged
9710396 to
daeb949
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
How did you build Python? What is your operating system name and version? What is your GCC version? |
vstinner
left a comment
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.
initialize gil_state in functions to stop -Wmaybe-uninitialized warnings
Sadly, GCC is wrong here, gil_state is always initialized and it's used. GCC is confused by if (need_gil).
| PyTraceMalloc_Track(unsigned int domain, uintptr_t ptr, | ||
| size_t size) | ||
| { | ||
| PyGILState_STATE gil_state = PyGILState_UNLOCKED; |
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.
This change is not needed.
gcc (GCC) 15.2.1 20251211 (Red Hat 15.2.1-5)
i see, sorry for wasting your time. should i close the pr or would you still want it just to suppress the warning? |
Initialize PyGILState_STATE gil_state to PyGILState_UNLOCKED in PyTraceMalloc_Track, tracemalloc_alloc, tracemalloc_realloc to stop -Wmaybe-uninitialized warnings on GCC. Behavior is unchanged