Comments (27)
This was caused by 42e7d7b which broke the preprocessor condition for make_setter
by inverting the sense of the test. There was a later change in 590b788 but it didn't restore the old behaviour.
from python.
What intermediate solution can projects (e.g. ledger) use to fix this until the next release of boost python?
from python.
You could define the "missing" overload in your own code:
#if BOOST_VERSION == 105900
// Fix for https://github.com/boostorg/python/issues/39
namespace boost { namespace python {
template <class D>
inline object make_setter(D const& x)
{
return detail::make_setter(x, default_call_policies(), is_member_pointer<D>(), 0);
}
}}
#endif
from python.
Thank you for your reply. I already tried that to no avail, which I find quite odd.
I tried adding the "missing" overload in different places in the code, but still see errors like:
../src/py_amount.cc:131:26: error: no matching function for call to 'make_setter'
make_setter(&amount_t::is_initialized))
^~~~~~~~~~~
/opt/homebrew/include/boost/python/data_members.hpp:303:15: note: candidate function [with D = bool *] not viable: no known conversion from 'bool *' to 'bool *&' for 1st argument
inline object make_setter(D& x)
^
/opt/homebrew/include/boost/python/data_members.hpp:291:15: note: candidate function template not viable: requires 2 arguments, but 1 was provided
inline object make_setter(D& x, Policies const& policies)
from python.
Looks like you didn't declare the overload everywhere it's needed, since it's not listed as a candidate function.
from python.
(As usual, it might help to put together a minimal test case and share that. Otherwise it's hard to help just by second-guessing.)
from python.
@stefanseefeld The #40 fix works just fine. Yet I would like to make the project aware that boost python 1.59 has an issue and address that with a workaround within the project.
from python.
Yes, I understand. But even if you ask for help on your own code, it's hard to do so without seeing the actual code. (And often enough putting together a test case might in itself reveal the problem, so it's a good strategy anyhow. :-))
from python.
Be aware that Fedora rawhide (which will become Fedora 24) has a patched version of Boost 1.59.0 which includes the fix, so putting a workaround in the project might conflict with that patched version of Boost.
from python.
I'm afraid I may have had an unclean environment, in which I tested. With a fresh workspace and merely the proposed changes by @jwakely it compiles just fine.
@stefanseefeld Thanks for the advice. I'll remember it for next time.
from python.
@jwakely Thanks for the heads up. How would such an issue be addressed best?
- Within the project's configuration step (for ledger that would be CMake)?
- Add the fix for the "majority" of users and have it fail for the others?
- Not all?
- Deliver a patch that users can apply manually?
from python.
Within the project's configuration step (for ledger that would be CMake)?
Yes, I would add an autoconf / cmake test and only add the missing overload if needed.
from python.
(This is entirely off-topic, but anyhow: Given that "#if BOOST_VERSION == 105900" appears to be the condition under which you'll need this patch, there is really nothing to configure for. Just put the above patch from @jwakely into your source code wherever needed and move on.)
from python.
@jwakely does the patched boost 1.59 version have a difference BOOST_VERSION
number?
from python.
There is no "patched boost 1.59 version". The patch is on master, and will be part of boost 1.60.
from python.
@stefanseefeld I'm quoting @jwakely: "Be aware that Fedora rawhide (which will become Fedora 24) has a patched version of Boost 1.59.0"
from python.
Oh, I stand corrected. Hmm, I don't like that idea. @jwakely, I think rather than having Fedora roll its own Boost.Python release, I think it would be better to try to get a new Boost.Python (bugfix) release out. (As you know, I have been trying to get Boost.Python to the point where I can do releases independently from the rest of Boost, anyhow.)
In any case, the version string to check for is "105900". Anything else should not need the patch.
from python.
Fedora rawhide has a patched Boost 1.59.0 with the same BOOST_VERSION
of 105900 (otherwise I would not have bothered pointing it out).
It's necessary to patch Boost for Fedora because Boost usually ships with several regressions in every release, and it's not an option to wait several months for another release, with another set of new regressions. I'm sure other distros carry patches too.
from python.
@jwakely , that's very unfortunate, in particular as it doesn't allow users to discriminate based on BOOST_VERSION. There should be some way to check for the version using some macro.
(I understand and agree with what you are saying, which is precisely why I want to decouple Boost.Python as much as possible. All I'm saying is that this should be coordinated a bit. Imagine developers who want to write portable code. What a nightmare !)
from python.
@afh raises ✋. I want to write portable code and think this is (kind-of) a nightmare 😄
I think writing a CMake module that tests the issue by trying to compile the example given initially by @jwakely is a good idea.
from python.
Yes, but it's only needed precisely because of that nightmare we are in. :-(
from python.
If Boost did 1.Y.1 releases more often (including critical fixes like this one and boostorg/log@7da193f) then distros could use that, as it is we have no choice but to ship 1.Y.0 with all the breaking changes that entails, and then patch things to get the distro to build.
from python.
@jwakely, yes, I agree. It's a systemic issue caused by the separation between project maintenance and distro maintenance. (How often have I filed bugs with RH's bugzilla only to be told that this is an "upstream" issue that can't be fixed by RH. As an end-user I don't want to have to care for "upstream"...) Anyhow, sorry for the ranting. I can fully understand and appreciate all the sides of this, as I have been part of this game for a long time... :-)
from python.
Understood. For the next Boost release I plan to try rebuilding everything in Fedora with the release candidates, and try to report regressions before the release, but that is a lot of work and didn't happen this time.
from python.
Here's a little CMake snippet I'll use in order to check for this issue and
include the "missing" overload when necessary:
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} ${Boost_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES} ${PROFILE_LIBS})
check_cxx_source_runs("
#include <boost/python.hpp>
struct X { int y; };
int main()
{
boost::python::make_setter(&X::y);
}" BOOST_MAKE_SETTER_RUNS)
if (BOOST_MAKE_SETTER_RUNS)
set(HAVE_BOOST_159_ISSUE_39 0)
else()
set(HAVE_BOOST_159_ISSUE_39 1)
endif()
cmake_pop_check_state()
from python.
Thanks for the insightful conversation and the helpful comments about the issue at hand.
I look forward to Boost 1.60.0 or the next Boost.Python release, whichever comes first 😝
from python.
@afh Note that you also need ${PYTHON_INCLUDE_DIRS}
and ${PYTHON_LIBRARIES}
(see CMakeFiles/CMakeError.log
when compiling with a patched boost version). I pushed a fix in ledger/ledger@429765ee4.
from python.
Related Issues (20)
- `no_proxy_helper` should not access `Container::value_type`
- Boost.Python doesn't build under MSVC... HOT 4
- NULL ptr deref in instance_dealloc
- About `No Python class registered for C++ class`,throw errors. HOT 1
- Is it possible to programmatically retrieve C++ class name / Python class name mapping ? HOT 1
- __qualname__ on embedded/inner classes is wrong
- Outdated reference to bjam in examples dir
- Broken URL in build/Jamfile HOT 2
- Qt binding to python - undefined symbol HOT 2
- Compilation failure using numpy 2.0.0b1 HOT 4
- Is Boost.Python is bound to specific python version? HOT 1
- Jupyter Kernel Notebook Dies After Starting Threaded Class HOT 4
- Cannot import Boost.Python from Python 3.11 HOT 4
- Minimal Boost Python example not working HOT 7
- Segfault when importing Python Module HOT 1
- How to Properly Expose Enum Comparison Operators to Python Using Boost.Python? HOT 1
- Expose shared_ptr to const
- missing lib boost_numpy312-vc143-mt-x64-1_85.lib HOT 1
- Boost Python 1.83.0 doesn't support NumPy 2.0
- Move operators for make_tuple and list::append?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python.