diff --git a/changelog.txt b/changelog.txt index fe13fc9..a9adff8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +version 0.4.8 +-------------------------------------------------- +* Fix value dtype handling for windows OS and uint as 32 bits. +* __getitem__ method return a Fxp with raw value as view (this solve issue #62). +* Add tests for issues #60 and #62. + version 0.4.7 -------------------------------------------------- * Keep val as original_vdtype and not as object when it is convenient (solve issue #60). diff --git a/fxpmath/__init__.py b/fxpmath/__init__.py index 77eec82..fbe5a84 100644 --- a/fxpmath/__init__.py +++ b/fxpmath/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.4.8-dev0' +__version__ = '0.4.8' import sys import os diff --git a/fxpmath/objects.py b/fxpmath/objects.py index f03c8cc..723955e 100644 --- a/fxpmath/objects.py +++ b/fxpmath/objects.py @@ -1456,7 +1456,10 @@ def __ge__(self, x): # indexation def __getitem__(self, index): - return Fxp(self.val[index], like=self, raw=True) + # return Fxp(self.val[index], like=self, raw=True) + y = Fxp(like=self) + y.val = self.val[index] + return y def __setitem__(self, index, value): self.set_val(value, index=index) diff --git a/tests/test_issues.py b/tests/test_issues.py index e2a4a43..69ba000 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -254,4 +254,4 @@ def test_issue_62_v0_4_7(): y[0][0] = y[0][0] + 1.0 - assert y[0][0]() == 2.0 + assert y[0][0]() == 0.0