From: <fwi...@us...> - 2009-03-02 19:26:29
|
Revision: 6060 http://jython.svn.sourceforge.net/jython/?rev=6060&view=rev Author: fwierzbicki Date: 2009-03-02 19:26:12 +0000 (Mon, 02 Mar 2009) Log Message: ----------- Added BytesWarning, plus a couple of quick bandaids to get regrtest sort of running. Modified Paths: -------------- trunk/sandbox/wierzbicki/test27/Lib/socket.py trunk/sandbox/wierzbicki/test27/Lib/test/regrtest.py trunk/sandbox/wierzbicki/test27/Lib/warnings.py trunk/sandbox/wierzbicki/test27/src/org/python/core/Py.java trunk/sandbox/wierzbicki/test27/src/org/python/core/PySystemState.java trunk/sandbox/wierzbicki/test27/src/org/python/core/exceptions.java Modified: trunk/sandbox/wierzbicki/test27/Lib/socket.py =================================================================== --- trunk/sandbox/wierzbicki/test27/Lib/socket.py 2009-03-02 18:59:56 UTC (rev 6059) +++ trunk/sandbox/wierzbicki/test27/Lib/socket.py 2009-03-02 19:26:12 UTC (rev 6060) @@ -136,6 +136,10 @@ exception.java_exception = exc return exception +#XXX: just copying from CPython -- someone with better knowledge of socket.py +# should check if this makes sense. +_GLOBAL_DEFAULT_TIMEOUT = object() + MODE_BLOCKING = 'block' MODE_NONBLOCKING = 'nonblock' MODE_TIMEOUT = 'timeout' Modified: trunk/sandbox/wierzbicki/test27/Lib/test/regrtest.py =================================================================== --- trunk/sandbox/wierzbicki/test27/Lib/test/regrtest.py 2009-03-02 18:59:56 UTC (rev 6059) +++ trunk/sandbox/wierzbicki/test27/Lib/test/regrtest.py 2009-03-02 19:26:12 UTC (rev 6060) @@ -553,6 +553,8 @@ else: cfp = cStringIO.StringIO() + #XXX: seems to need setting outside of the try block. + indirect_test = None try: save_stdout = sys.stdout if junit_xml_dir: @@ -605,6 +607,7 @@ print test, "skipped --", msg sys.stdout.flush() if junit_xml_dir: + from test.junit_xml import Tee, write_direct_test write_direct_test(junit_xml_dir, abstest, time.time() - start, 'skipped', sys.exc_info(), stdout=stdout.getvalue(), @@ -629,6 +632,7 @@ traceback.print_exc(file=sys.stdout) sys.stdout.flush() if junit_xml_dir and indirect_test is None: + from test.junit_xml import Tee, write_direct_test write_direct_test(junit_xml_dir, abstest, time.time() - start, 'error', sys.exc_info(), stdout=stdout.getvalue(), Modified: trunk/sandbox/wierzbicki/test27/Lib/warnings.py =================================================================== --- trunk/sandbox/wierzbicki/test27/Lib/warnings.py 2009-03-02 18:59:56 UTC (rev 6059) +++ trunk/sandbox/wierzbicki/test27/Lib/warnings.py 2009-03-02 19:26:12 UTC (rev 6060) @@ -187,6 +187,8 @@ fnl = filename.lower() if fnl.endswith((".pyc", ".pyo")): filename = filename[:-1] + elif fnl.endswith("$py.class"): + filename = filename[:-9] + '.py' else: if module == "__main__": try: @@ -391,12 +393,16 @@ if not _warnings_defaults: simplefilter("ignore", category=PendingDeprecationWarning, append=1) simplefilter("ignore", category=ImportWarning, append=1) - bytes_warning = sys.flags.bytes_warning - if bytes_warning > 1: - bytes_action = "error" - elif bytes_warning: - bytes_action = "default" - else: - bytes_action = "ignore" + + #FIXME: setting to "ignore" just to get moving + bytes_action = "ignore" + #bytes_warning = sys.flags.bytes_warning + #if bytes_warning > 1: + # bytes_action = "error" + #elif bytes_warning: + # bytes_action = "default" + #else: + # bytes_action = "ignore" + simplefilter(bytes_action, category=BytesWarning, append=1) del _warnings_defaults Modified: trunk/sandbox/wierzbicki/test27/src/org/python/core/Py.java =================================================================== --- trunk/sandbox/wierzbicki/test27/src/org/python/core/Py.java 2009-03-02 18:59:56 UTC (rev 6059) +++ trunk/sandbox/wierzbicki/test27/src/org/python/core/Py.java 2009-03-02 19:26:12 UTC (rev 6060) @@ -375,6 +375,12 @@ warning(UnicodeWarning, message); } + public static PyObject BytesWarning; + public static void BytesWarning(String message) { + warning(BytesWarning, message); + } + + private static PyObject warnings_mod; private static PyObject importWarnings() { @@ -731,6 +737,7 @@ RuntimeWarning = initExc("RuntimeWarning", exc, dict); FutureWarning = initExc("FutureWarning", exc, dict); ImportWarning = initExc("ImportWarning", exc, dict); + BytesWarning = initExc("BytesWarning", exc, dict); UnicodeWarning = initExc("UnicodeWarning", exc, dict); // Pre-initialize the PyJavaClass for OutOfMemoryError so when we need Modified: trunk/sandbox/wierzbicki/test27/src/org/python/core/PySystemState.java =================================================================== --- trunk/sandbox/wierzbicki/test27/src/org/python/core/PySystemState.java 2009-03-02 18:59:56 UTC (rev 6059) +++ trunk/sandbox/wierzbicki/test27/src/org/python/core/PySystemState.java 2009-03-02 19:26:12 UTC (rev 6060) @@ -101,6 +101,9 @@ private static boolean initialized = false; + //XXX: placeholder. + public static final boolean py3kwarning = false; + /** The arguments passed to this program on the command line. */ public PyList argv = new PyList(); Modified: trunk/sandbox/wierzbicki/test27/src/org/python/core/exceptions.java =================================================================== --- trunk/sandbox/wierzbicki/test27/src/org/python/core/exceptions.java 2009-03-02 18:59:56 UTC (rev 6059) +++ trunk/sandbox/wierzbicki/test27/src/org/python/core/exceptions.java 2009-03-02 19:26:12 UTC (rev 6060) @@ -166,6 +166,10 @@ buildClass(dict, "ImportWarning", "Warning", "Base class for warnings about probable mistakes in module imports"); + buildClass(dict, "BytesWarning", "Warning", + "Base class for warnings about bytes and buffer related problems, mostly\n" + + "related to conversion from str or comparing to str."); + buildClass(dict, "UnicodeWarning", "Warning", "Base class for warnings about Unicode related problems, mostly\n" + "related to conversion problems."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |