File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
examples/extension-hatch/examplePy Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,15 @@ static PyObject *
5
5
temperature_celsius_to_fahrenheit (PyObject * self , PyObject * args )
6
6
{
7
7
long celsius ;
8
+ long fahrenheit ;
8
9
PyObject * ret ;
9
10
10
11
if (!PyArg_ParseTuple (args , "l" , & celsius ))
11
12
return NULL ;
12
13
13
- celsius = (celsius * 9 /5 ) + 32 ;
14
+ fahrenheit = (celsius * 9 /5 ) + 32 ;
14
15
15
- ret = PyLong_FromLong (celsius );
16
+ ret = PyLong_FromLong (fahrenheit );
16
17
Py_INCREF (ret );
17
18
return ret ;
18
19
}
@@ -21,14 +22,15 @@ static PyObject *
21
22
temperature_fahrenheit_to_celsius (PyObject * self , PyObject * args )
22
23
{
23
24
long fahrenheit ;
25
+ long celsius ;
24
26
PyObject * ret ;
25
27
26
28
if (!PyArg_ParseTuple (args , "l" , & fahrenheit ))
27
29
return NULL ;
28
30
29
- fahrenheit = (fahrenheit - 32 ) * 9 /5 ;
31
+ celsius = (fahrenheit - 32 ) * 9 /5 ;
30
32
31
- ret = PyLong_FromLong (fahrenheit );
33
+ ret = PyLong_FromLong (celsius );
32
34
Py_INCREF (ret );
33
35
return ret ;
34
36
}
You can’t perform that action at this time.
0 commit comments