At present the ldshared executible is set only by locating it in the python Makefile (there is a fallback if it is not found, as well). While that works in many cases, it may be that one needs to set the ldshared to agree with a compiler/linker other than the one python was compiled with. You can set CC, but when creating shared objects you are stuck with whatever python was compiled with. The patch simply checks for LDSHARED in the current environment, and if it is present, it uses it. This is the same behaviour (and method) as for CC and CXX. Note that I'm indicating this is for 2.3, but I've browsed CVS and found sysconfig.py to be identical in this area of the code.