Skip to content
Closed
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
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NonCopyableAnalyzer" Version="0.7.0">
<!--<PackageReference Include="NonCopyableAnalyzer" Version="0.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</PackageReference>-->
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/embed_tests/Python.EmbeddingTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Condition="$(MSBuildRuntimeType) == 'Core'">
<Version>1.0.0</Version>
<PrivateAssets>all</PrivateAssets>
Expand Down
124 changes: 124 additions & 0 deletions src/embed_tests/TestConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,90 @@ class PyGetListImpl(test.GetListImpl):
List<string> result = inst.GetList();
CollectionAssert.AreEqual(new[] { "testing" }, result);
}

/// <summary>
/// Test that when a method returns a concrete type implementing IDisposable,
/// the object is wrapped as the concrete type (not IDisposable interface),
/// preserving access to concrete type members and supporting 'with' statements.
/// </summary>
[Test]
public void ConcreteTypeImplementingIDisposable_IsWrappedAsConcreteType()
{
using var scope = Py.CreateScope();
scope.Import(typeof(ConcreteDisposableResource).Namespace, asname: "test");

// Reset static state
ConcreteDisposableResource.IsDisposed = false;
ConcreteDisposableResource.InstanceCount = 0;

// Test that a method returning IDisposable but actually returning a concrete type
// wraps the object as the concrete type, not the interface
scope.Exec(@"
import clr
clr.AddReference('Python.EmbeddingTest')
from Python.EmbeddingTest import ConcreteDisposableResource

# Get a resource through a method that declares IDisposable return type
resource = ConcreteDisposableResource.GetResource()

# Verify it's wrapped as the concrete type, not IDisposable
# The concrete type has a GetValue() method that IDisposable doesn't have
value = resource.GetValue()
assert value == 42, f'Expected 42, got {value}'

# Verify the concrete type name is accessible
type_name = resource.GetType().Name
assert type_name == 'ConcreteDisposableResource', f'Expected ConcreteDisposableResource, got {type_name}'

# Verify 'with' statement still works (IDisposable support)
with resource:
inside_value = resource.GetValue()
assert inside_value == 42
assert ConcreteDisposableResource.IsDisposed == False

# After 'with' block, should be disposed
assert ConcreteDisposableResource.IsDisposed == True
");

// Verify the resource was actually disposed
Assert.IsTrue(ConcreteDisposableResource.IsDisposed, "Resource should be disposed after 'with' statement");
}

/// <summary>
/// Test that Converter.ToPython wraps concrete types implementing interfaces
/// as the concrete type, not the interface, when the declared type is an interface.
/// </summary>
[Test]
public void Converter_ToPython_ConcreteTypeOverInterface()
{
using (Py.GIL())
{
// Create a concrete type that implements IDisposable
var concreteResource = new ConcreteDisposableResource(100);

// Convert using IDisposable as the declared type (simulating method return type)
var pyObject = Converter.ToPython(concreteResource, typeof(IDisposable));

// Verify it's wrapped as the concrete type, not IDisposable
var wrappedObject = ManagedType.GetManagedObject(pyObject.BorrowOrThrow());
Assert.IsInstanceOf<CLRObject>(wrappedObject);

var clrObject = (CLRObject)wrappedObject;
var wrappedType = clrObject.inst.GetType();

// Should be the concrete type, not IDisposable
Assert.AreEqual(typeof(ConcreteDisposableResource), wrappedType);
Assert.AreNotEqual(typeof(IDisposable), wrappedType);

// Verify we can access concrete type members from Python
using var scope = Py.CreateScope();
scope.Set("resource", pyObject.MoveToPyObject());
var result = scope.Eval("resource.GetValue()");
Assert.AreEqual(100, result.As<int>());

pyObject.Dispose();
}
}
}

public interface IGetList
Expand All @@ -220,4 +304,44 @@ public class GetListImpl : IGetList
{
public List<string> GetList() => new() { "testing" };
}

