Pylint: Emoji-induced RecursionError

Created on 22 Nov 2020  ยท  4Comments  ยท  Source: PyCQA/pylint

Steps to reproduce

Run pylint on the snippet below which performs several emoji substitutions.

Commenting various lines out, I thought the hippos were to blame. Yet, if I actually remove everything but the hippos, pylint runs just fine. I couldn't isolate the problem; maybe it's the number of substitutions?

def emoji(msg):
    msg = msg.replace('[:-)]', '๐Ÿ™‚')
    msg = msg.replace('[:->]', '๐Ÿ˜€')
    msg = msg.replace('[:-D]', '๐Ÿ˜†')
    msg = msg.replace('[;-D]', '๐Ÿคฃ')
    msg = msg.replace('[;-)]', '๐Ÿ˜‰')
    msg = msg.replace('[:-|]', '๐Ÿ˜')
    msg = msg.replace('[:-P]', '๐Ÿ˜›')
    msg = msg.replace('[8-D]', '๐Ÿ˜‚')
    msg = msg.replace('[8-o]', '๐Ÿ˜ฒ')
    msg = msg.replace('[:-o]', '๐Ÿ˜ฎ')
    msg = msg.replace('[:-(]', '๐Ÿ˜Ÿ')
    msg = msg.replace('[:-E]', '๐Ÿ˜ก')
    msg = msg.replace('[;-(]', '๐Ÿ˜ข')
    msg = msg.replace('[:-c]', '๐Ÿ˜ฉ')
    msg = msg.replace('[:-Q]', '๐Ÿคฎ')
    msg = msg.replace('[8-P]', '๐Ÿ˜œ')
    msg = msg.replace('[:-3]', '๐Ÿ˜Š')
    msg = msg.replace('[:-$]', '๐Ÿคข')
    msg = msg.replace('[O:-)]', '๐Ÿ˜‡')
    msg = msg.replace('[]:-)]', '๐Ÿ˜ˆ')
    msg = msg.replace('[Z]', 'โšก')
    msg = msg.replace('[?]', 'โ“')
    msg = msg.replace('[!]', 'โ—')
    msg = msg.replace('[R^]', '๐Ÿ‘')
    msg = msg.replace('[Rv]', '๐Ÿ‘Ž')
    msg = msg.replace('[O=]', '๐Ÿ’ก')
    msg = msg.replace('[@)->-]', '๐ŸŒน')
    msg = msg.replace('[@=]', '๐Ÿ’ฃ')
    msg = msg.replace('[8=]', '๐Ÿ’€')
    msg = msg.replace('[$>]', '๐Ÿ’—')
    msg = msg.replace('B-)', '๐Ÿ˜Ž')
    msg = msg.replace(':-[)', '๐Ÿ˜ท')
    msg = msg.replace('8-[)', '๐Ÿ˜ท')
    msg = msg.replace('(8:O)', '๐Ÿฆ›')
    msg = msg.replace('(8:o)', '๐Ÿฆ›')
    msg = msg.replace('(8:ยฐ)', '๐Ÿฆ›')
    msg = msg.replace('(รรร)', '๐Ÿฐ')
    return msg

Current behavior

pylint crashes with RecursionError: maximum recursion depth exceeded

Expected behavior

pylint works just fine.

pylint --version output

pylint 2.6.0
astroid 2.4.2
Python 3.7.9 (default, Oct 22 2020, 15:11:35) 
[GCC 10.2.0]
astroid bug crash needs reproduction

Most helpful comment

@contyk thanks for the report!

And now I've just notice your handle...

All 4 comments

@contyk thanks for the report!

Let me know if I can provide more details, such as the exception stack. But it's quite long (duh) and if you can reproduce it, it will be simpler.

@contyk thanks for the report!

And now I've just notice your handle...

I'm not able to reproduce this with:

pylint 2.6.1-dev1
astroid 2.5.0
Python 3.8.1 (default, Feb 13 2020, 10:17:07)
[Clang 8.1.0 (clang-802.0.42)]

It would be great to see the traceback you are getting but emojis should not affect the parser or the inference resulting in recursion errors. I'm closing this for now but let's reopen if you are able to reproduce and can provide the traceback. Also if you can test with the astroid version installed from the master branch, that would be great.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hubro picture Hubro  ยท  3Comments

PCManticore picture PCManticore  ยท  3Comments

mrginglymus picture mrginglymus  ยท  3Comments

GergelyKalmar picture GergelyKalmar  ยท  3Comments

pylint-bot picture pylint-bot  ยท  3Comments