[Python-bugs-list] [ python-Bugs-661354 ] test_strptime fails on the Mac

noreply@sourceforge.net noreply@sourceforge.net
Thu, 02 Jan 2003 15:54:11 -0800


Bugs item #661354, was opened at 2003-01-02 14:29
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661354&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 7
Submitted By: Jack Jansen (jackjansen)
Assigned to: Guido van Rossum (gvanrossum)
Summary: test_strptime fails on the Mac

Initial Comment:
test_strptime fails for MacPython-OS9. It appears to be an error in the test itself, but it could be this error is triggered only on the Mac (because it doesn't have a builtin strptime() function but uses the pure Python strptime implementation). Here is the first stacktrace from the test (a lot of very similar ones follow):
Traceback (most recent call last):
  File "Moes:SWdev:Jack:MacPython:Lib:test:test_strptime.py", line 183, in test_compile
    compiled = self.time_re.compile("%%%s"% directive)
  File "Moes:SWdev:Jack:MacPython:Lib:_strptime.py", line 394, in compile
    return re_compile(self.pattern(format), IGNORECASE)
  File "Moes:SWdev:Jack:MacPython:Lib:sre.py", line 179, in compile
    return _compile(pattern, flags)
  File "Moes:SWdev:Jack:MacPython:Lib:sre.py", line 229, in _compile
    raise error, v # invalid expression
error: redefinition of group name 'Z' as group 2; was group 1


----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2003-01-02 15:54

Message:
Logged In: YES 
user_id=357491

As for the bug, obviously a regex is being created where the
regex group Z is being specified twice.  I will take a look,
but I just ran the tests and I am having no problems on OS X
10.2.3.  I have some ideas on where this trouble could be
produced, though, so I will see if I can find a problem or
come up with some code Jack can run to try to help figure
out the problem.  Are the "very similar ones" that follow
this stack trace all from the same line in test_strptime, or
all from the same line in _strptime?  In other words, are
they all the same error being caused by the same test or the
same chunk of code in _strptime?  Or am I so unlucky that it
is just the same redefinition error but with everything else
different every time?

Oh, and one quick syntax thing; line 394 in test_strptime.py
has a string where the ``%`` operator has no space between
it and the string being worked on.  I know what a stickler
you are, Guido, so I thought you should know <wink>.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-01-02 14:44

Message:
Logged In: YES 
user_id=6380

BTW, there's an #undef HAVE_STRPTIME in timemodule.c, so
that *everybody* will *always* be using the Python
implementation. The test passes for me on Linux, FWIW.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-01-02 14:40

Message:
Logged In: YES 
user_id=6380

I've forwarded this to Brett Cannon -- he's the author,
maybe he understands what's going on.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661354&group_id=5470