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
1=== modified file 'NEWS'
2--- NEWS 2019-09-27 19:22:54 +0000
3+++ NEWS 2019-09-29 14:16:49 +0000
4@@ -5,6 +5,7 @@
5 ---------
6
7 - Fix incorrect caching of wrapped DB-API exceptions (bug 1845702).
8+- Support Python 3.6 and 3.7.
9
10 0.21 (2019-09-20)
11 =================
12
13=== modified file 'storm/sqlobject.py'
14--- storm/sqlobject.py 2019-09-17 09:35:10 +0000
15+++ storm/sqlobject.py 2019-09-29 14:16:49 +0000
16@@ -167,6 +167,8 @@
17
18 attr_to_prop = {}
19 for attr, prop in list(six.iteritems(dict)):
20+ if attr == "__classcell__": # Python >= 3.6
21+ continue
22 attr_to_prop[attr] = attr
23 if isinstance(prop, ForeignKey):
24 db_name = prop.kwargs.get("dbName", attr)
25
26=== modified file 'storm/variables.py'
27--- storm/variables.py 2019-08-11 16:57:24 +0000
28+++ storm/variables.py 2019-09-29 14:16:49 +0000
29@@ -421,6 +421,17 @@
30 elif not isinstance(value, datetime):
31 raise TypeError("Expected datetime, found %s" % repr(value))
32 if self._tzinfo is not None:
33+ # Python 3.6 gained support for calling the astimezone
34+ # method on naive datetime objects, presuming them to
35+ # represent system local time. This is probably
36+ # inappropriate for most uses of Storm, since depending on
37+ # what the system local time happens to be is usually a
38+ # mistake, so forbid this explicitly for now; we can always
39+ # open it up later if there's a good reason.
40+ if (value.tzinfo is None or
41+ value.tzinfo.utcoffset(value) is None):
42+ raise ValueError(
43+ "Expected aware datetime, found naive: %r" % value)
44 value = value.astimezone(self._tzinfo)
45 return value
46
47
48=== modified file 'tox.ini'
49--- tox.ini 2019-09-17 09:45:08 +0000
50+++ tox.ini 2019-09-29 14:16:49 +0000
51@@ -2,6 +2,8 @@
52 envlist =
53 py27-{cextensions,nocextensions}
54 py35-{cextensions,nocextensions}
55+ py36-{cextensions,nocextensions}
56+ py37-{cextensions,nocextensions}
57
58 [testenv]
59 deps =

Subscribers

People subscribed via source and target branches

to status/vote changes: