[Checkins] SVN: zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c Weirdly it's happy with PyBytes_AS_STRING even though the objects are actually unicode objects.

Lennart Regebro regebro at gmail.com
Fri Nov 19 16:58:24 EST 2010


Log message for revision 118505:
  Weirdly it's happy with PyBytes_AS_STRING even though the objects are actually unicode objects.
  

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-19 21:24:32 UTC (rev 118504)
+++ zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c	2010-11-19 21:58:24 UTC (rev 118505)
@@ -229,7 +229,7 @@
 #if PY_MAJOR_VERSION < 3
     name_as_string = PyString_AS_STRING(name);
 #else
-    name_as_string = PyBytes_AS_STRING(PyUnicode_AsUTF8String(name));
+    name_as_string = PyBytes_AS_STRING(name);
 #endif
 
     wrapped = Proxy_GET_OBJECT(self);
@@ -331,7 +331,7 @@
 #if PY_MAJOR_VERSION < 3
     name_as_string = PyString_AS_STRING(name);
 #else
-    name_as_string = PyBytes_AS_STRING(PyUnicode_AsUTF8String(name));
+    name_as_string = PyBytes_AS_STRING(name);
 #endif
 
     wrapped = Proxy_GET_OBJECT(self);
@@ -371,8 +371,6 @@
 {
     return PyObject_Compare(Proxy_GET_OBJECT(wrapper), v);
 }
-#else
-  #define wrap_compare 0
 #endif
 
 static long
@@ -865,7 +863,11 @@
     wrap_print,				/* tp_print */
     0,					/* tp_getattr */
     0,					/* tp_setattr */
+#if PY_MAJOR_VERSION < 3
     wrap_compare,			/* tp_compare */
+#else
+    0,			                /* tp_reserved */
+#endif    
     wrap_repr,				/* tp_repr */
     &wrap_as_number,			/* tp_as_number */
     &wrap_as_sequence,			/* tp_as_sequence */
@@ -879,7 +881,7 @@
 #if PY_MAJOR_VERSION < 3
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
         | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ 
-#else // Checktypes is gone in Python 3, because there is no coersion
+#else // Py_TPFLAGS_CHECKTYPES is always true in Python 3 and removed.
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
         | Py_TPFLAGS_BASETYPE, /* tp_flags */
 #endif



More information about the checkins mailing list