[PyKDE] eric: Refactoring renaming bug

Detlev Offenbach detlev at die-offenbachs.de
Wed Oct 20 18:08:03 BST 2004


Hi,

I was able to reproduce the problem and forwarded your report to the 
maintainer of Bicycle Repair Man (the refactoring package). However, your 
statement, that there is no "Undo" is incorrect. BRM comes with it's own undo 
accessible via the Refactoring menu and that did the trick for me.

Regards,
Detlev

Am Mittwoch, 20. Oktober 2004 04:02 schrieb Parzival Herzog:
> Eric seems to rename the wrong thing in some cases, when renaming a global
> variable.
> .
>
> I tried to rename the global "charmap" to "Charmap", by selecting
> the first "charmap" in the snippet below, and using
> Refactoring/Refactoring/Rename:
>
> Original code:
>
> ----------
> charmap = ''.join(map(chr,range(1, maxchar)))
>
> def encode(x, y, charmap=charmap):
>     """ Compute a binary encoding of the difference between string x and
>         string y.
>     """
>     if x == y:
>         return ""
>     if len(x) != len(y):
>         return '\0' + y
>     return b2c(_encode(x, y), charmap=charmap)
> ---------
>
>
> Result:
>
> ----------
> Charmap = ''.join(map(chr,range(1, maxchar)))
>
> def encode(x, y, Charmap=charmap):
>     """ Compute a binary encoding of the difference between string x and
>         string y.
>     """
>     if x == y:
>         return ""
>     if len(x) != len(y):
>         return '\0' + y
>     return b2c(_encode(x, y), charmap=charmap)
> -----------
>
>
> Notice that the formal parameter name is erroneously renamed, while the
> default value expression which refers to the renamed global is not altered.
>
> There is also no undo for this change, and the file is altered, so the
> consequences of this bug could be difficult to reverse in some
> circumstances.

-- 
Detlev Offenbach
detlev at die-offenbachs.de




More information about the PyQt mailing list