Import failure during windows build process of extension C module

In gh-72793: C implementation of parts of copy.deepcopy by eendebakpt · Pull Request #91610 · python/cpython · GitHub part of the python deepcopy implementation is replaced with C code to improve performance. The PR passes tests and performance is good, but the windows build is failing.

The C code lives in Modules/_copy.c and I added the new _copy module to Modules/ and Modules/ That was sufficient for the linux build. What more should be done for the windows build?

For reference: build failing: gh-72793: C implementation of parts of copy.deepcopy · python/cpython@1dcceed · GitHub

You need to add the new module to some PCbuild files, like when we added _typing: bpo-44353: Implement typing.NewType __call__ method in C (#27262) · python/cpython@96c4cbd · GitHub

Yes, as Jelle says.

More precisely, if you’re adding it as a built-in module, you can add the files directly to pythoncore.vcxproj. This will also require it to be listed in PC\config.c so that it can be found at runtime.

However, if you want it to be built as a standalone extension module (which is I believe what you’re doing for POSIX), then you’ll need to clone one of the existing project files for a similar module and update its parameters. I suspect in this case there’s very little gained by putting this in a separate DLL, so better to go with the first option.

Thanks for the information. The build on windows is working!

1 Like