Merge lp:~cjwatson/storm/py36 into lp:storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 533
Proposed branch: lp:~cjwatson/storm/py36
Merge into: lp:storm
Diff against target: 59 lines (+16/-0)
4 files modified
NEWS (+1/-0)
storm/sqlobject.py (+2/-0)
storm/variables.py (+11/-0)
tox.ini (+2/-0)
To merge this branch: bzr merge lp:~cjwatson/storm/py36
Reviewer Review Type Date Requested Status
Kristian Glass (community) Approve
Storm Developers Pending
Review via email: mp+373380@code.launchpad.net

Commit message

Support Python 3.6 and 3.7.

Description of the change

There were a couple of minor problems:

 * SQLObjectMeta needs to skip the new __classcell__ namespace entry added by the changes for PEP 487.

 * datetime.datetime.astimezone now presumes that naive datetime instances represent system local time rather than raising ValueError, which caused a test to fail. Since this presumption seems unlikely to be a good thing for things like web applications to rely on, forbid this case manually for now.

To post a comment you must log in.
Revision history for this message
Kristian Glass (doismellburning) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2019-09-27 19:22:54 +0000
+++ NEWS 2019-09-29 14:16:49 +0000
@@ -5,6 +5,7 @@
5---------5---------
66
7- Fix incorrect caching of wrapped DB-API exceptions (bug 1845702).7- Fix incorrect caching of wrapped DB-API exceptions (bug 1845702).
8- Support Python 3.6 and 3.7.
89
90.21 (2019-09-20)100.21 (2019-09-20)
10=================11=================
1112
=== modified file 'storm/sqlobject.py'
--- storm/sqlobject.py 2019-09-17 09:35:10 +0000
+++ storm/sqlobject.py 2019-09-29 14:16:49 +0000
@@ -167,6 +167,8 @@
167167
168 attr_to_prop = {}168 attr_to_prop = {}
169 for attr, prop in list(six.iteritems(dict)):169 for attr, prop in list(six.iteritems(dict)):
170 if attr == "__classcell__": # Python >= 3.6
171 continue
170 attr_to_prop[attr] = attr172 attr_to_prop[attr] = attr
171 if isinstance(prop, ForeignKey):173 if isinstance(prop, ForeignKey):
172 db_name = prop.kwargs.get("dbName", attr)174 db_name = prop.kwargs.get("dbName", attr)
173175
=== modified file 'storm/variables.py'
--- storm/variables.py 2019-08-11 16:57:24 +0000
+++ storm/variables.py 2019-09-29 14:16:49 +0000
@@ -421,6 +421,17 @@
421 elif not isinstance(value, datetime):421 elif not isinstance(value, datetime):
422 raise TypeError("Expected datetime, found %s" % repr(value))422 raise TypeError("Expected datetime, found %s" % repr(value))
423 if self._tzinfo is not None:423 if self._tzinfo is not None:
424 # Python 3.6 gained support for calling the astimezone
425 # method on naive datetime objects, presuming them to
426 # represent system local time. This is probably
427 # inappropriate for most uses of Storm, since depending on
428 # what the system local time happens to be is usually a
429 # mistake, so forbid this explicitly for now; we can always
430 # open it up later if there's a good reason.
431 if (value.tzinfo is None or
432 value.tzinfo.utcoffset(value) is None):
433 raise ValueError(
434 "Expected aware datetime, found naive: %r" % value)
424 value = value.astimezone(self._tzinfo)435 value = value.astimezone(self._tzinfo)
425 return value436 return value
426437
427438
=== modified file 'tox.ini'
--- tox.ini 2019-09-17 09:45:08 +0000
+++ tox.ini 2019-09-29 14:16:49 +0000
@@ -2,6 +2,8 @@
2envlist =2envlist =
3 py27-{cextensions,nocextensions}3 py27-{cextensions,nocextensions}
4 py35-{cextensions,nocextensions}4 py35-{cextensions,nocextensions}
5 py36-{cextensions,nocextensions}
6 py37-{cextensions,nocextensions}
57
6[testenv]8[testenv]
7deps =9deps =

Subscribers

People subscribed via source and target branches

to status/vote changes: