Joshua J Cogliati added the comment:
I looked and the autoconf variable for the c++ linker is CXXLINK, so I think
the proper way to fix this would be to change sysconfig.py to look at both
CXXFLAGS and CXXLINK, and create those and use it to define a cxxlink variable,
and only
Joshua J Cogliati added the comment:
Let me try and explain what is trying to be done in the original code,
what the fix was, and then discuss some possible better solutions.
Original code:
if target_lang == c++ and self.compiler_cxx:
linker[0] = self.compiler_cxx[0]
Current code
Joshua J Cogliati added the comment:
Looking at the patch (3078fdb7cf3d for Issue1488098) it has:
if target_lang == c++ and self.compiler_cxx:
-linker[0] = self.compiler_cxx[0]
One possibility is that that the problem was:
linker[0] = self.compiler_cxx[0
Joshua J Cogliati added the comment:
Here is an example to use to test for this bug.
Proper use on my computer (PYTHONPATH may need adjusting on other systems):
Python2:
cd small_example
python setup.py build_ext build install --prefix=`pwd`
export PYTHONPATH=`pwd`/lib64/python2.7/site
Joshua J Cogliati added the comment:
Does the patch fix things on Mac OS X and Linux?
So far as I can tell, the code in question is to do something so
that CXX variables like:
export CXX=env BAR=FOO g++
work better. However, it is broken for that case, and since it has
been broken since
Joshua J Cogliati added the comment:
On OSX 10.10.1,
With the small_example, and with python 3.4.3 and:
$ export CXX=env BAR=FOO g++
$ python3 setup.py build_ext build install --prefix=`pwd`
running build_ext
building '_example' extension
swigging example/example.i to example/example_wrap.cpp
Joshua J Cogliati added the comment:
Once this is fixed, maybe issue 8027 can be fixed as well in 3.5.0.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23644
Joshua J Cogliati added the comment:
@Joshua: Can you please try to compile your extension with Py_LIMITED_API
defined? Ex: #define Py_LIMITED_API 0x0303 at the top of your C file,
or g++ -DPy_LIMITED_API=0x0303.
It fails in that case, because SWIG is using functions
Joshua J Cogliati added the comment:
This bug is still in Python 3.5.0a2 (but first issue 23644 needs to be fixed
before g++ can be used at all)
Attached is a patch for Python 3.5.0.
--
versions: +Python 3.5
Added file: http://bugs.python.org/file38530/fix-distutils-350.patch
Joshua J Cogliati added the comment:
Hum, I'm lost with the problem with C++ :-( What is your use case? Do you
want to compile CPython with C++? Or compile a third-party extension with C++
and this extension includes Python.h which includes pyatomic.h.
My use case is I have C++ code that I
Joshua J Cogliati added the comment:
using namespace std;
Doing this in a header is ugly.
If you put it in the:
#ifdef __cplusplus
extern C {
#endif
then it would only apply till the end of the pyatomic header, and not to
anything that includes it. Something like:
#ifdef __cplusplus
New submission from Joshua J Cogliati:
The attached example works fine with Python 3.4.2, but fails with Python
3.5.0a1 and 3.5.0a2
I am using:
$ g++ --version
g++ (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
$ swig -version
SWIG Version 3.0.5
Compiled with g++ [x86_64-redhat-linux-gnu
Joshua J Cogliati added the comment:
I have:
/local/python_fix/include/python3.5m/pyatomic.h
#ifndef Py_LIMITED_API
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H
#include dynamic_annotations.h
#include pyconfig.h
#ifdef __cplusplus
extern C {
#endif
#if defined(HAVE_STD_ATOMIC)
#include
Joshua J Cogliati added the comment:
If I change the header to:
#ifndef Py_LIMITED_API
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H
#include dynamic_annotations.h
#include pyconfig.h
#ifdef __cplusplus
extern C {
#endif
#if defined(HAVE_STD_ATOMIC)
#ifdef __cplusplus
#include atomic
using
Joshua J Cogliati added the comment:
The documentation does claim that swig should just work the build_ext command
knows how to deal with SWIG extensions: it will run SWIG on the interface file
and compile the resulting C/C++ file into your extension.
It would be nice if there was one obvious
Joshua J Cogliati added the comment:
Hm. That is a good point. Possibly it could only be done when
from __future__ import unicode_literals
has been used. For example:
python2 -3
Python 2.7.5 snip
Type help, copyright, credits or license for more information.
type(ba) == type(a)
True
from
New submission from Joshua J Cogliati:
The -3 option should warn about str to bytes conversions and str to bytes
comparisons:
For example in Python 3 the following happens:
python3
Python 3.3.2 snip
Type help, copyright, credits or license for more information.
ba + a
Traceback (most recent
17 matches
Mail list logo