[svn] commit: r2342 - /experiments/python-binding/src/lib/dns/python/name_python.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jun 30 09:28:12 UTC 2010


Author: jelte
Date: Wed Jun 30 09:28:12 2010
New Revision: 2342

Log:
use heap-allocated instance for root_name

Modified:
    experiments/python-binding/src/lib/dns/python/name_python.cc

Modified: experiments/python-binding/src/lib/dns/python/name_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/name_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/name_python.cc Wed Jun 30 09:28:12 2010
@@ -642,9 +642,7 @@
     addClassVariable(name_type, "COMPRESS_POINTER_MARK16", Py_BuildValue("I", Name::COMPRESS_POINTER_MARK16));
 
     s_Name* root_name = PyObject_New(s_Name, &name_type);
-    // casting const away here should be safe, as it should be impossible
-    // to modify attributes of built-in/extension types.
-    root_name->name = const_cast<Name*>(&Name::ROOT_NAME());
+    root_name->name = new Name(Name::ROOT_NAME());
     PyObject* po_ROOT_NAME = root_name;
     addClassVariable(name_type, "ROOT_NAME", po_ROOT_NAME);
 




More information about the bind10-changes mailing list