From 2316313fc6777591494e870ba0c5da0d3dcd6dc6 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 10 Jan 2022 10:44:49 +0900 Subject: [PATCH 1/6] Add __module__ attributes to exception classes. (#523) --- MySQLdb/_exceptions.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/MySQLdb/_exceptions.py b/MySQLdb/_exceptions.py index ba35deaf..a5aca7e1 100644 --- a/MySQLdb/_exceptions.py +++ b/MySQLdb/_exceptions.py @@ -9,32 +9,44 @@ class MySQLError(Exception): """Exception related to operation with MySQL.""" + __module__ = "MySQLdb" + class Warning(Warning, MySQLError): """Exception raised for important warnings like data truncations while inserting, etc.""" + __module__ = "MySQLdb" + class Error(MySQLError): """Exception that is the base class of all other error exceptions (not Warning).""" + __module__ = "MySQLdb" + class InterfaceError(Error): """Exception raised for errors that are related to the database interface rather than the database itself.""" + __module__ = "MySQLdb" + class DatabaseError(Error): """Exception raised for errors that are related to the database.""" + __module__ = "MySQLdb" + class DataError(DatabaseError): """Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc.""" + __module__ = "MySQLdb" + class OperationalError(DatabaseError): """Exception raised for errors that are related to the database's @@ -43,27 +55,37 @@ class OperationalError(DatabaseError): found, a transaction could not be processed, a memory allocation error occurred during processing, etc.""" + __module__ = "MySQLdb" + class IntegrityError(DatabaseError): """Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails, duplicate key, etc.""" + __module__ = "MySQLdb" + class InternalError(DatabaseError): """Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync, etc.""" + __module__ = "MySQLdb" + class ProgrammingError(DatabaseError): """Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc.""" + __module__ = "MySQLdb" + class NotSupportedError(DatabaseError): """Exception raised in case a method or database API was used which is not supported by the database, e.g. requesting a .rollback() on a connection that does not support transaction or has transactions turned off.""" + + __module__ = "MySQLdb" From 9729618950577b3352f3569d17564ee06d96f708 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Fri, 15 Apr 2022 20:18:03 +0900 Subject: [PATCH 2/6] Create SECURITY.md --- SECURITY.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..a54d21b1 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,9 @@ +# Security Policy + +## Supported Versions + +2.1.x + +## Reporting a Vulnerability + +email: songofacandy@gmail.com From c1c812a1dfeb2a8b3e08ff56058dd3365e0937f5 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 17 Apr 2022 10:21:21 +0900 Subject: [PATCH 3/6] Fix out of range bug (#538) --- MySQLdb/_mysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index f10cd015..2c02d765 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -1442,7 +1442,7 @@ _mysql_ResultObject_fetch_row( &maxrows, &how)) return NULL; check_result_connection(self); - if (how >= (int)sizeof(row_converters)) { + if (how >= (int)(sizeof(row_converters) / sizeof(row_converters[0]))) { PyErr_SetString(PyExc_ValueError, "how out of range"); return NULL; } From 6979a47f2e0f444e988aeadb1fbfceaeb45fd3c3 Mon Sep 17 00:00:00 2001 From: Llewyllen <61664783+Llewyllen@users.noreply.github.com> Date: Thu, 2 Jun 2022 05:57:40 +0200 Subject: [PATCH 4/6] Fix docstring for _mysql.connect (#540) --- MySQLdb/_mysql.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index 2c02d765..7737dbe7 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -581,10 +581,10 @@ host\n\ user\n\ string, user to connect as\n\ \n\ -passwd\n\ +password\n\ string, password to use\n\ \n\ -db\n\ +database\n\ string, database to use\n\ \n\ port\n\ From aafdec84cf34155d69e584f138c7a4a7984bf77b Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Wed, 22 Jun 2022 09:07:56 +0900 Subject: [PATCH 5/6] Action: Update Windows wheel build (#541) --- .github/workflows/windows.yaml | 36 ++++++++++------------------------ 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index ac9b28da..e2314b44 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -4,13 +4,14 @@ on: push: branches: - master + - ci workflow_dispatch: jobs: build: runs-on: windows-latest env: - CONNECTOR_VERSION: "3.2.4" + CONNECTOR_VERSION: "3.3.1" steps: - name: Cache Connector @@ -57,36 +58,19 @@ jobs: EOF cat site.cfg + - uses: actions/setup-python@v2 + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.7.0 - name: Build wheels - shell: cmd working-directory: mysqlclient - run: | - py -3.10 -m pip install -U setuptools wheel pip - py -3.10 setup.py bdist_wheel - py -3.9 -m pip install -U setuptools wheel pip - py -3.9 setup.py bdist_wheel - py -3.8 -m pip install -U setuptools wheel pip - py -3.8 setup.py bdist_wheel - py -3.7 -m pip install -U setuptools wheel pip - py -3.7 setup.py bdist_wheel + env: + CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8" + CIBW_ARCHS: "AMD64" + CIBW_TEST_COMMAND: "python -c \"import MySQLdb; print(MySQLdb.version_info)\" " + run: "python -m cibuildwheel --prerelease-pythons --output-dir dist" - name: Upload Wheel uses: actions/upload-artifact@v2 with: name: win-wheels path: mysqlclient/dist/*.whl - - - name: Check wheels - shell: bash - working-directory: mysqlclient/dist - run: | - ls -la - py -3.10 -m pip install --no-index --find-links . mysqlclient - py -3.10 -c "import MySQLdb; print(MySQLdb.version_info)" - py -3.9 -m pip install --no-index --find-links . mysqlclient - py -3.9 -c "import MySQLdb; print(MySQLdb.version_info)" - py -3.8 -m pip install --no-index --find-links . mysqlclient - py -3.8 -c "import MySQLdb; print(MySQLdb.version_info)" - py -3.7 -m pip install --no-index --find-links . mysqlclient - py -3.7 -c "import MySQLdb; print(MySQLdb.version_info)" - From 78caa9ed05d8c27a27abe5eafd96d782279f1fca Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Wed, 22 Jun 2022 10:22:08 +0900 Subject: [PATCH 6/6] v2.1.1 --- HISTORY.rst | 14 ++++++++++++++ metadata.cfg | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 19d57bee..674c6881 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,3 +1,17 @@ +====================== + What's new in 2.1.1 +====================== + +Release: 2022-06-22 + +* Fix qualname of exception classes. (#522) +* Fix range check in ``MySQLdb._mysql.result.fetch_row()``. Invalid ``how`` argument caused SEGV. (#538) +* Fix docstring of ``_mysql.connect``. (#540) +* Windows: Binary wheels are updated. (#541) + * Use MariaDB Connector/C 3.3.1. + * Use cibuildwheel to build wheels. + * Python 3.8-3.11 + ====================== What's new in 2.1.0 ====================== diff --git a/metadata.cfg b/metadata.cfg index 95433ffb..5bf1e815 100644 --- a/metadata.cfg +++ b/metadata.cfg @@ -1,6 +1,6 @@ [metadata] -version: 2.1.0 -version_info: (2,1,0,'final',0) +version: 2.1.1 +version_info: (2,1,1,'final',0) description: Python interface to MySQL author: Inada Naoki author_email: songofacandy@gmail.com