[Python-bugs-list] [ python-Bugs-530285 ] redefining SRE_CODE in Modules/sre.h
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 19 Mar 2002 06:41:02 -0800
Bugs item #530285, was opened at 2002-03-15 13:44
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=530285&group_id=5470
Category: Regular Expressions
Group: Python 2.3
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: Fredrik Lundh (effbot)
Summary: redefining SRE_CODE in Modules/sre.h
Initial Comment:
Taken from Modules/sre.h:
/* size of a code word (must be unsigned short or
larger, and
large enough to hold a Py_UNICODE character) */
#ifdef Py_UNICODE_WIDE
#define SRE_CODE unsigned long
#else
#define SRE_CODE unsigned short
#endif
#define SRE_CODE unsigned short
------------------
SRE_CODE is always an unsigned short.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2002-03-19 15:41
Message:
Logged In: YES
user_id=21627
Isn't there also some interaction with sre_compile.MAXCODE?
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-03-18 19:48
Message:
Logged In: YES
user_id=33168
Fixed in revision: 2.22.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2002-03-18 14:00
Message:
Logged In: YES
user_id=6656
That was easy enough; fixed in revision 2.21.16.1 of
Modules/sre.h.
Will need to go onto the trunk, later...
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2002-03-17 23:10
Message:
Logged In: YES
user_id=38376
as neal points out, the 3rd define (after the #endif)
should be removed.
(my CVS workspace is broken right now, so I cannot
patch this myself -- at least not tonight...)
</F>
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-03-15 19:05
Message:
Logged In: YES
user_id=33168
Regardless of the value of Py_UNICODE_WIDE, SRE_CODE will be
defined to unsigned short after the #ifdef because of the
#define after the #ifdef.
There is actually a warning produced that SRE_CODE is
redefined if Py_UNICODE_WIDE is set.
If SRE_CODE needs to be differerent, the 3rd #define of
SRE_CODE should be removed. I tried this a while ago and
purify reported more errors. (purify is still broken, so I
can't give any current info.)
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-03-15 18:50
Message:
Logged In: YES
user_id=21627
What do you mean with "SRE_CODE is always an unsigned
short"; if sre.h defines it as something different, it is
different.
It also needs to be different for Py_UNICODE_WIDE: For
SRE_OP_LITERAL, a Py_UNICODE is the argument. If Py_UNICODE
is 4 bytes, SRE_CODE must be also four bytes.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=530285&group_id=5470