[New-bugs-announce] [issue3606] 2to3: commands varible replaced by subprocess

STINNER Victor report at bugs.python.org
Wed Aug 20 00:05:41 CEST 2008


New submission from STINNER Victor <haypo at users.sourceforge.net>:

I tried 2to3 on my python-ptrace project and with minor changes, it 
works fine. One of the minor changes is to replace 
subprocess.split(";") by commands.split(";"). The original code was:

   commands = command
   ok = True
   for command in commands.split(";"):
      command = command.strip()
      ok &= self.execute(command)

I don't import subprocess and I don't use this module in my code. It 
is possible to reproduce the bug only with two lines:

   commands = "a;b;c"
   x = commands.split(";")

So 2to3 doesn't care if commands is a module or variable, it just 
replaced the text pattern... It looks like the change is done 
by "fixes/fix_imports.py", maybe this pattern:

   # Find usages of module members in code e.g. urllib.foo(bar)
   yield """power< (%s)
            trailer<'.' any > any* >
         """ % mod_name_list

----------
assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool)
messages: 71490
nosy: collinwinter, haypo
severity: normal
status: open
title: 2to3: commands varible replaced by subprocess

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3606>
_______________________________________


More information about the New-bugs-announce mailing list