comparison Python/errors.c @ 72848:81380082d216

Use identifier API for PyObject_GetAttrString.
author Martin v. Löwis <martin@v.loewis.de>
date Mon, 10 Oct 2011 18:11:30 +0200
parents 8beaa9a37387
children 41a1de81ef2b
comparison
equal deleted inserted replaced
72847:f924e0f62bcb 72848:81380082d216
705 /* Call when an exception has occurred but there is no way for Python 705 /* Call when an exception has occurred but there is no way for Python
706 to handle it. Examples: exception in __del__ or during GC. */ 706 to handle it. Examples: exception in __del__ or during GC. */
707 void 707 void
708 PyErr_WriteUnraisable(PyObject *obj) 708 PyErr_WriteUnraisable(PyObject *obj)
709 { 709 {
710 _Py_identifier(__module__);
710 PyObject *f, *t, *v, *tb; 711 PyObject *f, *t, *v, *tb;
711 PyErr_Fetch(&t, &v, &tb); 712 PyErr_Fetch(&t, &v, &tb);
712 f = PySys_GetObject("stderr"); 713 f = PySys_GetObject("stderr");
713 if (f != NULL && f != Py_None) { 714 if (f != NULL && f != Py_None) {
714 PyFile_WriteString("Exception ", f); 715 PyFile_WriteString("Exception ", f);
721 char *dot = strrchr(className, '.'); 722 char *dot = strrchr(className, '.');
722 if (dot != NULL) 723 if (dot != NULL)
723 className = dot+1; 724 className = dot+1;
724 } 725 }
725 726
726 moduleName = PyObject_GetAttrString(t, "__module__"); 727 moduleName = _PyObject_GetAttrId(t, &PyId___module__);
727 if (moduleName == NULL) 728 if (moduleName == NULL)
728 PyFile_WriteString("<unknown>", f); 729 PyFile_WriteString("<unknown>", f);
729 else { 730 else {
730 char* modstr = _PyUnicode_AsString(moduleName); 731 char* modstr = _PyUnicode_AsString(moduleName);
731 if (modstr && 732 if (modstr &&