Skip to content

Pasting bad Unicode data to editor kills the process #32

Closed

Description

@aivarannamaa

Original report by me.


and Tk.report_callback_exception is not called

Traceback (most recent call last):
  File "D:\workspaces\python_stuff\thonny\src\launch.py", line 12, in <module>
    main.Thonny().mainloop()    
  File "C:\Python34\lib\tkinter\__init__.py", line 1069, in mainloop
    self.tk.mainloop(n)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 50: invalid continuation byte

Activity

  1. aivarannamaa commented on Oct 2, 2014

    @aivarannamaa
    MemberAuthor

    Original changes by Aivar Annamaa (Bitbucket: aivarannamaa
    GitHub: aivarannamaa
    ).


    • added labels: editor
  2. aivarannamaa commented on Feb 4, 2016

    @aivarannamaa
    MemberAuthor

    Original changes by Aivar Annamaa (Bitbucket: aivarannamaa
    GitHub: aivarannamaa
    ).


    • added labels: low priority
  3. aivarannamaa commented on Feb 4, 2016

    @aivarannamaa
    MemberAuthor

    Haven't seen this for a while. Don't know how to replicate. Hopefully went away.

  4. aivarannamaa commented on Feb 4, 2016

    @aivarannamaa
    MemberAuthor

    Original changes by Aivar Annamaa (Bitbucket: aivarannamaa
    GitHub: aivarannamaa
    ).


    • changed status to closed
  5. Ivoz commented on Sep 27, 2019

    @Ivoz
    Contributor

    Hi @aivarannamaa maybe I found a way to replicate this :D

    I went to https://rushter.com/blog/python-strings-and-memory/ and tried to paste exactly '🐍' from its code box .

    Pasting just the snake does nothing. Pasting the two quotes with the snake inside raises this error. Both shell and file editor. Thonny 3.2.1 on Windows

  6. aivarannamaa commented on Sep 28, 2019

    @aivarannamaa
    MemberAuthor

    Thank you!

    I guess I need to add a guard to paste and load operations and present a warning/confirmation dialog when unsupported characters are found in the input.

    https://stackoverflow.com/questions/23530080/how-to-print-non-bmp-unicode-characters-in-tkinter-e-g

  7. added this to the 3.2.2 milestone on Sep 28, 2019
  8. modified the milestones: 3.2.2, 4.0 on Oct 11, 2019
  9. aivarannamaa commented on Dec 19, 2019

    @aivarannamaa
    MemberAuthor

    Needs to be tested with Python 3.7.6. Hopefully it got fixed by python/cpython#16581

  10. 4 remaining items

  11. added this to the 4.0 milestone on Dec 24, 2019
  12. kcarnold commented on Apr 1, 2020

    @kcarnold

    Another, probably related, Unicode bug: paste any emoji (e.g., 💬) into an empty editor. My editor then looks like

    💬💬

    It gets worse: go to the beginning of the line and press Delete. Thonny hangs.

    My guess is that the rebuild will fix this one too.

  13. aivarannamaa commented on Apr 1, 2020

    @aivarannamaa
    MemberAuthor

    Unfortunately there is nothing I can do about it. Let's hope next Tk version to be included in Python fixes this.

  14. lurch commented on May 25, 2020

    @lurch
    Contributor

    Unfortunately there is nothing I can do about it.

    Understood, but in case it's useful, here's another way to reproduce this:

    1. Use Thonny's manage-plugins window to install black
    2. In the Shell window, type !black myfile.py
    3. Boom, Thonny crashes with
    X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
      Major opcode of failed request:  139 (RENDER)
      Minor opcode of failed request:  20 (RenderAddGlyphs)
      Serial number of failed request:  10827
      Current serial number in output stream:  10837
    
  15. lurch commented on May 25, 2020

    @lurch
    Contributor

    As a workaround I wondered if there was a way to turn off the emojis in the black output, but it seems that's something the black developers are stubbornly resistant to 😖 psf/black#1270

  16. aivarannamaa commented on Jun 2, 2020

    @aivarannamaa
    MemberAuthor

    I hope they will bundle Tk 8.6.10 with Python 3.9. If this doesn't help, then I have to preprocess the output before reaching the shell.

  17. modified the milestones: 4.0, 4.0.0 on Feb 27, 2021
  18. modified the milestones: 4.0, 4.0.0b1 on Nov 13, 2021
  19. aivarannamaa commented on Dec 26, 2021

    @aivarannamaa
    MemberAuthor

    Closing, as things are much better with Tcl/Tk 8.6.12 (to be bundled with Thonny 4.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions