[PR PATCH] Bulk octal and exception fixup changes

Andrew Bartlett abartlet at samba.org
Wed Feb 28 05:40:43 UTC 2018


On Wed, 2018-02-28 at 16:41 +1300, Douglas Bagnall wrote:
> 
> The last line of the first patch's commit message is slightly worrying:
> 
> > Subject: [PATCH 01/10] s4/dsdb: python3 api should take 'bytes'
> > 
> > Attributes are properly represented by 'bytes' and *maybe* can be converted
> > into strings (if they are text). py_dsdb_normalise_attributes
> > currently expects strings, this is fine in python2 however in python3 we
> > need to actually pass a 'bytes' class.
> > 
> > Signed-off-by: Noel Power <noel.power at suse.com>
> > 
> > squash
> 
> Did you mean to submit it in this form?
> 
> > -		if (!PyStr_Check(str)) {
> > -			PyErr_SetString(PyExc_TypeError, "Expected a string argument to GUID()");
> > +		/* in python2 we get a string, in python3 we expect bytes */
> > +		if (!PyBytes_Check(str)) {
> > +			PyErr_SetString(PyExc_TypeError,
> > +					"Expected a "
> > +#if IS_PY3
> > +					"bytes "
> > +#else
> > +					"string "
> > +#endif
> > +					"argument to GUID()");
> 
> I think I would prefer something like the attached patch, which
> concentrates the #ifdef-ing in one place.

Sadly this failed a private autobuild with:



[17(647)/2249 at 17m4s] samba.tests.dcerpc.misc.python3
UNEXPECTED(error):
samba.tests.dcerpc.misc.python3.samba.tests.dcerpc.misc.GUIDTests.test_
compare_different(none)
REASON: Exception: Exception: Traceback (most recent call last):
  File
"/home/ubuntu/autobuild/b32562/samba/bin/python/samba/tests/dcerpc/misc
.py", line 45, in test_compare_different
    guid1 = misc.GUID(text1)
TypeError: Expected a bytes argument to GUID()

FAILED (0 failures, 1 errors and 0 unexpected successes in 0
testsuites)

Sadly travis-ci never attempted this branch, so this wasn't picked up
earlier.

This routine needs to take bytes or a string.

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list