Changeset 1161a61 in git


Ignore:
Timestamp:
Jun 21, 2012, 11:21:06 PM (11 years ago)
Author:
Alexander Dreyer <alexander.dreyer@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'c987db42cd2ec943b97ac5746c99892ceddf909c')
Children:
7b156fb13a72b542c9e1172929270ebd7d365b14
Parents:
b2aa08657343fc20d230f035de4ac9ae5543a988
git-author:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-06-21 23:21:06+02:00
git-committer:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-08-01 23:07:44+02:00
Message:
fix: pyobject handles ternary operations acordingly
Location:
Singular
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/blackbox.h

    rb2aa08 r1161a61  
    5757BOOLEAN blackboxDefaultOp2(int op,leftv l, leftv r1, leftv r2);
    5858
     59/// default procedure blackboxDefaultOp3, to be called as "default:" branch
     60BOOLEAN blackboxDefaultOp3(int op,leftv l, leftv r1,leftv r2, leftv r3);
     61
    5962/// default procedure blackboxDefaultOpM, to be called as "default:" branch
    6063BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r);
  • Singular/pyobject.cc

    rb2aa08 r1161a61  
    158158    switch(op)
    159159    {
    160       case ATTRIB_CMD: PyObject_SetAttr(*this, arg1, arg2); return self();
    161     }
    162     Werror("ternary operation %s not implemented for 'pyobject`", iiTwoOps(op));
     160      case ATTRIB_CMD:
     161        if(PyObject_SetAttr(*this, arg1, arg2) == -1) handle_exception();
     162        return self();
     163    }
    163164    return self(null_tag());
    164165  }
     
    227228  }
    228229
    229   void handle_exception() {
     230  void handle_exception() const {
    230231   
    231232    PyObject *pType, *pMessage, *pTraceback;
     
    557558  PythonCastDynamic rhs2(arg3);
    558559
    559   return lhs(op, rhs1, rhs2).assign_to(res);
     560  if (!lhs(op, rhs1, rhs2).assign_to(res))
     561    return blackboxDefaultOp3(op, res, arg1, arg2, arg3);
    560562}
    561563
Note: See TracChangeset for help on using the changeset viewer.