Skip to content

Instantly share code, notes, and snippets.

@arpitbbhayani
Created January 2, 2020 19:28
Show Gist options
  • Save arpitbbhayani/88215842f8d841bbf1b229a974131d53 to your computer and use it in GitHub Desktop.
Save arpitbbhayani/88215842f8d841bbf1b229a974131d53 to your computer and use it in GitHub Desktop.
Python code to evaluate addition of two operands
case TARGET(BINARY_ADD): {
PyObject *right = POP();
PyObject *left = TOP();
PyObject *sum;
if (PyUnicode_CheckExact(left) &&
PyUnicode_CheckExact(right)) {
sum = unicode_concatenate(tstate, left, right, f, next_instr);
}
else {
sum = PyNumber_Add(left, right);
}
SET_TOP(sum);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment