Subject: [Boost-bugs] [Boost C++ Libraries] #1181: [boost.python] can modify enum value
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-08-14 08:17:13
#1181: [boost.python] can modify enum value
------------------------------------------+---------------------------------
Reporter: qiaozhiqiang_at_[hidden] | Owner: dave
Type: Bugs | Status: new
Milestone: To Be Determined | Component: Python
Version: release 1.34.0 | Severity: Problem
Keywords: enum modify |
------------------------------------------+---------------------------------
I use boost 1.34.0, python 2.5.1
User can modify the enum value, But enum should be a const value(read
only).
enum my_enum{my_value};
struct my_s{ enum{ my_value2 };};
void my_export
{
enum_< my_enum >("my_enum") .value("my_value", my_value);
scope* my_s_scope = new scope(class_< my_s>("my_s", init< >()));
scope().attr("my_value2") = (int)my_value2;
delete my_s_scope;
}
#in python
module.my_enum.my_value = 1
print module.my_enum.my_value
module.my_s.my_value2 = 2
print module.my_s.my_value2
# we can modify the const value.
# output
# 1
# 2
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1181>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC