Message ID | 20220722191935.2353648-1-i.maximets@ovn.org |
---|---|
State | Accepted |
Commit | 78dad3a0c8135f299d2a6e60b37260f523305f83 |
Headers | show |
Series | [ovs-dev] python-c-ext: Use designated initializers for type and module. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/intel-ovs-compilation | success | test: success |
ovsrobot/apply-robot | warning | apply and check: warning |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
Bleep bloop. Greetings Ilya Maximets, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: WARNING: Line lacks whitespace around operator #64 FILE: python/ovs/_json.c:176: .tp_itemsize= 0, Lines checked: 90, Warnings: 1, Errors: 0 Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
On 7/22/22 21:19, Ilya Maximets wrote: > Python documentation suggests to do so "to avoid listing all the > PyTypeObject fields that you don't care about and also to avoid > caring about the fields' declaration order". And that does make > sense. > > Signed-off-by: Ilya Maximets <i.maximets@ovn.org> > --- Aside from the 0-day bot style issue this looks good to me: Acked-by: Dumitru Ceara <dceara@redhat.com> Thanks!
On 8/26/22 15:27, Dumitru Ceara wrote: > On 7/22/22 21:19, Ilya Maximets wrote: >> Python documentation suggests to do so "to avoid listing all the >> PyTypeObject fields that you don't care about and also to avoid >> caring about the fields' declaration order". And that does make >> sense. >> >> Signed-off-by: Ilya Maximets <i.maximets@ovn.org> >> --- > > Aside from the 0-day bot style issue this looks good to me: > > Acked-by: Dumitru Ceara <dceara@redhat.com> Thanks! I added the missed space and applied the patch. Best regards, Ilya Maximets.
diff --git a/python/ovs/_json.c b/python/ovs/_json.c index 0b980038b..dd68a4bbd 100644 --- a/python/ovs/_json.c +++ b/python/ovs/_json.c @@ -170,55 +170,21 @@ static PyMethodDef Parser_methods[] = { static PyTypeObject json_ParserType = { PyVarObject_HEAD_INIT(NULL, 0) - "ovs._json.Parser", /* tp_name */ - sizeof (json_ParserObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) Parser_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - "Parser objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Parser_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - Parser_new, /* tp_new */ + .tp_name = "ovs._json.Parser", + .tp_doc = "Parser objects", + .tp_basicsize = sizeof(json_ParserObject), + .tp_itemsize= 0, + .tp_dealloc = (destructor) Parser_dealloc, + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + .tp_methods = Parser_methods, + .tp_new = Parser_new, }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, - "ovs._json", /* m_name */ - "OVS JSON Parser module", /* m_doc */ - 0, /* m_size */ - 0, /* m_methods */ - 0, /* m_slots */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ + .m_name = "ovs._json", + .m_doc = "OVS JSON Parser module", + .m_size = 0, }; PyMODINIT_FUNC
Python documentation suggests to do so "to avoid listing all the PyTypeObject fields that you don't care about and also to avoid caring about the fields' declaration order". And that does make sense. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> --- python/ovs/_json.c | 56 +++++++++------------------------------------- 1 file changed, 11 insertions(+), 45 deletions(-)