Update of /cvsroot/pywin32/pywin32/com/win32com
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20885
Modified Files:
Tag: py3k
__init__.py decimal_23.py olectl.py storagecon.py universal.py
Log Message:
Changes to build for Py3k
Index: decimal_23.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/decimal_23.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** decimal_23.py 31 May 2005 12:36:01 -0000 1.1
--- decimal_23.py 29 Aug 2008 08:58:52 -0000 1.1.4.1
***************
*** 507,511 ****
# From an integer
! if isinstance(value, (int,long)):
if value >= 0:
self._sign = 0
--- 507,511 ----
# From an integer
! if isinstance(value, (int,int)):
if value >= 0:
self._sign = 0
***************
*** 519,528 ****
if isinstance(value, (list,tuple)):
if len(value) != 3:
! raise ValueError, 'Invalid arguments'
if value[0] not in (0,1):
! raise ValueError, 'Invalid sign'
for digit in value[1]:
! if not isinstance(digit, (int,long)) or digit < 0:
! raise ValueError, "The second value in the tuple must be composed of non negative integer elements."
self._sign = value[0]
--- 519,528 ----
if isinstance(value, (list,tuple)):
if len(value) != 3:
! raise ValueError('Invalid arguments')
if value[0] not in (0,1):
! raise ValueError('Invalid sign')
for digit in value[1]:
! if not isinstance(digit, (int,int)) or digit < 0:
! raise ValueError("The second value in the tuple must be composed of non negative integer elements.")
self._sign = value[0]
***************
*** 545,549 ****
# From a string
# REs insist on real strings, so we can too.
! if isinstance(value, basestring):
if _isinfinity(value):
self._exp = 'F'
--- 545,549 ----
# From a string
# REs insist on real strings, so we can too.
! if isinstance(value, str):
if _isinfinity(value):
self._exp = 'F'
***************
*** 638,642 ****
return 0
! def __nonzero__(self):
"""Is the number non-zero?
--- 638,642 ----
return 0
! def __bool__(self):
"""Is the number non-zero?
***************
*** 700,709 ****
def __eq__(self, other):
! if not isinstance(other, (Decimal, int, long)):
return False
return self.__cmp__(other) == 0
def __ne__(self, other):
! if not isinstance(other, (Decimal, int, long)):
return True
return self.__cmp__(other) != 0
--- 700,709 ----
def __eq__(self, other):
! if not isinstance(other, (Decimal, int, int)):
return False
return self.__cmp__(other) == 0
def __ne__(self, other):
! if not isinstance(other, (Decimal, int, int)):
return True
return self.__cmp__(other) != 0
***************
*** 777,781 ****
context = getcontext()
! tmp = map(str, self._int)
numdigits = len(self._int)
leftdigits = self._exp + numdigits
--- 777,781 ----
context = getcontext()
! tmp = list(map(str, self._int))
numdigits = len(self._int)
leftdigits = self._exp + numdigits
***************
*** 1120,1124 ****
op2 = _WorkRep(other)
! ans = Decimal( (resultsign, map(int, str(op1.int * op2.int)), resultexp))
if shouldround:
ans = ans._fix(context)
--- 1120,1124 ----
op2 = _WorkRep(other)
! ans = Decimal( (resultsign, list(map(int, str(op1.int * op2.int))), resultexp))
if shouldround:
ans = ans._fix(context)
***************
*** 1429,1433 ****
return context._raise_error(InvalidContext)
elif self._isinfinity():
! raise OverflowError, "Cannot convert infinity to long"
if self._exp >= 0:
s = ''.join(map(str, self._int)) + '0'*self._exp
--- 1429,1433 ----
return context._raise_error(InvalidContext)
elif self._isinfinity():
! raise OverflowError("Cannot convert infinity to long")
if self._exp >= 0:
s = ''.join(map(str, self._int)) + '0'*self._exp
***************
*** 1444,1448 ****
Equivalent to long(int(self))
"""
! return long(self.__int__())
def _fix(self, context):
--- 1444,1448 ----
Equivalent to long(int(self))
"""
! return int(self.__int__())
def _fix(self, context):
***************
*** 2132,2136 ****
# get rounding method function:
! rounding_functions = [name for name in Decimal.__dict__.keys() if name.startswith('_round_')]
for name in rounding_functions:
#name is like _round_half_even, goes to the global ROUND_HALF_EVEN value.
--- 2132,2136 ----
# get rounding method function:
! rounding_functions = [name for name in list(Decimal.__dict__.keys()) if name.startswith('_round_')]
for name in rounding_functions:
#name is like _round_half_even, goes to the global ROUND_HALF_EVEN value.
***************
*** 2177,2181 ****
traps = dict([(s,s in traps) for s in _signals])
del s
! for name, val in locals().items():
if val is None:
setattr(self, name, copy.copy(getattr(DefaultContext, name)))
--- 2177,2181 ----
traps = dict([(s,s in traps) for s in _signals])
del s
! for name, val in list(locals().items()):
if val is None:
setattr(self, name, copy.copy(getattr(DefaultContext, name)))
***************
*** 2188,2193 ****
s = []
s.append('Context(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d' % vars(self))
! s.append('flags=[' + ', '.join([f.__name__ for f, v in self.flags.items() if v]) + ']')
! s.append('traps=[' + ', '.join([t.__name__ for t, v in self.traps.items() if v]) + ']')
return ', '.join(s) + ')'
--- 2188,2193 ----
s = []
s.append('Context(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d' % vars(self))
! s.append('flags=[' + ', '.join([f.__name__ for f, v in list(self.flags.items()) if v]) + ']')
! s.append('traps=[' + ', '.join([t.__name__ for t, v in list(self.traps.items()) if v]) + ']')
return ', '.join(s) + ')'
***************
*** 2232,2236 ****
# Errors should only be risked on copies of the context
#self._ignored_flags = []
! raise error, explanation
def _ignore_all_flags(self):
--- 2232,2236 ----
# Errors should only be risked on copies of the context
#self._ignored_flags = []
! raise error(explanation)
def _ignore_all_flags(self):
***************
*** 2255,2259 ****
"""A Context cannot be hashed."""
# We inherit object.__hash__, so we must deny this explicitly
! raise TypeError, "Cannot hash a Context."
def Etiny(self):
--- 2255,2259 ----
"""A Context cannot be hashed."""
# We inherit object.__hash__, so we must deny this explicitly
! raise TypeError("Cannot hash a Context.")
def Etiny(self):
***************
*** 2877,2884 ****
if isinstance(other, Decimal):
return other
! if isinstance(other, (int, long)):
return Decimal(other)
! raise TypeError, "You can interact Decimal only with int, long or Decimal data types."
_infinity_map = {
--- 2877,2884 ----
if isinstance(other, Decimal):
return other
! if isinstance(other, (int, int)):
return Decimal(other)
! raise TypeError("You can interact Decimal only with int, long or Decimal data types.")
_infinity_map = {
***************
*** 3028,3032 ****
mantissa = intpart + fracpart
! tmp = map(int, mantissa)
backup = tmp
while tmp and tmp[0] == 0:
--- 3028,3032 ----
mantissa = intpart + fracpart
! tmp = list(map(int, mantissa))
backup = tmp
while tmp and tmp[0] == 0:
Index: olectl.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/olectl.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** olectl.py 10 Nov 2003 00:51:07 -0000 1.2
--- olectl.py 29 Aug 2008 08:58:52 -0000 1.2.4.1
***************
*** 9,13 ****
def MAKE_SCODE(sev, fac, code):
! return int((long(-sev)<<31) | ((fac)<<16) | ((code)))
def STD_CTL_SCODE(n):
--- 9,13 ----
def MAKE_SCODE(sev, fac, code):
! return int((int(-sev)<<31) | ((fac)<<16) | ((code)))
def STD_CTL_SCODE(n):
Index: __init__.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/__init__.py,v
retrieving revision 1.10
retrieving revision 1.10.4.1
diff -C2 -d -r1.10 -r1.10.4.1
*** __init__.py 20 Jan 2004 01:55:42 -0000 1.10
--- __init__.py 29 Aug 2008 08:58:52 -0000 1.10.4.1
***************
*** 105,115 ****
# we must have a __gen_path__, but may not have a gen_py module -
# set that up.
! if not sys.modules.has_key("win32com.gen_py"):
# Create a "win32com.gen_py", but with a custom __path__
! import new
! gen_py = new.module("win32com.gen_py")
gen_py.__path__ = [ __gen_path__ ]
sys.modules[gen_py.__name__]=gen_py
! del new
gen_py = sys.modules["win32com.gen_py"]
--- 105,115 ----
# we must have a __gen_path__, but may not have a gen_py module -
# set that up.
! if "win32com.gen_py" not in sys.modules:
# Create a "win32com.gen_py", but with a custom __path__
! import imp
! gen_py = imp.new_module("win32com.gen_py")
gen_py.__path__ = [ __gen_path__ ]
sys.modules[gen_py.__name__]=gen_py
! del imp
gen_py = sys.modules["win32com.gen_py"]
Index: universal.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/universal.py,v
retrieving revision 1.13
retrieving revision 1.13.4.1
diff -C2 -d -r1.13 -r1.13.4.1
*** universal.py 8 Jun 2005 05:19:03 -0000 1.13
--- universal.py 29 Aug 2008 08:58:52 -0000 1.13.4.1
***************
*** 35,39 ****
# impl looks correct..
if type_info is None:
! raise ValueError, "The interface '%s' can not be located" % (name,)
# If we got back a Dispatch interface, convert to the real interface.
attr = type_info.GetTypeAttr()
--- 35,39 ----
# impl looks correct..
if type_info is None:
! raise ValueError("The interface '%s' can not be located" % (name,))
# If we got back a Dispatch interface, convert to the real interface.
attr = type_info.GetTypeAttr()
***************
*** 51,60 ****
# Cool - can used cached info.
if not interface_names:
! interface_names = mod.VTablesToClassMap.values()
for name in interface_names:
try:
iid = mod.NamesToIIDMap[name]
except KeyError:
! raise ValueError, "Interface '%s' does not exist in this cached typelib" % (name,)
# print "Processing interface", name
sub_mod = gencache.GetModuleForCLSID(iid)
--- 51,60 ----
# Cool - can used cached info.
if not interface_names:
! interface_names = list(mod.VTablesToClassMap.values())
for name in interface_names:
try:
iid = mod.NamesToIIDMap[name]
except KeyError:
! raise ValueError("Interface '%s' does not exist in this cached typelib" % (name,))
# print "Processing interface", name
sub_mod = gencache.GetModuleForCLSID(iid)
***************
*** 62,66 ****
method_defs = getattr(sub_mod, name + "_vtables_", None)
if is_dispatch is None or method_defs is None:
! raise ValueError, "Interface '%s' is IDispatch only" % (name,)
# And create the univgw defn
--- 62,66 ----
method_defs = getattr(sub_mod, name + "_vtables_", None)
if is_dispatch is None or method_defs is None:
! raise ValueError("Interface '%s' is IDispatch only" % (name,))
# And create the univgw defn
***************
*** 162,166 ****
return self._iid
def vtbl_argsizes(self):
! return map(lambda m: m.cbArgs, self._methods)
def dispatch(self, ob, index, argPtr,
ReadFromInTuple=_univgw.ReadFromInTuple,
--- 162,166 ----
return self._iid
def vtbl_argsizes(self):
! return [m.cbArgs for m in self._methods]
def dispatch(self, ob, index, argPtr,
ReadFromInTuple=_univgw.ReadFromInTuple,
***************
*** 178,182 ****
# None is an allowed return value stating that
# the code doesn't want to touch any output arguments.
! if type(retVal) == types.TupleType: # Like pythoncom, we special case a tuple.
# However, if they want to return a specific HRESULT,
# then they have to return all of the out arguments
--- 178,182 ----
# None is an allowed return value stating that
# the code doesn't want to touch any output arguments.
! if type(retVal) == tuple: # Like pythoncom, we special case a tuple.
# However, if they want to return a specific HRESULT,
# then they have to return all of the out arguments
***************
*** 186,190 ****
retVal = retVal[1:]
else:
! raise TypeError, "Expected %s return values, got: %s" % (len(meth._gw_out_args) + 1, len(retVal))
else:
retVal = [retVal]
--- 186,190 ----
retVal = retVal[1:]
else:
! raise TypeError("Expected %s return values, got: %s" % (len(meth._gw_out_args) + 1, len(retVal)))
else:
retVal = [retVal]
Index: storagecon.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/storagecon.py,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -d -r1.5 -r1.5.4.1
*** storagecon.py 3 Dec 2006 06:03:43 -0000 1.5
--- storagecon.py 29 Aug 2008 08:58:52 -0000 1.5.4.1
***************
*** 26,52 ****
CWCSTORAGENAME = 32
! STGM_DIRECT = 0x00000000L
! STGM_TRANSACTED = 0x00010000L
! STGM_SIMPLE = 0x08000000L
! STGM_READ = 0x00000000L
! STGM_WRITE = 0x00000001L
! STGM_READWRITE = 0x00000002L
! STGM_SHARE_DENY_NONE = 0x00000040L
! STGM_SHARE_DENY_READ = 0x00000030L
! STGM_SHARE_DENY_WRITE = 0x00000020L
! STGM_SHARE_EXCLUSIVE = 0x00000010L
! STGM_PRIORITY = 0x00040000L
! STGM_DELETEONRELEASE = 0x04000000L
! STGM_NOSCRATCH = 0x00100000L
! STGM_CREATE = 0x00001000L
! STGM_CONVERT = 0x00020000L
! STGM_FAILIFTHERE = 0x00000000L
! STGM_NOSNAPSHOT = 0x00200000L
! ASYNC_MODE_COMPATIBILITY = 0x00000001L
! ASYNC_MODE_DEFAULT = 0x00000000L
! STGTY_REPEAT = 0x00000100L
! STG_TOEND = 0xFFFFFFFFL
! STG_LAYOUT_SEQUENTIAL = 0x00000000L
! STG_LAYOUT_INTERLEAVED = 0x00000001L
## access rights used with COM server ACL's
--- 26,52 ----
CWCSTORAGENAME = 32
! STGM_DIRECT = 0x00000000
! STGM_TRANSACTED = 0x00010000
! STGM_SIMPLE = 0x08000000
! STGM_READ = 0x00000000
! STGM_WRITE = 0x00000001
! STGM_READWRITE = 0x00000002
! STGM_SHARE_DENY_NONE = 0x00000040
! STGM_SHARE_DENY_READ = 0x00000030
! STGM_SHARE_DENY_WRITE = 0x00000020
! STGM_SHARE_EXCLUSIVE = 0x00000010
! STGM_PRIORITY = 0x00040000
! STGM_DELETEONRELEASE = 0x04000000
! STGM_NOSCRATCH = 0x00100000
! STGM_CREATE = 0x00001000
! STGM_CONVERT = 0x00020000
! STGM_FAILIFTHERE = 0x00000000
! STGM_NOSNAPSHOT = 0x00200000
! ASYNC_MODE_COMPATIBILITY = 0x00000001
! ASYNC_MODE_DEFAULT = 0x00000000
! STGTY_REPEAT = 0x00000100
! STG_TOEND = 0xFFFFFFFF
! STG_LAYOUT_SEQUENTIAL = 0x00000000
! STG_LAYOUT_INTERLEAVED = 0x00000001
## access rights used with COM server ACL's
***************
*** 78,82 ****
## DiscardableInformation
! PIDDI_THUMBNAIL = 0x00000002L
## SummaryInformation
--- 78,82 ----
## DiscardableInformation
! PIDDI_THUMBNAIL = 0x00000002
## SummaryInformation
|