Skip to content

Commit

Permalink
Merge branch 'master-rhino-8.x' into rhino-8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Aug 7, 2024
2 parents e011469 + a0c002c commit 6cc0cf7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/Types/MethodObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ NewReference InvokeMethod(BorrowedReference target, BorrowedReference args, Borr
// ManagedType.GetManagedObject(target) returns the instance
if (name == "__init__"
&& !type.Value.IsClass
&& Runtime.PyTuple_Size(args) == 0)
&& Runtime.PyTuple_Size(args) == 0
&& (kw.IsNull || (!kw.IsNull && Runtime.PyDict_Size(kw) == 0)))
{
return new NewReference(Runtime.PyNone);
}
Expand Down
14 changes: 14 additions & 0 deletions tests/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ def test_struct_construction():
# test recursion
# test

def test_struct_construction_kwargs_only():
"""Test contruction of structs with kwarg only arguments"""
from Python.Test import Point

# structs can be instantiated using default ctor
p = Point()
assert p.__class__.__name__ == 'Point'
assert p.__module__ == 'Python.Test'

p = Point(x=10, y=10)
assert p.X == 10
assert p.Y == 10



def test_ienumerable_iteration():
"""Test iteration over objects supporting IEnumerable."""
Expand Down

0 comments on commit 6cc0cf7

Please sign in to comment.