Commits

Victor Stinner committed d295179

remove conv_python3.0.sh and python3.0.patch: setup.py runs 2to3

Comments (0)

Files changed (3)

 Minor tasks
 -----------
 
+ * setup.py: convert docstrings with 2to3 (run "2to3 -w -d ." ?)
  * Fix gdb.py "step" command on a jump. Example where step will never stop: ::
 
 (gdb) where

conv_python3.0.sh

-#!/bin/bash
-set -e
-set -x
-2to3 -w .
-2to3 -w -d .
-patch -p1 < python3.0.patch

python3.0.patch

-diff -ur python-ptrace.orig/ptrace/debugger/breakpoint.py python-ptrace.patched/ptrace/debugger/breakpoint.py
---- python-ptrace.orig/ptrace/debugger/breakpoint.py	2008-09-05 01:07:55.000000000 +0200
-+++ python-ptrace.patched/ptrace/debugger/breakpoint.py	2008-12-20 13:55:06.000000000 +0100
-@@ -30,7 +30,7 @@
-             new_bytes = word2bytes(0x0cc00000)
-         else:
-             # Replace instruction with "INT 3"
--            new_bytes = "\xCC" * size
-+            new_bytes = b"\xCC" * size
-         process.writeBytes(address, new_bytes)
-         self._installed = True
-
-diff -ur python-ptrace.orig/ptrace/debugger/process.py python-ptrace.patched/ptrace/debugger/process.py
---- python-ptrace.orig/ptrace/debugger/process.py	2008-12-20 13:52:36.000000000 +0100
-+++ python-ptrace.patched/ptrace/debugger/process.py	2008-12-20 13:55:06.000000000 +0100
-@@ -505,7 +505,7 @@
-             size -= subsize
-             address += CPU_WORD_SIZE
-         else:
--            data = ''
-+            data = b''
-
-         while size:
-             # Read word
-@@ -633,9 +633,9 @@
-         while True:
-             done = False
-             data = self.readBytes(address, chunk_length)
--            if '\0' in data:
-+            if 0 in data:
-                 done = True
--                data = data[:data.index('\0')]
-+                data = data[:data.index(b'\0')]
-             if max_size <= size+chunk_length:
-                 data = data[:(max_size-size)]
-                 string.append(data)
-@@ -646,7 +646,7 @@
-                 break
-             size += chunk_length
-             address += chunk_length
--        return ''.join(string), truncated
-+        return b''.join(string), truncated
-
-     def dumpStack(self, log=None):
-         if not log:
-diff -ur python-ptrace.orig/ptrace/pydistorm.py python-ptrace.patched/ptrace/pydistorm.py
---- python-ptrace.orig/ptrace/pydistorm.py	2008-12-20 13:52:25.000000000 +0100
-+++ python-ptrace.patched/ptrace/pydistorm.py	2008-12-20 13:55:06.000000000 +0100
-@@ -75,8 +75,8 @@
-     # Check arguments
-     if not isinstance(codeOffset, int):
-         raise TypeError("codeOffset have to be an integer")
--    if not isinstance(code, str):
--        raise TypeError("code have to be a string")
-+    if not isinstance(code, bytes):
-+        raise TypeError("code have to be bytes")
-     if dt not in DECODERS:
-         raise IndexError("Decoding-type must be either Decode16Bits, Decode32Bits or Decode64Bits.")
-
-diff -ur python-ptrace.orig/gdb.py python-ptrace.patched/gdb.py
---- python-ptrace.orig/gdb.py	2008-12-20 13:52:17.000000000 +0100
-+++ python-ptrace.patched/gdb.py	2008-12-20 13:55:06.000000000 +0100
-@@ -343,10 +343,10 @@
-                 bytes = self.process.readBytes(address, size)
-
-                 # Format bytes
--                hexa = ' '.join( "%02x" % ord(byte) for byte in bytes )
-+                hexa = ' '.join( ("%02x" % byte) for byte in bytes )
-                 def toAscii(byte):
--                    if 32 <= ord(byte) <= 127:
--                        return byte
-+                    if 32 <= byte <= 127:
-+                        return chr(byte)
-                     else:
-                         return '.'
-                 ascii = ''.join(toAscii(byte) for byte in bytes)