[New-bugs-announce] [issue43155] PyCMethod_New not defined in python3.lib

Barry Alan Scott report at bugs.python.org
Sun Feb 7 13:05:58 EST 2021

New submission from Barry Alan Scott <barry-scott at users.sourceforge.net>:

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 at Vold_style_class@@@Py@@MEAA?AVObject at 2@PEBD at 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'

messages: 386595
nosy: barry-scott
priority: normal
severity: normal
status: open
title: PyCMethod_New not defined in python3.lib
versions: Python 3.10, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list