Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
4a598d1c
Commit
4a598d1c
authored
Feb 23, 2011
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
even better __Pyx_check_binary_version()
parent
90120314
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+7
-10
No files found.
Cython/Compiler/ModuleNode.py
View file @
4a598d1c
...
@@ -2858,18 +2858,15 @@ check_binary_version_utility_code = UtilityCode(proto="""
...
@@ -2858,18 +2858,15 @@ check_binary_version_utility_code = UtilityCode(proto="""
static int __Pyx_check_binary_version(void);
static int __Pyx_check_binary_version(void);
"""
,
impl
=
"""
"""
,
impl
=
"""
static int __Pyx_check_binary_version(void) {
static int __Pyx_check_binary_version(void) {
long version_hex, major_version, minor_version;
char ctversion[4], rtversion[4];
PyObject *sys_hexversion = PySys_GetObject((char*)"hexversion");
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
if (sys_hexversion == NULL) return -1;
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
version_hex = PyInt_AsLong(sys_hexversion);
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
if (version_hex == -1 && PyErr_Occurred()) return -1;
major_version = ((unsigned long)version_hex >> 24);
minor_version = ((unsigned long)version_hex >> 16) & 0x00FF;
if (!(major_version == PY_MAJOR_VERSION && minor_version == PY_MINOR_VERSION)) {
char message[200];
char message[200];
PyOS_snprintf(message, sizeof(message),
PyOS_snprintf(message, sizeof(message),
"compiletime version (%d, %d) of module '%.100s' does not match runtime version (%d, %d).",
"compiletime version %s of module '%.100s' "
PY_MAJOR_VERSION, PY_MINOR_VERSION, __Pyx_MODULE_NAME, (int)major_version, (int)minor_version);
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
#if PY_VERSION_HEX < 0x02050000
#if PY_VERSION_HEX < 0x02050000
return PyErr_Warn(NULL, message);
return PyErr_Warn(NULL, message);
#else
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment