Changeset 11
- Timestamp:
- 04/23/07 14:58:16 (2 years ago)
- Files:
-
- branches/pygetsetcall/src/nrnpython/nrnpy_hoc.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/pygetsetcall/src/nrnpython/nrnpy_hoc.cpp
r10 r11 156 156 } 157 157 } 158 if (!sym) { 159 char e[200]; 160 sprintf(e, "'%s' is not a hoc variable name.", name); 161 PyErr_SetString(PyExc_LookupError, e); 162 } 158 163 return sym; 159 164 } … … 481 486 return 0; 482 487 }else{ 488 char e[200]; 489 sprintf(e, "'%s' requires subscript for assignment", n); 490 PyErr_SetString(PyExc_TypeError, e); 483 491 return -1; 484 492 } … … 489 497 switch (sym->type) { 490 498 case VAR: // double* 499 if (ISARRAY(sym)) { 500 PyErr_SetString(PyExc_TypeError, "wrong number of subscripts"); 501 return -1; 502 } 491 503 hoc_pushs(sym); 492 504 hoc_evalpointer(); … … 519 531 break; 520 532 default: 533 PyErr_SetString(PyExc_TypeError, "not assignable"); 534 err = -1; 521 535 break; 522 536 } … … 541 555 PyObject* result = NULL; 542 556 PyHocObject* po = (PyHocObject*)self; 543 assert(po->sym_); 557 if (!po->sym_) { 558 PyErr_SetString(PyExc_TypeError, "unsubscriptable object"); 559 return NULL; 560 } 544 561 assert(po->type_ == 3); 545 562 Arrayinfo* a = hocobj_aray(po->sym_, po->ho_); … … 576 593 int err = -1; 577 594 PyHocObject* po = (PyHocObject*)self; 578 assert(po->sym_); 595 if (!po->sym_) { 596 PyErr_SetString(PyExc_TypeError, "unsubscriptable object"); 597 return -1; 598 } 579 599 assert(po->type_ == 3); 580 600 Arrayinfo* a = hocobj_aray(po->sym_, po->ho_); 581 assert(a->nsub - 1 == po->nindex_); 601 if (a->nsub - 1 != po->nindex_) { 602 PyErr_SetString(PyExc_TypeError, "wrong number of subscripts"); 603 return -1; 604 } 582 605 if (po->ho_) { 583 606 eval_component(po, i);

