Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntEnum undeclared identifier #1022

Open
Killklli opened this issue Sep 30, 2023 · 2 comments
Open

IntEnum undeclared identifier #1022

Killklli opened this issue Sep 30, 2023 · 2 comments

Comments

@Killklli
Copy link

Killklli commented Sep 30, 2023

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?

@Killklli
Copy link
Author

Killklli commented Oct 1, 2023

Apologies this seems to be linked to #721 swapping off windows and compiling on linux gave me the same errors that posts defines.

@theoallouche
Copy link

Same problem here, did you find a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants