This is an automated email from the ASF dual-hosted git repository. astitcher pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit 468d34277ded647e5e8b6324b1b78720b9000590 Author: Andrew Stitcher <astitc...@apache.org> AuthorDate: Mon Dec 19 13:59:51 2022 -0500 PROTON-2675: Get rid of Selector string conversion This seems to be a hangover from python 2 compatibility and I can't see a good reason to convert bytes to unicode string in a selector filter with only python 3. --- python/proton/_reactor.py | 6 +++--- python/tests/proton_tests/reactor.py | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/python/proton/_reactor.py b/python/proton/_reactor.py index 0a84d166e..6696c7037 100644 --- a/python/proton/_reactor.py +++ b/python/proton/_reactor.py @@ -43,7 +43,7 @@ from functools import total_ordering from cproton import PN_PYREF, PN_ACCEPTED, PN_EVENT_NONE -from ._common import isstring, unicode2utf8, utf82unicode +from ._common import isstring, unicode2utf8 from ._data import Described, symbol, ulong from ._delivery import Delivery from ._endpoints import Connection, Endpoint, Link, Session, Terminus @@ -797,9 +797,9 @@ class Selector(Filter): :param name: Name of the selector, defaults to ``"selector"``. """ - def __init__(self, value: Union[bytes, str], name: str = 'selector') -> None: + def __init__(self, value: str, name: str = 'selector') -> None: super(Selector, self).__init__({symbol(name): Described( - symbol('apache.org:selector-filter:string'), utf82unicode(value))}) + symbol('apache.org:selector-filter:string'), value)}) class DurableSubscription(ReceiverOption): diff --git a/python/tests/proton_tests/reactor.py b/python/tests/proton_tests/reactor.py index eaa81ed6b..1b885fb7a 100644 --- a/python/tests/proton_tests/reactor.py +++ b/python/tests/proton_tests/reactor.py @@ -623,6 +623,3 @@ class SelectorTest(Test): def test_unicode_selector(self): assert Selector(u"Hello").filter_set[symbol('selector')].value == u"Hello" - - def test_non_unicode_selector(self): - assert Selector(b"Hello").filter_set[symbol('selector')].value == u"Hello" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org