You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "haosdent (JIRA)" <ji...@apache.org> on 2015/04/25 22:10:38 UTC
[jira] [Commented] (MESOS-2567) Python binding method
'declineOffer(offerid, filters=None)' raises exception when 'filters=None'
is assigned explicitly
[ https://issues.apache.org/jira/browse/MESOS-2567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14512683#comment-14512683 ]
haosdent commented on MESOS-2567:
---------------------------------
Review board: https://reviews.apache.org/r/33554/
> Python binding method 'declineOffer(offerid, filters=None)' raises exception when 'filters=None' is assigned explicitly
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: MESOS-2567
> URL: https://issues.apache.org/jira/browse/MESOS-2567
> Project: Mesos
> Issue Type: Bug
> Components: python api
> Reporter: Yan Xu
> Assignee: haosdent
>
> {code}
> def launchTasks(self, offerIds, tasks, filters=None): # The method's signature.
> ...
> declineOffer(offerId) # OK to call it this way
> declineOffer(offerId, filters=None) # Error when calling it this way
> {code}
> The error is printed from here
> https://github.com/apache/mesos/blob/04f8302c0cf81196e33ac538710dc5f48cd809d9/src/python/native/src/mesos/native/module.hpp#L66
> {code}
> if (obj == Py_None) {
> std::cerr << "None object given where protobuf expected" << std::endl;
> return false;
> }
> {code}
> And I think it's because when parsing the arguments the missing optional argument is interpreted as NULL and an explicit 'None' as Py_None and we didn't check the result properly here: https://github.com/apache/mesos/blob/04f8302c0cf81196e33ac538710dc5f48cd809d9/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.cpp#L632
> {code}
> if (filtersObj != NULL) {
> if (!readPythonProtobuf(filtersObj, &filters)) {
> PyErr_Format(PyExc_Exception,
> "Could not deserialize Python Filters");
> return NULL;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)