From 112c99981821b5c9bd7e4e85533c045792a433b8 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 6 Jul 2004 04:36:50 +0000 Subject: [PATCH] obtain correct class name via cl.attr("__name__") [SVN r23359] --- include/boost/python/suite/indexing/map_indexing_suite.hpp | 4 +++- test/map_indexing_suite.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/boost/python/suite/indexing/map_indexing_suite.hpp b/include/boost/python/suite/indexing/map_indexing_suite.hpp index 776b2473..35c06bb5 100644 --- a/include/boost/python/suite/indexing/map_indexing_suite.hpp +++ b/include/boost/python/suite/indexing/map_indexing_suite.hpp @@ -73,7 +73,9 @@ namespace boost { namespace python { { // Wrap the map's element (value_type) std::string elem_name = "map_indexing_suite_"; - elem_name += cl.ptr()->ob_type->tp_name; // the class name + object class_name(cl.attr("__name__")); + extract class_name_extractor(class_name); + elem_name += class_name_extractor(); elem_name += "_entry"; typedef typename mpl::if_< diff --git a/test/map_indexing_suite.py b/test/map_indexing_suite.py index f6752684..28edc5cf 100644 --- a/test/map_indexing_suite.py +++ b/test/map_indexing_suite.py @@ -5,6 +5,9 @@ ##################################################################### >>> from map_indexing_suite_ext import * +>>> assert "map_indexing_suite_IntMap_entry" in dir() +>>> assert "map_indexing_suite_TestMap_entry" in dir() +>>> assert "map_indexing_suite_XMap_entry" in dir() >>> x = X('hi') >>> x hi