Looking at the UNARY_NOT case in ceval.c: case UNARY_NOT: v = TOP(); err = PyObject_IsTrue(v); Py_DECREF(v); if (err == 0) { Py_INCREF(Py_True); SET_TOP(Py_True); continue; } else if (err > 0) { Py_INCREF(Py_False); SET_TOP(Py_False); err = 0; continue; } STACKADJ(-1); break; I don't understand why there's a STACKADJ(-1) at its end. Looking at the code, we know that if the CPU arrives to the STACKADJ, it's because of an error condition in the PyObject_IsTrue that sets err to a < 0 value, so exiting the big switch statement, an error will be raised. So the question is, why there's the need to skip the top stack PyObject? It's a different behaviour comparing it to the all other unary operators. For example: case UNARY_NEGATIVE: v = TOP(); x = PyNumber_Negative(v); Py_DECREF(v); SET_TOP(x); if (x != NULL) continue; break; There's no STACKADJ instruction on errors. Can someone explain it? Thanks a lot Cesare
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4