Py_GetPath() C API in python 3

stalex shao.tu at
Mon Dec 15 12:30:38 CET 2008

On 12ÔÂ13ÈÕ, ÉÏÎç9•r55·Ö, "Gabriel Genellina" <gagsl-... at>
> En Fri, 12 Dec 2008 04:50:06 -0200, stalex <shao... at> escribi¨®:
> >> I want to build a new, requires total control, python interpreter. So
> >> I implement my own version of Py_GetPath(), Py_GetPrefix(),
> >> Py_GetExecPrefix() and Py_GetProgramFullPath(). When compiling, I
> >> always get error messages, for each API function, look like
> >> followings:
> >> /opt/python-3.0/lib/python3.0/config/libpython3.0.a(getpath.o)(.text
> >> +0x211c): In function `Py_GetPath':
> >> ./Modules/getpath.c:739: multiple definition of `Py_GetPath'
> >> myApp.o(.text+0x0):/home/alex/workspace/develop/src/myApp.c:11: first
> >> defined here
> >> /usr/bin/ld: Warning: size of symbol `Py_GetPath' changed from 126 in
> >> system.o to 32 in /opt/python-3.0/lib/python3.0/config/libpython3.0.a
> >> (getpath.o)
> >> collect2: ld returned 1 exit status
> Looks like you added your own implementation of those functions  
> (/home/alex/...myApp.c) but forgot to remove the original one  
> (Modules/getpath.c)
> --
> Gabriel Genellina

No, I didn't remvoe the original one. But, why do I need to do that? I
just want to extend my application, based on the original python
installed by administrator, not to build/install another one python
interpreter. And by studing python api documentations, Py_GetPath() is
a public interface python itself provides. So I could achieve my goal
via implementating my own Py_GetPath() version as well as other

By the way, my application is stable and runs well since 2 years ago.
I do this just because I want to release, in the near future, a new
version. And I want to migrate its kernel from python2.5 to python3.

Any ideas?

More information about the Python-list mailing list