summaryrefslogtreecommitdiff
path: root/doc/release
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-01-01 19:21:11 +0000
committerEric Wieser <wieser.eric@gmail.com>2020-01-01 19:39:23 +0000
commitbc6d573a58bf8a8f4448f26ed220afff93df7c97 (patch)
tree5d36d6f7120f1b53242d94c37c21a7980e435a59 /doc/release
parentfdd8395f21a252373ff17fd43185c42e040c1b64 (diff)
downloadnumpy-bc6d573a58bf8a8f4448f26ed220afff93df7c97.tar.gz
DEP: records: Deprecate treating shape=0 as shape=None
`shape=n` is a shorthand for `shape=(n,)` except in the case when `n==0`, when it is a shorthand for `shape=None`. This special case is dangerous, as it makes `fromrecords(..., shape=len(a))` behave surprisingly when a is an empty sequence. Users impacted by this warning either: * Have a bug in their code, and will need to either: - wait for the deprecation to expire - change their code to use `(len(a),)` instead of `len(a)` * Are using the non-preferred spellling, and will need to replace a literal `0` or `False` with `None`
Diffstat (limited to 'doc/release')
-rw-r--r--doc/release/upcoming_changes/15217.deprecation.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/release/upcoming_changes/15217.deprecation.rst b/doc/release/upcoming_changes/15217.deprecation.rst
new file mode 100644
index 000000000..e9dd0995d
--- /dev/null
+++ b/doc/release/upcoming_changes/15217.deprecation.rst
@@ -0,0 +1,11 @@
+Passing ``shape=0`` to factory functions in ``numpy.rec`` is deprecated
+-----------------------------------------------------------------------
+
+``0`` is treated as a special case by these functions, which aliases to
+``None``. In future, ``0`` will not be a special case, and will be treated
+as an array length like any other integer is. The affected functions are:
+
+* `numpy.core.records.fromarrays`
+* `numpy.core.records.fromrecords`
+* `numpy.core.records.fromstring`
+* `numpy.core.records.fromfile`