[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2020-03-12 Thread STINNER Victor
STINNER Victor added the comment: FYI I modified SystemError("bad call flags") error message to include the method name in bpo-39884. -- ___ Python tracker ___ __

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-08-13 Thread Zackery Spytz
Change by Zackery Spytz : -- pull_requests: +14986 pull_request: https://github.com/python/cpython/pull/14814 ___ Python tracker ___ ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-04-30 Thread Andreas Schneider
Andreas Schneider added the comment: And how do you deal with METH_VARARGS|METH_KEYWORDS functions which have 3 arguments? PyObject* myfunc(PyObject *py_obj, PyObject *args, PyObject *kwargs) -- ___ Python tracker

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-04-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, and this particular case was fixed in adfffc7343ce7ebc88ec734a803d3247ba8927fb. -- ___ Python tracker ___ ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-04-30 Thread Andreas Schneider
Andreas Schneider added the comment: Looking at: https://github.com/python/cpython/commit/359a2f3daba49fde0d3a07fb3c7a8b051c450d08 This is not fixing the underlying issue but hiding it. The right fix would be to use a union for ml_meth providing members for the 3 different function. So the

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-03-05 Thread STINNER Victor
STINNER Victor added the comment: New changeset 359a2f3daba49fde0d3a07fb3c7a8b051c450d08 by Victor Stinner (Stéphane Wirtel) in branch 'master': bpo-33012: Fix compilation warnings in memoryobject.c and _collectionsmodule.c (GH-12179) https://github.com/python/cpython/commit/359a2f3daba49fde0

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-03-05 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- pull_requests: +12175 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-03-05 Thread STINNER Victor
STINNER Victor added the comment: I marked bpo-36197 as a duplicate of this issue: """ gcc -pthread -c -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -g -Og -Wall-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-29 Thread STINNER Victor
STINNER Victor added the comment: New changeset 77000bbb104021b89368b9f7cab6f1417794e348 by Victor Stinner in branch '3.6': bpo-33012: Fix more invalid function cast warnings with gcc 8. (GH-10751) (GH-10796) https://github.com/python/cpython/commit/77000bbb104021b89368b9f7cab6f1417794e348

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-29 Thread miss-islington
miss-islington added the comment: New changeset 1659c08d5d17357597f220c4d297b19e7a59737c by Miss Islington (bot) in branch '3.7': bpo-33012: Fix more invalid function cast warnings with gcc 8. (GH-10751) https://github.com/python/cpython/commit/1659c08d5d17357597f220c4d297b19e7a59737c -

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-29 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +10043 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-29 Thread miss-islington
Change by miss-islington : -- pull_requests: +10042 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Only one function cast warning is left, and it is a separate issue: issue33015. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 1c607155c9e363489036ae6258b165a3fae75134 by Serhiy Storchaka in branch 'master': bpo-33012: Fix more invalid function cast warnings with gcc 8. (GH-10751) https://github.com/python/cpython/commit/1c607155c9e363489036ae6258b165a3fae75134

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread miss-islington
miss-islington added the comment: New changeset d5c8bd8e4cc04873254f0bd38895a6479c23c8aa by Miss Islington (bot) in branch '3.6': bpo-33012: Fix signatures of METH_NOARGS functions. (GH-10736) (GH-10748) https://github.com/python/cpython/commit/d5c8bd8e4cc04873254f0bd38895a6479c23c8aa -

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: + ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset ad8ac54aa3d2323bdb5feb5e858a922840358187 by Serhiy Storchaka in branch '3.7': bpo-33012: Fix signatures of METH_NOARGS functions. (GH-10736) (GH-10748) https://github.com/python/cpython/commit/ad8ac54aa3d2323bdb5feb5e858a922840358187 ---

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread miss-islington
Change by miss-islington : -- pull_requests: +9998 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +9996 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread STINNER Victor
STINNER Victor added the comment: > New changeset 62be74290aca26d16f3f55ece7ff6dad14e60e8d by Serhiy Storchaka in > branch 'master': > bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749) I still get something 100 warnings with GCC 8.2.1 on Fedora 29. I wrote PR 10744 to add a

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9991 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 62be74290aca26d16f3f55ece7ff6dad14e60e8d by Serhiy Storchaka in branch 'master': bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749) https://github.com/python/cpython/commit/62be74290aca26d16f3f55ece7ff6dad14e60e8d --

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 81524022d0c0df7a41f9b2b2df41e2ebe140e610 by Serhiy Storchaka in branch 'master': bpo-33012: Fix signatures of METH_NOARGS funstions. (GH-10736) https://github.com/python/cpython/commit/81524022d0c0df7a41f9b2b2df41e2ebe140e610 -- ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +9983 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 4a934d490fac779d8954a8292369c4506bab23fa by Serhiy Storchaka in branch 'master': bpo-33012: Fix invalid function cast warnings with gcc 8 in Argument Clinic. (GH-6748) https://github.com/python/cpython/commit/4a934d490fac779d8954a8292369c4506

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-10-24 Thread Michael Airey
Michael Airey added the comment: Try this - https://github.com/siddhesh/cpython/tree/func-cast -- nosy: +resmord ___ Python tracker ___ ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-10-24 Thread Gregory P. Smith
Change by Gregory P. Smith : -- nosy: +gregory.p.smith versions: +Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-10-15 Thread STINNER Victor
STINNER Victor added the comment: I marked bpo-34992 as a duplicate of this issue: I use Fedora 28 and gcc (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5) and I get a lot of warnings, with the standard config of Python (./configure) Objects/call.c: In function '_PyMethodDef_RawFastCallDict': Objects/

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-09-23 Thread Terry J. Reedy
Terry J. Reedy added the comment: If I click the link for PR 6748, I see a page with "We went looking everywhere, but couldn’t find those commits." Maybe the PR needs to be refreshed or closed and maybe reopened. PR 6749 looks normal. -- nosy: +terry.reedy __

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-06-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem with invalid function signatures was initially reported in old issue1648268. -- ___ Python tracker ___ ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-28 Thread Xavier de Gaye
Xavier de Gaye added the comment: > There are still quite a few similar warnings on git-master. Do they indicate > the same problem or should I open new issues? This is the same issue, the warning line ends with [-Wcast-function-type]. -- ___ Pytho

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-28 Thread Xavier de Gaye
Xavier de Gaye added the comment: > Pedantically the correct way is to cast to a function pointer with no > prototype (empty parentheses) Thanks for raising this point Antti. This is hinted at by the gcc 8 documentation on -Wcast-function-type: "The function type void (*) (void) is special a

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-28 Thread Chih-Hsuan Yen
Chih-Hsuan Yen added the comment: There are still quite a few similar warnings on git-master. Do they indicate the same problem or should I open new issues? For example: gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes-std=c99 -Wextra -W

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-27 Thread Siddhesh Poyarekar
Siddhesh Poyarekar added the comment: > Pedantically the correct way is to cast to a function pointer with no > prototype (empty parentheses) and from that to the target type. See for > example. See for example https://godbolt.org/g/FdPdUj This is one way that the gcc diagnostics explicitly a

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-27 Thread Antti Haapala
Antti Haapala added the comment: Well, there's only one problem with casting to void *: while converting the function pointer to another *is* standard-compliant, and GCC is being just hypersensitive here, casting a function pointer to void * isn't, though it is a common extension (http://port

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-27 Thread Xavier de Gaye
Xavier de Gaye added the comment: > But the problem is that additional flags can be used, e.g. METH_CLASS. Right, https://docs.python.org/3/c-api/structures.html says: "The individual flags indicate either a calling convention or a binding convention". This may be overcome by introducing anot

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Great idea! But the problem is that additional flags can be used, e.g. METH_CLASS. -- ___ Python tracker ___ __

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-26 Thread Xavier de Gaye
Xavier de Gaye added the comment: I propose to enhance the changes made by PR 6748 and PR 6749 so that gcc 8 triggers a warning when the function type of a PyMethodDef element does not match its flags by using a macro (see below) that casts the function first to the function type correspondin

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-25 Thread Eitan Adler
Change by Eitan Adler : -- nosy: +eitan.adler ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-25 Thread miss-islington
miss-islington added the comment: New changeset 20b797dafa149afcdd7b64e489eb8ea1386d8eb4 by Miss Islington (bot) in branch '3.6': bpo-33012: Add -Wno-cast-function-type for gcc 8. (GH-6757) https://github.com/python/cpython/commit/20b797dafa149afcdd7b64e489eb8ea1386d8eb4 -- nosy: +mi

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-25 Thread miss-islington
Change by miss-islington : -- pull_requests: +6751 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset ef91ddeae79497fac25545dd68ee55a5a3c60e8d by Serhiy Storchaka in branch '3.7': bpo-33012: Add -Wno-cast-function-type for gcc 8. (GH-6757) https://github.com/python/cpython/commit/ef91ddeae79497fac25545dd68ee55a5a3c60e8d -- __

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it safer to silence this kind of warnings in 3.7 and 3.6. PR 6757 does this. -- ___ Python tracker ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6444 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread pmpp
Change by pmpp : -- nosy: +pmpp ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailma

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue33454 about a real bug found thanks to these warnings. -- ___ Python tracker ___ _

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread Charalampos Stratakis
Charalampos Stratakis added the comment: Is it possible/feasible to fix that for the 3.7 and 3.6 branches as well? -- ___ Python tracker ___ ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The following PRs fix warnings in casts to PyCFunction for method conventions different from METH_NOARGS, METH_O and METH_VARARGS. PR 6748 does this for Argument Clinic generated code (all files except Tools/clinic/clinic.py are generated). PR 6749 does it f

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6437 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-05-10 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6436 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 6405feecda6a5d5dd7a4240eb3054a2676ed29b1 by Serhiy Storchaka in branch 'master': bpo-33012: Fix invalid function casts for long_long. (GH-6652) https://github.com/python/cpython/commit/6405feecda6a5d5dd7a4240eb3054a2676ed29b1 --

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-30 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6348 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-30 Thread Siddhesh Poyarekar
Siddhesh Poyarekar added the comment: Yeah, there are multiple such uses that need wrappers to actually fix for gcc8, which will be released this week. I think I'll have more time for some more patches in this vein this weekend. -- ___ Python trac

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-30 Thread STINNER Victor
STINNER Victor added the comment: The commit 55edd0c185ad2d895b5d73e47d67049bc156b654 introduced a new warning: gcc -pthread -c -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes -O0 -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 55edd0c185ad2d895b5d73e47d67049bc156b654 by Serhiy Storchaka (Siddhesh Poyarekar) in branch 'master': bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030) https://github.com/python/cpython/commit/55edd0c185ad2d89

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-09 Thread Siddhesh Poyarekar
Siddhesh Poyarekar added the comment: Fair enough, I'll reduce my scope of changes for this patchset, especially since I'm unable to find enough time to work on the remaining changes I had thought of in the coming weeks. I'll post an updated patch soonish. -- ___

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-04 Thread Martin Panter
Martin Panter added the comment: Sorry, I realize there is a problem remaining with the pointer types for "Noddy_name" (Noddy vs PyObject pointers), so you can't remove the cast there. But my suggestion should still apply to other places, for instance the "error_out" method in Doc/howto/cport

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-04-01 Thread Martin Panter
Martin Panter added the comment: Siddhesh, it looks like your fixes make the C function signatures match the signature expected in the PyMethodDef structure. If so, I suggest to remove the (PyCFunction) casts from those structure definitions as well. For instance, now that we have PyObject

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-15 Thread Siddhesh Poyarekar
Siddhesh Poyarekar added the comment: I forgot to clarify that the function cast warning allows for variable argument casts as a wildcard, which is my basis for the PyObject *(*)(PyObject *, PyObject *, ...) fix proposal. -- ___ Python tracker

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-15 Thread Siddhesh Poyarekar
Siddhesh Poyarekar added the comment: > The warning in GCC shouldn't probably have been enabled at all in `-Wall > -Wextra` because the cast is explicit. However, it is somewhat true. The explicit cast is precisely what enables the more nuanced function cast warning where it checks the functi

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-15 Thread Antti Haapala
Antti Haapala added the comment: Yea, I looked into `ceval.c` and the function is *called incorrectly*, so there is undefined behaviour there - it has been wrong all along, in 3.5 all the way down to 2-something if (flags & (METH_NOARGS | METH_O)) { PyCFunction meth = PyCF

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- dependencies: +Questionable code in OrderedDict definition ___ Python tracker ___ ___ Python-bugs-lis

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-15 Thread Siddhesh Poyarekar
Siddhesh Poyarekar added the comment: > I don't have GCC 8 so I cannot verify this bug, but *function pointer casts* > are fine - any function pointer can be cast to any other function pointer - > it is only that they must *not* be called unless cast back again to be > compatible with the fun

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-15 Thread Antti Haapala
Antti Haapala added the comment: I don't have GCC 8 so I cannot verify this bug, but *function pointer casts* are fine - any function pointer can be cast to any other function pointer - it is only that they must *not* be called unless cast back again to be compatible with the function definit

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-08 Thread Siddhesh Poyarekar
Change by Siddhesh Poyarekar : -- keywords: +patch pull_requests: +5792 stage: -> patch review ___ Python tracker ___ ___ Python-bug

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-06 Thread Charalampos Stratakis
Charalampos Stratakis added the comment: We are getting hit by that quite often on Fedora, with the transition to gcc 8 and it creates unnecessary noise at our build logs. Thanks for working on that. When you sent your PR I can test it within our build system and verify if it works.

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Argument Clinic generates the following declaration for the second parameter of METH_NOARGS functions: PyObject *Py_UNUSED(ignored) It would be nice to follow the same style. If the first parameter is of type PyObject* too, the explicit cast to PyCFun

[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-06 Thread Siddhesh Poyarekar
New submission from Siddhesh Poyarekar : gcc 8 has added a new warning heuristic to detect invalid function casts and a stock python build seems to hit that warning quite often. The most common is the cast of a METH_NOARGS function (that uses just one argument) to a PyCFunction. The fix is p