Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ExtensionClass 4.2 with a Py3-compatible C extension.
- Loading branch information
Showing
4 changed files
with
103 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/***************************************************************************** | ||
Copyright (c) 2012 Zope Foundation and Contributors. | ||
All Rights Reserved. | ||
This software is subject to the provisions of the Zope Public License, | ||
Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
FOR A PARTICULAR PURPOSE | ||
****************************************************************************/ | ||
|
||
#ifndef PERSISTENT__COMPAT_H | ||
#define PERSISTENT__COMPAT_H | ||
|
||
#include "Python.h" | ||
|
||
#if PY_MAJOR_VERSION >= 3 | ||
#define PY3K | ||
#endif | ||
|
||
#ifdef PY3K | ||
#define INTERN PyUnicode_InternFromString | ||
#define INTERN_INPLACE PyUnicode_InternInPlace | ||
#define NATIVE_CHECK PyUnicode_Check | ||
#define NATIVE_CHECK_EXACT PyUnicode_CheckExact | ||
#define NATIVE_FROM_STRING PyUnicode_FromString | ||
#define NATIVE_FROM_STRING_AND_SIZE PyUnicode_FromStringAndSize | ||
|
||
#define INT_FROM_LONG(x) PyLong_FromLong(x) | ||
#define INT_CHECK(x) PyLong_Check(x) | ||
#define INT_AS_LONG(x) PyLong_AS_LONG(x) | ||
|
||
#else | ||
#define INTERN PyString_InternFromString | ||
#define INTERN_INPLACE PyString_InternInPlace | ||
#define NATIVE_CHECK PyString_Check | ||
#define NATIVE_CHECK_EXACT PyString_CheckExact | ||
#define NATIVE_FROM_STRING PyString_FromString | ||
#define NATIVE_FROM_STRING_AND_SIZE PyString_FromStringAndSize | ||
|
||
#define INT_FROM_LONG(x) PyInt_FromLong(x) | ||
#define INT_CHECK(x) PyInt_Check(x) | ||
#define INT_AS_LONG(x) PyInt_AS_LONG(x) | ||
#endif | ||
|
||
#endif |