Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Core/builtins.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ pydict(; kwargs...) =
isempty(kwargs) ? pynew(errcheck(C.PyDict_New())) : pystrdict_fromiter(kwargs)
pydict(x) = ispy(x) ? pybuiltins.dict(x) : pydict_fromiter(x)
pydict(x::NamedTuple) = pydict(; x...)
pydict(pairs::Pair...) = pydict(pairs)
export pydict

### datetime
Expand Down
4 changes: 4 additions & 0 deletions test/Core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ end
@test pyeq(Bool, pydict(Dict("foo" => 1, "bar" => 2)), x)
@test pyeq(Bool, pydict((foo = 1, bar = 2)), x)
@test pyeq(Bool, pydict(x), x)
y = pydict("foo" => 1, "bar" => 2)
@test pyeq(Bool, pygetitem(y, "foo"), 1)
@test pyeq(Bool, pygetitem(y, "bar"), 2)
@test pyeq(Bool, x, y)
end

@testitem "bool" begin
Expand Down
Loading