Skip to content

Commit

Permalink
Add Python 3.8 to officially supported versions.
Browse files Browse the repository at this point in the history
Fix compiler warnings introduced by Python 3.8 changes and newer version of gcc.
  • Loading branch information
joshuahlang committed Nov 15, 2019
1 parent 16053a0 commit 1db6c02
Show file tree
Hide file tree
Showing 18 changed files with 163 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ branches:

matrix:
include:
- env: CTDS_MAKE_TARGET=check_3.8
os: linux
dist: trusty
services: docker
sudo: required
- env: CTDS_MAKE_TARGET=check_3.7
os: linux
dist: trusty
Expand Down
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- Official support for Python3.8.

## [1.10.1] - 2019-06-27
### Fixed
Expand Down Expand Up @@ -203,19 +205,19 @@ when the option is supported, but the set fails.
## [1.0.4] - 2016-05-19
### Fixed
- Fix the `ctds.Connection.timeout` property to work with the **DBSETTIME**
option added in [FreeTDS](http://freetds.org) version *1.00*.
option added in [FreeTDS](https://www.freetds.org) version *1.00*.

### Added
- Support for TDS version *7.4*, introduced with [FreeTDS](http://freetds.org)
- Support for TDS version *7.4*, introduced with [FreeTDS](https://www.freetds.org)
version *1.00*.

## [1.0.3] - 2016-03-31
### Fixed
- Fix [execute()](https://www.python.org/dev/peps/pep-0249/#execute) and
[executemany()](https://www.python.org/dev/peps/pep-0249/#executemany) to work
with older versions of [FreeTDS](http://freetds.org) (prior to 0.92.405).
with older versions of [FreeTDS](https://www.freetds.org) (prior to 0.92.405).
Format the SQL command manually, instead of using **sp_executesql**, since
older versions of [FreeTDS](http://freetds.org) don't seem to support passing
older versions of [FreeTDS](https://www.freetds.org) don't seem to support passing
_NVARCHAR_ arguments to remote procedure calls.

### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG FREETDS_VERSION=1.00.80

# Build FreeTDS (required by ctds)
RUN set -ex \
&& wget -O freetds.tar.gz "http://www.freetds.org/files/stable/freetds-${FREETDS_VERSION}.tar.gz" \
&& wget -O freetds.tar.gz "https://www.freetds.org/files/stable/freetds-${FREETDS_VERSION}.tar.gz" \
&& mkdir -p /usr/src/freetds \
&& tar -xzC /usr/src/freetds --strip-components=1 -f freetds.tar.gz \
&& rm freetds.tar.gz \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-valgrind
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RUN set -ex \

# FreeTDS (required by ctds)
RUN set -ex \
&& wget -O freetds.tar.gz "http://www.freetds.org/files/stable/freetds-${FREETDS_VERSION}.tar.gz" \
&& wget -O freetds.tar.gz "https://www.freetds.org/files/stable/freetds-${FREETDS_VERSION}.tar.gz" \
&& mkdir -p /usr/src/freetds \
&& tar -xzC /usr/src/freetds --strip-components=1 -f freetds.tar.gz \
&& rm freetds.tar.gz \
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ SUPPORTED_PYTHON_VERSIONS := \
3.4 \
3.5 \
3.6 \
3.7
3.7 \
3.8

VALGRIND_PYTHON_VERSIONS := \
2.7.14 \
Expand All @@ -24,7 +25,7 @@ CHECKED_FREETDS_VERSIONS := \
0.92.405 \
0.95.95 \
1.00.80 \
1.1.4
1.1.4

# Valgrind FreeTDS versions are limited to one without sp_executesql support
# and one with.
Expand All @@ -36,7 +37,7 @@ VALGRIND_FREETDS_VERSIONS := \
DEFAULT_PYTHON_VERSION := $(lastword $(SUPPORTED_PYTHON_VERSIONS))
DEFAULT_FREETDS_VERSION := $(lastword $(CHECKED_FREETDS_VERSIONS))

VIRTUALENV_FREETDS_VERSION ?= dev.1.00.336
VIRTUALENV_FREETDS_VERSION ?= $(lastword $(CHECKED_FREETDS_VERSIONS))

# Ignore warnings, i.e. "Unknown distribution option: 'python_requires'"
CTDS_VERSION := $(strip $(shell python -W ignore setup.py --version))
Expand Down Expand Up @@ -289,11 +290,11 @@ $(VIRTUALENV_DIR)/include/sybdb.h: | $(VIRTUALENV_DIR) $(VIRTUALENV_FREETDS_VERS
$(VIRTUALENV_DIR):
virtualenv $(VIRTUALENV_DIR)

VIRTUALENV_FREETDS_VERSION_URL = http://www.freetds.org/files/current/freetds-$(VIRTUALENV_FREETDS_VERSION).tar.gz
VIRTUALENV_FREETDS_VERSION_URL = https://www.freetds.org/files/stable/freetds-$(VIRTUALENV_FREETDS_VERSION).tar.gz
$(VIRTUALENV_FREETDS_VERSION):
if [ `which wget` ]; then \
wget '$(VIRTUALENV_FREETDS_VERSION_URL)' -O freetds.tar.gz; \
else \
curl '$(VIRTUALENV_FREETDS_VERSION_URL)' -o freetds.tar.gz; \
curl -sSf '$(VIRTUALENV_FREETDS_VERSION_URL)' -o freetds.tar.gz; \
fi
tar -xzf freetds.tar.gz && rm freetds.tar.gz
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Dependencies
* `FreeTDS`_
* `Python`_

.. _`FreeTDS`: http://www.freetds.org/
.. _`FreeTDS`: https://www.freetds.org/
.. _`Python`: https://www.python.org/
.. _`DB API-2.0`: https://www.python.org/dev/peps/pep-0249

Expand Down
2 changes: 1 addition & 1 deletion doc/callproc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ parameter:
)
.. _FreeTDS: http://www.freetds.org
.. _FreeTDS: https://www.freetds.org
2 changes: 1 addition & 1 deletion doc/ctds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ctds

.. py:data:: freetds_version
The version of `FreeTDS <http://www.freetds.org>`_ in use at runtime.
The version of `FreeTDS <https://www.freetds.org>`_ in use at runtime.

.. py:data:: version_info
Expand Down
2 changes: 1 addition & 1 deletion doc/execute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ supported:
transmitted to the database.


.. _FreeTDS: http://www.freetds.org
.. _FreeTDS: https://www.freetds.org
.. _SQL Server: http://www.microsoft.com/sqlserver/
.. _sp_executesql: https://msdn.microsoft.com/en-us/library/ms188001.aspx
2 changes: 1 addition & 1 deletion doc/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ codepoints outside the *UCS-2* range will no longer be replaced.
if the connection will support *UTF-16* and assumes it does not.


.. _FreeTDS: http://www.freetds.org
.. _FreeTDS: https://www.freetds.org
6 changes: 3 additions & 3 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Installation From Source
# Create the virtual environment.
virtualenv ctds-venv && cd ctds-venv
wget 'http://www.freetds.org/files/stable/freetds-patched.tar.gz'
wget 'https://www.freetds.org/files/stable/freetds-patched.tar.gz'
tar -xzf freetds-patched.tar.gz
pushd freetds-*
Expand Down Expand Up @@ -128,8 +128,8 @@ When building on Windows, run the following in powershell:
pip install -e .
.. _FreeTDS: http://www.freetds.org
.. _homebrew: http://brew.sh/
.. _FreeTDS: https://www.freetds.org
.. _homebrew: https://brew.sh/
.. _pip: https://pip.pypa.io/en/stable/
.. _virtualenv: http://virtualenv.readthedocs.org/en/latest/userguide.html
.. _Visual C++ Build Tools: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def read(*names, **kwargs):
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: SQL',
'Topic :: Database',
Expand Down
24 changes: 24 additions & 0 deletions src/ctds/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,18 @@ static void raise_lasterror(PyObject* exception, const struct LastError* lasterr
case SYBESMSG:
case SYBEFCON:
{
#if defined(__GNUC__) && (__GNUC__ > 7)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif /* if defined(__GNUC__) && (__GNUC__ > 7) */
if (lastmsg && lastmsg->msgtext)
{
message = lastmsg->msgtext;
break;
}
#if defined(__GNUC__) && (__GNUC__ > 7)
# pragma GCC diagnostic pop
#endif
/* Intentional fall-through. */
}
default:
Expand Down Expand Up @@ -1886,6 +1893,11 @@ static PyObject* Connection___exit__(PyObject* self, PyObject* args)
}


#if defined(__GNUC__) && (__GNUC__ > 7)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-function-type"
#endif /* if defined(__GNUC__) && (__GNUC__ > 7) */

static PyMethodDef Connection_methods[] = {
/* ml_name, ml_meth, ml_flags, ml_doc */
/* DB API-2.0 required methods. */
Expand All @@ -1902,6 +1914,10 @@ static PyMethodDef Connection_methods[] = {
{ NULL, NULL, 0, NULL }
};

#if defined(__GNUC__) && (__GNUC__ > 7)
# pragma GCC diagnostic pop
#endif

PyObject* Connection_create(const char* server, uint16_t port, const char* instance,
const char* username, const char* password,
const char* database, const char* appname, const char* hostname,
Expand Down Expand Up @@ -2228,7 +2244,11 @@ PyTypeObject ConnectionType = {
sizeof(struct Connection), /* tp_basicsize */
0, /* tp_itemsize */
Connection_dealloc, /* tp_dealloc */
#if PY_VERSION_HEX >= 0x03080000
0, /* tp_vectorcall_offset */
#else
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down Expand Up @@ -2273,6 +2293,10 @@ PyTypeObject ConnectionType = {
#if PY_VERSION_HEX >= 0x03040000
NULL, /* tp_finalize */
#endif /* if PY_VERSION_HEX >= 0x03040000 */
#if PY_VERSION_HEX >= 0x03080000
NULL, /* tp_vectorcall */
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
};

PyTypeObject* ConnectionType_init(void)
Expand Down
33 changes: 33 additions & 0 deletions src/ctds/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2769,7 +2769,11 @@ PyTypeObject RowType = {
sizeof(struct Row), /* tp_basicsize */
sizeof(PyObject*), /* tp_itemsize */
Row_dealloc, /* tp_dealloc */
#if PY_VERSION_HEX >= 0x03080000
0, /* tp_vectorcall_offset */
#else
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down Expand Up @@ -2814,6 +2818,10 @@ PyTypeObject RowType = {
#if PY_VERSION_HEX >= 0x03040000
NULL, /* tp_finalize */
#endif /* if PY_VERSION_HEX >= 0x03040000 */
#if PY_VERSION_HEX >= 0x03080000
NULL, /* tp_vectorcall */
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
};

/* Stores the `struct RowBuffer` for a row until requested by the client. */
Expand Down Expand Up @@ -2962,7 +2970,11 @@ PyTypeObject RowListType = {
sizeof(struct RowList), /* tp_basicsize */
sizeof(struct LazilyCreatedRow), /* tp_itemsize */
RowList_dealloc, /* tp_dealloc */
#if PY_VERSION_HEX >= 0x03080000
0, /* tp_vectorcall_offset */
#else
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down Expand Up @@ -3007,6 +3019,10 @@ PyTypeObject RowListType = {
#if PY_VERSION_HEX >= 0x03040000
NULL, /* tp_finalize */
#endif /* if PY_VERSION_HEX >= 0x03040000 */
#if PY_VERSION_HEX >= 0x03080000
NULL, /* tp_vectorcall */
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
};

#define FETCH_ALL ((size_t)-1)
Expand Down Expand Up @@ -3432,6 +3448,11 @@ static PyObject* Cursor___exit__(PyObject* self, PyObject* args)
UNUSED(args);
}

#if defined(__GNUC__) && (__GNUC__ > 7)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-function-type"
#endif /* if defined(__GNUC__) && (__GNUC__ > 7) */

static PyMethodDef Cursor_methods[] = {
/* ml_name, ml_meth, ml_flags, ml_doc */
/* DB API-2.0 required methods. */
Expand Down Expand Up @@ -3462,6 +3483,10 @@ static PyMethodDef Cursor_methods[] = {
{ NULL, NULL, 0, NULL }
};

#if defined(__GNUC__) && (__GNUC__ > 7)
# pragma GCC diagnostic pop
#endif

static PyObject* Cursor_iter(PyObject* self)
{
if (0 != warn_extension_used("cursor.__iter__()"))
Expand Down Expand Up @@ -3511,7 +3536,11 @@ PyTypeObject CursorType = {
sizeof(struct Cursor), /* tp_basicsize */
0, /* tp_itemsize */
Cursor_dealloc, /* tp_dealloc */
#if PY_VERSION_HEX >= 0x03080000
0, /* tp_vectorcall_offset */
#else
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down Expand Up @@ -3556,6 +3585,10 @@ PyTypeObject CursorType = {
#if PY_VERSION_HEX >= 0x03040000
NULL, /* tp_finalize */
#endif /* if PY_VERSION_HEX >= 0x03040000 */
#if PY_VERSION_HEX >= 0x03080000
NULL, /* tp_vectorcall */
NULL, /* tp_print */
#endif /* if PY_VERSION_HEX >= 0x03080000 */
};

PyTypeObject* CursorType_init(void)
Expand Down
Loading

0 comments on commit 1db6c02

Please sign in to comment.