Python 3 and pygments-parser

Marcus Harnisch <[email protected]> Mon, 6 May 2024 16:57:43 +0200
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <CAAmKruU+uS6-H4c0BOo94jtQTCFVJR1cCdOQKaV1z_rkxxd24g@mail.gmail.com>
--0000000000005120ae0617ca4b02
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Shigio

The method =E2=80=98load_ctags_path()=E2=80=99 doesn't work with Python 3 (=
unless perhaps
with Win32/latin1). In other places the encoding has been fixed to =E2=80=
=98latin1=E2=80=99
as well. At least for =E2=80=98load_gtags_path()=E2=80=99 I'd probably chan=
ge the encoding
to the current locale with =E2=80=98locale.getpreferredencoding(False)=E2=
=80=99.
Not sure what to do about reading source code files (read_file) or ctags
output (CtagsParser.__init__()). Presumably, =E2=80=98utf-8=E2=80=99 would =
offer broader
support than =E2=80=98latin1=E2=80=99, but neither might be correct in all =
cases.

Python 2 support has been dropped from Pygments more than four years ago.
Does it make sense to maintain Python 2 compatibility in the
pygments-parser?

Best regards,
Marcus

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

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-size:small">Hi =
Shigio</div><div class=3D"gmail_default" style=3D"font-size:small"><br></di=
v><div class=3D"gmail_default" style=3D"font-size:small">The method =E2=80=
=98load_ctags_path()=E2=80=99 doesn&#39;t work with Python 3 (unless perhap=
s with Win32/latin1). In other places the encoding has been fixed to =E2=80=
=98latin1=E2=80=99 as well. At least for =E2=80=98load_gtags_path()=E2=80=
=99 I&#39;d probably change the encoding to the current locale with =E2=80=
=98locale.getpreferredencoding(False)=E2=80=99.</div><div class=3D"gmail_de=
fault" style=3D"font-size:small"></div><div class=3D"gmail_default" style=
=3D"font-size:small">Not sure what to do about reading source code files (r=
ead_file) or ctags output (CtagsParser.__init__()). Presumably, =E2=80=98ut=
f-8=E2=80=99 would offer broader support than =E2=80=98latin1=E2=80=99, but=
 neither might be correct in all cases.</div><div class=3D"gmail_default" s=
tyle=3D"font-size:small"><br></div><div class=3D"gmail_default" style=3D"fo=
nt-size:small">Python 2 support has been dropped from Pygments more than fo=
ur years ago. Does it make sense to maintain Python 2 compatibility in the =
pygments-parser?</div><div class=3D"gmail_default" style=3D"font-size:small=
"><br></div><div class=3D"gmail_default" style=3D"font-size:small">Best reg=
ards,</div><div class=3D"gmail_default" style=3D"font-size:small">Marcus</d=
iv><div class=3D"gmail_default" style=3D"font-size:small"><br></div></div>

--0000000000005120ae0617ca4b02--