Hello, as was discussed in the bi-weekly meeting, the newest version seems
to introduce stricter type checking. Here's a snippet that exhibits two
issues.

using (Py.GIL())
{
    dynamic sysmod = Py.Import("sys");
    dynamic syspath = sysmod.path;
    bool found = false;
    foreach (var path in syspath)
    {
        if (path == Path.GetFullPath("some/test/path/").Replace("\\", "/"))
        {
            found = true;
            break;
        }
    }
}

The first is a runtime exception with syspath:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : Cannot implicitly
convert type 'Python.Runtime.PyObject' to 'System.Collections.IEnumerable'.
An explicit conversion exists (are you missing a cast?)
The second is maybe a non-issue, but I think it used to work. If syspath is
made to be of type PyList there is now a compiler error: error CS0019:
Operator '==' cannot be applied to operands of type 'PyObject' and 'string'


Thanks
_______________________________________________
PythonNet mailing list -- pythonnet@python.org
To unsubscribe send an email to pythonnet-le...@python.org
https://mail.python.org/mailman3/lists/pythonnet.python.org/
Member address: arch...@mail-archive.com

Reply via email to