Issue 7147 - remove ability to attempt to build Python without complex number support (was broken anyway)

This commit is contained in:
Skip Montanaro 2009-10-18 14:25:35 +00:00
parent 6ead552b47
commit ba1e0f46ab
10 changed files with 4 additions and 32 deletions

View File

@ -73,9 +73,7 @@
#include "longintrepr.h" #include "longintrepr.h"
#include "boolobject.h" #include "boolobject.h"
#include "floatobject.h" #include "floatobject.h"
#ifndef WITHOUT_COMPLEX
#include "complexobject.h" #include "complexobject.h"
#endif
#include "rangeobject.h" #include "rangeobject.h"
#include "memoryobject.h" #include "memoryobject.h"
#include "tupleobject.h" #include "tupleobject.h"

View File

@ -12,6 +12,9 @@ What's New in Python 3.2 Alpha 1?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue *7147: Remove support for compiling Python without complex number
support.
- Issue #7120: logging: Removed import of multiprocessing which is causing - Issue #7120: logging: Removed import of multiprocessing which is causing
crash in GAE. crash in GAE.

View File

@ -12,8 +12,6 @@
#include <ieeefp.h> #include <ieeefp.h>
#endif #endif
#ifndef WITHOUT_COMPLEX
/* elementary operations on complex numbers */ /* elementary operations on complex numbers */
static Py_complex c_1 = {1., 0.}; static Py_complex c_1 = {1., 0.};
@ -1108,5 +1106,3 @@ PyTypeObject PyComplex_Type = {
complex_new, /* tp_new */ complex_new, /* tp_new */
PyObject_Del, /* tp_free */ PyObject_Del, /* tp_free */
}; };
#endif

View File

@ -1536,10 +1536,9 @@ _Py_ReadyTypes(void)
if (PyType_Ready(&PyStaticMethod_Type) < 0) if (PyType_Ready(&PyStaticMethod_Type) < 0)
Py_FatalError("Can't initialize static method type"); Py_FatalError("Can't initialize static method type");
#ifndef WITHOUT_COMPLEX
if (PyType_Ready(&PyComplex_Type) < 0) if (PyType_Ready(&PyComplex_Type) < 0)
Py_FatalError("Can't initialize complex type"); Py_FatalError("Can't initialize complex type");
#endif
if (PyType_Ready(&PyFloat_Type) < 0) if (PyType_Ready(&PyFloat_Type) < 0)
Py_FatalError("Can't initialize float type"); Py_FatalError("Can't initialize float type");

View File

@ -1383,10 +1383,8 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
c = tok_nextc(tok); c = tok_nextc(tok);
if (c == '.') if (c == '.')
goto fraction; goto fraction;
#ifndef WITHOUT_COMPLEX
if (c == 'j' || c == 'J') if (c == 'j' || c == 'J')
goto imaginary; goto imaginary;
#endif
if (c == 'x' || c == 'X') { if (c == 'x' || c == 'X') {
/* Hex */ /* Hex */
@ -1438,10 +1436,8 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
goto fraction; goto fraction;
else if (c == 'e' || c == 'E') else if (c == 'e' || c == 'E')
goto exponent; goto exponent;
#ifndef WITHOUT_COMPLEX
else if (c == 'j' || c == 'J') else if (c == 'j' || c == 'J')
goto imaginary; goto imaginary;
#endif
else if (nonzero) { else if (nonzero) {
tok->done = E_TOKEN; tok->done = E_TOKEN;
tok_backup(tok, c); 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); c = tok_nextc(tok);
} while (isdigit(c)); } while (isdigit(c));
} }
#ifndef WITHOUT_COMPLEX
if (c == 'j' || c == 'J') if (c == 'j' || c == 'J')
/* Imaginary part */ /* Imaginary part */
imaginary: imaginary:
c = tok_nextc(tok); c = tok_nextc(tok);
#endif
} }
} }
tok_backup(tok, c); tok_backup(tok, c);

View File

