Skip to content

Commit a28592d

Browse files
authored
Backports release 1.11 (#55855)
Backported PRs: - [x] #55773 <!-- Add compat entry for `Base.donotdelete` --> - [x] #41244 <!-- Fix shell `cd` error when working dir has been deleted --> - [x] #55795 <!-- fix #52986, regression in `@doc` of macro without REPL loaded --> - [x] #55829 <!-- [Dates] Make test more robust against non-UTC timezones --> - [x] #55641 <!-- fall back to slower stat filesize if optimized filesize fails --> - [x] #55744 <!-- fix #45494, error in ssa conversion with complex type decl --> - [x] #55783 <!-- use `inferencebarrier` instead of `invokelatest` for 1-arg `@assert` --> - [x] #55739 <!-- Add `invokelatest` barrier to `string(...)` in `@assert` --> Need manual backport: - [ ] #55798 <!-- Broadcast binary ops involving strided triangular --> Contains multiple commits, manual intervention needed: - [ ] #55509 <!-- Fix cong implementation to be properly random and not just cycling. --> - [ ] #55569 <!-- Add a docs section about loading/precomp/ttfx time tuning --> - [ ] #55824 <!-- Replace regex package module checks with actual code checks --> Non-merged PRs with backport label: - [ ] #55845 <!-- privatize annotated string API, take two --> - [ ] #55828 <!-- Fix some corner cases of `isapprox` with unsigned integers --> - [ ] #55813 <!-- Check for conflicting `@ccallable` name before JIT registration --> - [ ] #55743 <!-- doc: heap snapshot viewing --> - [ ] #55741 <!-- Change annotations to use a NamedTuple --> - [ ] #55534 <!-- Set stdlib sources as read-only during installation --> - [ ] #55499 <!-- propagate the terminal's `displaysize` to the `IOContext` used by the REPL --> - [ ] #55458 <!-- Allow for generically extracting unannotated string --> - [ ] #55457 <!-- Make AnnotateChar equality consider annotations --> - [ ] #55453 <!-- Privatise the annotations API, for StyledStrings --> - [ ] #55355 <!-- relocation: account for trailing path separator in depot paths --> - [ ] #55220 <!-- `isfile_casesensitive` fixes on Windows --> - [ ] #55169 <!-- `propertynames` for SVD respects private argument --> - [ ] #54457 <!-- Make `String(::Memory)` copy --> - [ ] #53957 <!-- tweak how filtering is done for what packages should be precompiled --> - [ ] #51479 <!-- prevent code loading from lookin in the versioned environment when building Julia --> - [ ] #50813 <!-- More doctests for Sockets and capitalization fix --> - [ ] #50157 <!-- improve docs for `@inbounds` and `Base.@propagate_inbounds` -->
2 parents 6cb5b1f + 704fdc6 commit a28592d

File tree

18 files changed

+73
-38
lines changed

18 files changed

+73
-38
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ Standard library changes
134134
writes 4 bytes for each character, instead of writing the UTF-8 representation of each character.
135135
The new format is compatible with that used by `Array`, making it possible to use `read!` to get
136136
the data back ([#42593]).
137+
* It's not possible to define `length` for stateful iterators in a generally consistent manner. The
138+
potential for silently incorrect results for `Stateful` iterators is addressed by deleting the
139+
`length(::Stateful)` method. The last type parameter of `Stateful` is gone, too. Issue: ([#47790]),
140+
PR: ([#51747]).
137141

138142
#### StyledStrings
139143

base/client.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function repl_cmd(cmd, out)
4141
if isempty(cmd.exec)
4242
throw(ArgumentError("no cmd to execute"))
4343
elseif cmd.exec[1] == "cd"
44-
new_oldpwd = pwd()
4544
if length(cmd.exec) > 2
4645
throw(ArgumentError("cd method only takes one argument"))
4746
elseif length(cmd.exec) == 2
@@ -52,11 +51,17 @@ function repl_cmd(cmd, out)
5251
end
5352
dir = ENV["OLDPWD"]
5453
end
55-
cd(dir)
5654
else
57-
cd()
55+
dir = homedir()
5856
end
59-
ENV["OLDPWD"] = new_oldpwd
57+
try
58+
ENV["OLDPWD"] = pwd()
59+
catch ex
60+
ex isa IOError || rethrow()
61+
# if current dir has been deleted, then pwd() will throw an IOError: pwd(): no such file or directory (ENOENT)
62+
delete!(ENV, "OLDPWD")
63+
end
64+
cd(dir)
6065
println(out, pwd())
6166
else
6267
@static if !Sys.iswindows()

base/docs/Docs.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ function _doc(binding::Binding, sig::Type = Union{})
519519
for msig in multidoc.order
520520
sig <: msig && return multidoc.docs[msig]
521521
end
522+
# if no matching signatures, return first
523+
if !isempty(multidoc.docs)
524+
return first(values(multidoc.docs))
525+
end
522526
end
523527
end
524528
return nothing

base/docs/basedocs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,6 +3643,9 @@ unused and delete the entire benchmark code).
36433643
which the value of the arguments of this intrinsic were available (in a register,
36443644
in memory, etc.).
36453645
3646+
!!! compat "Julia 1.8"
3647+
This method was added in Julia 1.8.
3648+
36463649
# Examples
36473650
36483651
```julia

base/error.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,16 @@ macro assert(ex, msgs...)
223223
msg = msg # pass-through
224224
elseif !isempty(msgs) && (isa(msg, Expr) || isa(msg, Symbol))
225225
# message is an expression needing evaluating
226-
msg = :(Main.Base.string($(esc(msg))))
226+
# N.B. To reduce the risk of invalidation caused by the complex callstack involved
227+
# with `string`, use `inferencebarrier` here to hide this `string` from the compiler.
228+
msg = :(Main.Base.inferencebarrier(Main.Base.string)($(esc(msg))))
227229
elseif isdefined(Main, :Base) && isdefined(Main.Base, :string) && applicable(Main.Base.string, msg)
228230
msg = Main.Base.string(msg)
229231
else
230232
# string() might not be defined during bootstrap
231233
msg = quote
232234
msg = $(Expr(:quote,msg))
233-
isdefined(Main, :Base) ? Main.Base.string(msg) :
235+
isdefined(Main, :Base) ? Main.Base.inferencebarrier(Main.Base.string)(msg) :
234236
(Core.println(msg); "Error during bootstrap. See stdout.")
235237
end
236238
end

base/exports.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,15 +1096,8 @@ public
10961096
Lockable,
10971097
OneTo,
10981098
LogRange,
1099-
AnnotatedString,
1100-
AnnotatedChar,
11011099
UUID,
11021100

1103-
# Annotated strings
1104-
annotatedstring,
1105-
annotate!,
1106-
annotations,
1107-
11081101
# Semaphores
11091102
Semaphore,
11101103
acquire,

base/iostream.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ end
224224
function filesize(s::IOStream)
225225
sz = @_lock_ios s ccall(:ios_filesize, Int64, (Ptr{Cvoid},), s.ios)
226226
if sz == -1
227-
err = Libc.errno()
228-
throw(IOError(string("filesize: ", Libc.strerror(err), " for ", s.name), err))
227+
# if `s` is not seekable `ios_filesize` can fail, so fall back to slower stat method
228+
sz = filesize(stat(s))
229229
end
230230
return sz
231231
end

base/strings/annotated.jl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ the combined range.
3939
See also [`AnnotatedChar`](@ref), [`annotatedstring`](@ref),
4040
[`annotations`](@ref), and [`annotate!`](@ref).
4141
42-
!!! warning
43-
While the constructors are part of the Base public API, the fields
44-
of `AnnotatedString` are not. This is to allow for potential future
45-
changes in the implementation of this type. Instead use the
46-
[`annotations`](@ref), and [`annotate!`](@ref) getter/setter
47-
functions.
48-
4942
# Constructors
5043
5144
```julia
@@ -81,13 +74,6 @@ More specifically, this is a simple wrapper around any other
8174
See also: [`AnnotatedString`](@ref), [`annotatedstring`](@ref), `annotations`,
8275
and `annotate!`.
8376
84-
!!! warning
85-
While the constructors are part of the Base public API, the fields
86-
of `AnnotatedChar` are not. This it to allow for potential future
87-
changes in the implementation of this type. Instead use the
88-
[`annotations`](@ref), and [`annotate!`](@ref) getter/setter
89-
functions.
90-
9177
# Constructors
9278
9379
```julia

deps/checksums/Downloads-1061ecc377a053fce0df94e1a19e5260f7c030f5.tar.gz/md5

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/checksums/Downloads-1061ecc377a053fce0df94e1a19e5260f7c030f5.tar.gz/sha512

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2472bd6434d21c4b3e3199437e6fdcf7
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0a3fa9a09de81aa9676dbc7448408c7503f45e42519a2667540ad890316c7da089c95de5464a2032171f963c6f3cba73d6b3c246f1c7ac6ede283fc8132d5209

doc/src/base/strings.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ Core.String(::AbstractString)
1717
Base.SubString
1818
Base.LazyString
1919
Base.@lazy_str
20-
Base.AnnotatedString
21-
Base.AnnotatedChar
22-
Base.annotatedstring
23-
Base.annotations
24-
Base.annotate!
2520
Base.transcode
2621
Base.unsafe_string
2722
Base.ncodeunits(::AbstractString)
@@ -98,3 +93,17 @@ Base.escape_string
9893
Base.escape_raw_string
9994
Base.unescape_string
10095
```
96+
97+
## `AnnotatedString`s
98+
99+
!!! note
100+
The API for AnnotatedStrings is considered experimental and is subject to change between
101+
Julia versions.
102+
103+
```@docs
104+
Base.AnnotatedString
105+
Base.AnnotatedChar
106+
Base.annotatedstring
107+
Base.annotations
108+
Base.annotate!
109+
```

doc/src/manual/strings.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,10 @@ last backslash escapes a quote, since these backslashes appear before a quote.
12071207

12081208
## [Annotated Strings](@id man-annotated-strings)
12091209

1210+
!!! note
1211+
The API for AnnotatedStrings is considered experimental and is subject to change between
1212+
Julia versions.
1213+
12101214
It is sometimes useful to be able to hold metadata relating to regions of a
12111215
string. A [`AnnotatedString`](@ref Base.AnnotatedString) wraps another string and
12121216
allows for regions of it to be annotated with labelled values (`:label => value`).

stdlib/Dates/test/types.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,11 @@ end
263263
end
264264

265265
@testset "issue #31524" begin
266-
dt1 = Libc.strptime("%Y-%M-%dT%H:%M:%SZ", "2018-11-16T10:26:14Z")
266+
# Ensure the result doesn't depend on local timezone, especially on macOS
267+
# where an extra internal call to `mktime` is affected by timezone settings.
268+
dt1 = withenv("TZ" => "UTC") do
269+
Libc.strptime("%Y-%m-%dT%H:%M:%SZ", "2018-11-16T10:26:14Z")
270+
end
267271
dt2 = Libc.TmStruct(14, 30, 5, 10, 1, 99, 3, 40, 0)
268272

269273
time = Time(dt1)

stdlib/Downloads.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
DOWNLOADS_BRANCH = master
2-
DOWNLOADS_SHA1 = 1061ecc377a053fce0df94e1a19e5260f7c030f5
2+
DOWNLOADS_SHA1 = 89d3c7dded535a77551e763a437a6d31e4d9bf84
33
DOWNLOADS_GIT_URL := https://github.com/JuliaLang/Downloads.jl.git
44
DOWNLOADS_TAR_URL = https://api.github.com/repos/JuliaLang/Downloads.jl/tarball/$1

test/docs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Base.Docs: meta, @var, DocStr, parsedoc
44

55
# check that @doc can work before REPL is loaded
66
@test !startswith(read(`$(Base.julia_cmd()) -E '@doc sin'`, String), "nothing")
7+
@test !startswith(read(`$(Base.julia_cmd()) -E '@doc @time'`, String), "nothing")
78

89
using Markdown
910
using REPL

test/file.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,26 @@ end
16011601
end
16021602
end
16031603

1604+
@testset "pwd tests" begin
1605+
mktempdir() do dir
1606+
cd(dir) do
1607+
withenv("OLDPWD" => nothing) do
1608+
io = IOBuffer()
1609+
Base.repl_cmd(@cmd("cd"), io)
1610+
Base.repl_cmd(@cmd("cd -"), io)
1611+
@test realpath(pwd()) == realpath(dir)
1612+
if !Sys.iswindows()
1613+
# Delete the working directory and check we can cd out of it
1614+
# Cannot delete the working directory on Windows
1615+
rm(dir)
1616+
@test_throws Base._UVError("pwd()", Base.UV_ENOENT) pwd()
1617+
Base.repl_cmd(@cmd("cd \\~"), io)
1618+
end
1619+
end
1620+
end
1621+
end
1622+
end
1623+
16041624
@testset "readdir tests" begin
16051625
(a, b) = sort(a) == sort(b)
16061626
mktempdir() do dir

0 commit comments

Comments
 (0)