# Buggy code
def auto_number(tokens, local_dict, global_dict):
    """Converts numeric literals to use SymPy equivalents.

    Complex numbers use ``I``; integer literals use ``Integer``, float
    literals use ``Float``, and repeating decimals use ``Rational``.

    """
    result = []
    prevtoken = ""

    for toknum, tokval in tokens:
        if toknum == NUMBER:
            number = tokval
            postfix = []

            if number.endswith("j") or number.endswith("J"):
                number = number[:-1]
                postfix = [(OP, "*"), (NAME, "I")]

            if "." in number or (
                ("e" in number or "E" in number)
                and not (number.startswith("0x") or number.startswith("0X"))
            ):
                match = _re_repeated.match(number)

                if match is not None:
                    # Clear repeating decimals, e.g. 3.4[31] -> (3 + 4/10 + 31/990)
                    pre, post, repetend = match.groups()

                    zeros = "0" * len(post)
                    post, repetends = [w.lstrip("0") for w in [post, repetend]]
                    # or else interpreted as octal

                    a = pre or "0"
                    b, c = post or "0", "1" + zeros
                    d, e = repetends, ("9" * len(repetend)) + zeros

                    seq = [
                        (OP, "("),
                        (NAME, "Integer"),
                        (OP, "("),
                        (NUMBER, a),
                        (OP, ")"),
                        (OP, "+"),
                        (NAME, "Rational"),
                        (OP, "("),
                        (NUMBER, b),
                        (OP, ","),
                        (NUMBER, c),
                        (OP, ")"),
                        (OP, "+"),
                        (NAME, "Rational"),
                        (OP, "("),
                        (NUMBER, d),
                        (OP, ","),
                        (NUMBER, e),
                        (OP, ")"),
                        (OP, ")"),
                    ]
                else:
                    seq = [
                        (NAME, "Float"),
                        (OP, "("),
                        (NUMBER, repr(str(number))),
                        (OP, ")"),
                    ]
            else:
                seq = [(NAME, "Integer"), (OP, "("), (NUMBER, number), (OP, ")")]

            result.extend(seq + postfix)
        else:
            result.append((toknum, tokval))

    return result


# Traceback (SympifyError)
In [37]: S("α")
--------------------------------------------------------------------------
-
SympifyError                              Traceback (most recent call last)

/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in <module>()

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/sympify.pyc in sympify(a,
locals, convert_xor)
114             a = a.replace('^','**')
115         import ast_parser
--> 116         return ast_parser.parse_expr(a, locals)
117     raise SympifyError("%r is NOT a valid SymPy expression" % a)
118

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/ast_parser.pyc in
parse_expr(s, local_dict)
89             a = parse(s.strip(), mode="eval")
90         except SyntaxError:
---> 91             raise SympifyError("Cannot parse.")
92         a = Transform(local_dict, global_dict).visit(a)
93         e = compile(a, "<string>", "eval")

SympifyError: SympifyError: Cannot parse.

sympify() should be able to parse greek letters, as they are pretty printed for symbols of that
name:

In [44]: alpha = Symbol('alpha')

In [45]: alpha
Out[45]: α

# Fixed code
def auto_number(tokens, local_dict, global_dict):
    """
    Converts numeric literals to use SymPy equivalents.

    Complex numbers use ``I``, integer literals use ``Integer``, and float
    literals use ``Float``.

    """
    result = []

    for toknum, tokval in tokens:
        if toknum == NUMBER:
            number = tokval
            postfix = []

            if number.endswith("j") or number.endswith("J"):
                number = number[:-1]
                postfix = [(OP, "*"), (NAME, "I")]

            if "." in number or (
                ("e" in number or "E" in number)
                and not (number.startswith("0x") or number.startswith("0X"))
            ):
                seq = [
                    (NAME, "Float"),
                    (OP, "("),
                    (NUMBER, repr(str(number))),
                    (OP, ")"),
                ]
            else:
                seq = [(NAME, "Integer"), (OP, "("), (NUMBER, number), (OP, ")")]

            result.extend(seq + postfix)
        else:
            result.append((toknum, tokval))

    return result