Discussion:
[PR PATCH] Py3 string arg handling
Github bot account via samba-technical
2018-04-16 14:32:07 UTC
Permalink
There is a new pull request by noelpower against master on the Samba Samba Github repository

https://github.com/noelpower/samba py3-string-arg-handling
https://github.com/samba-team/samba/pull/166

Py3 string arg handling
Separate out patches from pull request #161
Many of the python c-modules don't handle unicode as string types when passed say as object. This wasn't really a problem in a python2 only world. With code ported to be python2/python3 compatible it seems (at least in code we are porting) that we now find objects that were previously string in python2 now getting passed as unicode types in python2. This is a side affect of trying to cater for variables returned from functions as 'bytes' in python3 that are returned as 'string' in python2. We normally do something like

py2py3compat_var.decode('utf8')

To ensure the bytes provided in python3 are converted to 'str' The same line of code when running under python2 will covert a 'str' type to 'unicode'

We really should handle 'unicode' anyway as it is a 'text type. For example python2 code that use the ParseTuplexxxx functions to handle arguments already automatically handle 'str' or
'unicode' when passed a 'string' format.

A patch file from https://github.com/samba-team/samba/pull/166.patch is attached
Github bot account via samba-technical
2018-04-30 17:40:40 UTC
Permalink
New comment by noelpower on Samba Github repository

https://github.com/samba-team/samba/pull/166#issuecomment-385

Loading...