##// END OF EJS Templates
cext: use sys.executable instead of deprecated Py_GetProgramFullPath...
Mads Kiilerich -
r53002:5ac506ee stable
parent child Browse files
Show More
@@ -1232,6 +1232,15 static int check_python_version(void)
1232 * should only occur in unusual circumstances (e.g. if sys.hexversion
1232 * should only occur in unusual circumstances (e.g. if sys.hexversion
1233 * is manually set to an invalid value). */
1233 * is manually set to an invalid value). */
1234 if ((hexversion == -1) || (hexversion >> 16 != PY_VERSION_HEX >> 16)) {
1234 if ((hexversion == -1) || (hexversion >> 16 != PY_VERSION_HEX >> 16)) {
1235 PyObject *sys = PyImport_ImportModule("sys"), *executable;
1236 if (!sys) {
1237 return -1;
1238 }
1239 executable = PyObject_GetAttrString(sys, "executable");
1240 Py_DECREF(sys);
1241 if (!executable) {
1242 return -1;
1243 }
1235 PyErr_Format(PyExc_ImportError,
1244 PyErr_Format(PyExc_ImportError,
1236 "%s: The Mercurial extension "
1245 "%s: The Mercurial extension "
1237 "modules were compiled with Python " PY_VERSION
1246 "modules were compiled with Python " PY_VERSION
@@ -1240,7 +1249,8 static int check_python_version(void)
1240 "sys.hexversion=%ld: "
1249 "sys.hexversion=%ld: "
1241 "Python %s\n at: %s",
1250 "Python %s\n at: %s",
1242 versionerrortext, hexversion, Py_GetVersion(),
1251 versionerrortext, hexversion, Py_GetVersion(),
1243 Py_GetProgramFullPath());
1252 PyUnicode_AsUTF8(executable));
1253 Py_DECREF(executable);
1244 return -1;
1254 return -1;
1245 }
1255 }
1246 return 0;
1256 return 0;
General Comments 0
You need to be logged in to leave comments. Login now