Skip to content

Commit

Permalink
Fix behavior on PyPy3
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Nov 19, 2018
1 parent 367521e commit c689081
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- python: "3.4"
- python: "3.5"
- python: "3.6"
- python: "3.7"
dist: xenial
- python: "pypy3"

- stage: linting
python: "3.6"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Fixed copy of TOML documents.
- Fixed behavior on PyPy3.


## [0.5.2] - 2018-11-09
Expand Down
5 changes: 4 additions & 1 deletion tomlkit/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,10 @@ def __add__(self, other):
def __sub__(self, other):
result = super(DateTime, self).__sub__(other)

return self._new(result)
if isinstance(result, datetime):
result = self._new(result)

return result

def _new(self, result):
raw = result.isoformat()
Expand Down
4 changes: 0 additions & 4 deletions tomlkit/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ def __exit__(self, exception_type, exception_val, trace):
if self._save_marker:
self._source._marker = self._marker

# Restore exceptions are silently consumed, other exceptions need to
# propagate
return exception_type is None


class _StateHandler:
"""
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
isolated_build=true
envlist = py27, py34, py35, py36, py37
envlist = py27, py34, py35, py36, py37, pypy3

[testenv]
whitelist_externals = poetry
Expand Down

0 comments on commit c689081

Please sign in to comment.