From: <pj...@us...> - 2009-05-31 03:27:45
|
Revision: 6433 http://jython.svn.sourceforge.net/jython/?rev=6433&view=rev Author: pjenvey Date: 2009-05-31 03:26:57 +0000 (Sun, 31 May 2009) Log Message: ----------- deprecate the no longer needed {str,unicode}.isunicode and remove cPickle's use of it Modified Paths: -------------- trunk/jython/src/org/python/core/PyString.java trunk/jython/src/org/python/core/PyUnicode.java trunk/jython/src/org/python/modules/cPickle.java Modified: trunk/jython/src/org/python/core/PyString.java =================================================================== --- trunk/jython/src/org/python/core/PyString.java 2009-05-31 00:25:12 UTC (rev 6432) +++ trunk/jython/src/org/python/core/PyString.java 2009-05-31 03:26:57 UTC (rev 6433) @@ -2406,9 +2406,9 @@ return str_isunicode(); } - //XXX: need doc - @ExposedMethod/*(doc = BuiltinDocs.unicode_isunicode_doc)*/ + @ExposedMethod(doc = "isunicode is deprecated.") final boolean str_isunicode() { + Py.warning(Py.DeprecationWarning, "isunicode is deprecated."); int n = string.length(); for (int i = 0; i < n; i++) { char ch = string.charAt(i); Modified: trunk/jython/src/org/python/core/PyUnicode.java =================================================================== --- trunk/jython/src/org/python/core/PyUnicode.java 2009-05-31 00:25:12 UTC (rev 6432) +++ trunk/jython/src/org/python/core/PyUnicode.java 2009-05-31 03:26:57 UTC (rev 6433) @@ -1318,10 +1318,11 @@ } return true; } - // XXX: needs doc + // end utf-16 aware - @ExposedMethod + @ExposedMethod(doc = "isunicode is deprecated.") final boolean unicode_isunicode() { + Py.warning(Py.DeprecationWarning, "isunicode is deprecated."); return true; } Modified: trunk/jython/src/org/python/modules/cPickle.java =================================================================== --- trunk/jython/src/org/python/modules/cPickle.java 2009-05-31 00:25:12 UTC (rev 6432) +++ trunk/jython/src/org/python/modules/cPickle.java 2009-05-31 03:26:57 UTC (rev 6433) @@ -1067,21 +1067,15 @@ final private void save_string(PyObject object) { - boolean unicode = ((PyString) object).isunicode(); String str = object.toString(); if (protocol > 0) { - if (unicode) - str = codecs.PyUnicode_EncodeUTF8(str, "struct"); int l = str.length(); - if (l < 256 && !unicode) { + if (l < 256) { file.write(SHORT_BINSTRING); file.write((char)l); } else { - if (unicode) - file.write(BINUNICODE); - else - file.write(BINSTRING); + file.write(BINSTRING); file.write((char)( l & 0xFF)); file.write((char)((l >>> 8 ) & 0xFF)); file.write((char)((l >>> 16) & 0xFF)); @@ -1089,14 +1083,8 @@ } file.write(str); } else { - if (unicode) { - file.write(UNICODE); - file.write(codecs.PyUnicode_EncodeRawUnicodeEscape(str, - "strict", true)); - } else { - file.write(STRING); - file.write(object.__repr__().toString()); - } + file.write(STRING); + file.write(object.__repr__().toString()); file.write("\n"); } put(putMemo(get_id(object), object)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |