File: 0001-Don-t-try-to-encode-non-text.patch

package info (click to toggle)
pg8000 1.10.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 440 kB
  • sloc: python: 2,505; makefile: 149
file content (27 lines) | stat: -rw-r--r-- 967 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 52ec28329c68846c1571b9c708e3c4e012aeff2b Mon Sep 17 00:00:00 2001
From: Ximin Luo <infinity0@debian.org>
Date: Wed, 12 Oct 2016 10:18:44 +0200
Subject: Don't try to encode non-text

 pg8000 when used by calendarserver sometimes passes unicode objects into
 text_out which causes an exception. This patch fixes that; it should not
 break anything else, but perhaps a wider fix is more appropiate - awaiting
 reply from upstream on that.
Bug: https://github.com/mfenniak/pg8000/issues/93
---
 pg8000/core.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pg8000/core.py b/pg8000/core.py
index fe8507c..78429dd 100644
--- a/pg8000/core.py
+++ b/pg8000/core.py
@@ -1332,6 +1332,8 @@ class Connection(object):
         self.ParameterStatusReceived += self.handle_PARAMETER_STATUS
 
         def text_out(v):
+            if not isinstance(v, text_type):
+                return v
             return v.encode(self._client_encoding)
 
         def time_out(v):