GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-150467: Fix linking python3.dll and python3t.dll with ASan on Windows by ck0i · Pull Request #160992 · python/cpython

Conversation

@ck0i

@ck0i ck0i commented Oct 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Fixes gh-150467.

Root cause

python3.dll and python3t.dll only contain /EXPORT forwarders and are linked with /NOENTRY, so the CRT is never pulled in. With ASan enabled, the linker adds clang_rt.asan_dynamic_runtime_thunk, which needs the CRT (_initterm, abort, __vcrt_*, __acrt_*), so the link fails with LNK2001.

python3.dll also fails this way at the parent of GH-149218, so the bug is older. That change added python3t.dll, a second forwarder built with the same settings.

Fix

python3dll.vcxproj and python3tdll.vcxproj now set NoEntryPoint only when EnableASAN isn't true, so ASan builds keep the default CRT entry point. ASan turned on only through _CL_/_LINK_ is not detected; use /p:EnableASAN=true.

Non-ASan builds are unchanged: both DLLs still have no entry point and no imports.

Testing

x64 Release, VS 2026 (MSVC 14.51), building python3dll.vcxproj and python3tdll.vcxproj on their own:

  • /p:EnableASAN=true: both failed with LNK2001 before, and link now. dumpbin shows _DllMainCRTStartup as the entry point and an import of clang_rt.asan_dynamic-x86_64.dll.
  • Without ASan: both still have no entry point and no imports, and export the same 964 forwarders.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ck0i
pythongh-150467: Fix linking python3.dll and python3t.dll with ASan o…
0fd9307
…n Windows

The stable ABI forwarder DLLs are linked with /NOENTRY, so nothing pulls
in the CRT. With AddressSanitizer enabled, the linker adds the ASan
runtime thunk library, which needs the CRT, and the link fails with
unresolved symbols. Keep the default CRT entry point for these DLLs
when building with ASan.
@ck0i
ck0i requested a review from a team as a code owner October 31, 2026 03:32
@bedevere-app bedevere-app Bot added the awaiting review label Oct 31, 2026
@python-cla-bot

python-cla-bot Bot commented Oct 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot mentioned this pull request Oct 31, 2026
[Asan + msvc] Cpython build failed with error LNK2001: unresolved external symbol on windows #150467
Open
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T03:33:16.126766Z
We couldn’t complete this review. Comment @codex review to try again.
0fd9307 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz added the AI-needs-explanation AI-assisted work that needs further explanation and follow up from the contributor label Oct 31, 2026
@bedevere-app

bedevere-app Bot commented Oct 31, 2026

Copy link
Copy Markdown

Thank you for your interest in contributing to Python. This is a community-driven project, and we want it to be a welcoming place to learn and collaborate.

Contributors are responsible for reviewing and understanding what they submit, checking its claims, and being able to explain changes in their own words. This helps reviewers focus on the contribution and leaves more time to support other contributors.

This contribution appears to have been authored with AI assistance. Please explain your contribution in your own words and describe how you checked its correctness.

Please read our guidelines for using AI tools.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
picnixz requested a review from chris-eibl October 31, 2026 14:18
@chris-eibl

chris-eibl commented Oct 31, 2026

Copy link
Copy Markdown
Member

LGTM, but see my earlier #150467 (comment) before we proceed here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ck0i
Drive the python3 DLL entry point from EnableASAN only
d04b81a
@ck0i

ck0i commented Oct 31, 2026

Copy link
Copy Markdown
Author

Agreed, made some changes regarding the comment you linked. Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@chris-eibl chris-eibl Awaiting requested review from chris-eibl

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

AI-needs-explanation AI-assisted work that needs further explanation and follow up from the contributor awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Asan + msvc] Cpython build failed with error LNK2001: unresolved external symbol on windows

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ck0i @chris-eibl @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.