Skip to content

gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 - #133598

Merged
zooba merged 3 commits into
python:mainfrom
sergey-miryanov:fix_memory_leak_sys_getwindowsversion_from_kernel32
May 8, 2025
Merged

zooba merged 3 commits into
python:mainfrom
sergey-miryanov:fix_memory_leak_sys_getwindowsversion_from_kernel32

Conversation

@sergey-miryanov

@sergey-miryanov sergey-miryanov commented May 7, 2025 •

Copy link
Copy Markdown
Contributor

If GetFileVersionInfoW or VerQueryValueW fails inside _sys_getwindowsversion_from_kernel32 then allocated verblock not freed.

@sergey-miryanov

Copy link
Copy Markdown
Contributor Author

I believe this PR may skip news.

@Eclips4

Eclips4 commented May 7, 2025

Copy link
Copy Markdown
Member

FYI, Sergey, the CI fails due to the recent beta(3.14b1) release. I'll restart it later.

@sergey-miryanov

Copy link
Copy Markdown
Contributor Author

Thanks! Yeah, I saw a possible fix #133599

@Eclips4 Eclips4 added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels May 7, 2025
@Eclips4
Eclips4 requested a review from zooba May 8, 2025 07:09
@zooba
zooba merged commit 0ec8fc8 into python:main May 8, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @sergey-miryanov for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 8, 2025
…version_from_kernel32 (pythonGH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 8, 2025
…version_from_kernel32 (pythonGH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
@bedevere-app

bedevere-app Bot commented May 8, 2025

Copy link
Copy Markdown

GH-133659 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 8, 2025
@bedevere-app

bedevere-app Bot commented May 8, 2025

Copy link
Copy Markdown

GH-133660 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label May 8, 2025
zooba pushed a commit that referenced this pull request May 8, 2025
…n_from_kernel32 (GH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
zooba pushed a commit that referenced this pull request May 8, 2025
…n_from_kernel32 (GH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Debian root 3.14 (tier-1) has failed when building commit caeb422.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1742/builds/11) and take a look at the build logs.
  4. Check if the failure is related to this commit (caeb422) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1742/builds/11

Failed tests:

  • test_tokenize

Failed subtests:

  • test_random_files - test.test_tokenize.TestRoundtrip.test_random_files

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_tokenize.py", line 2021, in test_random_files
    self.check_roundtrip(f)
    ~~~~~~~~~~~~~~~~~~~~^^^
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_tokenize.py", line 1869, in check_roundtrip
    untokenized_code = tokenize.untokenize(tokenize.tokenize(readline))
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 341, in untokenize
    out = ut.untokenize(iterable)
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 229, in untokenize
    for t in it:
             ^^
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 492, in tokenize
    yield from _generate_tokens_from_c_tokenizer(rl_gen.__next__, encoding, extra_tokens=True)
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 583, in _generate_tokens_from_c_tokenizer
    yield TokenInfo._make(info)
          ^^^^^^^^^^^^^^^
AttributeError: type object 'TokenInfo' has no attribute '_tokenize'
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants