nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: JuliaPy/PyCall.jl
Pull request #877 (2021-01-12 20:53:41)

Fix tests, Core.TypeofVararg for Julia 1.7 and AOT
I extracted this commit from the "transpose_and_slice" branch to focus on fixing the tests and AOT now that several issues have been resolved.

mkitti: Hi @stevengj and @tkf ,

This PR makes PyCall nightly (1.7) compatible and updates the AOT code now that several issues have been resolved.

I believe it will also run the AOT tests on code in a PR rather than just on master. There was a line that would dev PyCall, but this just ended up pulling down master.
https://github.com/JuliaPy/PyCall.jl/pull/877/files#diff-4b46bebfbbf4ad893abfcd8217a3e897e27cf16134a5970b31739320ef5c0894L50

I extracted this from #876 so we can see that the tests pass without the other changes and so that these changes can be merged as soon as possible.

Patch:
diff --git a/.github/workflows/aot.yml b/.github/workflows/aot.yml
index d12b7db..ea23d76 100644
--- a/.github/workflows/aot.yml
+++ b/.github/workflows/aot.yml
@@ -41,13 +41,7 @@ jobs:
           arch: ${{ matrix.architecture }}
           show-versioninfo: true
 
-      # Revert to `@v1` after this PR is merged:
-      # https://github.com/JuliaLang/PackageCompiler.jl/pull/443
-      - run: julia -e 'using Pkg; pkg"add PackageCompiler#cb994c72e2087c57ffa4727ef93589e1b98d8a32"'
-
-      # Workaround https://github.com/JuliaLang/julia/issues/37441.
-      # Once it's solved, we can remove the following line:
-      - run: julia -e 'using Pkg; pkg"dev PyCall"'
+      - run: julia -e 'using Pkg; pkg"add PackageCompiler@v1"'
 
       - run: aot/compile.jl
       - run: aot/assert_has_pycall.jl
diff --git a/src/conversions.jl b/src/conversions.jl
index 540c25b..0226f03 100644
--- a/src/conversions.jl
+++ b/src/conversions.jl
@@ -170,7 +170,10 @@ function pyany_toany(T::Type)
 end
 pyany_toany(::Type{PyAny}) = Any
 pyany_toany(t::Type{T}) where {T<:Tuple} = Tuple{map(pyany_toany, t.types)...}
-
+@static if isdefined(Core, :TypeofVararg) # VERSION >= v"1.7.0-DEV.77"
+    # Core.TypeofVararg introduced in https://github.com/JuliaLang/julia/pull/38136
+    pyany_toany(T::typeof(Vararg)) = T === Vararg{PyAny} ? Vararg{Any} : T
+end
 # PyAny acts like Any for conversions, except for converting PyObject (below)
 convert(::Type{PyAny}, x) = x
 


Test patch:
diff --git a/aot/runtests.sh b/aot/runtests.sh
index 4d5f573..6f4f292 100755
--- a/aot/runtests.sh
+++ b/aot/runtests.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 thisdir="$(dirname "${BASH_SOURCE[0]}")"
-exec "$thisdir/julia.sh" --startup-file=no --color=yes -e '
+exec "$thisdir/julia.sh" --startup-file=no --color=yes --project=$thisdir -e '
 using Pkg
 Pkg.test("PyCall")
 '
Repository: JuliaPy/PyCall.jl
Pull request #1059 (2023-10-30 20:47:31)

A few fixes for julia master
1. Fix use of `cconvert(Cwstring)`. This may count as a breakage from base julia but it's a bit of a grey area. It may be argued that the return type for `cconvert` isn't really guaranteed.
2. `Docs.doc` is defined in base but the methods are defined in `REPL`. With `REPL` moved out of the sysimg by default this needs to be loaded explicitly.


Patch:
diff --git a/Project.toml b/Project.toml
index 413c282..565f73f 100644
--- a/Project.toml
+++ b/Project.toml
@@ -20,6 +20,7 @@ julia = "1.4"
 
 [extras]
 Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
+REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
 
 [targets]
-test = ["Test"]
+test = ["Test", "REPL"]
diff --git a/deps/depsutils.jl b/deps/depsutils.jl
index 35ed1e1..73ae294 100644
--- a/deps/depsutils.jl
+++ b/deps/depsutils.jl
@@ -64,8 +64,10 @@ function _preserveas!(dest::Vector{UInt8}, ::Type{Cstring}, x::AbstractString)
 end
 
 function _preserveas!(dest::Vector{UInt8}, ::Type{Cwstring}, x::AbstractString)
-    s = reinterpret(UInt8, Base.cconvert(Cwstring, x))
-    copyto!(resize!(dest, length(s)), s)
+    s = reinterpret(UInt8, transcode(Cwchar_t, String(x)))
+    len = length(s)
+    copyto!(resize!(dest, len + sizeof(Cwchar_t)), s)
+    dest[len + 1:len + sizeof(Cwchar_t)] .= 0
     return pointer(dest)
 end
 


Test patch:
diff --git a/test/runtests.jl b/test/runtests.jl
index 96dc4fa..bc124a5 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -1,6 +1,7 @@
 using PyCall
 using PyCall: hasproperty
 using Test, Dates, Serialization
+using REPL # for Docs.doc methods
 
 filter(f, itr) = collect(Iterators.filter(f, itr))
 filter(f, d::AbstractDict) = Base.filter(f, d)