/// <summary>
/// A concrete class implementing IDisposable with additional members.
/// Used to test that methods returning IDisposable but actually returning
/// concrete types are wrapped as the concrete type, not the interface.
/// </summary>
public class ConcreteDisposableResource : IDisposable
{
public static bool IsDisposed { get; set; }
public static int InstanceCount { get; set; }

private readonly int _value;

public ConcreteDisposableResource(int value = 42)
{
_value = value;
InstanceCount++;
IsDisposed = false;
}

/// <summary>
/// A method that exists only on the concrete type, not on IDisposable.
/// This verifies that the object is wrapped as the concrete type.
/// </summary>
public int GetValue() => _value;

public void Dispose()
{
IsDisposed = true;
}

/// <summary>
/// A method that declares IDisposable return type but actually returns
/// the concrete type. This is the scenario we're testing.
/// </summary>
public static IDisposable GetResource()
{
return new ConcreteDisposableResource();
}
}
}
2 changes: 1 addition & 1 deletion src/module_tests/Python.ModuleTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Condition="$(MSBuildRuntimeType) == 'Core'">
<Version>1.0.0</Version>
<PrivateAssets>all</PrivateAssets>
Expand Down
8 changes: 1 addition & 7 deletions src/perf_tests/Python.PerformanceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@
<IsPackable>false</IsPackable>
<Platforms>x64</Platforms>
<PlatformTarget>x64</PlatformTarget>

</PropertyGroup>

<ItemGroup>
<Reference Include="Python.Runtime.dll">
<HintPath>..\..\pythonnet\runtime\Python.Runtime.dll</HintPath>
<Private>true</Private>
</Reference>
<ProjectReference Include="..\runtime\Python.Runtime.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0">
Expand Down
2 changes: 1 addition & 1 deletion src/python_tests_runner/Python.PythonTestsRunner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<PackageReference Include="NUnit" Version="3.*" />
<PackageReference Include="NUnit3TestAdapter" Version="3.*">
<PackageReference Include="NUnit3TestAdapter" Version="4.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
132 changes: 130 additions & 2 deletions src/runtime/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,105 @@

internal static NewReference ToPythonDetectType(object? value)
=> value is null ? new NewReference(Runtime.PyNone) : ToPython(value, value.GetType());

