#34480 closed Bug (fixed)

Annotating with Chr raises ValueError

Reported by: Jacob Walls Owned by: Jacob Walls
Component: Database layer (models, ORM) Version: 4.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Jacob Walls)

>>> Author.objects.annotate(first_letter=Chr(Value(77)))
File "/Users/.../.../.venv/lib/python3.9/site-packages/django/db/models/expressions.py", line 369, in <lambda>
    else int(value)
ValueError: invalid literal for int() with base 10: 'M'

I'm suggesting in Chr we can set output_field = CharField() to prevent this.

Change History (5)

comment:1 by Jacob Walls, 20 months ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 20 months ago

Triage Stage: UnreviewedAccepted

comment:3 by Jacob Walls, 20 months ago

Has patch: set

comment:4 by Mariusz Felisiak, 20 months ago

Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 20 months ago

Resolution: fixed
Status: assignedclosed

In c3d7a71f:

Fixed #34480 -- Fixed crash of annotations with Chr().

Note: See TracTickets for help on using tickets.
Back to Top