]> granicus.if.org Git - python/commitdiff
today's SRE update:
authorFredrik Lundh <fredrik@pythonware.com>
Sat, 1 Jul 2000 17:50:59 +0000 (17:50 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Sat, 1 Jul 2000 17:50:59 +0000 (17:50 +0000)
-- changed 1.6 to 2.0 in the file headers

-- fixed ISALNUM macro for the unicode locale.  this
   solution isn't perfect, but the best I can do with
   Python's current unicode database.

Lib/sre.py
Lib/sre_compile.py
Lib/sre_constants.py
Lib/sre_parse.py
Modules/_sre.c

index 5e6aeeb8533633890bc3cbbdfe8de7574b40ca2f..a09184b2a00f40f16925d23c76102b57cc986378 100644 (file)
@@ -6,7 +6,7 @@
 # Copyright (c) 1998-2000 by Secret Labs AB.  All rights reserved.
 #
 # Portions of this engine have been developed in cooperation with
-# CNRI.  Hewlett-Packard provided funding for 1.6 integration and
+# CNRI.  Hewlett-Packard provided funding for 2.0 integration and
 # other compatibility work.
 #
 
index 590e45fb42507c8425aaf8d3471188fab5aeb9fd..14b1970d56c10dcec423b8221e72910b7c86699e 100644 (file)
@@ -6,7 +6,7 @@
 # Copyright (c) 1997-2000 by Secret Labs AB.  All rights reserved.
 #
 # Portions of this engine have been developed in cooperation with
-# CNRI.  Hewlett-Packard provided funding for 1.6 integration and
+# CNRI.  Hewlett-Packard provided funding for 2.0 integration and
 # other compatibility work.
 #
 
index 45f4f482d2887f10ae6175b23a5de129b7f59976..39db58fd4f9cdd99602116b8be885ce19dc1a410 100644 (file)
@@ -7,7 +7,7 @@
 # Copyright (c) 1998-2000 by Secret Labs AB.  All rights reserved.
 #
 # Portions of this engine have been developed in cooperation with
-# CNRI.  Hewlett-Packard provided funding for 1.6 integration and
+# CNRI.  Hewlett-Packard provided funding for 2.0 integration and
 # other compatibility work.
 #
 
index 53616f618fc057fcf6030fc8c377bbfa0f9d32db..0e01ad62dbf42cfa506aefef67c34273630270d1 100644 (file)
@@ -6,7 +6,7 @@
 # Copyright (c) 1998-2000 by Secret Labs AB.  All rights reserved.
 #
 # Portions of this engine have been developed in cooperation with
-# CNRI.  Hewlett-Packard provided funding for 1.6 integration and
+# CNRI.  Hewlett-Packard provided funding for 2.0 integration and
 # other compatibility work.
 #
 
index 46fe4ed67952db9f218a242db93236979eb2cef1..3d6305a6ae222e1bd3cde5b003b0f6166727ceee 100644 (file)
@@ -25,7 +25,7 @@
  * Copyright (c) 1997-2000 by Secret Labs AB.  All rights reserved.
  *
  * Portions of this engine have been developed in cooperation with
- * CNRI.  Hewlett-Packard provided funding for 1.6 integration and
+ * CNRI.  Hewlett-Packard provided funding for 2.0 integration and
  * other compatibility work.
  */
 
@@ -52,7 +52,7 @@ char copyright[] = " SRE 0.9.4 Copyright (c) 1997-2000 by Secret Labs AB ";
 #undef DEBUG
 
 #if PY_VERSION_HEX >= 0x01060000
-/* defining this enables unicode support (default under 1.6) */
+/* defining this enables unicode support (default under 1.6a1 and later) */
 #define HAVE_UNICODE
 #endif
 
@@ -143,11 +143,18 @@ static unsigned int sre_lower_unicode(unsigned int ch)
 {
     return (unsigned int) Py_UNICODE_TOLOWER((Py_UNICODE)(ch));
 }
-#define SRE_UNI_TO_LOWER(ch) Py_UNICODE_TOLOWER((Py_UNICODE)(ch))
+
+#if !defined(Py_UNICODE_ISALNUM)
+/* FIXME: workaround.  should be fixed in unicodectype.c */
+#define Py_UNICODE_ISALNUM(ch)\
+    (Py_UNICODE_ISLOWER(ch) || Py_UNICODE_ISUPPER(ch) ||\
+     Py_UNICODE_ISTITLE(ch) || Py_UNICODE_ISDIGIT(ch))
+#endif
+
 #define SRE_UNI_IS_DIGIT(ch) Py_UNICODE_ISDIGIT((Py_UNICODE)(ch))
 #define SRE_UNI_IS_SPACE(ch) Py_UNICODE_ISSPACE((Py_UNICODE)(ch))
 #define SRE_UNI_IS_LINEBREAK(ch) Py_UNICODE_ISLINEBREAK((Py_UNICODE)(ch))
-#define SRE_UNI_IS_ALNUM(ch) ((ch) < 256 ? isalnum((ch)) : 0)
+#define SRE_UNI_IS_ALNUM(ch) Py_UNICODE_ISALNUM((Py_UNICODE)(ch))
 #define SRE_UNI_IS_WORD(ch) (SRE_IS_ALNUM((ch)) || (ch) == '_')
 #endif