python / python/cpython

EnumType __call__ method description does not match the implementation

Aberta
#119,110 1 comentário 0 reações 1 responsável Ver no GitHub

@ethanfurman já está trabalhando nisso.

Desde 17/5/2024.

docs stdlib
Linguagem predominante
Python
Estrelas
77.2k
Forks
35.9k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

Documentation

See EnumType.call documentation, where the prototype is:

__call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

While in the enum.py source code there is:

def __call__(cls, value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None):
  1. The _not_given helper behaves differently than None, which even breaks compatibility with previous versions (this change was introduced in 3.12.3), when one needs to do some customization of enum metaclass.

    • e.g. as propsed on the stack overflow to implement enum item deprecation warning - note that this implementation stops working in 3.12.3 since the call of the parent EnumType.__call__ passes None instead of _not_given and it causes different behavior.
  2. Note * vs. *values, which I believe even behaves differently.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.