Skip to content

Commit d0ca7a7

Browse files
committed
WL12239: Add support for Python 3.7
1 parent f431fe8 commit d0ca7a7

File tree

9 files changed

+29
-21
lines changed

9 files changed

+29
-21
lines changed

cpyint

lib/mysql/connector/cursor.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -498,16 +498,19 @@ def _execute_iter(self, query_iter):
498498

499499
i = 0
500500
while True:
501-
result = next(query_iter) # pylint: disable=R1708
502-
self._reset_result()
503-
self._handle_result(result)
504501
try:
505-
self._executed = executed_list[i].strip()
506-
i += 1
507-
except IndexError:
508-
self._executed = executed_list[0]
509-
510-
yield self
502+
result = next(query_iter)
503+
self._reset_result()
504+
self._handle_result(result)
505+
try:
506+
self._executed = executed_list[i].strip()
507+
i += 1
508+
except IndexError:
509+
self._executed = executed_list[0]
510+
511+
yield self
512+
except StopIteration:
513+
return
511514

512515
def execute(self, operation, params=None, multi=False):
513516
"""Executes the given operation

lib/mysql/connector/cursor_cext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,13 @@ def _execute_iter(self):
205205
while True:
206206
try:
207207
if not self.nextset():
208-
raise StopIteration # pylint: disable=R1708
208+
raise StopIteration
209209
except errors.InterfaceError as exc:
210210
# Result without result set
211211
if exc.errno != CR_NO_RESULT_SET:
212212
raise
213+
except StopIteration:
214+
return
213215
i += 1
214216
try:
215217
self._executed = executed_list[i].strip()

lib/mysqlx/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def create_enum(name, fields, values=None):
4343
Returns:
4444
namedtuple: A namedtuple object.
4545
"""
46-
Enum = namedtuple(name, fields, verbose=False)
46+
Enum = namedtuple(name, fields)
4747
if values is None:
4848
return Enum(*fields)
4949
return Enum(*values)

setupinfo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
'Programming Language :: Python :: 3.4',
131131
'Programming Language :: Python :: 3.5',
132132
'Programming Language :: Python :: 3.6',
133+
'Programming Language :: Python :: 3.7',
133134
'Topic :: Database',
134135
'Topic :: Software Development',
135136
'Topic :: Software Development :: Libraries :: Application Frameworks',

src/mysqlxpb/mysqlxpb.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -667,7 +667,7 @@ static google::protobuf::Message* CreateMessage(PyObject* dict,
667667
PyObject* type_name_obj = PyDict_GetItemString(dict, kMessageTypeKey);
668668

669669
if (type_name_obj && PyString_CheckExact(type_name_obj)) {
670-
char* type_name = PyString_AsString(type_name_obj);
670+
const char* type_name = PyString_AsString(type_name_obj);
671671
const google::protobuf::Descriptor* descriptor =
672672
MessageDescriptorByName(type_name);
673673

@@ -682,7 +682,7 @@ static google::protobuf::Message* CreateMessage(PyObject* dict,
682682

683683
while (PyDict_Next(dict, &pos, &key, &value)) {
684684
if (key && PyString_CheckExact(key)) {
685-
char* key_name = PyString_AsString(key);
685+
const char* key_name = PyString_AsString(key);
686686

687687
if (::strcmp(key_name, kMessageTypeKey) == 0)
688688
continue;

src/mysqlxpb/python_cast.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0, as
@@ -128,7 +128,7 @@ std::string python_cast<std::string>(PyObject* obj) {
128128
#ifdef PY3
129129
else if (PyUnicode_CheckExact(obj)) {
130130
Py_ssize_t len;
131-
char* str = PyUnicode_AsUTF8AndSize(obj, &len);
131+
const char* str = PyUnicode_AsUTF8AndSize(obj, &len);
132132
return std::string(str, len);
133133
} else if (PyBytes_CheckExact(obj)) {
134134
return std::string(PyBytes_AsString(obj), PyBytes_Size(obj));

tests/mysqld.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ def _init_mysql_install(self):
242242
afile == 'innodb_memcached_config.sql':
243243
self._scriptdir = root
244244

245-
if not self._lc_messages_dir or not self._scriptdir:
245+
version = self._get_version()
246+
if not self._lc_messages_dir or (version < (8, 0, 13) and
247+
not self._scriptdir):
246248
raise MySQLBootstrapError(
247249
"errmsg.sys and mysql_system_tables.sql not found"
248250
" under {0}".format(self._sharedir))
@@ -549,7 +551,7 @@ def bootstrap(self):
549551
test_sql = open(self._init_sql, "w")
550552
test_sql.write("\n".join(extra_sql))
551553
test_sql.close()
552-
else:
554+
elif self._version < (8, 0, 13):
553555
for filename in script_files:
554556
full_path = os.path.join(self._scriptdir, filename)
555557
LOGGER.debug("Reading SQL from '%s'", full_path)

tests/test_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -138,7 +138,7 @@ def test_classifiers(self):
138138
if 'Programming Language :: Python' in clsfr:
139139
ver = clsfr.replace('Programming Language :: Python :: ', '')
140140
if ver not in ('2.6', '2.7', '3', '3.1', '3.2', '3.3', '3.4',
141-
'3.5', '3.6'):
141+
'3.5', '3.6', '3.7'):
142142
self.fail('Unsupported version in classifiers')
143143
if 'Development Status ::' in clsfr:
144144
status = clsfr.replace('Development Status :: ', '')

0 commit comments

Comments
 (0)