@ -3177,17 +3177,13 @@ parsenumber(struct compiling *c, const char *s)
const char *end; const char *end;
long x; long x;
double dx; double dx;
#ifndef WITHOUT_COMPLEX
Py_complex compl; Py_complex compl;
int imflag; int imflag;
#endif
assert(s != NULL); assert(s != NULL);
errno = 0; errno = 0;
end = s + strlen(s) - 1; end = s + strlen(s) - 1;
#ifndef WITHOUT_COMPLEX
imflag = *end == 'j' || *end == 'J'; imflag = *end == 'j' || *end == 'J';
#endif
if (s[0] == '0') { if (s[0] == '0') {
x = (long) PyOS_strtoul((char *)s, (char **)&end, 0); x = (long) PyOS_strtoul((char *)s, (char **)&end, 0);
if (x < 0 && errno == 0) { if (x < 0 && errno == 0) {
@ -3204,7 +3200,6 @@ parsenumber(struct compiling *c, const char *s)
return PyLong_FromLong(x); return PyLong_FromLong(x);
} }
/* XXX Huge floats may silently fail */ /* XXX Huge floats may silently fail */
#ifndef WITHOUT_COMPLEX
if (imflag) { if (imflag) {
compl.real = 0.; compl.real = 0.;
compl.imag = PyOS_string_to_double(s, (char **)&end, NULL); 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); return PyComplex_FromCComplex(compl);
} }
else else
#endif
{ {
dx = PyOS_string_to_double(s, NULL, NULL); dx = PyOS_string_to_double(s, NULL, NULL);
if (dx == -1.0 && PyErr_Occurred()) if (dx == -1.0 && PyErr_Occurred())

View File

@ -2302,9 +2302,7 @@ _PyBuiltin_Init(void)
SETBUILTIN("bytearray", &PyByteArray_Type); SETBUILTIN("bytearray", &PyByteArray_Type);
SETBUILTIN("bytes", &PyBytes_Type); SETBUILTIN("bytes", &PyBytes_Type);
SETBUILTIN("classmethod", &PyClassMethod_Type); SETBUILTIN("classmethod", &PyClassMethod_Type);
#ifndef WITHOUT_COMPLEX
SETBUILTIN("complex", &PyComplex_Type); SETBUILTIN("complex", &PyComplex_Type);
#endif
SETBUILTIN("dict", &PyDict_Type); SETBUILTIN("dict", &PyDict_Type);
SETBUILTIN("enumerate", &PyEnum_Type); SETBUILTIN("enumerate", &PyEnum_Type);
SETBUILTIN("filter", &PyFilter_Type); SETBUILTIN("filter", &PyFilter_Type);

View File

@ -818,7 +818,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
break; break;
} }
#ifndef WITHOUT_COMPLEX
case 'D': {/* complex double */ case 'D': {/* complex double */
Py_complex *p = va_arg(*p_va, Py_complex *); Py_complex *p = va_arg(*p_va, Py_complex *);
Py_complex cval; Py_complex cval;
@ -829,7 +828,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
*p = cval; *p = cval;
break; break;
} }
#endif /* WITHOUT_COMPLEX */
case 'c': {/* char */ case 'c': {/* char */
char *p = va_arg(*p_va, char *); char *p = va_arg(*p_va, char *);
@ -1772,9 +1770,7 @@ skipitem(const char **p_format, va_list *p_va, int flags)
#endif #endif
case 'f': /* float */ case 'f': /* float */
case 'd': /* double */ case 'd': /* double */
#ifndef WITHOUT_COMPLEX
case 'D': /* complex double */ case 'D': /* complex double */
#endif
case 'c': /* char */ case 'c': /* char */
{ {
(void) va_arg(*p_va, void *); (void) va_arg(*p_va, void *);

View File

@ -254,7 +254,6 @@ w_object(PyObject *v, WFILE *p)
PyMem_Free(buf); PyMem_Free(buf);
} }
} }
#ifndef WITHOUT_COMPLEX
else if (PyComplex_CheckExact(v)) { else if (PyComplex_CheckExact(v)) {
if (p->version > 1) { if (p->version > 1) {
unsigned char buf[8]; unsigned char buf[8];
@ -297,7 +296,6 @@ w_object(PyObject *v, WFILE *p)
PyMem_Free(buf); PyMem_Free(buf);
} }
} }
#endif
else if (PyBytes_CheckExact(v)) { else if (PyBytes_CheckExact(v)) {
w_byte(TYPE_STRING, p); w_byte(TYPE_STRING, p);
n = PyBytes_GET_SIZE(v); n = PyBytes_GET_SIZE(v);
@ -714,7 +712,6 @@ r_object(RFILE *p)
break; break;
} }
#ifndef WITHOUT_COMPLEX
case TYPE_COMPLEX: case TYPE_COMPLEX:
{ {
char buf[256]; char buf[256];
@ -773,7 +770,6 @@ r_object(RFILE *p)
retval = PyComplex_FromCComplex(c); retval = PyComplex_FromCComplex(c);
break; break;
} }
#endif
case TYPE_STRING: case TYPE_STRING:
n = r_long(p); n = r_long(p);

View File

@ -279,11 +279,9 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
return PyFloat_FromDouble( return PyFloat_FromDouble(
(double)va_arg(*p_va, va_double)); (double)va_arg(*p_va, va_double));
#ifndef WITHOUT_COMPLEX
case 'D': case 'D':
return PyComplex_FromCComplex( return PyComplex_FromCComplex(
*((Py_complex *)va_arg(*p_va, Py_complex *))); *((Py_complex *)va_arg(*p_va, Py_complex *)));
#endif /* WITHOUT_COMPLEX */
case 'c': case 'c':
{ {