[PR PATCH] Py3 string arg handling

github at samba.org github at samba.org
Mon Apr 16 14:32:07 UTC 2018


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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: github-pr-py3-string-arg-handling-166.patch
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180416/3a900a8d/github-pr-py3-string-arg-handling-166.patch>


More information about the samba-technical mailing list