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.

Author barry-scott
Recipients barry-scott
Date 2021-02-07.18:05:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When using the limited API PyCMethod_New is not defined in python3.lib.
This leads to a link error.

This error is in 3.9 and 3.10a5

Discovered when I improved the PyCXX test suite.

Example output:

Link obj\simple.pyd
        cl /nologo /W4 /LD /Zi /MT /EHsc  /Zi /MT /EHsc -I. -ISrc -IC:\Python310.win64\include -D_CRT_NONSTDC_NO_DEPRECATE -U_DEBUG -DNDEBUG -DPy_LIMITED_API=0x3090000 /Feobj\simple.pyd /Fdobj\simple.pdf obj\simple.obj obj\cxxsupport.obj obj\cxx_extensions.obj obj\cxx_exceptions.obj obj\cxxextensions.obj obj\IndirectPythonInterface.obj C:\Python310.win64\libs\python3.lib
   Creating library obj\simple.lib and object obj\simple.exp
simple.obj : error LNK2019: unresolved external symbol __imp_PyCMethod_New referenced in function "protected: virtual class Py::Object __cdecl Py::PythonExtension<class old_style_class>::getattr_methods(char const *)" (?getattr_methods@?$PythonExtension@Vold_style_class@@@Py@@MEAA?AVObject@2@PEBD@Z)
obj\simple.pyd : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"' : return code '0x2'
Date User Action Args
2021-02-07 18:05:58barry-scottsetrecipients: + barry-scott
2021-02-07 18:05:58barry-scottsetmessageid: <>
2021-02-07 18:05:58barry-scottlinkissue43155 messages
2021-02-07 18:05:58barry-scottcreate