File: 0010-Fix-compilation-errors-when-installing-package-in-Py.patch

package info (click to toggle)
python-eventlet 0.20.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,376 kB
  • sloc: python: 31,120; sh: 208; makefile: 90
file content (75 lines) | stat: -rw-r--r-- 3,094 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From ca0e32395ef6e48cdaaff90118766cc88a3230ab Mon Sep 17 00:00:00 2001
From: Thomas Goirand <zigo@debian.org>
Date: Tue, 14 Nov 2017 22:31:38 +0100
Subject: Fix compilation errors when installing package in Python 2.7

---
 eventlet/green/http/client.py    | 13 ++++++++-----
 eventlet/green/http/cookiejar.py |  3 ++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/eventlet/green/http/client.py b/eventlet/green/http/client.py
index c7d3bda..8d5bcad 100644
--- a/eventlet/green/http/client.py
+++ b/eventlet/green/http/client.py
@@ -121,6 +121,7 @@ Unread-response                _CS_IDLE           <response_class>
 Req-started-unread-response    _CS_REQ_STARTED    <response_class>
 Req-sent-unread-response       _CS_REQ_SENT       <response_class>
 """
+from __future__ import print_function
 
 import email.parser
 import email.message
@@ -192,8 +193,8 @@ _MAXHEADERS = 100
 # the patterns for both name and value are more leniant than RFC
 # definitions to allow for backwards compatibility
 # Eventlet change: match used instead of fullmatch for Python 3.3 compatibility
-_is_legal_header_name = re.compile(rb'[^:\s][^:\r\n]*\Z').match
-_is_illegal_header_value = re.compile(rb'\n(?![ \t])|\r(?![ \t\n])').search
+_is_legal_header_name = re.compile(b'[^:\\s][^:\\r\\n]*\\Z').match
+_is_illegal_header_value = re.compile(b'\\n(?![ \\t])|\\r(?![ \\t\\n])').search
 
 # We always set the Content-Length header for these methods because some
 # servers will otherwise respond with a 411
@@ -205,14 +206,16 @@ def _encode(data, name='data'):
     try:
         return data.encode("latin-1")
     except UnicodeEncodeError as err:
-        raise UnicodeEncodeError(
+        exc = UnicodeEncodeError(
             err.encoding,
             err.object,
             err.start,
             err.end,
             "%s (%.20r) is not valid Latin-1. Use %s.encode('utf-8') "
             "if you want to send it encoded in UTF-8." %
-            (name.title(), data[err.start:err.end], name)) from None
+            (name.title(), data[err.start:err.end], name))
+        exc.__cause__ = None
+        raise exc
 
 
 class HTTPMessage(email.message.Message):
@@ -1330,7 +1333,7 @@ else:
 
         def __init__(self, host, port=None, key_file=None, cert_file=None,
                      timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
-                     source_address=None, *, context=None,
+                     source_address=None, context=None,
                      check_hostname=None):
             super(HTTPSConnection, self).__init__(host, port, timeout,
                                                   source_address)
diff --git a/eventlet/green/http/cookiejar.py b/eventlet/green/http/cookiejar.py
index 9c884e9..658faba 100644
--- a/eventlet/green/http/cookiejar.py
+++ b/eventlet/green/http/cookiejar.py
@@ -1266,7 +1266,8 @@ def deepvalues(mapping):
             pass
         else:
             mapping = True
-            yield from deepvalues(obj)
+            for i in deepvalues(obj):
+                yield i
         if not mapping:
             yield obj