SF.net SVN: jython:[7181] trunk/jython

[email protected] Wed, 29 Dec 2010 01:59:21 +0000
Newsgroups gmane.comp.lang.jython.cvs
Message-ID <[email protected]>
Revision: 7181
          http://jython.svn.sourceforge.net/jython/?rev=7181&view=rev
Author:   pjenvey
Date:     2010-12-29 01:59:20 +0000 (Wed, 29 Dec 2010)

Log Message:
-----------
fix strptime('','')
fixes #1668
patch from Israel Tsadok

Modified Paths:
--------------
    trunk/jython/Lib/test/test_time.py
    trunk/jython/NEWS
    trunk/jython/src/org/python/modules/time/Time.java

Modified: trunk/jython/Lib/test/test_time.py
===================================================================
--- trunk/jython/Lib/test/test_time.py	2010-12-27 15:50:19 UTC (rev 7180)
+++ trunk/jython/Lib/test/test_time.py	2010-12-29 01:59:20 UTC (rev 7181)
@@ -120,6 +120,12 @@
             except ValueError:
                 self.fail('conversion specifier: %r failed.' % format)
 
+    def test_strptime_empty(self):
+        try:
+            time.strptime('', '')
+        except ValueError:
+            self.fail('strptime failed on empty args.')
+
     def test_asctime(self):
         time.asctime(time.gmtime(self.t))
         self.assertRaises(TypeError, time.asctime, 0)

Modified: trunk/jython/NEWS
===================================================================
--- trunk/jython/NEWS	2010-12-27 15:50:19 UTC (rev 7180)
+++ trunk/jython/NEWS	2010-12-29 01:59:20 UTC (rev 7181)
@@ -7,6 +7,7 @@
     - [ 1681 ] JSR-223, Jython 2.5.2 and implementing Java Interfaces from Python
     - [ 1675 ] Jython exits prematurely when executing a file, thus killing Swing windows
     - [ 1682 ] exit code of 0 on unhandled exception
+    - [ 1668 ] strptime('','') works on cpython but not on jython
       
 Jython 2.5.2rc2
   Bugs Fixed

Modified: trunk/jython/src/org/python/modules/time/Time.java
===================================================================
--- trunk/jython/src/org/python/modules/time/Time.java	2010-12-27 15:50:19 UTC (rev 7180)
+++ trunk/jython/src/org/python/modules/time/Time.java	2010-12-29 01:59:20 UTC (rev 7181)
@@ -759,6 +759,10 @@
         boolean directive = false;
         boolean inQuote = false;
 
+        if (format.length() == 0) {
+            return null;
+        }
+
         for (int i = 0; i < format.length(); i++) {
             char charAt = format.charAt(i);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl