File tree Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ static bool add_int(int argc, py_Ref argv) {
1111 return true;
1212}
1313
14+ // this magic macro is used to get the input string
1415#define INPUT ""
1516
1617int main () {
Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ int main() {
2222 goto finalize ;
2323 }
2424
25- py_push (py_retval ());
26- py_pushnil ();
27- py_newint (py_pushtmp (), x );
28- py_newint (py_pushtmp (), y );
25+ py_push (py_retval ()); // callable
26+ py_pushnil (); // self or nil
27+ py_newint (py_pushtmp (), x ); // arg1
28+ py_newint (py_pushtmp (), y ); // arg2
2929
3030 if (!py_vectorcall (2 , 0 )) {
3131 py_printexc ();
@@ -39,19 +39,8 @@ int main() {
3939
4040 // Multiplier(x).multiply(y)
4141 py_newint (py_r0 (), x );
42- if (!py_smarteval ("Multiplier(_)" , __main__ , py_r0 ())) {
43- py_printexc ();
44- goto finalize ;
45- }
46-
47- py_push (py_retval ());
48- if (!py_pushmethod (py_name ("multiply" ))) {
49- py_printexc ();
50- goto finalize ;
51- }
52- py_newint (py_pushtmp (), y );
53-
54- if (!py_vectorcall (1 , 0 )) {
42+ py_newint (py_r1 (), y );
43+ if (!py_smarteval ("Multiplier(_0).multiply(_1)" , NULL , py_r0 (), py_r1 ())) {
5544 py_printexc ();
5645 goto finalize ;
5746 }
You can’t perform that action at this time.
0 commit comments