Re: About extensions ... New: excepthook experiments with IDLE and Friendly-traceback

AndrĂ© Roberge <[email protected]> Wed, 10 Feb 2021 14:52:31 -0400
Newsgroups gmane.comp.python.idle
Message-ID <CAGMu_=qK4CprM+RXC3JwgUEziPtg+C=mAOJcdpWQoxuOaV7C4Q@mail.gmail.com>
--===============8109414904614372292==
Content-Type: multipart/alternative; boundary="000000000000f24a9305baffe9a2"

--000000000000f24a9305baffe9a2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Apologies if you receive this message twice. I sent an email a few hours
ago but I have not seen any sign of it in the idle-dev archive. From past
experience, I do not recall messages to idle-dev being moderated, so I
decided to reply to an older message in this second attempt.

=3D =3D =3D

Hello everyone,

The latest Python version (3.10.a5) of IDLE's repl has support for
user-defined exception hooks. After being contacted by Terry Reedy about
this feature, I investigated integrating Friendly-traceback [1] with IDLE.

For those that are interested, I have documented on github [2] (with
screenshots) how Friendly-traceback works with IDLE, including some
limitations. Feel free to comment on that issue for any suggestion you
might have about possible improvements to Friendly-traceback, including the
current API used.

In some cases, I determine based on Python's version whether or not a
feature can be enabled. I consider this to be brittle.  Rather than relying
on Python's version, I would much prefer if I could be able to write
something like:

try:
    from idlelib import support_excepthook
except:
    support_excepthook =3D False

This would be especially useful if this support for user-defined exception
hooks within IDLE's shell is backported to older versions of Python.

Something similar would also be useful if and when support for custom
handling of SyntaxError is added to IDLE.

Best,

Andr=C3=A9 Roberge


[1] https://aroberge.github.io/friendly-traceback-docs/docs/html/
Currently, the documentation does not include the new IDLE-related features=
.
[2] https://github.com/aroberge/friendly-traceback/issues/183




>
>
> _______________________________________________
> IDLE-dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/idle-dev
>

--000000000000f24a9305baffe9a2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:arial,helvetica,sans-serif;font-size:small">Apologies if you recei=
ve this message twice. I sent an email a few hours ago but I have not seen =
any sign of it in the idle-dev archive. From past experience, I do not reca=
ll messages to idle-dev being moderated, so I decided to reply to an older =
message in this second attempt.</div><div class=3D"gmail_default" style=3D"=
font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div clas=
s=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;font-si=
ze:small">=3D =3D =3D</div><div class=3D"gmail_default" style=3D"font-famil=
y:arial,helvetica,sans-serif;font-size:small"><br></div><div class=3D"gmail=
_default" style=3D"font-family:arial,helvetica,sans-serif;font-size:small">=
<div class=3D"gmail_default">Hello everyone,</div><div class=3D"gmail_defau=
lt"><br></div><div class=3D"gmail_default">The latest Python version (3.10.=
a5) of IDLE&#39;s repl has support for user-defined exception hooks. After =
being contacted by Terry Reedy about this feature, I investigated integrati=
ng Friendly-traceback [1] with IDLE.=C2=A0=C2=A0</div><div class=3D"gmail_d=
efault"><br></div><div class=3D"gmail_default">For those that are intereste=
d, I have documented on=C2=A0github [2] (with screenshots) how Friendly-tra=
ceback works with IDLE, including some limitations. Feel free to comment on=
 that issue for any suggestion you might have about possible improvements t=
o Friendly-traceback, including the current API used.</div><div class=3D"gm=
ail_default"><br></div><div class=3D"gmail_default">In some cases, I determ=
ine based on Python&#39;s version whether or not a feature can be enabled. =
I consider this to be brittle.=C2=A0 Rather than relying on Python&#39;s ve=
rsion, I would=C2=A0much prefer if I could be able to write something like:=
</div><div class=3D"gmail_default"><br></div><div class=3D"gmail_default">t=
ry:</div><div class=3D"gmail_default">=C2=A0 =C2=A0 from idlelib import sup=
port_excepthook</div><div class=3D"gmail_default">except:</div><div class=
=3D"gmail_default">=C2=A0 =C2=A0 support_excepthook =3D False</div><div cla=
ss=3D"gmail_default"><br></div><div class=3D"gmail_default">This would=C2=
=A0be especially useful if this support for user-defined exception hooks wi=
thin IDLE&#39;s shell is backported to older versions of Python.</div><div =
class=3D"gmail_default"><br></div><div class=3D"gmail_default">Something si=
milar would also be useful if and when support for custom handling of Synta=
xError is added to IDLE.</div><div class=3D"gmail_default"><br></div><div c=
lass=3D"gmail_default">Best,</div><div class=3D"gmail_default"><br></div><d=
iv class=3D"gmail_default">Andr=C3=A9 Roberge</div><div class=3D"gmail_defa=
ult"><br></div><div class=3D"gmail_default"><br></div><div class=3D"gmail_d=
efault">[1]=C2=A0<a href=3D"https://aroberge.github.io/friendly-traceback-d=
ocs/docs/html/" target=3D"_blank">https://aroberge.github.io/friendly-trace=
back-docs/docs/html/</a>=C2=A0 Currently, the documentation does not includ=
e the new IDLE-related features.</div><div class=3D"gmail_default">[2]=C2=
=A0<a href=3D"https://github.com/aroberge/friendly-traceback/issues/183" ta=
rget=3D"_blank">https://github.com/aroberge/friendly-traceback/issues/183</=
a></div></div><div class=3D"gmail_default" style=3D"font-family:arial,helve=
tica,sans-serif;font-size:small"><br></div><div class=3D"gmail_default" sty=
le=3D"font-family:arial,helvetica,sans-serif;font-size:small"><br></div></d=
iv><br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><br><br>
<br>
_______________________________________________<br>
IDLE-dev mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
g</a><br>
<a href=3D"https://mail.python.org/mailman/listinfo/idle-dev" rel=3D"norefe=
rrer" target=3D"_blank">https://mail.python.org/mailman/listinfo/idle-dev</=
a><br>
</blockquote></div></div>

--000000000000f24a9305baffe9a2--

--===============8109414904614372292==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
IDLE-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/idle-dev

--===============8109414904614372292==--