Skip to content

Commit 565f8d4

Browse files
committed
use explicit return names
1 parent 11e3521 commit 565f8d4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

examples/extension-hatch/examplePy/temperature.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ static PyObject *
55
temperature_celsius_to_fahrenheit(PyObject *self, PyObject *args)
66
{
77
long celsius;
8+
long fahrenheit;
89
PyObject *ret;
910

1011
if (!PyArg_ParseTuple(args, "l", &celsius))
1112
return NULL;
1213

13-
celsius = (celsius * 9/5) + 32;
14+
fahrenheit = (celsius * 9/5) + 32;
1415

15-
ret = PyLong_FromLong(celsius);
16+
ret = PyLong_FromLong(fahrenheit);
1617
Py_INCREF(ret);
1718
return ret;
1819
}
@@ -21,14 +22,15 @@ static PyObject *
2122
temperature_fahrenheit_to_celsius(PyObject *self, PyObject *args)
2223
{
2324
long fahrenheit;
25+
long celsius;
2426
PyObject *ret;
2527

2628
if (!PyArg_ParseTuple(args, "l", &fahrenheit))
2729
return NULL;
2830

29-
fahrenheit = (fahrenheit - 32) * 9/5;
31+
celsius = (fahrenheit - 32) * 9/5;
3032

31-
ret = PyLong_FromLong(fahrenheit);
33+
ret = PyLong_FromLong(celsius);
3234
Py_INCREF(ret);
3335
return ret;
3436
}

0 commit comments

Comments
 (0)