Hello,

The following trivial patch to pylupdate/fetchtr.cpp (for PyQt 4.10.3)
allows pylupdate4 to correctly process backslashes at the end of a line,
instead of replacing such backslashes with a linefeed (ASCII 10)
character. This is very useful in triple-quoted strings to avoid
introducing newlines that don't exist in the original Python string.
(this is *not* about "\n" sequences; these work fine, having an
identical counterpart in C++ syntax)

Unfortunately, the patch only works for Python source files that have
Unix-style line endings, but doesn't make things any worse for other
newline styles. Ideally, Python source files would be read in some kind
of universal newlines mode...

Could you please include it, or something similar?

Thanks.

-- 
Florent
--- a/pylupdate/fetchtr.cpp
+++ b/pylupdate/fetchtr.cpp
@@ -342,7 +342,8 @@
                                     yyString[yyStringLen++] = (char) n;
                             } else {
                                 const char *p = strchr( tab, yyCh );
-                                if ( yyStringLen < sizeof(yyString) - 1 )
+                                if ( yyStringLen < sizeof(yyString) - 1
+                                     && yyCh != '\n' )
                                     yyString[yyStringLen++] = ( p == 0 ) ?
                                             (char) yyCh : backTab[p - tab];
                                 yyCh = getChar();
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to