fix: the return type is wrong for int +/- float (#277)
GitOrigin-RevId: 14230ea7791bee8542e56ccd7efba34ba584f004
Change-Id: Ia10bdadf0f5b79a284e5d83aeeebf98edb022958
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 22bd503..3a850f7 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,7 +11,7 @@
steps:
- name: Checkout code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
submodules: "recursive"
@@ -20,7 +20,7 @@
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Set up Python 3.9
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: "3.9"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 6108d6b..ebe25ae 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -48,7 +48,7 @@
- name: Install Poetry
shell: bash
- run: curl -fsSL https://install.python-poetry.org | python - -y
+ run: curl -fsSL https://install.python-poetry.org | python - -y --version 1.4.0
- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
diff --git a/tomlkit/items.py b/tomlkit/items.py
index 5990eea..da40880 100644
--- a/tomlkit/items.py
+++ b/tomlkit/items.py
@@ -647,28 +647,28 @@
return self._raw
def __add__(self, other):
- return self._new(int(self._raw) + other)
+ result = super().__add__(other)
+ if result is NotImplemented:
+ return result
+ return self._new(result)
def __radd__(self, other):
result = super().__radd__(other)
-
- if isinstance(other, Integer):
- return self._new(result)
-
- return result
+ if result is NotImplemented:
+ return result
+ return self._new(result)
def __sub__(self, other):
result = super().__sub__(other)
-
+ if result is NotImplemented:
+ return result
return self._new(result)
def __rsub__(self, other):
result = super().__rsub__(other)
-
- if isinstance(other, Integer):
- return self._new(result)
-
- return result
+ if result is NotImplemented:
+ return result
+ return self._new(result)
def _new(self, result):
raw = str(result)