New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python_optional not working for float and double types #1367
Comments
worked around in 60d843a |
re-opening, looks like this code may handle this better: http://toast.sourceforge.net/optional_8hpp-source.html |
37cc3de boost::optional to/from Python converter |
reopening, ideally we also should fix enough to remove this other workaround: 0972662#bindings/python/mapnik_raster_symbolizer.cpp |
Currently with that workaround removed: diff --git a/bindings/python/mapnik_raster_symbolizer.cpp b/bindings/python/mapnik_raster_symbolizer.cpp
index 54f66a5..fd4a77c 100644
--- a/bindings/python/mapnik_raster_symbolizer.cpp
+++ b/bindings/python/mapnik_raster_symbolizer.cpp
@@ -27,19 +27,8 @@
#include <mapnik/raster_symbolizer.hpp>
#include <mapnik/raster_colorizer.hpp>
#include <mapnik/image_scaling.hpp>
+#include "python_optional.hpp"
-namespace {
-
-// https://github.com/mapnik/mapnik/issues/1367
-PyObject* get_premultiplied_impl(mapnik::raster_symbolizer & sym)
-{
- boost::optional<bool> premultiplied = sym.premultiplied();
- if (premultiplied)
- return ::PyBool_FromLong(*premultiplied);
- Py_RETURN_NONE;
-}
-
-}
using mapnik::raster_symbolizer;
void export_raster_symbolizer()
@@ -132,7 +121,7 @@ void export_raster_symbolizer()
">>> r.mesh_size = 32\n"
)
.add_property("premultiplied",
- &get_premultiplied_impl,
+ &raster_symbolizer::premultiplied,
&raster_symbolizer::set_premultiplied,
"Get/Set premultiplied status of the source image.\n"
"Can be used to override what the source data reports (when in error)\n" I get:
|
@springmeyer OK I'll add more converters tomorrow |
closing via 392561c |
This is totally mysterious.
python_optional
works for custom classes, but not built in types likedouble
andfloat
.Hence the failing test:
The text was updated successfully, but these errors were encountered: