Skip to content

Python 2: %s formatting a greenlet results in a unicode object instead of a str #218

Closed
@jamadden

Description

@jamadden

Because tp_repr is using PyUnicode_Format; directly calling repr or str converts the result to a str, but for some reason %s formatting does not.

>>> import sys
>>> print(sys.version)
2.7.18 (default, Sep  7 2020, 05:51:03)
[GCC Apple LLVM 12.0.0 (clang-1200.0.31.1)]
None
>>> import greenlet
>>> '%s' % (greenlet.getcurrent(),)
u'<greenlet.greenlet object at 0x10694b910 (otid=0x106bd1950) current active started main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions