Skip to content

Emoji-induced RecursionError #3952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
contyk opened this issue Nov 22, 2020 · 4 comments
Closed

Emoji-induced RecursionError #3952

contyk opened this issue Nov 22, 2020 · 4 comments
Labels
Astroid Related to astroid Bug 🪲 Crash 💥 A bug that makes pylint crash Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine

Comments

@contyk
Copy link

contyk commented Nov 22, 2020

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]
@hippo91
Copy link
Contributor

hippo91 commented Nov 26, 2020

@contyk thanks for the report!

@hippo91 hippo91 added Astroid Related to astroid Bug 🪲 Crash 💥 A bug that makes pylint crash labels Nov 26, 2020
@contyk
Copy link
Author

contyk commented Nov 26, 2020

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
Copy link
Author

contyk commented Nov 26, 2020

@contyk thanks for the report!

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

@PCManticore
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Bug 🪲 Crash 💥 A bug that makes pylint crash Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine
Projects
None yet
Development

No branches or pull requests

3 participants