Skip to content

Commit f1544bc

Browse files
cjpryboltkelman
authored andcommitted
address concerns that depwarn for transpose is unclear (#19205)
* close #18320 * Update NEWS.md * Update deprecated.jl * Update deprecated.jl
1 parent 5af39d2 commit f1544bc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

NEWS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,9 @@ Deprecated or removed
508508
* Sparse matrix functions `etree`, `ereach`, `csc_permute`, and `symperm` have been moved
509509
to the [SuiteSparse.jl package](https://github.com/JuliaSparse/SuiteSparse.jl) ([#12231], [#17033]).
510510
511-
* The no-op `transpose` fallback has been deprecated. Consider introducing suitable
512-
`transpose` methods or calling `permutedims(x, [2,1])` ([#13171], [#17075], [#17374]).
511+
* The no-op `transpose` fallback for non-numeric arrays has been deprecated. Consider introducing suitable
512+
`transpose` methods or calling `permutedims(x, (2, 1))` for matrices and `reshape(x, 1, length(x))` for
513+
vectors. ([#13171], [#17075], [#17374]).
513514
514515
* The following macros have been deprecated ([#16219]):
515516
* `@windows` is deprecated in favor of `is_windows()`

base/deprecated.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,10 @@ end
765765

766766
# Deprecate no-op transpose fallback. Please see #13171 and #17075.
767767
function transpose(x)
768-
depwarn(string("the no-op `transpose` fallback is deprecated, and no more specific ",
769-
"`transpose` method for $(typeof(x)) exists. Consider `permutedims(x, [2, 1])` ",
770-
"or writing a specific `transpose(x::$(typeof(x)))` method if appropriate."),
768+
depwarn(string("the no-op `transpose` for non-numeric arrays is deprecated, ",
769+
"and no specific `transpose` method for $(typeof(x)) exists. Use ",
770+
"`permutedims(x, (2, 1))` for matrices and `reshape(x, 1, length(x))` for vectors, ",
771+
"or write a specific `transpose(x::$(typeof(x)))` method if appropriate."),
771772
:transpose)
772773
return x
773774
end

0 commit comments

Comments
 (0)