{
PyTypeObject *tp = v->ob_type;
+ if (!PyString_Check(name)) {
#ifdef Py_USING_UNICODE
- /* The Unicode to string conversion is done here because the
- existing tp_getattro slots expect a string object as name
- and we wouldn't want to break those. */
- if (PyUnicode_Check(name)) {
- name = _PyUnicode_AsDefaultEncodedString(name, NULL);
- if (name == NULL)
- return NULL;
- }
- else
+ /* The Unicode to string conversion is done here because the
+ existing tp_getattro slots expect a string object as name
+ and we wouldn't want to break those. */
+ if (PyUnicode_Check(name)) {
+ name = _PyUnicode_AsDefaultEncodedString(name, NULL);
+ if (name == NULL)
+ return NULL;
+ }
+ else
#endif
- if (!PyString_Check(name)) {
- PyErr_SetString(PyExc_TypeError,
- "attribute name must be string");
- return NULL;
+ {
+ PyErr_SetString(PyExc_TypeError,
+ "attribute name must be string");
+ return NULL;
+ }
}
if (tp->tp_getattro != NULL)
return (*tp->tp_getattro)(v, name);
PyTypeObject *tp = v->ob_type;
int err;
+ if (!PyString_Check(name)){
#ifdef Py_USING_UNICODE
- /* The Unicode to string conversion is done here because the
- existing tp_setattro slots expect a string object as name
- and we wouldn't want to break those. */
- if (PyUnicode_Check(name)) {
- name = PyUnicode_AsEncodedString(name, NULL, NULL);
- if (name == NULL)
- return -1;
- }
- else
+ /* The Unicode to string conversion is done here because the
+ existing tp_setattro slots expect a string object as name
+ and we wouldn't want to break those. */
+ if (PyUnicode_Check(name)) {
+ name = PyUnicode_AsEncodedString(name, NULL, NULL);
+ if (name == NULL)
+ return -1;
+ }
+ else
#endif
- if (!PyString_Check(name)){
- PyErr_SetString(PyExc_TypeError,
- "attribute name must be string");
- return -1;
+ {
+ PyErr_SetString(PyExc_TypeError,
+ "attribute name must be string");
+ return -1;
+ }
}
else
Py_INCREF(name);
descrgetfunc f;
PyObject **dictptr;
+ if (!PyString_Check(name)){
#ifdef Py_USING_UNICODE
- /* The Unicode to string conversion is done here because the
- existing tp_setattro slots expect a string object as name
- and we wouldn't want to break those. */
- if (PyUnicode_Check(name)) {
- name = PyUnicode_AsEncodedString(name, NULL, NULL);
- if (name == NULL)
- return NULL;
- }
- else
+ /* The Unicode to string conversion is done here because the
+ existing tp_setattro slots expect a string object as name
+ and we wouldn't want to break those. */
+ if (PyUnicode_Check(name)) {
+ name = PyUnicode_AsEncodedString(name, NULL, NULL);
+ if (name == NULL)
+ return NULL;
+ }
+ else
#endif
- if (!PyString_Check(name)){
- PyErr_SetString(PyExc_TypeError,
- "attribute name must be string");
- return NULL;
+ {
+ PyErr_SetString(PyExc_TypeError,
+ "attribute name must be string");
+ return NULL;
+ }
}
else
Py_INCREF(name);
PyObject **dictptr;
int res = -1;
+ if (!PyString_Check(name)){
#ifdef Py_USING_UNICODE
- /* The Unicode to string conversion is done here because the
- existing tp_setattro slots expect a string object as name
- and we wouldn't want to break those. */
- if (PyUnicode_Check(name)) {
- name = PyUnicode_AsEncodedString(name, NULL, NULL);
- if (name == NULL)
- return -1;
- }
- else
+ /* The Unicode to string conversion is done here because the
+ existing tp_setattro slots expect a string object as name
+ and we wouldn't want to break those. */
+ if (PyUnicode_Check(name)) {
+ name = PyUnicode_AsEncodedString(name, NULL, NULL);
+ if (name == NULL)
+ return -1;
+ }
+ else
#endif
- if (!PyString_Check(name)){
- PyErr_SetString(PyExc_TypeError,
- "attribute name must be string");
- return -1;
+ {
+ PyErr_SetString(PyExc_TypeError,
+ "attribute name must be string");
+ return -1;
+ }
}
else
Py_INCREF(name);