This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Alexander Riccio
Recipients Alexander Riccio, amaury.forgeotdarc, belopolsky, meador.inge
Date 2015-12-12.04:50:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1449895849.48.0.817393868037.issue25845@psf.upfronthosting.co.za>
In-reply-to
Content
I found this while writing up a separate bug (CPython doesn't use static analysis!).


In _ctypes/cfield.c, Z_set has a bug of some sort:

    if (PyLong_Check(value) || PyLong_Check(value)) {

See: https://hg.python.org/cpython/file/tip/Modules/_ctypes/cfield.c#l1378

...which has been there for at least 5 years: https://hg.python.org/cpython/rev/cab14be0ada1


I'm not sure what the original programmer meant - it's been around forever & I don't know what was there before it - but PyLong_Check(value) is evaluated twice. Which doesn't really make sense.

Compiling with /analyze found this quite easily:

c:\pythondev\repo\modules\_ctypes\cfield.c(1378): warning C6287: Redundant code:  the left and right sub-expressions are identical.



There's a similar issue in P_set, at line 1486.
History
Date User Action Args
2015-12-12 04:50:49Alexander Ricciosetrecipients: + Alexander Riccio, amaury.forgeotdarc, belopolsky, meador.inge
2015-12-12 04:50:49Alexander Ricciosetmessageid: <1449895849.48.0.817393868037.issue25845@psf.upfronthosting.co.za>
2015-12-12 04:50:49Alexander Ricciolinkissue25845 messages
2015-12-12 04:50:48Alexander Ricciocreate