/// <summary>
/// Checks if a concrete type has explicit interface implementations for the given interface
/// or any of its base interfaces. Explicit implementations are only accessible through
/// the interface type, so we need to wrap as the interface to preserve access.
/// </summary>
private static bool HasExplicitInterfaceImplementations(Type concreteType, Type interfaceType)
{
// Get all interfaces to check: the declared interface and all its base interfaces
var interfacesToCheck = new HashSet<Type> { interfaceType };
foreach (var baseInterface in interfaceType.GetInterfaces())
{
interfacesToCheck.Add(baseInterface);
}

foreach (var iface in interfacesToCheck)
{
// Skip if the concrete type doesn't implement this interface
if (!iface.IsAssignableFrom(concreteType))
{
continue;
}

try
{
// Get the interface mapping to see how members are implemented
var interfaceMap = concreteType.GetInterfaceMap(iface);

// Check each interface method/property to see if it's explicitly implemented
for (int i = 0; i < interfaceMap.InterfaceMethods.Length; i++)
{
var interfaceMethod = interfaceMap.InterfaceMethods[i];
var targetMethod = interfaceMap.TargetMethods[i];

// Explicit interface implementations have names like "InterfaceName.MethodName"
// and are not directly accessible on the concrete type
if (targetMethod.Name.Contains("."))
{
// This is an explicit interface implementation
// Also verify it's not directly accessible on the concrete type
var directMethod = concreteType.GetMethod(
interfaceMethod.Name,
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly,
null,
interfaceMethod.GetParameters().Select(p => p.ParameterType).ToArray(),
null);

if (directMethod == null)
{
// Method is explicitly implemented and not directly accessible
return true;
}
}
}

// Check properties as well
foreach (var prop in iface.GetProperties())
{
var getter = prop.GetGetMethod();
var setter = prop.GetSetMethod();

if (getter != null)
{
var concreteGetter = concreteType.GetProperty(
prop.Name,
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

if (concreteGetter == null)
{
// Property getter is explicitly implemented
return true;
}
}

if (setter != null)
{
var concreteSetter = concreteType.GetProperty(
prop.Name,
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

if (concreteSetter == null)
{
// Property setter is explicitly implemented
return true;
}
}
}
}
catch
{
// If GetInterfaceMap fails (e.g., for generic interfaces), assume no explicit implementations
// and prefer concrete type
continue;
}
}

return false;
}

internal static NewReference ToPython(object? value, Type type)
{
if (value is PyObject pyObj)
Expand All @@ -140,10 +239,39 @@
}
}

// If the declared type is an interface, check if the actual runtime type
// is a concrete class. If so, prefer the concrete type to preserve access
// to all members. Only wrap as interface if the runtime type is also an
// interface or if we need explicit interface behavior.
if (type.IsInterface)
{
var ifaceObj = (InterfaceObject)ClassManager.GetClassImpl(type);
return ifaceObj.TryWrapObject(value);
Type actualType = value.GetType();
// Prefer concrete types over interface types to preserve full member access.
// This fixes issues where methods return concrete types that implement
// interfaces (e.g., IDisposable) but should be exposed as their
// concrete type for proper member access and Python 'with' statement support.
if (!actualType.IsInterface)
{
// Check if the declared interface (or any of its base interfaces) has
// members that are explicitly implemented in the concrete type.
// If so, we need to wrap as the interface to preserve access to those members.
if (HasExplicitInterfaceImplementations(actualType, type))
{
// Wrap as interface to preserve access to explicit interface implementations
var ifaceObj = (InterfaceObject)ClassManager.GetClassImpl(type);
return ifaceObj.TryWrapObject(value);
}

// No explicit interface implementations, use the actual concrete type
// to preserve full member access (e.g., for IDisposable with 'with' statement)
type = actualType;
}
else
{
// Runtime type is also an interface (rare: proxy/dynamic case), wrap as interface
var ifaceObj = (InterfaceObject)ClassManager.GetClassImpl(type);
return ifaceObj.TryWrapObject(value);
}
}

if (type.IsArray || type.IsEnum)
Expand Down Expand Up @@ -994,10 +1122,10 @@
}
else
{
elementType = null;

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.10)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.12)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.8)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.10)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.8)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.9)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.12)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.10)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.9)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.12)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1125 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.8)

Converting null literal or possible null value to non-nullable type.
}

result = null;

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.10)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.12)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.7)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.8)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.10)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.11)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.11)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.7)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.8)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.9)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.12)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.11)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.10)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.9)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.7)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.12)

Cannot convert null literal to non-nullable reference type.

Check warning on line 1128 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.8)

Cannot convert null literal to non-nullable reference type.

bool IsSeqObj = Runtime.PySequence_Check(value);
var len = IsSeqObj ? Runtime.PySequence_Size(value) : -1;
Expand Down Expand Up @@ -1031,9 +1159,9 @@
using var item = Runtime.PyIter_Next(IterObject.Borrow());
if (item.IsNull()) break;

object obj = null;

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.8)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.10)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.8)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.9)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.12)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.10)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.9)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.12)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1162 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.8)

Converting null literal or possible null value to non-nullable type.

if (!Converter.ToManaged(item.Borrow(), elementType ?? typeof(object), out obj, setError))

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.8)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.10)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu, x64, ubuntu-22.04, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.8)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.9)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x86, windows-latest, 3.12)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.11)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.10)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.9)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.7)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.12)

Converting null literal or possible null value to non-nullable type.

Check warning on line 1164 in src/runtime/Converter.cs

View workflow job for this annotation

GitHub Actions / Build and Test (windows, x64, windows-latest, 3.8)

Converting null literal or possible null value to non-nullable type.
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,8 +1335,8 @@ def test_special_array_creation():
assert value[1].__class__ == inst.__class__
assert value.Length == 2

iface_class = ISayHello1(inst).__class__
value = Array[ISayHello1]([inst, inst])
iface_class = ISayHello1(inst).__class__
assert value[0].__class__ == iface_class
assert value[1].__class__ == iface_class
assert value.Length == 2
Expand Down
Loading
Loading