Commits

Jean-Paul Calderone  committed 186a3c9

Mark str as HAVE_GETCHARBUFFER so getarg lets it through t#

  • Participants
  • Parent commits 32677db
  • Branches pyarg-parsebuffer-new

Comments (0)

Files changed (3)

File pypy/module/cpyext/api.py

 
 
 constant_names = """
-Py_TPFLAGS_READY Py_TPFLAGS_READYING
-METH_COEXIST METH_STATIC METH_CLASS 
+Py_TPFLAGS_READY Py_TPFLAGS_READYING Py_TPFLAGS_HAVE_GETCHARBUFFER
+METH_COEXIST METH_STATIC METH_CLASS
 METH_NOARGS METH_VARARGS METH_KEYWORDS METH_O
 Py_TPFLAGS_HEAPTYPE Py_TPFLAGS_HAVE_CLASS
 Py_LT Py_LE Py_EQ Py_NE Py_GT Py_GE

File pypy/module/cpyext/src/getargs.c

 		char **p = va_arg(*p_va, char **);
 		PyBufferProcs *pb = arg->ob_type->tp_as_buffer;
 		Py_ssize_t count;
-                printf("this far\n");
 
 #if 0
 		if (*format++ != '#')
 				"invalid use of 't' format character", 
 				arg, msgbuf, bufsize);
 #endif
-		if (!PyType_HasFeature(arg->ob_type,
+               if (!PyType_HasFeature(arg->ob_type,
 				       Py_TPFLAGS_HAVE_GETCHARBUFFER)
 #if 0
 		    || pb == NULL || pb->bf_getcharbuffer == NULL ||
 				"string or pinned buffer",
 				arg, msgbuf, bufsize);
 #endif
-                printf("this far!\n");
-                printf("%p\n", pb->bf_getcharbuffer);
 		count = pb->bf_getcharbuffer(arg, 0, p);
-                printf("after\n");
 #if 0
 		if (count < 0)
 			return converterr("(unspecified)", arg, msgbuf, bufsize);
 #endif
 		{
-                    printf("fetch size\n");
 			FETCH_SIZE;
-                        printf("did that\n");
 			STORE_SIZE(count);
-                        printf("store size done\n");
+                        ++format;
 		}
 		break;
 	}

File pypy/module/cpyext/typeobject.py

     cpython_api, cpython_struct, bootstrap_function, Py_ssize_t, Py_ssize_tP,
     generic_cpy_call, Py_TPFLAGS_READY, Py_TPFLAGS_READYING,
     Py_TPFLAGS_HEAPTYPE, METH_VARARGS, METH_KEYWORDS, CANNOT_FAIL,
+    Py_TPFLAGS_HAVE_GETCHARBUFFER,
     build_type_checkers)
 from pypy.module.cpyext.pyobject import (
     PyObject, make_ref, create_ref, from_ref, get_typedescr, make_typedescr,
     c_buf.c_bf_getcharbuffer = llhelper(str_getcharbuffer.api_func.functype,
                                  str_getcharbuffer.api_func.get_wrapper(space))
     pto.c_tp_as_buffer = c_buf
+    pto.c_tp_flags |= Py_TPFLAGS_HAVE_GETCHARBUFFER
 
 @cpython_api([PyObject], lltype.Void, external=False)
 def type_dealloc(space, obj):
     if space.is_w(w_type, space.w_str):
         setup_string_buffer_procs(space, pto)
 
-    pto.c_tp_flags = Py_TPFLAGS_HEAPTYPE
+    pto.c_tp_flags |= Py_TPFLAGS_HEAPTYPE
     pto.c_tp_free = llhelper(PyObject_Del.api_func.functype,
             PyObject_Del.api_func.get_wrapper(space))
     pto.c_tp_alloc = llhelper(PyType_GenericAlloc.api_func.functype,