diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-05 22:31:58 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-05 22:31:58 (GMT) |
commit | b173f7853e4e3a4215a661d98174291e379cf6fb (patch) | |
tree | 02735987f20fc27277a82c14c5da5e043cc134aa /Include/datetime.h | |
parent | c679fd8efcae2b5d1117fc09380d74f0000086b0 (diff) | |
download | cpython-b173f7853e4e3a4215a661d98174291e379cf6fb.zip cpython-b173f7853e4e3a4215a661d98174291e379cf6fb.tar.gz cpython-b173f7853e4e3a4215a661d98174291e379cf6fb.tar.bz2 |
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.h | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/Include/datetime.h b/Include/datetime.h index 0d310b4..4b506b2 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) |