X golang_str: Fix bstr/ustr __add__ and friends to return NotImplemented wrt unsupported types
In bbbb58f0 (golang_str: bstr/ustr support for + and *) I've added support for binary string operations, but similarly to __eq__ did not handle correctly the case for arbitrary arguments that potentially define __radd__ and similar. As the result it breaks when running e.g. bstr + pyparsing.Regex File ".../pyparsing-2.4.7-py2.7.egg/pyparsing.py", line 6591, in pyparsing_common _full_ipv6_address = (_ipv6_part + (':' + _ipv6_part) * 7).setName("full IPv6 address") File "golang/_golang_str.pyx", line 469, in golang._golang._pybstr.__add__ return pyb(zbytes.__add__(a, _pyb_coerce(b))) File "golang/_golang_str.pyx", line 243, in golang._golang._pyb_coerce raise TypeError("b: coerce: invalid type %s" % type(x)) TypeError: b: coerce: invalid type <class 'pyparsing.Regex'> because pyparsing.Regex is a type, that does not inherit from str, but defines its own __radd__ to handle str + Regex as Regex. -> Fix it by returning NotImplemented from under __add__ and other operations where it is needed so that bstr and ustr behave in the same way as builtin str wrt third types, but care to handle bstr/ustr promise that only explicit conversion through `b` and `u` accept objects with buffer interface. Automatic coercion does not.
Status | Job ID | Name | Coverage | ||||||
---|---|---|---|---|---|---|---|---|---|
External | |||||||||
failed |
#671565
external
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr |
00:32:57
|
||||||
failed |
#671592
external
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:29:19
|
||||||
running |
#671594
external
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
5845:10:11 |
||||||
failed |
#671567
external
retried
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:54:37
|
||||||
failed |
#671570
external
retried
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:37:09
|
||||||
failed |
#671574
external
retried
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:31:24
|
||||||
failed |
#671576
external
retried
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:30:18
|
||||||
failed |
#671578
external
retried
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:30:26
|
||||||
failed |
#671584
external
retried
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:29:03
|
||||||
failed |
#671587
external
retried
|
ERP5.UnitTest-Zope4Py3-pygolang-bstr-py2 |
00:29:25
|
||||||