PyObject* PyBuiltInIter::__call__(vector<PyObject*>* args) { vector<PyObject*>* iterArgs = new vector<PyObject*>(); PyObject* x; ostringstream msg; if (args->size() != 1) { msg << "TypeError: expected 1 arguments, got " << args->size(); throw new PyException(PYWRONGARGCOUNTEXCEPTION,msg.str()); } x = (*args)[0]; PyObject* result = x->callMethod("__iter__",iterArgs); return result; }
PyObject* PyNoneType::__call__(vector<PyObject*>* args) { vector<PyObject*>* emptyArgs = new vector<PyObject*>(); PyObject * arg; string funName; switch (args-> size()) { case 0: throw new PyException(PYILLEGALOPERATIONEXCEPTION, "TypeError: cannot create 'NoneType' instances"); break; case 1: arg = (*args)[0]; funName = "__"+this->toString()+"__"; return arg->callMethod(funName,emptyArgs); break; default: throw new PyException(PYILLEGALOPERATIONEXCEPTION, "Incorrect number of arguments for PyNone type"); break; } }