"Tim Golden" <m...@timgolden.me.uk> wrote in message news:4f944314.4030...@timgolden.me.uk... > Could someone glance at this to confirm that it does indeed > seem to be a bug before I start hunting up the chain of > function calls to spot the issue, please? > > Steps are simple: > > 1) Use Python 3.2 and pywin32 217 > > 2) Use the following code (obviously substituting some suitable domain): > > from win32com import adsi > adsi.ADsGetObject("LDAP://dc=example,dc=com", adsi.IID_IADs) > > 3) Receive: "TypeError: expected bytes, str found" > > The error appears to be in a hasattr call in _get_good_ret > inside the __init__.py of the adsi subpackage. I've also > seen this in another circumstance where it doesn't make sense: > in an isinstance call where the first param is an PyIADs object. > > Further information: this doesn't happen if you don't request > the IID_IADs interface (and it defaults to a wrapped IDispatch) > > I assume that, somewhere up the chain of attribute handling from PyIADs > upwards, the ytes/str error is occurring either > specifically within the pywin32 code or implicitly as it passes something to > Python itself. > I've eyeballed the getattro code in PyIADs.cpp but I can't see anything > absolutely obvious. > > As it happens I don't have a build environment set up here so I'll > have to build Python & then pywin32 in order to drop into the debugger. > I thought I'd ask first in case anyone else could spot something > which I'd missed. > > Thanks > > TJG
The problem is in this code: PyObject* PyIADs_getattro(PyObject *ob, PyObject *obname) { char *name = PyString_AsString(obname); if (!name) return NULL; It should be using PYWIN_ATTR_CONVERT on the attribute name. Roger _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32