This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients rhettinger, serhiy.storchaka, zd nex
Date 2020-03-13.18:29:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584124171.61.0.886117642667.issue39956@roundup.psfhosted.org>
In-reply-to
Content
You can validate the input before using it.

    if '_' in s: raise ValueError

or

    if not re.fullmatch('[0-9]+', s): raise ValueError

Do you want to accept "۱۲۳۴" or "       12       "? If not then validate the input before using int().

Also, do not use ast.literal_eval() with untrusted input without validation. It is not a "safe eval" and may even crash the interpreter.
History
Date User Action Args
2020-03-13 18:29:31serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, zd nex
2020-03-13 18:29:31serhiy.storchakasetmessageid: <1584124171.61.0.886117642667.issue39956@roundup.psfhosted.org>
2020-03-13 18:29:31serhiy.storchakalinkissue39956 messages
2020-03-13 18:29:31serhiy.storchakacreate