[pypy-svn] pypy pyarg-parsebuffer-new: Mark str as HAVE_GETCHARBUFFER so getarg lets it through t#
exarkun
commits-noreply at bitbucket.org
Wed Apr 20 23:20:16 CEST 2011
Author: Jean-Paul Calderone <exarkun at twistedmatrix.com>
Branch: pyarg-parsebuffer-new
Changeset: r43500:186a3c976b98
Date: 2011-04-20 17:19 -0400
http://bitbucket.org/pypy/pypy/changeset/186a3c976b98/
Log: Mark str as HAVE_GETCHARBUFFER so getarg lets it through t#
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -10,6 +10,7 @@
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,
@@ -403,6 +404,7 @@
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):
@@ -443,7 +445,7 @@
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,
diff --git a/pypy/module/cpyext/src/getargs.c b/pypy/module/cpyext/src/getargs.c
--- a/pypy/module/cpyext/src/getargs.c
+++ b/pypy/module/cpyext/src/getargs.c
@@ -1271,7 +1271,6 @@
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++ != '#')
@@ -1279,7 +1278,7 @@
"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 ||
@@ -1300,20 +1299,15 @@
"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;
}
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -90,8 +90,8 @@
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
More information about the Pypy-commit
mailing list