[Python-checkins] r59830 - in python/trunk: Objects/typeobject.c Parser/tokenizer.c Parser/tokenizer.h Python/ast.c

georg.brandl python-checkins at python.org
Mon Jan 7 19:16:37 CET 2008


Author: georg.brandl
Date: Mon Jan  7 19:16:36 2008
New Revision: 59830

Modified:
   python/trunk/Objects/typeobject.c
   python/trunk/Parser/tokenizer.c
   python/trunk/Parser/tokenizer.h
   python/trunk/Python/ast.c
Log:
Make Python compile with --disable-unicode.


Modified: python/trunk/Objects/typeobject.c
==============================================================================
--- python/trunk/Objects/typeobject.c	(original)
+++ python/trunk/Objects/typeobject.c	Mon Jan  7 19:16:36 2008
@@ -3220,8 +3220,10 @@
 		type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS;
 	else if (PyType_IsSubtype(base, &PyString_Type))
 		type->tp_flags |= Py_TPFLAGS_STRING_SUBCLASS;
+#ifdef Py_USING_UNICODE
 	else if (PyType_IsSubtype(base, &PyUnicode_Type))
 		type->tp_flags |= Py_TPFLAGS_UNICODE_SUBCLASS;
+#endif
 	else if (PyType_IsSubtype(base, &PyTuple_Type))
 		type->tp_flags |= Py_TPFLAGS_TUPLE_SUBCLASS;
 	else if (PyType_IsSubtype(base, &PyList_Type))

Modified: python/trunk/Parser/tokenizer.c
==============================================================================
--- python/trunk/Parser/tokenizer.c	(original)
+++ python/trunk/Parser/tokenizer.c	Mon Jan  7 19:16:36 2008
@@ -1533,6 +1533,7 @@
 	return result;
 }
 
+#ifdef Py_USING_UNICODE
 /* This function is only called from parsetok. However, it cannot live
    there, as it must be empty for PGEN, and we can check for PGEN only
    in this file. */
@@ -1593,6 +1594,7 @@
 }
 #endif
 
+#endif /* defined(Py_USING_UNICODE) */
 			   
 
 #ifdef Py_DEBUG

Modified: python/trunk/Parser/tokenizer.h
==============================================================================
--- python/trunk/Parser/tokenizer.h	(original)
+++ python/trunk/Parser/tokenizer.h	Mon Jan  7 19:16:36 2008
@@ -58,8 +58,10 @@
 extern struct tok_state *PyTokenizer_FromFile(FILE *, char *, char *);
 extern void PyTokenizer_Free(struct tok_state *);
 extern int PyTokenizer_Get(struct tok_state *, char **, char **);
+#ifdef Py_USING_UNICODE
 extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok, 
 					  int len, int *offset);
+#endif
 
 #ifdef __cplusplus
 }

Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c	(original)
+++ python/trunk/Python/ast.c	Mon Jan  7 19:16:36 2008
@@ -1246,6 +1246,7 @@
     case STRING: {
         PyObject *str = parsestrplus(c, n);
         if (!str) {
+#ifdef Py_USING_UNICODE
             if (PyErr_ExceptionMatches(PyExc_UnicodeError)){
                 PyObject *type, *value, *tback, *errstr;
                 PyErr_Fetch(&type, &value, &tback);
@@ -1263,6 +1264,7 @@
                 Py_DECREF(value);
                 Py_XDECREF(tback);
             }
+#endif
             return NULL;
         }
         PyArena_AddPyObject(c->c_arena, str);


More information about the Python-checkins mailing list