summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-14 21:41:06 (GMT)
committerGitHub <noreply@github.com>2021-10-14 21:41:06 (GMT)
commit0a883a76cda8205023c52211968bcf87bd47fd6e (patch)
tree3a540308c72262afb3a750f47df6713410a99d90 /Include/cpython
parent79cf20e48d0b5d69d9fac2a0204b5ac2c366066a (diff)
downloadcpython-0a883a76cda8205023c52211968bcf87bd47fd6e.zip
cpython-0a883a76cda8205023c52211968bcf87bd47fd6e.tar.gz
cpython-0a883a76cda8205023c52211968bcf87bd47fd6e.tar.bz2
bpo-35134: Add Include/cpython/floatobject.h (GH-28957)
Split Include/floatobject.h into sub-files: add Include/cpython/floatobject.h and Include/internal/pycore_floatobject.h.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/floatobject.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/cpython/floatobject.h b/Include/cpython/floatobject.h
new file mode 100644
index 0000000..fffd468
--- /dev/null
+++ b/Include/cpython/floatobject.h
@@ -0,0 +1,12 @@
+#ifndef Py_CPYTHON_FLOATOBJECT_H
+# error "this header file must not be included directly"
+#endif
+
+typedef struct {
+ PyObject_HEAD
+ double ob_fval;
+} PyFloatObject;
+
+// Macro version of PyFloat_AsDouble() trading safety for speed.
+// It doesn't check if op is a double object.
+#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)