Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Python 3.11.0b4 str(enum) giving integer value and not name #94763

Copy link
Copy link

Description

@jborean93
Issue body actions

Bug report

The str() method on Python 3.11.0b4 is outputting the raw integer value not the class name and label that older Python versions do.

import enum

class MyEnum(enum.IntEnum):
    TEST = 1


assert str(MyEnum.TEST) == "MyEnum.TEST", f"Actual '{MyEnum.TEST}'"

On Python 3.10 (and older Python 3 versions) this assertion is true. On python 3.11.0b4 the str value is just 1.

The repr() is the same as on older versions, just seems like str() is affected.

Your environment

  • CPython versions tested on: 3.11.0b4
  • Operating system and architecture: Linux (should be N/A though)
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.