Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jerryjhird wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromjerryjhird:tracemalloc-gilstate-fix

Conversation

@jerryjhird
Copy link

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

@python-cla-bot
Copy link

python-cla-botbot commentedJan 30, 2026
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

jerryjhird reacted with thumbs up emoji

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@jerryjhirdjerryjhird changed the title[tracemalloc] initialize gil_state in functions to stop warnings[tracemalloc] initialize gil_state in functions to stop -Wmaybe-uninitialized warningsJan 30, 2026
Initialize PyGILState_STATE gil_state to PyGILState_UNLOCKED inPyTraceMalloc_Track, tracemalloc_alloc, tracemalloc_realloc tostop -Wmaybe-uninitialized warnings on GCC. Behavior is unchanged
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@vstinner
Copy link
Member

How did you build Python? What is your operating system name and version? What is your GCC version?

Copy link
Member

@vstinnervstinner left a 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 byif (need_gil).

PyTraceMalloc_Track(unsigned int domain, uintptr_t ptr,
size_t size)
{
PyGILState_STATE gil_state = PyGILState_UNLOCKED;
Copy link
Member

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.

@jerryjhird
Copy link
Author

jerryjhird commentedJan 30, 2026
edited
Loading

How did you build Python? What is your operating system name and version? What is your GCC version?

gcc (GCC) 15.2.1 20251211 (Red Hat 15.2.1-5)
Fedora Linux 42 (Workstation Edition) x86_64

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 byif (need_gil).

i see, sorry for wasting your time. should i close the pr or would you still want it just to suppress the warning?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jerryjhird@vstinner

[8]ページ先頭

©2009-2026 Movatter.jp