Mercurial > cpython-lru_cache-weakref
annotate Include/complexobject.h @ 73323:dad02a080bbc
Improve byte-compilation in packaging to be independent of -O or -B.
The code I fixed to comply with PEP 3147 still had one bug: When run
under python -O, some paths for pyc files would be pyo, because I called
imp.cache_from_source without explicit debug_override argument in some
places, and under -O that would return .pyo (this is well explained in
the imp docs). Now all code (util.byte_compile, build_py, install_lib)
can create .pyo files according to options given by users,
without interference from the calling Python’s own optimize mode.
On a related topic, I also removed the code that prevented byte
compilation under python -B. The rationale is that packaging gives
control over the creation of pyc files to the user with its own explicit
option, and the behavior should not be changed if the calling Python
happens to run with -B for whatever reason. I will argue that this is a
bug fix and ask to be allowed to backport this change to distutils.
Finally, I moved one nugget of information about the --compile and
--optimize options from the source into the doc. It clears up a
misunderstanding that I (and maybe other people) had.
| author | Éric Araujo <merwok@netwok.org> |
|---|---|
| date | Thu, 03 Nov 2011 05:08:28 +0100 |
| parents | 8beaa9a37387 |
| children | 22b56b0b8619 |
| rev | line source |
|---|---|
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
9586
diff
changeset
|
1 /* Complex number structure */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
9586
diff
changeset
|
2 |
|
25554
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24752
diff
changeset
|
3 #ifndef Py_COMPLEXOBJECT_H |
|
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24752
diff
changeset
|
4 #define Py_COMPLEXOBJECT_H |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 #ifdef __cplusplus |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 extern "C" { |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 #endif |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
9 #ifndef Py_LIMITED_API |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
9586
diff
changeset
|
11 double real; |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
9586
diff
changeset
|
12 double imag; |
|
3765
db5488fe495b
renamed complex -> Py_complex
Guido van Rossum <guido@python.org>
parents:
3613
diff
changeset
|
13 } Py_complex; |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 /* Operations on complex numbers from complexmodule.c */ |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 |
|
3613
2f314ca0cd33
rename exported symbols with _Py_ prefix
Guido van Rossum <guido@python.org>
parents:
3321
diff
changeset
|
17 #define c_sum _Py_c_sum |
|
2f314ca0cd33
rename exported symbols with _Py_ prefix
Guido van Rossum <guido@python.org>
parents:
3321
diff
changeset
|
18 #define c_diff _Py_c_diff |
|
2f314ca0cd33
rename exported symbols with _Py_ prefix
Guido van Rossum <guido@python.org>
parents:
3321
diff
changeset
|
19 #define c_neg _Py_c_neg |
|
2f314ca0cd33
rename exported symbols with _Py_ prefix
Guido van Rossum <guido@python.org>
parents:
3321
diff
changeset
|
20 #define c_prod _Py_c_prod |
|
2f314ca0cd33
rename exported symbols with _Py_ prefix
Guido van Rossum <guido@python.org>
parents:
3321
diff
changeset
|
21 #define c_quot _Py_c_quot |
|
2f314ca0cd33
rename exported symbols with _Py_ prefix
Guido van Rossum <guido@python.org>
parents:
3321
diff
changeset
|
22 #define c_pow _Py_c_pow |
|
46477
b69f443ef480
Merged revisions 62380,62382-62383 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
23 #define c_abs _Py_c_abs |
|
3613
2f314ca0cd33
rename exported symbols with _Py_ prefix
Guido van Rossum <guido@python.org>
parents:
3321
diff
changeset
|
24 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
25 PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
26 PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
27 PyAPI_FUNC(Py_complex) c_neg(Py_complex); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
28 PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
29 PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
30 PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); |
|
46477
b69f443ef480
Merged revisions 62380,62382-62383 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
31 PyAPI_FUNC(double) c_abs(Py_complex); |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
32 #endif |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 /* Complex object interface */ |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 /* |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 PyComplexObject represents a complex number with double-precision |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 real and imaginary parts. |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 */ |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
40 #ifndef Py_LIMITED_API |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
9586
diff
changeset
|
42 PyObject_HEAD |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
9586
diff
changeset
|
43 Py_complex cval; |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
44 } PyComplexObject; |
|
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
45 #endif |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
47 PyAPI_DATA(PyTypeObject) PyComplex_Type; |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 |
|
19550
19d271f297dc
Make the PyXXX_Check() macros for the numeric types inheritance-aware.
Guido van Rossum <guido@python.org>
parents:
13444
diff
changeset
|
49 #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
42334
diff
changeset
|
50 #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
52 #ifndef Py_LIMITED_API |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
53 PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
54 #endif |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
55 PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
57 PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
58 PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
59 #ifndef Py_LIMITED_API |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19889
diff
changeset
|
60 PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
61 #endif |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 |
|
53632
2cde0d003ffc
Issue #1588: Add complex.__format__.
Eric Smith <eric@trueblade.com>
parents:
46477
diff
changeset
|
63 /* Format the object based on the format_spec, as defined in PEP 3101 |
|
2cde0d003ffc
Issue #1588: Add complex.__format__.
Eric Smith <eric@trueblade.com>
parents:
46477
diff
changeset
|
64 (Advanced String Formatting). */ |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
65 #ifndef Py_LIMITED_API |
|
53632
2cde0d003ffc
Issue #1588: Add complex.__format__.
Eric Smith <eric@trueblade.com>
parents:
46477
diff
changeset
|
66 PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj, |
| 72475 | 67 PyObject *format_spec, |
| 68 Py_ssize_t start, | |
| 69 Py_ssize_t end); | |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
53632
diff
changeset
|
70 #endif |
|
53632
2cde0d003ffc
Issue #1588: Add complex.__format__.
Eric Smith <eric@trueblade.com>
parents:
46477
diff
changeset
|
71 |
|
3316
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 #ifdef __cplusplus |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 } |
|
e5d1f242daf9
complex numbers a la Konrad Hinsen
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 #endif |
|
25554
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24752
diff
changeset
|
75 #endif /* !Py_COMPLEXOBJECT_H */ |
