]> granicus.if.org Git - python/commitdiff
Make Python compile with --disable-unicode.
authorGeorg Brandl <georg@python.org>
Mon, 7 Jan 2008 18:16:36 +0000 (18:16 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 7 Jan 2008 18:16:36 +0000 (18:16 +0000)
Objects/typeobject.c
Parser/tokenizer.c
Parser/tokenizer.h
Python/ast.c

index e790c0486dbf9c30e5e4bcf7433229452e7c77ef..bfd2a4c5d331ba60b22505b879f56e25c6689522 100644 (file)
@@ -3220,8 +3220,10 @@ inherit_special(PyTypeObject *type, PyTypeObject *base)
                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))
index f59ab59ad561b4fc1f0d6fcd4f0b6e9e71211f6c..7fcff201de7b7fb4f579d09f284be9712a713ba8 100644 (file)
@@ -1533,6 +1533,7 @@ PyTokenizer_Get(struct tok_state *tok, char **p_start, char **p_end)
        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 @@ PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int *offset)
 }
 #endif
 
+#endif /* defined(Py_USING_UNICODE) */
                           
 
 #ifdef Py_DEBUG
index 8482cddfc54f84f054edb92bf0c9f8c5fc64cc95..feccd4e2ba0de32c9ab343b888cdbd7ab8d27543 100644 (file)
@@ -58,8 +58,10 @@ extern struct tok_state *PyTokenizer_FromString(const char *);
 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
 }
index b084e01a575e56bf0052e486337b38eae712a49f..ddcd0a0030880a733c66ba4347f04f1b9200720e 100644 (file)
@@ -1246,6 +1246,7 @@ ast_for_atom(struct compiling *c, const node *n)
     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 @@ ast_for_atom(struct compiling *c, const node *n)
                 Py_DECREF(value);
                 Py_XDECREF(tback);
             }
+#endif
             return NULL;
         }
         PyArena_AddPyObject(c->c_arena, str);