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

Python 3.11 error #15

Closed
demberto opened this issue Oct 5, 2022 · 7 comments
Closed

Python 3.11 error #15

demberto opened this issue Oct 5, 2022 · 7 comments

Comments

@demberto
Copy link

demberto commented Oct 5, 2022

in <module>
    import construct_typed as ct
construct_typed\__init__.py:21: in <module>
    from .tenum import EnumBase, FlagsEnumBase, TEnum, TFlagsEnum
construct_typed\tenum.py:8: in <module>
    class EnumBase(enum.IntEnum):
construct_typed\tenum.py:25: in EnumBase
    def _create_pseudo_member_(cls, value: int) -> "EnumBase":
\Python311\Lib\enum.py:378: in __setitem__
    raise ValueError(
E   ValueError: _sunder_ names, such as '_create_pseudo_member_', are reserved for future Enum use

Precisely this

def _create_pseudo_member_(cls, value: int) -> "EnumBase":
pseudo_member = cls._value2member_map_.get(value, None) # type: ignore
if pseudo_member is None:
new_member = int.__new__(cls, value)
# I expect a name attribute to hold a string, hence str(value)
# However, new_member._name_ = value works, too
new_member._name_ = str(value)
new_member._value_ = value
pseudo_member = cls._value2member_map_.setdefault(value, new_member) # type: ignore
return pseudo_member # type: ignore

@timrid
Copy link
Owner

timrid commented Oct 23, 2022

Thanks for the bug report. I fixed it on main. It will come into the next release.

@timrid timrid closed this as completed Oct 23, 2022
@demberto
Copy link
Author

How about not creating a separate method itself? Putting all logic in _missing_ itself?

@timrid
Copy link
Owner

timrid commented Oct 25, 2022

Good point. I removed _create_pseudo_member_ completely.

@demberto
Copy link
Author

@timrid Can you give an estimate on how much time a release will take? I have a project which depends on this library and it seems I cannot publish wheels with a direct git commit dependency

ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
         Invalid value for requires_dist. Error: Can't have direct dependency: 'construct-typing @
         git+https://github.com/timrid/construct-typing.git@ce871936d9e885c84f2f507c723fc5a7e99c9096'

This is the error I got from twine. There's no solutions afaik, and google doesn't return much results about this

@timrid
Copy link
Owner

timrid commented Oct 28, 2022

I guess I can make it in a few days. At most a week.

@timrid
Copy link
Owner

timrid commented Oct 31, 2022

v0.5.3 is released

@demberto
Copy link
Author

Thanks

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