annotate Include/floatobject.h @ 17405:afbb65b60fa2 2.0

Inspired by Tim Peters' 1.14->1.15 checkin to asynchat Quoting orignal message: ''' Fix from the Madusa mailing list: http://groups.yahoo.com/group/medusa/message/333 It's clear that Medusa should not be checking for an empty buffer via "buf is ''". The patch merely changes "is" to "==". However, there's a mystery here all the same: Python attempts to store null strings uniquely, so it's unclear why "buf is ''" ever returned false when buf actually was empty. *Some* string operations produce non-unique null strings, e.g. '''
author Moshe Zadka <moshez@math.huji.ac.il>
date Wed, 11 Apr 2001 08:06:02 +0000
parents 6f6f965c5e2d
children fe4c1034b480
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
1
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 /* Float object interface */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 /*
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
5 PyFloatObject represents a (double precision) floating point number.
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
7
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
8 #ifndef Py_FLOATOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
9 #define Py_FLOATOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
10 #ifdef __cplusplus
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
11 extern "C" {
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
12 #endif
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
13
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 typedef struct {
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
15 PyObject_HEAD
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
16 double ob_fval;
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
17 } PyFloatObject;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
18
2436
fa98dda07877 make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents: 2129
diff changeset
19 extern DL_IMPORT(PyTypeObject) PyFloat_Type;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
20
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
21 #define PyFloat_Check(op) ((op)->ob_type == &PyFloat_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
22
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
23 extern DL_IMPORT(PyObject *) PyFloat_FromString(PyObject*, char**);
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
24 extern DL_IMPORT(PyObject *) PyFloat_FromDouble(double);
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
25 extern DL_IMPORT(double) PyFloat_AsDouble(PyObject *);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
26
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 /* Macro, trading safety for speed */
5917
04a1b82c832b Add cast to PyFloat_AS_DOUBLE macro, as suggested by Marc Lemburg.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
28 #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
29
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
30 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
31 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
32 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
33 #endif /* !Py_FLOATOBJECT_H */