[Python.NET] Re: Stricter types in 3.0
LOST _ <[email protected]> Thu, 3 Feb 2022 12:55:32 -0800
| Newsgroups | gmane.comp.python.dotnet |
|---|---|
| Message-ID | <[email protected]> |
--===============7436440923206366547==
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="utf-8"
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of=
fice/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta ht=
tp-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"><meta name=
=3DGenerator content=3D"Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=3DEN-US link=3Dblue vlink=3D"#954F72" style=3D=
'word-wrap:break-word'><div class=3DWordSection1><p class=3DMsoNormal>Exact=
ly the same issue is reported here: <a href=3D"https://github.com/pythonnet=
/pythonnet/issues/1680">https://github.com/pythonnet/pythonnet/issues/1680<=
/a></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>Have =
you seen it?<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><div s=
tyle=3D'mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.=
0pt;padding:3.0pt 0in 0in 0in'><p class=3DMsoNormal style=3D'border:none;pa=
dding:0in'><b>From: </b><a href=3D"mailto:felix.bourbonnais@imaginary-space=
s.com">Felix Bourbonnais</a><br><b>Sent: </b>Thursday, February 3, 2022 12:=
53 PM<br><b>To: </b><a href=3D"mailto:[email protected]">pythonnet@pytho=
n.org</a><br><b>Subject: </b>[Python.NET] Stricter types in 3.0</p></div><p=
class=3DMsoNormal><o:p> </o:p></p><div><div><p class=3DMsoNormal>Hell=
o, as was discussed in the bi-weekly meeting, the newest version seems to i=
ntroduce stricter type checking. Here's a snippet that exhibits two issues.=
</p></div><div><p class=3DMsoNormal><o:p> </o:p></p></div><div><p clas=
s=3DMsoNormal>using (Py.GIL())<br>{<br> dynamic sysmod =3D Py.=
Import("sys");<br> dynamic syspath =3D sysmod.path;<=
br> bool found =3D false;<br> foreach (var path i=
n syspath)<br> {<br> if (path =3D=
=3D Path.GetFullPath("some/test/path/").Replace("\\", &=
quot;/"))<br> {<br> &nb=
sp; found =3D true;<br> &nb=
sp; break;<br> }<br> }<br>}</p></di=
v><div><p class=3DMsoNormal><o:p> </o:p></p></div><div><p class=3DMsoN=
ormal>The first is a runtime exception with syspath: Microsoft.CSharp.Runti=
meBinder.RuntimeBinderException : Cannot implicitly convert type 'Python.Ru=
ntime.PyObject' to 'System.Collections.IEnumerable'. An explicit conversion=
exists (are you missing a cast?)</p></div><div><p class=3DMsoNormal>The se=
cond 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 =
'=3D=3D' cannot be applied to operands of type 'PyObject' and 'string'</p><=
/div><div><p class=3DMsoNormal><o:p> </o:p></p></div><div><p class=3DM=
soNormal><o:p> </o:p></p></div></div><p class=3DMsoNormal>Thanks</p><p=
class=3DMsoNormal><o:p> </o:p></p></div></body></html>=
--===============7436440923206366547==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
PythonNet mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/pythonnet.python.org/
Member address: [email protected]
--===============7436440923206366547==--