This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Misleading error message "Python failed to load the default activation context"
Type: behavior Stage: resolved
Components: Windows Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, paul.moore, rhabacker, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2019-05-23 21:13 by rhabacker, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16579 closed ZackerySpytz, 2019-10-04 09:50
PR 16897 merged ZackerySpytz, 2019-10-23 05:45
Messages (6)
msg343329 - (view) Author: Ralf Habacker (rhabacker) Date: 2019-05-23 21:13
When I started Kicad under Windows I got the following error message in dbgview: "Python could not load the default activation context".

This message is issued by the Python runtime environment when checking the return value of the Windows API function AddRefActCtx() if the return value is zero (see

According to, this function does not return a value, which makes the check result dependent on temporary internal register/stack values and does not indicate a real problem.

This check should be completely removed so as not to waste the precious time of developers and users searching for the reason for this misleading message.

The corresponding definitions (and line 37) should also be adjusted.

The issue is also present in version 2.7.
msg353914 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-10-04 09:53
Thank you for the report. I've created a pull request to fix this issue.
msg353952 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-10-04 16:27
This doesn't apply since Python 3.5, as the HAVE_SXS preprocessor variable is not defined.

We should just delete this code entirely in 3.9, and patch the message in 2.7.
msg355244 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-10-23 18:16
New changeset 009a6928727b23344613ab6a9a52b9da56ab905c by Steve Dower (Zackery Spytz) in branch '2.7':
bpo-37025: AddRefActCtx() shouldn't be checked for failure (GH-16897)
msg355245 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-10-23 18:17
Merged the 2.7 fix. Let's just delete the whole block in master.
msg361394 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-02-05 00:45
Fixed in 2.7 - using issue39553 for removing the code in master.
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81206
2020-02-05 00:45:34steve.dowersetstatus: open -> closed
resolution: fixed
messages: + msg361394

stage: patch review -> resolved
2019-10-23 18:17:14steve.dowersetmessages: + msg355245
2019-10-23 18:16:03steve.dowersetmessages: + msg355244
2019-10-23 05:45:05ZackerySpytzsetpull_requests: + pull_request16435
2019-10-04 16:27:17steve.dowersetmessages: + msg353952
versions: - Python 3.7, Python 3.8, Python 3.9
2019-10-04 09:53:36ZackerySpytzsetnosy: + ZackerySpytz

messages: + msg353914
versions: + Python 2.7, Python 3.8, Python 3.9
2019-10-04 09:50:51ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16170
2019-05-23 21:13:39rhabackercreate