Skip to content

Added ToPythonAs() extension method for explicit conversion using an arbitrary type #2419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Remove warning
  • Loading branch information
joaompneves committed Jul 18, 2024
commit bc111365482557e85f7474e68d2d76dc5ff8fff3
2 changes: 1 addition & 1 deletion src/runtime/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ public static PyObject ToPythonAs<T>(this T? o)
return Converter.ToPython(o, typeof(T)).MoveToPyObject();
}

public static PyObject ToPythonAs(this object o, Type type)
public static PyObject ToPythonAs(this object? o, Type type)
{
if (o is null) return Runtime.None;
return Converter.ToPython(o, type).MoveToPyObject();
Expand Down