[pywin32-checkins] pywin32/win32/Lib win32verstamp.py,1.3,1.4
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-12-06 00:42:45
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22295/win32/Lib Modified Files: win32verstamp.py Log Message: Use py3k compatible handling of bytes Index: win32verstamp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32verstamp.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** win32verstamp.py 26 Nov 2008 08:56:33 -0000 1.3 --- win32verstamp.py 6 Dec 2008 00:42:39 -0000 1.4 *************** *** 2,7 **** """ ! from win32api import BeginUpdateResource, UpdateResource, EndUpdateResource, Unicode ! U = Unicode import os --- 2,6 ---- """ ! from win32api import BeginUpdateResource, UpdateResource, EndUpdateResource import os *************** *** 16,19 **** --- 15,19 ---- VOS_NT_WINDOWS32 = 0x00040004 + null_byte = "\0".encode("ascii") # str in py2k, bytes in py3k # # Set VS_FF_PRERELEASE and DEBUG if Debug *************** *** 47,54 **** def nullterm(s): ! try: ! return buffer(unicode(s)) + "\0\0" ! except NameError: # No unicode builtin ! return U(s).raw + '\0\0' def pad32(s, extra=2): --- 47,52 ---- def nullterm(s): ! # get raw bytes for a NULL terminated unicode string. ! return (unicode(s) + u'\0').encode('unicode-internal') def pad32(s, extra=2): *************** *** 56,60 **** l = 4 - ((len(s) + extra) & 3) if l < 4: ! return s + ('\0' * l) return s --- 54,58 ---- l = 4 - ((len(s) + extra) & 3) if l < 4: ! return s + (null_byte * l) return s |