Skip to content

Commit

Permalink
Add support for Python 3.12 (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
sitingren authored Oct 27, 2023
1 parent ff50f91 commit 881f80e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy3.9']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9']

steps:
- name: Check out repository
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

Please check out [release notes](https://github.com/vertica/vertica-python/releases) to learn about the latest improvements.

vertica-python has been tested with Vertica 23.4.0 and Python 3.7/3.8/3.9/3.10/3.11. Feel free to submit issues and/or pull requests (Read up on our [contributing guidelines](#contributing-guidelines)).
vertica-python has been tested with Vertica 23.4.0 and Python 3.7/3.8/3.9/3.10/3.11/3.12. Feel free to submit issues and/or pull requests (Read up on our [contributing guidelines](#contributing-guidelines)).


## Installation
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Database :: Front-Ends",
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tox]
envlist = py37,py38,py39,py310,py311
envlist = py37,py38,py39,py310,py311,py312

[testenv]
passenv = *
commands =
pytest {posargs}
deps =
pytest
pytest-timeout==1.4.2
pytest-timeout
parameterized
python-dateutil
mock
8 changes: 4 additions & 4 deletions vertica_python/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from __future__ import print_function, division, absolute_import

from datetime import date, datetime, time
from datetime import date, datetime, time, timezone


# noinspection PyPep8Naming
Expand All @@ -56,19 +56,19 @@ def Timestamp(year, month, day, hour, minute, second):

# noinspection PyPep8Naming
def DateFromTicks(ticks):
d = datetime.utcfromtimestamp(ticks)
d = datetime.fromtimestamp(ticks, timezone.utc)
return d.date()


# noinspection PyPep8Naming
def TimeFromTicks(ticks):
d = datetime.utcfromtimestamp(ticks)
d = datetime.fromtimestamp(ticks, timezone.utc)
return d.time()


# noinspection PyPep8Naming
def TimestampFromTicks(ticks):
d = datetime.utcfromtimestamp(ticks)
d = datetime.fromtimestamp(ticks, timezone.utc)
return d.time()


Expand Down
5 changes: 4 additions & 1 deletion vertica_python/vertica/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,10 @@ def enable_ssl(self, raw_socket, ssl_options):
raise errors.ConnectionError(msg)
raw_socket = ssl_options.wrap_socket(raw_socket, server_hostname=server_host)
else:
raw_socket = ssl.wrap_socket(raw_socket)
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
raw_socket = ssl_context.wrap_socket(raw_socket)
except ssl.CertificateError as e:
raise errors.ConnectionError(str(e))
except ssl.SSLError as e:
Expand Down

0 comments on commit 881f80e

Please sign in to comment.