Skip to content

DEP: Speed up WarnOnWrite deprecation in buffer interface#14030

Merged
charris merged 1 commit intonumpy:masterfrom
seberg:forwardport-13993
Jul 17, 2019
Merged

DEP: Speed up WarnOnWrite deprecation in buffer interface#14030
charris merged 1 commit intonumpy:masterfrom
seberg:forwardport-13993

Conversation

@seberg
Copy link
Member

@seberg seberg commented Jul 17, 2019

Forward port of #13993 .

When a buffer interface does not request a writeable buffer,
simply pass a read-only one when the warn on write flag is set.

This is to give an easier way forward with avoiding the deprecation
warnings: Simply do not ask for a writeable buffer.

It will break code that expects writeable buffers but does not
ask for them specifically a bit harder than would be nice.
But since such code probably should ask for it specifically, this
is likely fine (an RC release has to find out).

The main reason for this is, that this way it plays very will with
cython, which requests writeable buffers explicitly and if declared
const is happy about read-only (so that using const is the best
way to avoid the warning and makes code cleaner).

Closes gh-13929, gh-13974


Forward port of gh-13993 release notes are not included.

When a buffer interface does not request a writeable buffer,
simply pass a read-only one when the warn on write flag is set.

This is to give an easier way forward with avoiding the deprecation
warnings: Simply do not ask for a writeable buffer.

It will break code that expects writeable buffers but does not
ask for them specifically a bit harder than would be nice.
But since such code probably should ask for it specifically, this
is likely fine (an RC release has to find out).

The main reason for this is, that this way it plays very will with
cython, which requests writeable buffers explicitly and if declared
`const` is happy about read-only (so that using `const` is the best
way to avoid the warning and makes code cleaner).

Closes numpygh-13929, numpygh-13974
@charris
Copy link
Member

charris commented Jul 17, 2019

Thanks Sebastian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positives for warning about writing to broadcast array in cython code

2 participants