Codebase list python-amqp / 933e91b
Merge tag 'upstream/2.6.1' into upstream Upstream version 2.6.1 Thomas Goirand 3 years ago
9 changed file(s) with 52 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
33 py-amqp is fork of amqplib used by Kombu containing additional features and improvements.
44 The previous amqplib changelog is here:
55 http://code.google.com/p/py-amqplib/source/browse/CHANGES
6
7 .. _version-2.6.0:
8
9 2.6.1
10 =====
11 :release-date: 2020-07-31 10.30 P.M UTC+6:00
12 :release-by: Asif Saif Uddin
13
14 - Fix buffer overflow in frame_writer after frame_max is increased. `frame_writer`
15 allocates a `bytearray` on intialization with a length based on the `connection.frame_max`
16 value. If `connection.frame_max` is changed to a larger value, this causes an
17 error like `pack_into requires a buffer of at least 408736 bytes`.
18
619
720 .. _version-2.6.0:
821
00 Metadata-Version: 1.2
11 Name: amqp
2 Version: 2.6.0
2 Version: 2.6.1
33 Summary: Low-level AMQP client for Python (fork of amqplib).
44 Home-page: http://github.com/celery/py-amqp
55 Author: Barry Pederson
1717 Classifier: Programming Language :: Python :: 3.5
1818 Classifier: Programming Language :: Python :: 3.6
1919 Classifier: Programming Language :: Python :: 3.7
20 Classifier: Programming Language :: Python :: 3.8
2021 Classifier: License :: OSI Approved :: BSD License
2122 Classifier: Intended Audience :: Developers
2223 Classifier: Operating System :: OS Independent
33
44 |build-status| |coverage| |license| |wheel| |pyversion| |pyimp|
55
6 :Version: 2.6.0
6 :Version: 2.6.1
77 :Web: https://amqp.readthedocs.io/
88 :Download: https://pypi.org/project/amqp/
99 :Source: http://github.com/celery/py-amqp/
55
66 from collections import namedtuple
77
8 __version__ = '2.6.0'
8 __version__ = '2.6.1'
99 __author__ = 'Barry Pederson'
1010 __maintainer__ = 'Asif Saif Uddin, Matus Valo'
1111 __contact__ = 'pyamqp@celeryproject.org'
8484 return on_frame
8585
8686
87 class Buffer(object):
88 def __init__(self, buf):
89 self.buf = buf
90
91 @property
92 def buf(self):
93 return self._buf
94
95 @buf.setter
96 def buf(self, buf):
97 self._buf = buf
98 self.view = memoryview(buf)
99
100
87101 def frame_writer(connection, transport,
88102 pack=pack, pack_into=pack_into, range=range, len=len,
89103 bytes=bytes, str_to_bytes=str_to_bytes, text_t=text_t):
90104 """Create closure that writes frames."""
91105 write = transport.write
92106
93 # memoryview first supported in Python 2.7
94 # Initial support was very shaky, so could be we have to
95 # check for a bugfix release.
96 buf = bytearray(connection.frame_max - 8)
97 view = memoryview(buf)
107 buffer_store = Buffer(bytearray(connection.frame_max - 8))
98108
99109 def write_frame(type_, channel, method_sig, args, content):
100110 chunk_size = connection.frame_max - 8
111 # frame_max can be updated via connection._on_tune. If
112 # it became larger, then we need to resize the buffer
113 # to prevent overflow.
114 if chunk_size > len(buffer_store.buf):
115 buffer_store.buf = bytearray(chunk_size)
116 buf = buffer_store.buf
117 view = buffer_store.view
101118 offset = 0
102119 properties = None
103120 args = str_to_bytes(args)
00 Metadata-Version: 1.2
11 Name: amqp
2 Version: 2.6.0
2 Version: 2.6.1
33 Summary: Low-level AMQP client for Python (fork of amqplib).
44 Home-page: http://github.com/celery/py-amqp
55 Author: Barry Pederson
1717 Classifier: Programming Language :: Python :: 3.5
1818 Classifier: Programming Language :: Python :: 3.6
1919 Classifier: Programming Language :: Python :: 3.7
20 Classifier: Programming Language :: Python :: 3.8
2021 Classifier: License :: OSI Approved :: BSD License
2122 Classifier: Intended Audience :: Developers
2223 Classifier: Operating System :: OS Independent
0 :Version: 2.6.0
0 :Version: 2.6.1
11 :Web: https://amqp.readthedocs.io/
22 :Download: https://pypi.org/project/amqp/
33 :Source: http://github.com/celery/py-amqp/
2525 Programming Language :: Python :: 3.5
2626 Programming Language :: Python :: 3.6
2727 Programming Language :: Python :: 3.7
28 Programming Language :: Python :: 3.8
2829 License :: OSI Approved :: BSD License
2930 Intended Audience :: Developers
3031 Operating System :: OS Independent
137137 assert isinstance(memory, memoryview)
138138 assert 'body'.encode('utf-16') in memory.tobytes()
139139 assert msg.properties['content_encoding'] == 'utf-16'
140
141 def test_frame_max_update(self):
142 msg = Message(body='t' * (self.connection.frame_max + 10))
143 frame = 2, 1, spec.Basic.Publish, b'x' * 10, msg
144 self.connection.frame_max += 100
145 self.g(*frame)
146 self.write.assert_called()
147 memory = self.write.call_args[0][0]
148 assert isinstance(memory, memoryview)