BIND 10 #2853: Python wrapper of data source extensions
BIND 10 Development
do-not-reply at isc.org
Wed Jun 12 16:09:49 UTC 2013
#2853: Python wrapper of data source extensions
-------------------------------------+-------------------------------------
Reporter: jinmei | Owner:
Type: task | vorner
Priority: medium | Status:
Component: data source | reviewing
Keywords: | Milestone:
Sensitive: 0 | Sprint-20130625
Sub-Project: DNS | Resolution:
Estimated Difficulty: 5 | CVSS Scoring:
Total Hours: 0 | Defect Severity: N/A
| Feature Depending on Ticket:
| shared memory data source
| Add Hours to Ticket: 0
| Internal?: 0
-------------------------------------+-------------------------------------
Comment (by jinmei):
Replying to [comment:22 muks]:
> Replying to [comment:21 jinmei]:
> > This seems to be problematic:
> >
> > {{{#!cpp
> > PyObject *tup = Py_BuildValue("(ssI)",
> > status[i].getName().c_str(),
> >
status[i].getSegmentType().c_str(),
> >
status[i].getSegmentState());
> > }}}
> >
> > because if the state is unused, getSegmentType() throws.
>
> I have added code to handle this exception, and also updated the C++
> `getStatus()` implementation to be more correct (#2943 should be a
> duplicate now). However, from the Python code I can't find a way to
> trigger that exception to test it.
Regarding the test: if you meant how to test the case of unused state,
you should simply use a data source with disabling in-memory cache.
Regarding the code, I personally think it's better to check the state
explicitly and use Py_None if it's SEGMENT_UNUSED.
And, not directly on this point, but on a closer look the code looks
generally unsafe. For example, in `ConfigurableClientList_getStatus`
if this fails:
{{{#!cpp
PyObject* tup = Py_BuildValue("(sOI)",
status[i].getName().c_str(),
segment_type,
status[i].getSegmentState());
}}}
then the reference to segment_type will be lost. You'll need a help
of `PyObjectContainer` here.
--
Ticket URL: <http://bind10.isc.org/ticket/2853#comment:24>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list