Author: Armin Rigo <[email protected]>
Branch:
Changeset: r1063:90ea9158b0cd
Date: 2012-11-24 19:14 +0100
http://bitbucket.org/cffi/cffi/changeset/90ea9158b0cd/
Log: Python 3.2 compatibility.
diff --git a/c/file_emulator.h b/c/file_emulator.h
--- a/c/file_emulator.h
+++ b/c/file_emulator.h
@@ -32,16 +32,13 @@
FILE *f = NULL;
int fd;
char *mode;
- _Py_IDENTIFIER(flush);
- _Py_IDENTIFIER(mode);
- _Py_IDENTIFIER(__cffi_FILE);
- ob = _PyObject_CallMethodId(ob_file, &PyId_flush, NULL);
+ ob = PyObject_CallMethod(ob_file, "flush", NULL);
if (ob == NULL)
goto fail;
Py_DECREF(ob);
- ob_capsule = _PyObject_GetAttrId(ob_file, &PyId___cffi_FILE);
+ ob_capsule = PyObject_GetAttrString(ob_file, "__cffi_FILE");
if (ob_capsule == NULL) {
PyErr_Clear();
@@ -49,7 +46,7 @@
if (fd < 0)
goto fail;
- ob_mode = _PyObject_GetAttrId(ob_file, &PyId_mode);
+ ob_mode = PyObject_GetAttrString(ob_file, "mode");
if (ob_mode == NULL)
goto fail;
mode = PyText_AsUTF8(ob_mode);
@@ -78,7 +75,7 @@
goto fail;
}
- if (_PyObject_SetAttrId(ob_file, &PyId___cffi_FILE, ob_capsule) < 0)
+ if (PyObject_SetAttrString(ob_file, "__cffi_FILE", ob_capsule) < 0)
goto fail;
}
return PyCapsule_GetPointer(ob_capsule, "FILE");
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit