[issue2921] enable embedding: declare/#define only py* symbols in #includes

2019-05-14 Thread STINNER Victor


STINNER Victor  added the comment:

Since this issue has been reported, a lot of work has been done to cleanup 
Python header files. In Python 3.8, we created Include/cpython/ and 
Include/internal/ subdirectories to clarify the intent and usage of header 
files. I close this issue.

See bpo-2897 for the specific case of structmember.h.

--
dependencies:  -Deprecate structmember.h
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2012-11-30 Thread Bruno Dupuis

Changes by Bruno Dupuis :


--
nosy: +bruno.dupuis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2010-11-04 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2010-08-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions:  -Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2009-05-16 Thread Daniel Diniz

Daniel Diniz  added the comment:

Hallvard,
There is ongoing discussion on separating public and private headers:
http://groups.google.com/group/unladen-swallow/t/f3a89fc723411c49

Also see #2897, #4805, #5748 and #896330 for (sometimes slightly)
related issues.

--
dependencies: +include structmember.h in Python.h
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2009-05-16 Thread Hallvard B Furuseth

Hallvard B Furuseth  added the comment:

Daniel Diniz writes:
> Would this break existing code?

Source code?  Not if you use the PYTHON_NAMESPACE_ONLY trick.  Old
programs will receive all old definitions in addition to the new
autoconf symbols, since they didn't #define PYTHON_NAMESPACE_ONLY.

Programs that do #define PYTHON_NAMESPACE_ONLY will lose symbols you
can't offer because you couldn't be bothered to make them independent
of autoconf.  BTW, another "reduced API" variant would be to throw
autoconf-independent symbols out to separate .h files.  #include those
files from the .h files they come from, and document that programs can
#include them instead of Python.h.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2009-05-16 Thread Daniel Diniz

Daniel Diniz  added the comment:

Would this break existing code? Are the benefits worth it?

--
nosy: +ajaksu2
priority:  -> normal
versions: +Python 2.7, Python 3.2 -Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2008-05-20 Thread Hallvard B Furuseth

Hallvard B Furuseth <[EMAIL PROTECTED]> added the comment:

Duh, I should of course have said defined(PY_HAVE_ACOSH)
and not defined(HAVE_ACOSH), that was the whole point:-)
And the puts() should print "#define PY_HAVE_WHATEVER 1".

Hopefully there are not too many #defines which would
need to get corresponding PY_* variants.

For that matter, PYTHON_NAMESPACE_ONLY could offer a
reduced Python C API - omitting parts it would be
cumbersome to get right with only py* symbols.

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2008-05-19 Thread Benjamin Peterson

Changes by Benjamin Peterson <[EMAIL PROTECTED]>:


--
components: +Interpreter Core -None

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2008-05-19 Thread Hallvard B Furuseth

New submission from Hallvard B Furuseth <[EMAIL PROTECTED]>:

It can be cumbersome to embed Python in a program which also #includes
a config.h from autoconf, because Python's and the program's autoconf
macros may interfere with each other.  Assuming it compiles at all,
both could define the same features, sometimes the same way and
sometimes differently.  Or one could be compiled with a feature macro
undefined and another with it defined, resulting in binary
incompatibility with the library which was compiled with the macro
undefined.

So one has to do something like: put the Python calls in one set of
files, the calls to the embedding program in another set, and make
them communicate via some glue code.


For this reason, please do not declare/#define symbols other than
those starting with 'py' in the include files that an embedded program
needs.  Thus, do not #include at least pyconfig.h, pymath.h and
pyport.h as they are today.

Or to keep backwards compatibility, wrap such definitions in
#ifndef PYTHON_NAMESPACE_ONLY
which an application can #define before #including Python files.

Instead, you can #define/declare symbols that match the current
autoconf symbols but are prefixed with PY_, and make use of those in
#ifdefs in the include files.  The files defining this can hopefully
be autogenerated, e.g. generate a .c file like

#include "pyconfig.h"
int main() {
#ifdef HAVE_WHATEVER
puts("PY_HAVE_WHATEVER");
#endif
...
}

Things like acosh() from pymath.h which you define if the system lacks
it, could become something like this:

#include  /* get acosh etc */
...
extern double py_acosh(double); /* always present in python */
#if !defined(PYTHON_NAMESPACE_ONLY) && !defined(HAVE_ACOSH)
/* an other package's autoconf might do the same, so hide this
 * if requested */
extern double acosh(double);
#endif
#if !defined(PYTHON_NAMESPACE_ONLY) || defined(HAVE_ACOSH)
#define py_acosh acosh /* optimization - hide wrapper function */
#endif

--
components: None
messages: 67078
nosy: hfuru
severity: normal
status: open
title: enable embedding: declare/#define only py* symbols in #includes
type: feature request
versions: Python 2.6

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com