Skip to content

Commit 5a89ecb

Browse files
author
Kareem Zidane
authoredNov 6, 2018
Merge pull request #63 from cs50/develop
v2.4.4
2 parents 1926b08 + 4cfc648 commit 5a89ecb

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
 

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
package_dir={"": "src"},
1717
packages=["cs50"],
1818
url="https://github.com/cs50/python-cs50",
19-
version="2.4.3"
19+
version="2.4.4"
2020
)

‎src/cs50/sql.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -103,39 +103,39 @@ def process(value):
103103
"""Render a literal value, escaping as needed."""
104104

105105
# bool
106-
if isinstance(value, bool):
106+
if type(value) is bool:
107107
return sqlalchemy.types.Boolean().literal_processor(dialect)(value)
108108

109109
# datetime.date
110-
elif isinstance(value, datetime.date):
110+
elif type(value) is datetime.date:
111111
return sqlalchemy.types.String().literal_processor(dialect)(value.strftime("%Y-%m-%d"))
112112

113113
# datetime.datetime
114-
elif isinstance(value, datetime.datetime):
114+
elif type(value) is datetime.datetime:
115115
return sqlalchemy.types.String().literal_processor(dialect)(value.strftime("%Y-%m-%d %H:%M:%S"))
116116

117117
# datetime.time
118-
elif isinstance(value, datetime.time):
118+
elif type(value) is datetime.time:
119119
return sqlalchemy.types.String().literal_processor(dialect)(value.strftime("%H:%M:%S"))
120120

121121
# float
122-
elif isinstance(value, float):
122+
elif type(value) is float:
123123
return sqlalchemy.types.Float().literal_processor(dialect)(value)
124124

125125
# int
126-
elif isinstance(value, int):
126+
elif type(value) is int:
127127
return sqlalchemy.types.Integer().literal_processor(dialect)(value)
128128

129129
# long
130-
elif sys.version_info.major != 3 and isinstance(value, long):
130+
elif sys.version_info.major != 3 and type(value) is long:
131131
return sqlalchemy.types.Integer().literal_processor(dialect)(value)
132132

133133
# str
134-
elif isinstance(value, str):
134+
elif type(value) is str:
135135
return sqlalchemy.types.String().literal_processor(dialect)(value)
136136

137137
# None
138-
elif isinstance(value, sqlalchemy.sql.elements.Null):
138+
elif type(value) is sqlalchemy.sql.elements.Null:
139139
return sqlalchemy.types.NullType().literal_processor(dialect)(value)
140140

141141
# Unsupported value
@@ -192,7 +192,7 @@ def process(value):
192192
rows = [dict(row) for row in result.fetchall()]
193193
for row in rows:
194194
for column in row:
195-
if isinstance(row[column], decimal.Decimal):
195+
if type(row[column]) is decimal.Decimal:
196196
row[column] = float(row[column])
197197
ret = rows
198198

0 commit comments

Comments
 (0)
Please sign in to comment.