Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated UnicodeToString param #2143

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions com/win32com/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ def __WrapDispatch(
userName=None,
resultCLSID=None,
typeinfo=None,
UnicodeToString=None,
clsctx=pythoncom.CLSCTX_SERVER,
WrapperClass=None,
):
"""
Helper function to return a makepy generated class for a CLSID if it exists,
otherwise cope by using CDispatch.
"""
assert UnicodeToString is None, "this is deprecated and will go away"
if resultCLSID is None:
try:
typeinfo = dispatch.GetTypeInfo()
Expand Down Expand Up @@ -110,11 +108,9 @@ def Dispatch(
userName=None,
resultCLSID=None,
typeinfo=None,
UnicodeToString=None,
clsctx=pythoncom.CLSCTX_SERVER,
):
"""Creates a Dispatch based COM object."""
assert UnicodeToString is None, "this is deprecated and will go away"
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch, userName, clsctx)
return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)

Expand All @@ -125,11 +121,9 @@ def DispatchEx(
userName=None,
resultCLSID=None,
typeinfo=None,
UnicodeToString=None,
clsctx=None,
):
"""Creates a Dispatch based COM object on a specific machine."""
assert UnicodeToString is None, "this is deprecated and will go away"
# If InProc is registered, DCOM will use it regardless of the machine name
# (and regardless of the DCOM config for the object.) So unless the user
# specifies otherwise, we exclude inproc apps when a remote machine is used.
Expand Down Expand Up @@ -157,11 +151,8 @@ class CDispatch(dynamic.CDispatch):
if/when possible.
"""

def _wrap_dispatch_(
self, ob, userName=None, returnCLSID=None, UnicodeToString=None
):
assert UnicodeToString is None, "this is deprecated and will go away"
return Dispatch(ob, userName, returnCLSID, None)
def _wrap_dispatch_(self, ob, userName=None, returnCLSID=None):
return Dispatch(ob, userName, returnCLSID)

def __dir__(self):
return dynamic.CDispatch.__dir__(self)
Expand Down
15 changes: 5 additions & 10 deletions com/win32com/client/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ def Dispatch(
userName=None,
createClass=None,
typeinfo=None,
UnicodeToString=None,
clsctx=pythoncom.CLSCTX_SERVER,
):
assert UnicodeToString is None, "this is deprecated and will go away"
IDispatch, userName = _GetGoodDispatchAndUserName(IDispatch, userName, clsctx)
if createClass is None:
createClass = CDispatch
Expand Down Expand Up @@ -180,22 +178,17 @@ def DumbDispatch(
IDispatch,
userName=None,
createClass=None,
UnicodeToString=None,
clsctx=pythoncom.CLSCTX_SERVER,
):
"Dispatch with no type info"
assert UnicodeToString is None, "this is deprecated and will go away"
IDispatch, userName = _GetGoodDispatchAndUserName(IDispatch, userName, clsctx)
if createClass is None:
createClass = CDispatch
return createClass(IDispatch, build.DispatchItem(), userName)


class CDispatch:
def __init__(
self, IDispatch, olerepr, userName=None, UnicodeToString=None, lazydata=None
):
assert UnicodeToString is None, "this is deprecated and will go away"
def __init__(self, IDispatch, olerepr, userName=None, lazydata=None):
if userName is None:
userName = "<unknown>"
self.__dict__["_oleobj_"] = IDispatch
Expand Down Expand Up @@ -369,10 +362,12 @@ def _ApplyTypes_(self, dispid, wFlags, retType, argTypes, user, resultCLSID, *ar
return self._get_good_object_(result, user, resultCLSID)

def _wrap_dispatch_(
self, ob, userName=None, returnCLSID=None, UnicodeToString=None
self,
ob,
userName=None,
returnCLSID=None,
):
# Given a dispatch object, wrap it in a class
assert UnicodeToString is None, "this is deprecated and will go away"
return Dispatch(ob, userName)

def _get_good_single_object_(self, ob, userName=None, ReturnCLSID=None):
Expand Down
2 changes: 0 additions & 2 deletions com/win32com/client/genpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,9 +877,7 @@ def __init__(
sourceFilename,
progressObject,
bBuildHidden=1,
bUnicodeToString=None,
):
assert bUnicodeToString is None, "this is deprecated and will go away"
self.bHaveWrittenDispatchBaseClass = 0
self.bHaveWrittenCoClassBaseClass = 0
self.bHaveWrittenEventBaseClass = 0
Expand Down
5 changes: 1 addition & 4 deletions com/win32com/client/makepy.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,9 @@ def GenerateFromTypeLibSpec(
file=None,
verboseLevel=None,
progressInstance=None,
bUnicodeToString=None,
bForDemand=bForDemandDefault,
bBuildHidden=1,
):
assert bUnicodeToString is None, "this is deprecated and will go away"
if verboseLevel is None:
verboseLevel = 0 # By default, we use no gui and no verbose level!

Expand Down Expand Up @@ -338,9 +336,8 @@ def GenerateFromTypeLibSpec(


def GenerateChildFromTypeLibSpec(
child, typelibInfo, verboseLevel=None, progressInstance=None, bUnicodeToString=None
child, typelibInfo, verboseLevel=None, progressInstance=None
):
assert bUnicodeToString is None, "this is deprecated and will go away"
if verboseLevel is None:
verboseLevel = (
0 # By default, we use no gui, and no verbose level for the children.
Expand Down
5 changes: 1 addition & 4 deletions com/win32comext/adsi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ def __GetIndex(self, index):


class ADSIDispatch(win32com.client.CDispatch):
def _wrap_dispatch_(
self, ob, userName=None, returnCLSID=None, UnicodeToString=None
):
assert UnicodeToString is None, "this is deprectated and will be removed"
def _wrap_dispatch_(self, ob, userName=None, returnCLSID=None):
if not userName:
userName = "ADSI-object"
olerepr = win32com.client.dynamic.MakeOleRepr(ob, None, None)
Expand Down