mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Issue 7147 - remove ability to attempt to build Python without complex number support (was broken anyway)
This commit is contained in:
parent
6ead552b47
commit
ba1e0f46ab
10 changed files with 4 additions and 32 deletions
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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':
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue