Skip to content

Type name cannot contain surrogates #4786

@DimitrisJim

Description

@DimitrisJim

Issue caught after an update to test_builtins in #4765. Creating a new type and supplying as a name a value that contains a surrogate (in this case \udcdc is used) should result in an error.

RustPython:

>>> type("A\udcdcB", (), {})
>>> <class '__main__.A�B'>

While in CPython:

>>> type("A\udcdcB", (), {})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcdc' in position 1: surrogates not allowed

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't workingC-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions