Skip to content

Commit

Permalink
Fix to properly propagate float_type to converter
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed May 4, 2020
1 parent ef61cc9 commit 414c02b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion typepy/converter/_realnumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class FloatConverter(AbstractValueConverter):
def __init__(self, value, params):
super().__init__(value, params)

self.float_class = DefaultValue.FLOAT_TYPE
self.float_class = self._params.get("float_type")
if self.float_class is None:
self.float_class = DefaultValue.FLOAT_TYPE

def force_convert(self):
if isinstance(self._value, self.float_class):
Expand Down
2 changes: 0 additions & 2 deletions typepy/type/_realnumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from typing import Any

from .._const import DefaultValue
from .._typecode import Typecode
from ._base import AbstractType

Expand Down Expand Up @@ -35,6 +34,5 @@ def _create_type_converter(self):
from ..converter._realnumber import FloatConverter

converter = FloatConverter(self._data, self._params)
converter.float_class = self._params.get("float_type", DefaultValue.FLOAT_TYPE)

return converter

0 comments on commit 414c02b

Please sign in to comment.