BIND 10 trac1258, updated. 84ada921a2fe98489b578b6d780c1ad2e6c31482 [1258] improved type error string for Message.from_wire()
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 30 18:23:26 UTC 2011
The branch, trac1258 has been updated
via 84ada921a2fe98489b578b6d780c1ad2e6c31482 (commit)
from bb7833f2054edca11a32d24d17486f153db00ec1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 84ada921a2fe98489b578b6d780c1ad2e6c31482
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Sep 30 11:23:00 2011 -0700
[1258] improved type error string for Message.from_wire()
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 ++++++++
src/lib/dns/python/message_python.cc | 5 ++++-
src/lib/dns/python/tests/message_python_test.py | 1 +
3 files changed, 13 insertions(+), 1 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index d0565e1..73a63ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+288.? [func] jinmei
+ libdns++/pydnspp: added an option parameter to the "from wire"
+ methods of the Message class. One option is defined,
+ PRESERVE_ORDER, which specifies the parser to handle each RR
+ separately, preserving the order, and construct RRsets in the
+ message sections so that each RRset contains only one RR.
+ (Trac #1258, git TBD)
+
287. [bug]* jinmei
Python script files for log messages (xxx_messages.py) should have
been installed under the "isc" package. This fix itself should
diff --git a/src/lib/dns/python/message_python.cc b/src/lib/dns/python/message_python.cc
index 8f99835..6012153 100644
--- a/src/lib/dns/python/message_python.cc
+++ b/src/lib/dns/python/message_python.cc
@@ -647,6 +647,7 @@ Message_fromWire(PyObject* const pyself, PyObject* args) {
const char* b;
Py_ssize_t len;
unsigned int options = Message::PARSE_DEFAULT;
+
if (PyArg_ParseTuple(args, "y#", &b, &len) ||
PyArg_ParseTuple(args, "y#I", &b, &len, &options)) {
// We need to clear the error in case the first call to ParseTuple
@@ -685,7 +686,9 @@ Message_fromWire(PyObject* const pyself, PyObject* args) {
}
}
- PyErr_SetString(PyExc_TypeError, "Invalid arguments to Message.from_wire");
+ PyErr_SetString(PyExc_TypeError,
+ "from_wire() arguments must be a byte object and "
+ "(optional) parse options");
return (NULL);
}
diff --git a/src/lib/dns/python/tests/message_python_test.py b/src/lib/dns/python/tests/message_python_test.py
index 8f2d732..d769f27 100644
--- a/src/lib/dns/python/tests/message_python_test.py
+++ b/src/lib/dns/python/tests/message_python_test.py
@@ -427,6 +427,7 @@ test.example.com. 3600 IN A 192.0.2.2
self.assertRaises(InvalidMessageOperation, self.r.to_text)
def test_from_wire(self):
+ self.r.from_wire(2, 2)
self.assertRaises(TypeError, self.r.from_wire, 1)
self.assertRaises(InvalidMessageOperation,
Message.from_wire, self.r, bytes())
More information about the bind10-changes
mailing list