Skip to content

Commit 04c4778

Browse files
authored
A few fixes for julia master (#1059)
* Fix breakage due to JuliaLang/julia#51319 `cconvert` does not return an array anymore and cannot be used with `reinterpret`. Fix to use the underlying `transcode` function directly, which is also consistent with the `Cstring` version. * Fix doc test
1 parent 2a9f077 commit 04c4778

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ julia = "1.4"
2020

2121
[extras]
2222
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
23+
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
2324

2425
[targets]
25-
test = ["Test"]
26+
test = ["Test", "REPL"]

deps/depsutils.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ function _preserveas!(dest::Vector{UInt8}, ::Type{Cstring}, x::AbstractString)
6464
end
6565

6666
function _preserveas!(dest::Vector{UInt8}, ::Type{Cwstring}, x::AbstractString)
67-
s = reinterpret(UInt8, Base.cconvert(Cwstring, x))
68-
copyto!(resize!(dest, length(s)), s)
67+
s = reinterpret(UInt8, transcode(Cwchar_t, String(x)))
68+
len = length(s)
69+
copyto!(resize!(dest, len + sizeof(Cwchar_t)), s)
70+
dest[len + 1:len + sizeof(Cwchar_t)] .= 0
6971
return pointer(dest)
7072
end
7173

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using PyCall
22
using PyCall: hasproperty
33
using Test, Dates, Serialization
4+
using REPL # for Docs.doc methods
45

56
filter(f, itr) = collect(Iterators.filter(f, itr))
67
filter(f, d::AbstractDict) = Base.filter(f, d)

0 commit comments

Comments
 (0)