[Python-modules-commits] [python-vertica] 05/10: Add patch for issue 117 on github

Jean Baptiste Favre jbfavre-guest at moszumanska.debian.org
Mon May 23 19:39:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

jbfavre-guest pushed a commit to branch master
in repository python-vertica.

commit 485a9756f2dda10fbfa630eb8ff084cd554fa726
Author: Jean Baptiste Favre <debian at jbfavre.org>
Date:   Sun May 22 15:53:50 2016 +0200

    Add patch for issue 117 on github
---
 debian/patches/github_pr_119_fix_117.patch | 54 ++++++++++++++++++++++++++++++
 debian/patches/series                      |  1 +
 2 files changed, 55 insertions(+)

diff --git a/debian/patches/github_pr_119_fix_117.patch b/debian/patches/github_pr_119_fix_117.patch
new file mode 100644
index 0000000..1aade49
--- /dev/null
+++ b/debian/patches/github_pr_119_fix_117.patch
@@ -0,0 +1,54 @@
+Description: fixed parsing of Timestamp and TimestampTz columns in Python3
+ This modifies timestamp_parse and timestamp_tz_parse to coerce the argument
+ to a utf-8 encode string. In Python2 the argument is already a string while
+ in Python3 it is a bytes object.
+Author: Dennis O'Brien
+Origin: https://github.com/uber/vertica-python/pull/119
+Bug: https://github.com/uber/vertica-python/issues/117
+Reviewed-by: Jean Baptiste Favre <debian at jbfavre.org>
+Last-Update: 2016-05-22
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/vertica_python/vertica/column.py
++++ b/vertica_python/vertica/column.py
+@@ -34,6 +34,7 @@ years_re = re.compile(r'^([0-9]+)-')
+ # timestamptz type stores: 2013-01-01 05:00:00.01+00
+ #       select t AT TIMEZONE 'America/New_York' returns: 2012-12-31 19:00:00.01
+ def timestamp_parse(s):
++    s = str(s, 'utf-8')
+     try:
+         dt = _timestamp_parse(s)
+     except ValueError:
+@@ -62,6 +63,7 @@ def _timestamp_parse_without_year(s):
+ 
+ 
+ def timestamp_tz_parse(s):
++    s = str(s, 'utf-8')
+     # if timezome is simply UTC...
+     if s.endswith('+00'):
+         # remove time zone
+--- a/vertica_python/tests/date_tests.py
++++ b/vertica_python/tests/date_tests.py
+@@ -56,16 +56,19 @@ class TimestampParsingTestCase(VerticaTe
+ 
+ 
+     def test_timestamp_parser(self):
+-        parsed_timestamp = timestamp_parse('1841-05-05 22:07:58')
++        test_timestamp = '1841-05-05 22:07:58'.encode(encoding='utf-8', errors='strict')
++        parsed_timestamp = timestamp_parse(test_timestamp)
+         # Assert parser default to strptime
+         self.assertEqual(datetime(year=1841, month=5, day=5, hour=22, minute=7, second=58), parsed_timestamp)
+ 
+     def test_timestamp_with_year_over_9999(self):
+-        parsed_timestamp = timestamp_parse('44841-05-05 22:07:58')
++        test_timestamp = '44841-05-05 22:07:58'.encode(encoding='utf-8', errors='strict')
++        parsed_timestamp = timestamp_parse(test_timestamp)
+         # Assert year was truncated properly
+         self.assertEqual(datetime(year=4841, month=5, day=5, hour=22, minute=7, second=58), parsed_timestamp)
+ 
+     def test_timestamp_with_year_over_9999_and_ms(self):
+-        parsed_timestamp = timestamp_parse('124841-05-05 22:07:58.000003')
++        test_timestamp = '124841-05-05 22:07:58.000003'.encode(encoding='utf-8', errors='strict')
++        parsed_timestamp = timestamp_parse(test_timestamp)
+         # Assert year was truncated properly
+         self.assertEqual(datetime(year=4841, month=5, day=5, hour=22, minute=7, second=58, microsecond=3), parsed_timestamp)
diff --git a/debian/patches/series b/debian/patches/series
index 671bd98..12a0c3d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 github_pr_118_fix_116.patch
+github_pr_119_fix_117.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-vertica.git



More information about the Python-modules-commits mailing list