@@ -70,21 +70,23 @@ static PyObject* _setup_module(PyObject* module) {
70
70
PyObject * collections = PyImport_ImportModule ("collections" );
71
71
72
72
// Set up a Command namedtuple object, with empty default for heredocs substructure.
73
- PyObject * defaults = Py_BuildValue ("(())" );
74
73
PyObject * args = Py_BuildValue ("ss" , "Command" , "cmd sub_cmd json original start_line end_line flags value heredocs" );
75
- PyObject * keywords = PyDict_New ();
76
- PyDict_SetItemString (keywords , "defaults" , defaults );
74
+ PyObject * kwargs = PyDict_New ();
75
+ PyObject * defaults = Py_BuildValue ("(())" );
76
+ PyDict_SetItemString (kwargs , "defaults" , defaults );
77
77
PyObject * namedtuple_method = PyObject_GetAttrString (collections , "namedtuple" );
78
- PyDockerfile_Command = PyObject_Call (namedtuple_method , args , keywords );
78
+ PyDockerfile_Command = PyObject_Call (namedtuple_method , args , kwargs );
79
79
Py_DECREF (args );
80
- Py_DECREF (keywords );
80
+ Py_DECREF (kwargs );
81
+ Py_DECREF (defaults );
81
82
Py_DECREF (namedtuple_method );
82
83
PyObject_SetAttrString (
83
84
PyDockerfile_Command , "__module__" ,
84
85
PyObject_GetAttrString (module , "__name__" )
85
86
);
86
87
PyModule_AddObject (module , "Command" , PyDockerfile_Command );
87
88
89
+ // Set up a Heredoc namedtuple object.
88
90
PyDockerfile_Heredoc = PyObject_CallMethod (
89
91
collections , "namedtuple" , "ss" ,
90
92
"Heredoc" , "name file_descriptor content"
0 commit comments