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

_Py_ThreadId() fails when compiled using GCC on Windows #124609

Closed
@tonyroberts

Description

@tonyroberts

Bug report

Bug description:

It should be possible to build a C extension module using GCC on Windows, but when defining Py_GIL_DISABLED any call to _Py_ThreadId fails.

The if/defs in _Py_ThreadId look for _MSC_VER to be defined to determine whether it's a Windows build or not, but that specifies the VS version and not whether the build is for Windows or not.

Instead it would be better to use _WIN32 (seehttps://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170)

Something along these lines...

#if defined(_WIN32)#include <intrin.h>#endifstatic inline uintptr_t_Py_ThreadId(void){    uintptr_t tid;#if defined(_WIN32) && defined(_M_X64)    tid = __readgsqword(48);#elif defined(_WIN32) && defined(_M_IX86)    tid = __readfsdword(24);#elif defined(_WIN32) && defined(_M_ARM64)    tid = __getReg(18);...

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp