]> granicus.if.org Git - python/commitdiff
Issue 7147 - remove ability to attempt to build Python without complex number support...
authorSkip Montanaro <skip@pobox.com>
Sun, 18 Oct 2009 14:25:35 +0000 (14:25 +0000)
committerSkip Montanaro <skip@pobox.com>
Sun, 18 Oct 2009 14:25:35 +0000 (14:25 +0000)
Include/Python.h
Misc/NEWS
Objects/complexobject.c
Objects/object.c
Parser/tokenizer.c
Python/ast.c
Python/bltinmodule.c
Python/getargs.c
Python/marshal.c
Python/modsupport.c

index aa805e7e7af02df917db63e7fcbeef9afa86abdd..d900978141dbcefd260f2d50cd83f90689ee6aba 100644 (file)
@@ -73,9 +73,7 @@
 #include "longintrepr.h"
 #include "boolobject.h"
 #include "floatobject.h"
-#ifndef WITHOUT_COMPLEX
 #include "complexobject.h"
-#endif
 #include "rangeobject.h"
 #include "memoryobject.h"
 #include "tupleobject.h"
index e0dd0cc6dd36b66728035bf53dd94847dcc1a5fc..7ff7783fc156f9d40bf02d97756a29fdffe35c96 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 3.2 Alpha 1?
 Core and Builtins
 -----------------
 
+- Issue *7147: Remove support for compiling Python without complex number
+  support.
+
 - Issue #7120: logging: Removed import of multiprocessing which is causing
   crash in GAE.
 
index 30d8b5216e0a8d2c6349297ba968a548c554cf88..ccee38229c2b19f4d9b78e05a1faa50df7d0af53 100644 (file)
@@ -12,8 +12,6 @@
 #include <ieeefp.h>
 #endif
 
-#ifndef WITHOUT_COMPLEX
-
 /* elementary operations on complex numbers */
 
 static Py_complex c_1 = {1., 0.};
@@ -1108,5 +1106,3 @@ PyTypeObject PyComplex_Type = {
        complex_new,                            /* tp_new */
        PyObject_Del,                           /* tp_free */
 };
-
-#endif
index e8ac8a2e469559fbdc2a2b452bb4337509937734..90cdc74195a875cf66bff5fff364a899c64a4930 100644 (file)
@@ -1536,10 +1536,9 @@ _Py_ReadyTypes(void)
        if (PyType_Ready(&PyStaticMethod_Type) < 0)
                Py_FatalError("Can't initialize static method type");
 
-#ifndef WITHOUT_COMPLEX
        if (PyType_Ready(&PyComplex_Type) < 0)
                Py_FatalError("Can't initialize complex type");
-#endif
+
        if (PyType_Ready(&PyFloat_Type) < 0)
                Py_FatalError("Can't initialize float type");
 
index cc142a7127278d0b57fbed164bbaa74f8b359f5d..daf18dc2be61fe7cec7af8844650216d4a221b14 100644 (file)
@@ -1383,10 +1383,8 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
                        c = tok_nextc(tok);
                        if (c == '.')
                                goto fraction;
-#ifndef WITHOUT_COMPLEX
                        if (c == 'j' || c == 'J')
                                goto imaginary;
-#endif
                        if (c == 'x' || c == 'X') {
 
                                /* Hex */
@@ -1438,10 +1436,8 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
                                        goto fraction;
                                else if (c == 'e' || c == 'E')
                                        goto exponent;
-#ifndef WITHOUT_COMPLEX
                                else if (c == 'j' || c == 'J')
                                        goto imaginary;
-#endif
                                else if (nonzero) {
                                        tok->done = E_TOKEN;
                                        tok_backup(tok, c);
@@ -1478,12 +1474,10 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
                                                c = tok_nextc(tok);
                                        } while (isdigit(c));
                                }
-#ifndef WITHOUT_COMPLEX
                                if (c == 'j' || c == 'J')
                                        /* Imaginary part */
                imaginary:
                                        c = tok_nextc(tok);
-#endif
                        }
                }
                tok_backup(tok, c);
index 8a35a1206ff48ebf49dedd5893547d00e08f0f2d..c3edea35346fa567c095d37e8123ae06cf9f3aab 100644 (file)
@@ -3177,17 +3177,13 @@ parsenumber(struct compiling *c, const char *s)
     const char *end;
     long x;
     double dx;
-#ifndef WITHOUT_COMPLEX
     Py_complex compl;
     int imflag;
-#endif
 
     assert(s != NULL);
     errno = 0;
     end = s + strlen(s) - 1;
-#ifndef WITHOUT_COMPLEX
     imflag = *end == 'j' || *end == 'J';
-#endif
     if (s[0] == '0') {
         x = (long) PyOS_strtoul((char *)s, (char **)&end, 0);
         if (x < 0 && errno == 0) {
@@ -3204,7 +3200,6 @@ parsenumber(struct compiling *c, const char *s)
         return PyLong_FromLong(x);
     }
     /* XXX Huge floats may silently fail */
-#ifndef WITHOUT_COMPLEX
     if (imflag) {
         compl.real = 0.;
         compl.imag = PyOS_string_to_double(s, (char **)&end, NULL);
@@ -3213,7 +3208,6 @@ parsenumber(struct compiling *c, const char *s)
         return PyComplex_FromCComplex(compl);
     }
     else
-#endif
     {
         dx = PyOS_string_to_double(s, NULL, NULL);
         if (dx == -1.0 && PyErr_Occurred())
index 2224d3722fce45c0464dae0c2e17c526e6b1bf08..ab6049cabff35a14cad3c372655f3ce4d13aaf82 100644 (file)
@@ -2302,9 +2302,7 @@ _PyBuiltin_Init(void)
        SETBUILTIN("bytearray",         &PyByteArray_Type);
        SETBUILTIN("bytes",             &PyBytes_Type);
        SETBUILTIN("classmethod",       &PyClassMethod_Type);
-#ifndef WITHOUT_COMPLEX
        SETBUILTIN("complex",           &PyComplex_Type);
-#endif
        SETBUILTIN("dict",              &PyDict_Type);
        SETBUILTIN("enumerate",         &PyEnum_Type);
        SETBUILTIN("filter",            &PyFilter_Type);
index 486cf7d07d3172693e09f6cf43d8bb1d20c86de5..f41cd05eaf44e3948f77756e4c724019965067ad 100644 (file)
@@ -818,7 +818,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
                break;
        }
 
-#ifndef WITHOUT_COMPLEX
        case 'D': {/* complex double */
                Py_complex *p = va_arg(*p_va, Py_complex *);
                Py_complex cval;
@@ -829,7 +828,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
                        *p = cval;
                break;
        }
-#endif /* WITHOUT_COMPLEX */
 
        case 'c': {/* char */
                char *p = va_arg(*p_va, char *);
@@ -1772,9 +1770,7 @@ skipitem(const char **p_format, va_list *p_va, int flags)
 #endif
        case 'f': /* float */
        case 'd': /* double */
-#ifndef WITHOUT_COMPLEX
        case 'D': /* complex double */
-#endif
        case 'c': /* char */
                {
                        (void) va_arg(*p_va, void *);
index 256285b4268c8162de18c8fb8069c1963f667ab1..3391085ccb077b82ed43416447dfc2476ddecdc0 100644 (file)
@@ -254,7 +254,6 @@ w_object(PyObject *v, WFILE *p)
                        PyMem_Free(buf);
                }
        }
-#ifndef WITHOUT_COMPLEX
        else if (PyComplex_CheckExact(v)) {
                if (p->version > 1) {
                        unsigned char buf[8];
@@ -297,7 +296,6 @@ w_object(PyObject *v, WFILE *p)
                        PyMem_Free(buf);
                }
        }
-#endif
        else if (PyBytes_CheckExact(v)) {
                w_byte(TYPE_STRING, p);
                n = PyBytes_GET_SIZE(v);
@@ -714,7 +712,6 @@ r_object(RFILE *p)
                        break;
                }
 
-#ifndef WITHOUT_COMPLEX
        case TYPE_COMPLEX:
                {
                        char buf[256];
@@ -773,7 +770,6 @@ r_object(RFILE *p)
                        retval = PyComplex_FromCComplex(c);
                        break;
                }
-#endif
 
        case TYPE_STRING:
                n = r_long(p);
index 0cbc6f7cfbd8cb55db6cc5d4e88ed41b7db70d15..0f31634a78a5e6b2d1873082137655db52eec8b3 100644 (file)
@@ -279,11 +279,9 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
                        return PyFloat_FromDouble(
                                (double)va_arg(*p_va, va_double));
 
-#ifndef WITHOUT_COMPLEX
                case 'D':
                        return PyComplex_FromCComplex(
                                *((Py_complex *)va_arg(*p_va, Py_complex *)));
-#endif /* WITHOUT_COMPLEX */
 
                case 'c':
                {