Skip to content

IntEnum undeclared identifier #1022

@Killklli

Description

@Killklli

Hi,
I've been digging into this for a while and unfortunately have not been able to come across the right docs to solve this issue.

"""Kong enum."""
from enum import IntEnum, auto
from typing import List


class Kongs(IntEnum):
    """Kong enum."""

    donkey = 0
    diddy = auto()
    lanky = auto()
    tiny = auto()
    chunky = auto()
    any = auto()


def GetKongs() -> List[Kongs]:
    """Return list of kongs without any."""
    return [Kongs.donkey, Kongs.diddy, Kongs.lanky, Kongs.tiny, Kongs.chunky]

Whenever I try to compile this I'm getting the following errors.

build\randomizer\Enums\__native_Kongs.c(78): error C2065: 'CPyStatic_Kongs___donkey': undeclared identifier
build\randomizer\Enums\__native_Kongs.c(78): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
build\randomizer\Enums\__native_Kongs.c(88): error C2065: 'CPyStatic_Kongs___diddy': undeclared identifier
build\randomizer\Enums\__native_Kongs.c(88): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
build\randomizer\Enums\__native_Kongs.c(98): error C2065: 'CPyStatic_Kongs___lanky': undeclared identifier
build\randomizer\Enums\__native_Kongs.c(98): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
build\randomizer\Enums\__native_Kongs.c(108): error C2065: 'CPyStatic_Kongs___tiny': undeclared identifier
build\randomizer\Enums\__native_Kongs.c(108): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
build\randomizer\Enums\__native_Kongs.c(118): error C2065: 'CPyStatic_Kongs___chunky': undeclared identifier
build\randomizer\Enums\__native_Kongs.c(118): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'

It only occurs when I have the function defined along with it in the file, if I even move the function outside the file itself and try to compile it in the same set as the enum it then fails.
Am I missing a delayed import of the typing for the enum? Is there a simple way to solve that?

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