summaryrefslogtreecommitdiff
path: root/Include/datetime.h
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-05 22:31:58 +0000
committerBenjamin Peterson <benjamin@python.org>2009-05-05 22:31:58 +0000
commitb173f7853e4e3a4215a661d98174291e379cf6fb (patch)
tree02735987f20fc27277a82c14c5da5e043cc134aa /Include/datetime.h
parentc679fd8efcae2b5d1117fc09380d74f0000086b0 (diff)
downloadcpython-git-b173f7853e4e3a4215a661d98174291e379cf6fb.tar.gz
add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this. Patch by Larry Hastings
Diffstat (limited to 'Include/datetime.h')
-rw-r--r--Include/datetime.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/Include/datetime.h b/Include/datetime.h
index 0d310b47a1..4b506b2e72 100644
--- a/Include/datetime.h
+++ b/Include/datetime.h
@@ -158,9 +158,8 @@ typedef struct {
} PyDateTime_CAPI;
+#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
-/* "magic" constant used to partially protect against developer mistakes. */
-#define DATETIME_API_MAGIC 0x414548d5
#ifdef Py_BUILD_CORE
@@ -186,15 +185,7 @@ typedef struct {
static PyDateTime_CAPI *PyDateTimeAPI;
#define PyDateTime_IMPORT \
- PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \
- "datetime_CAPI")
-
-/* This macro would be used if PyCObject_ImportEx() was created.
-#define PyDateTime_IMPORT \
- PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_ImportEx("datetime", \
- "datetime_CAPI", \
- DATETIME_API_MAGIC)
-*/
+ PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
/* Macros for type checking when not building the Python core. */
#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)