Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 387c547

Browse files
committed
Revert parts of patch #453627, documenting the resulting test failures
instead.
1 parent c2d272a commit 387c547

6 files changed

Lines changed: 9 additions & 56 deletions

File tree

Modules/cmathmodule.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@
88
#define M_PI (3.141592653589793239)
99
#endif
1010

11-
#ifdef SCO_ATAN2_BUG
12-
/*
13-
* UnixWare 7+ is known to have a bug in atan2 that will return PI instead
14-
* of ZERO (0) if the first argument is ZERO(0).
15-
*/
16-
static double atan2_sco(double x, double y)
17-
{
18-
if (x == 0.0)
19-
return (double)0.0;
20-
return atan2(x, y);
21-
}
22-
#define ATAN2 atan2_sco
23-
#else
24-
#define ATAN2 atan2
25-
#endif
26-
2711
/* First, the C functions that do the real work */
2812

2913
/* constants */
@@ -175,7 +159,7 @@ c_log(Py_complex x)
175159
{
176160
Py_complex r;
177161
double l = hypot(x.real,x.imag);
178-
r.imag = ATAN2(x.imag, x.real);
162+
r.imag = atan2(x.imag, x.real);
179163
r.real = log(l);
180164
return r;
181165
}
@@ -191,7 +175,7 @@ c_log10(Py_complex x)
191175
{
192176
Py_complex r;
193177
double l = hypot(x.real,x.imag);
194-
r.imag = ATAN2(x.imag, x.real)/log(10.);
178+
r.imag = atan2(x.imag, x.real)/log(10.);
195179
r.real = log10(l);
196180
return r;
197181
}

Modules/mathmodule.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,6 @@ extern double modf (double, double *);
1212
#endif /* __STDC__ */
1313
#endif /* _MSC_VER */
1414

15-
#ifdef SCO_ATAN2_BUG
16-
/*
17-
* UnixWare 7+ is known to have a bug in atan2 that will return PI instead
18-
* of ZERO (0) if the first argument is ZERO(0).
19-
*/
20-
static double atan2_sco(double x, double y)
21-
{
22-
if (x == 0.0)
23-
return (double)0.0;
24-
return atan2(x, y);
25-
}
26-
#define ATAN2 atan2_sco
27-
#else
28-
#define ATAN2 atan2
29-
#endif
30-
3115
/* Call is_error when errno != 0, and where x is the result libm
3216
* returned. is_error will usually set up an exception and return
3317
* true (1), but may return false (0) without setting up an exception.
@@ -115,7 +99,7 @@ FUNC1(asin, asin,
11599
"asin(x)\n\nReturn the arc sine (measured in radians) of x.")
116100
FUNC1(atan, atan,
117101
"atan(x)\n\nReturn the arc tangent (measured in radians) of x.")
118-
FUNC2(atan2, ATAN2,
102+
FUNC2(atan2, atan2,
119103
"atan2(y, x)\n\nReturn the arc tangent (measured in radians) of y/x.\n"
120104
"Unlike atan(y/x), the signs of both x and y are considered.")
121105
FUNC1(ceil, ceil,

Objects/complexobject.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,6 @@
2626
#define PREC_REPR 17
2727
#define PREC_STR 12
2828

29-
#ifdef SCO_ATAN2_BUG
30-
/*
31-
* UnixWare 7+ is known to have a bug in atan2 that will return PI instead
32-
* of ZERO (0) if the first argument is ZERO(0).
33-
*/
34-
static double atan2_sco(double x, double y)
35-
{
36-
if (x == 0.0)
37-
return (double)0.0;
38-
return atan2(x, y);
39-
}
40-
#define ATAN2 atan2_sco
41-
#else
42-
#define ATAN2 atan2
43-
#endif
44-
4529
/* elementary operations on complex numbers */
4630

4731
static Py_complex c_1 = {1., 0.};
@@ -154,7 +138,7 @@ c_pow(Py_complex a, Py_complex b)
154138
else {
155139
vabs = hypot(a.real,a.imag);
156140
len = pow(vabs,b.real);
157-
at = ATAN2(a.imag, a.real);
141+
at = atan2(a.imag, a.real);
158142
phase = at*b.real;
159143
if (b.imag != 0.0) {
160144
len /= exp(at*b.imag);

README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ SCO: The following apply to SCO 3 only; Python builds out of the box
296296

297297
LIBS=' -lsocket -lcrypt_i'
298298

299+
UnixWare: There are known bugs in the math library of the system, as well as
300+
problems in the handling of threads (calling fork in one
301+
thread may interrupt system calls in others). Therefore, test_math and
302+
tests involving threads will fail until those problems are fixed.
303+
299304
SunOS 4.x: When using the SunPro C compiler, you may want to use the
300305
'-Xa' option instead of '-Xc', to enable some needed non-ANSI
301306
Sunisms.

acconfig.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,6 @@
245245

246246
/* Define the macros needed if on a UnixWare 7.x system. */
247247
#if defined(__USLC__) && defined(__SCO_VERSION__)
248-
#define SCO_ACCEPT_BUG /* Use workaround for UnixWare accept() bug */
249-
#define SCO_ATAN2_BUG /* Use workaround for UnixWare atan2() bug */
250248
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
251249
#endif
252250

pyconfig.h.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,6 @@
725725

726726
/* Define the macros needed if on a UnixWare 7.x system. */
727727
#if defined(__USLC__) && defined(__SCO_VERSION__)
728-
#define SCO_ACCEPT_BUG /* Use workaround for UnixWare accept() bug */
729-
#define SCO_ATAN2_BUG /* Use workaround for UnixWare atan2() bug */
730728
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
731729
#endif
732730

0 commit comments

Comments
 (0)