8000 Drop Python 3.4 support (#762) · RecentProgress/PyMySQL@fe0cd60 · GitHub
[go: up one dir, main page]

Skip to content

Commit fe0cd60

Browse files
authored
Drop Python 3.4 support (PyMySQL#762)
1 parent 8eee266 commit fe0cd60

File tree

7 files changed

+9
-62
lines changed

7 files changed

+9
-62
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# vim: sw=2 ts=2 sts=2 expandtab
22

3-
sudo: required
3+
dist: xenial
44
language: python
5+
cache: pip
6+
57
services:
68
- docker
79

8-
cache: pip
9-
1010
matrix:
1111
include:
1212
- env:
@@ -17,7 +17,7 @@ matrix:
1717
python: "3.6"
1818
- env:
1919
- DB=mariadb:10.1
20-
python: "pypy"
20+
python: "pypy3.5"
2121
- env:
2222
- DB=mariadb:10.2
2323
python: "2.7"
@@ -32,7 +32,7 @@ matrix:
3232
python: "3.6"
3333
- env:
3434
- DB=mysql:5.7
35-
python: "3.4"
35+
python: "3.7"
3636
- env:
3737
- DB=mysql:8.0
3838
- TEST_AUTH=yes

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Requirements
3838

3939
* Python -- one of the following:
4040

41-
- CPython_ : 2.7 and >= 3.4
41+
- CPython_ : 2.7 and >= 3.5
4242
- PyPy_ : Latest version
4343

4444
* MySQL Server -- one of the following:

docs/source/user/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Requirements
1818

1919
* Python -- one of the following:
2020

21-
- CPython_ >= 2.7 or >= 3.4
21+
- CPython_ >= 2.7 or >= 3.5
2222
- Latest PyPy_
2323

2424
* MySQL Server -- one of the following:

pymysql/converters.py

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -301,46 +301,6 @@ def convert_date(obj):
301301
return obj
302302

303303

304-
def convert_mysql_timestamp(timestamp):
305-
"""Convert a MySQL TIMESTAMP to a Timestamp object.
306-
307-
MySQL >= 4.1 returns TIMESTAMP in the same format as DATETIME:
308-
309-
>>> mysql_timestamp_converter('2007-02-25 22:32:17')
310-
datetime.datetime(2007, 2, 25, 22, 32, 17)
311-
312-
MySQL < 4.1 uses a big string of numbers:
313-
314-
>>> mysql_timestamp_converter('20070225223217')
315-
datetime.datetime(2007, 2, 25, 22, 32, 17)
316-
317-
Illegal values are returned as None:
318-
319-
>>> mysql_timestamp_converter('2007-02-31 22:32:17') is None
320-
True
321-
>>> mysql_timestamp_converter('00000000000000') is None
322-
True
323-
324-
"""
325-
if not PY2 and isinstance(timestamp, (bytes, bytearray)):
326-
timestamp = timestamp.decode('ascii')
327-
if timestamp[4] == '-':
328-
return convert_datetime(timestamp)
329-
timestamp += "0"*(14-len(timestamp)) # padding
330-
year, month, day, hour, minute, second = \
331-
int(timestamp[:4]), int(timestamp[4:6]), int(timestamp[6:8]), \
332-
int(timestamp[8:10]), int(timestamp[10:12]), int(timestamp[12:14])
333-
try:
334-
return datetime.datetime(year, month, day, hour, minute, second)
335-
except ValueError:
336-
return timestamp
337-
338-
def convert_set(s):
339-
if isinstance(s, (bytes, bytearray)):
340-
return set(s.split(b","))
341-
return set(s.split(","))
342-
343-
344304
def through(x):
345305
return x
346306

@@ -388,11 +348,10 @@ def through(x):
388348
FIELD_TYPE.LONGLONG: int,
389349
FIELD_TYPE.INT24: int,
390350
FIELD_TYPE.YEAR: int,
391-
FIELD_TYPE.TIMESTAMP: convert_mysql_timestamp,
351+
FIELD_TYPE.TIMESTAMP: convert_datetime,
392352
FIELD_TYPE.DATETIME: convert_datetime,
393353
FIELD_TYPE.TIME: convert_timedelta,
394354
FIELD_TYPE.DATE: convert_date,
395-
FIELD_TYPE.SET: convert_set,
396355
FIELD_TYPE.BLOB: through,
397356
FIELD_TYPE.TINY_BLOB: through,
398357
FIELD_TYPE.MEDIUM_BLOB: through,

pymysql/err.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ def _map_error(exc, *errors):
9999

100100
def raise_mysql_exception(data):
101101
errno = struct.unpack('<h', data[1:3])[0]
102-
is_41 = data[3:4] == b"#"
103-
if is_41:
104-
# client protocol 4.1
105-
errval = data[9:].decode('utf-8', 'replace')
106-
else:
107-
errval = data[3:].decode('utf-8', 'replace')
102+
errval = data[9:].decode('utf-8', 'replace')
108103
errorclass = error_map.get(errno, InternalError)
109104
raise errorclass(errno, errval)

pymysql/tests/test_err.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
class TestRaiseException(unittest2.TestCase):
1010

1111
def test_raise_mysql_exception(self):
12-
data = b"\xff\x15\x04Access denied"
13-
with self.assertRaises(err.OperationalError) as cm:
14-
err.raise_mysql_exception(data)
15-
self.assertEqual(cm.exception.args, (1045, 'Access denied'))
16-
17-
def test_raise_mysql_exception_client_protocol_41(self):
1812
data = b"\xff\x15\x04#28000Access denied"
1913
with self.assertRaises(err.OperationalError) as cm:
2014
err.raise_mysql_exception(data)

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
'Programming Language :: Python :: 2',
2626
'Programming Language :: Python :: 2.7',
2727
'Programming Language :: Python :: 3',
28-
'Programming Language :: Python :: 3.4',
2928
'Programming Language :: Python :: 3.5',
3029
'Programming Language :: Python :: 3.6',
3130
'Programming Language :: Python :: 3.7',

0 commit comments

Comments
 (0)
0