Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Pass type information to `format_exception` from `transform_errors` for primitive types

Aperta
#401 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start by locating transform_errors and format_exception, then inspect how notes carries target types for iterable and class structuring failures. The work is complete when format_exception can receive the exact target type for primitive types such as int and float without inspecting the error message.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

  • cattrs version: v23.1.2
  • Python version: Python 3.8
  • Operating System: Ubuntu 20.04
Description

In #258, __notes__ were added to support passing AttributeValidationNote and IterableValidationNote around. transform_errors uses these notes to pass the target type when calling format_exception. This works well in most cases, except for primitive types.

Feature Request

I want to be able to customize my format_exception function so that I know the exact target type of the exception without needing to inspect the error message. If I understand it correctly, in the current design, __notes__ is only set on exceptions that are raised when structuring an iterable or class, but is not for types like int, float and etc.

Lingua principale
Python
Stelle
1.1k
Fork
168
Merge medio
3g 7m
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python-attrs/cattrs

Tutte le issue di python-attrs/cattrs

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.