[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Changes by Charles-François Natali cf.nat...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Tshepang Lekhonkhobe added the comment: @antoine I don't understand This is a lot of code churn, but it touches code that is unlikely to be modified otherwise, so I guess it's ok.. What does it mean it's okay when it touches on code that's unlikely to be modified? -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Charles-François Natali added the comment: I don't understand This is a lot of code churn, but it touches code that is unlikely to be modified otherwise, so I guess it's ok.. What does it mean it's okay when it touches on code that's unlikely to be modified? The problem with refactoring is that it can complicate further merges between branches. In this case, the code is nearly never touched, so it's unlikely to be an issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Tshepang Lekhonkhobe added the comment: Ok, I thought so. Just wanted to make sure. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Roundup Robot added the comment: New changeset 12cbb5183d98 by Charles-Francois Natali in branch 'default': Issue #17917: Use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() http://hg.python.org/cpython/rev/12cbb5183d98 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
STINNER Victor added the comment: ins_macro-2.diff looks good to me, go ahead! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Charles-François Natali added the comment: PC/_msi.c: Oh, here you should remove cast to int. Example: PyModule_AddIntMacro(m, (int)MSIDBOPEN_CREATEDIRECT); I'm surprised that the does compile. You may have a (int)MSIDBOPEN_CREATEDIRECT variable :-) Probably, good catch ;-) I'll fix that. Modules/fcntlmodule.c and Modules/posixmodule.c are using explicit cast to long. I don't know if there is a good reason for such cast. There's a prototype, so arguments are implicitly converted to long: PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long); #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Changes by Charles-François Natali cf.nat...@gmail.com: Added file: http://bugs.python.org/file30167/ins_macro-2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
New submission from Charles-François Natali: In many cases, PyModule_AddIntMacro() could be used instead of PyModule_AddIntConstant(), e.g. in socketmodule.c and posixmodule.c: PyModule_AddIntMacro(m, AF_INET6); vs (currently) PyModule_AddIntConstant(m, AF_INET6, AF_INET6); It reduces the possibility of typo and is less verbose. -- keywords: easy messages: 188531 nosy: neologix priority: low severity: normal stage: needs patch status: open title: use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Charles-François Natali added the comment: Here's a (gigantic) patch. I used an ad-hoc script for the conversion (next time I might try with coccinelle). I tested it on Linux, FreeBSD, Openindiana, OS-X and Windows. -- keywords: +needs review, patch nosy: +pitrou stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Changes by Charles-François Natali cf.nat...@gmail.com: Added file: http://bugs.python.org/file30155/ins_macro.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Antoine Pitrou added the comment: This is a lot of code churn, but it touches code that is unlikely to be modified otherwise, so I guess it's ok. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
STINNER Victor added the comment: Could you please generete the same patch without --git so it can be reviewed on Rietveld? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Changes by Charles-François Natali cf.nat...@gmail.com: Removed file: http://bugs.python.org/file30155/ins_macro.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
Changes by Charles-François Natali cf.nat...@gmail.com: Added file: http://bugs.python.org/file30157/ins_macro-1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable
STINNER Victor added the comment: Modules/fcntlmodule.c and Modules/posixmodule.c are using explicit cast to long. I don't know if there is a good reason for such cast. PC/_msi.c: Oh, here you should remove cast to int. Example: PyModule_AddIntMacro(m, (int)MSIDBOPEN_CREATEDIRECT); I'm surprised that the does compile. You may have a (int)MSIDBOPEN_CREATEDIRECT variable :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17917 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com