bpo-34201: Make ndarray.readonly a bool and use stricter tests in test_buffer. by serhiy-storchaka · Pull Request #8414 · python/cpython

@serhiy-storchaka

@serhiy-storchaka

brettcannon

skrah

itemsize, fmt, readonly,
ndim, shape, strides,
lst, sliced=False, cast=False):
# Verify buffer contents against expected values. Default values

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment that gives the rationale for the curious initialization no longer applies.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# The consumer may have requested default values or a NULL format.
ro = 0 if match(req, PyBUF_WRITABLE) else ex.readonly
ro = not match(req, PyBUF_WRITABLE) and ex.readonly

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use the previous version, just replacing 0 with False?

I can accept not p or q for implication, but this goes too far IMHO.