[Checkins] SVN: zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c It's strange that PyBytesCheck passes for Unicode.
Lennart Regebro
regebro at gmail.com
Sat Nov 20 13:35:48 EST 2010
Log message for revision 118512:
It's strange that PyBytesCheck passes for Unicode.
Changed:
U zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c
-=-
Modified: zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c
===================================================================
--- zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c 2010-11-20 18:31:54 UTC (rev 118511)
+++ zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c 2010-11-20 18:35:47 UTC (rev 118512)
@@ -294,7 +294,8 @@
#if PY_MAJOR_VERSION < 3 && defined(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. */
+ (except under Python 3) and we wouldn't want to break those. */
+
if (PyUnicode_Check(name)) {
name = PyUnicode_AsEncodedString(name, NULL, NULL);
if (name == NULL)
@@ -306,7 +307,7 @@
#if PY_MAJOR_VERSION < 3
if (!PyString_Check(name)){
#else
- if (!PyBytes_Check(name)){
+ if (!PyUnicode_Check(name)){
#endif
PyErr_SetString(PyExc_TypeError, "attribute name must be string");
return -1;
More information about the checkins
mailing list