diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-20 14:37:51 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-20 18:20:05 -0300 |
commit | 4d89c3d81477a730b7d7ce6c9b5c062ee8cd1ec7 (patch) | |
tree | ad6d249bd8d952bc8db3b31aaa3eb0f9279bcf41 /libshiboken/pyenum.cpp | |
parent | 08acf3d1c3f5fd364ebd29ae00f48b6f6ad2f97d (diff) |
All enums are now extensible to match the C++ casting behaviour.
Now the user can build new values of a particular enum type passing
an integer to its constructor. Thus, the following C++ code:
MyEnum val = (MyEnum) 1;
is the equivalent of this Python code:
val = MyEnum(1)
The enum unit tests were also updated.
Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'libshiboken/pyenum.cpp')
-rw-r--r-- | libshiboken/pyenum.cpp | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/libshiboken/pyenum.cpp b/libshiboken/pyenum.cpp index 3a223ef08..b7bacc9e6 100644 --- a/libshiboken/pyenum.cpp +++ b/libshiboken/pyenum.cpp @@ -77,14 +77,6 @@ extern "C" { PyObject* -SbkEnumObject_NonExtensibleNew(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyErr_SetString(PyExc_TypeError, "enum is not extensible"); - return 0; -} - - -PyObject* SbkEnumObject_repr(PyObject* self) { return PyString_FromFormat("<enum-item %s.%s (%ld)>", |