Changes between Initial Version and Version 1 of Ticket #33033
- Timestamp:
- Aug 18, 2021, 2:06:28 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #33033
- Property Summary numpy.nan can be stored in DecimalField but cannot be retrieved → NaN can be stored in DecimalField but cannot be retrieved
-
Ticket #33033 – Description
initial v1 1 1 **Description** 2 2 3 If, for whatever reason, a ` numpy.nan` valueis stored in a `DecimalField` using `sqlite3`, the object cannot be retrieved from the database.3 If, for whatever reason, a `NaN` value (either `float('nan')`, `math.nan`, or `numpy.nan`) is stored in a `DecimalField` using `sqlite3`, the object cannot be retrieved from the database. 4 4 5 5 Attempts to do so will raise `TypeError: argument must be int or float` … … 9 9 **Steps to reproduce** 10 10 11 1. Create a brand new project using python 3.8.10 , numpy 1.21.2, and django 3.2.6 with the default `sqlite3` backend.11 1. Create a brand new project using python 3.8.10 and django 3.2.6 with the default `sqlite3` backend (optionally with numpy 1.21.2). 12 12 13 13 2. Create a model with a `DecimalField`: … … 18 18 }}} 19 19 20 3. Programmatically create a model instance with `value= numpy.nan`, then try to retrieve the object from the database (or refresh from database).20 3. Programmatically create a model instance with `value=float('nan')` (or `math.nan`, or `numpy.nan`), then try to retrieve the object from the database (or refresh from database). 21 21 22 22 {{{ 23 obj = MyModel.objects.create(value= numpy.nan)23 obj = MyModel.objects.create(value=float('nan')) 24 24 # the following raises a "TypeError: argument must be int or float" 25 25 obj.refresh_from_db()