[Python-Dev] Private header files (Was: Renaming Include/object.h)

Ronald Oussoren ronaldoussoren at mac.com
Thu Jan 4 20:36:54 CET 2007


On 4 Jan, 2007, at 17:56, Fred L. Drake, Jr. wrote:

> On Thursday 04 January 2007 11:33, Martin v. Löwis wrote:
>> For the python subdirectory, there is the issue that the framework
>> includes in OSX magically look for python.framework when searching  
>> for
>> python/foo.h, which they find, so that may get us the wrong version.
>> Somebody would have to study the details here, first.
>
> If everything public gets included from Python.h, perhaps python/ 
> object.h and
> friends could become pythonX.Y/object.h; I'm not sure this will  
> solve the Mac
> OS framework magic issue, though, not being a Mac OS developer.

That would solve the problem, however I don't think there is one. An  
experiment seems to indicate that the include path is prefered over  
the magic inclusion of framework headers (see the trace below). I  
haven't checked yet if the behaviour shown below is intentional, but  
I'd be surprised if it isn't.

$ mkdir include
$ mkdir include/Python
$ cat > include/Python/object.h <<EOF
#error "my header included"
EOF
$ cat > demo.c <<-EOF
#include <Python/object.h>
EOF
$
$ cc -c demo.c
In file included from demo.c:1:
/System/Library/Frameworks/Python.framework/Headers/object.h:227:  
error: parse error before ‘FILE’
/System/Library/Frameworks/Python.framework/Headers/object.h:353:  
error: parse error before ‘PyType_IsSubtype’
... more errors removed, this clearly includes a header from the  
python framework
$
$ cc -I include -c t.c
In file included from demo.c:1:
include/Python/object.h:1:2: error: #error "my error"

Therefore moving all headers into a directory named Python would  
cause no problems users that use the normal way of linking with  
python and would even allow users to use the python framework as a  
normal framework.

Ronald
>
>
>   -Fred
>
> -- 
> Fred L. Drake, Jr.   <fdrake at acm.org>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/ 
> ronaldoussoren%40mac.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20070104/e1d8808a/attachment.bin 


More information about the Python-Dev mailing list