mercurial/parsers.c
branchstable
changeset 23943 5fb44983a696
parent 23942 fefa5f2a1730
child 23944 ec28f8b66e62
equal deleted inserted replaced
23942:fefa5f2a1730 23943:5fb44983a696
  2265 		PyObject_GC_UnTrack(nullentry);
  2265 		PyObject_GC_UnTrack(nullentry);
  2266 }
  2266 }
  2267 
  2267 
  2268 static int check_python_version(void)
  2268 static int check_python_version(void)
  2269 {
  2269 {
  2270 	PyObject *sys = PyImport_ImportModule("sys");
  2270 	PyObject *sys = PyImport_ImportModule("sys"), *ver;
  2271 	long hexversion = PyInt_AsLong(PyObject_GetAttrString(sys, "hexversion"));
  2271 	long hexversion;
       
  2272 	if (!sys)
       
  2273 		return -1;
       
  2274 	ver = PyObject_GetAttrString(sys, "hexversion");
       
  2275 	Py_DECREF(sys);
       
  2276 	if (!ver)
       
  2277 		return -1;
       
  2278 	hexversion = PyInt_AsLong(ver);
       
  2279 	Py_DECREF(ver);
  2272 	/* sys.hexversion is a 32-bit number by default, so the -1 case
  2280 	/* sys.hexversion is a 32-bit number by default, so the -1 case
  2273 	 * should only occur in unusual circumstances (e.g. if sys.hexversion
  2281 	 * should only occur in unusual circumstances (e.g. if sys.hexversion
  2274 	 * is manually set to an invalid value). */
  2282 	 * is manually set to an invalid value). */
  2275 	if ((hexversion == -1) || (hexversion >> 16 != PY_VERSION_HEX >> 16)) {
  2283 	if ((hexversion == -1) || (hexversion >> 16 != PY_VERSION_HEX >> 16)) {
  2276 		PyErr_Format(PyExc_ImportError, "%s: The Mercurial extension "
  2284 		PyErr_Format(PyExc_ImportError, "%s: The Mercurial extension "