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 terry.reedy
Recipients brett.cannon, terry.reedy, vstinner
Date 2011-01-19.23:55:06
SpamBayes Score 2.1704516e-09
Marked as misclassified No
Message-id <1295481310.94.0.294323365102.issue10951@psf.upfronthosting.co.za>
In-reply-to
Content
I took a look at an example of each type.

Sign-compare, Parser/node.c, 94
        if (required_capacity > PY_SIZE_MAX / sizeof(node))

I presume PY_SIZE_MAX and sizeof(node) are both unsigned.
So is, conceptually, required_capacity, but it is defined as an int because it is defined with XXXROUNDUP() and hence fancy_roundup(), which returns -1 if n1->n_nchildren is so large that the smallest power of 2 larger is too big for an int.

The comparison is 'OK' in context in that it is preceded by and guarded by
    if (current_capacity < 0 || required_capacity < 0)
        return E_OVERFLOW;

If I had written this, I might have thought about replacing all the comparisons with one check of n1->n_nchildren against some reasonable limit calculated from PY_SIZE_MAX / sizeof(node), and making both capacities unsigned.

---
Unused, Parser/parsetok.c, 130: local vars handling_with and handling_import are both set to 0 both here and again on line 157 and not seen elsewhere in the file. I presume both could just be deleted both places. 

---
Empty body, pgen, multiple places: those I checked are appearances of the REQN() macro. The REQ() macro did not generate a warning. 

#ifdef Py_DEBUG
#define REQN(i, count) \
    if (i < count) { \
        fprintf(stderr, REQNFMT, count); \
        Py_FatalError("REQN"); \
    } else
#else
#define REQN(i, count)  /* empty */
#endif

Since all invocations of REQN look like "     REQN(i, 1);", I presume the 'else' is there to swallow up the ';' which is added to make macro calls look like statements with a function call. I guess this is a style issue. As I remember, the suggestion to simply add '{}' to the macro would make syntax errors.

---
Uninitialized, Objects/setobject.c, 2445, in test_c_api: 
    while (_PySet_NextEntry((PyObject *)dup, &i, &x, &hash)) {
        s = _PyUnicode_AsString(x);

I presume x is set by _PySet... . (If i and hash are also, they are not used). So 'may be' but not actually.

---
Conclusion: the 'fix' is some real cleanup, some warning suppression.
History
Date User Action Args
2011-01-19 23:55:11terry.reedysetrecipients: + terry.reedy, brett.cannon, vstinner
2011-01-19 23:55:10terry.reedysetmessageid: <1295481310.94.0.294323365102.issue10951@psf.upfronthosting.co.za>
2011-01-19 23:55:06terry.reedylinkissue10951 messages
2011-01-19 23:55:06terry.reedycreate