[pypy-commit] pypy default: Make C-API char* parameters const-correct with respect to CPython.
devin.jeanpierre
pypy.commits at gmail.com
Mon Jan 25 12:34:30 EST 2016
Author: Devin Jeanpierre <jeanpierreda at gmail.com>
Branch:
Changeset: r81934:2b601dbb5d24
Date: 2016-01-25 09:19 -0800
http://bitbucket.org/pypy/pypy/changeset/2b601dbb5d24/
Log: Make C-API char* parameters const-correct with respect to CPython.
diff --git a/pypy/module/cpyext/dictobject.py b/pypy/module/cpyext/dictobject.py
--- a/pypy/module/cpyext/dictobject.py
+++ b/pypy/module/cpyext/dictobject.py
@@ -59,7 +59,7 @@
return None
return borrow_from(w_dict, w_res)
- at cpython_api([PyObject, rffi.CCHARP], rffi.INT_real, error=-1)
+ at cpython_api([PyObject, CONST_STRING], rffi.INT_real, error=-1)
def PyDict_DelItemString(space, w_dict, key_ptr):
"""Remove the entry in dictionary p which has a key specified by the string
key. Return 0 on success or -1 on failure."""
diff --git a/pypy/module/cpyext/eval.py b/pypy/module/cpyext/eval.py
--- a/pypy/module/cpyext/eval.py
+++ b/pypy/module/cpyext/eval.py
@@ -128,7 +128,7 @@
filename = "<string>"
return run_string(space, source, filename, start, w_globals, w_locals)
- at cpython_api([rffi.CCHARP, rffi.INT_real, PyObject, PyObject,
+ at cpython_api([CONST_STRING, rffi.INT_real, PyObject, PyObject,
PyCompilerFlagsPtr], PyObject)
def PyRun_StringFlags(space, source, start, w_globals, w_locals, flagsptr):
"""Execute Python source code from str in the context specified by the
@@ -189,7 +189,7 @@
pi[0] = space.getindex_w(w_obj, None)
return 1
- at cpython_api([rffi.CCHARP, rffi.CCHARP, rffi.INT_real, PyCompilerFlagsPtr],
+ at cpython_api([CONST_STRING, CONST_STRING, rffi.INT_real, PyCompilerFlagsPtr],
PyObject)
def Py_CompileStringFlags(space, source, filename, start, flagsptr):
"""Parse and compile the Python source code in str, returning the
diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py
--- a/pypy/module/cpyext/pystrtod.py
+++ b/pypy/module/cpyext/pystrtod.py
@@ -1,6 +1,6 @@
import errno
from pypy.interpreter.error import OperationError
-from pypy.module.cpyext.api import cpython_api
+from pypy.module.cpyext.api import cpython_api, CONST_STRING
from pypy.module.cpyext.pyobject import PyObject
from rpython.rlib import rdtoa
from rpython.rlib import rfloat
@@ -22,7 +22,7 @@
rfloat.DIST_NAN: Py_DTST_NAN
}
- at cpython_api([rffi.CCHARP, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0)
+ at cpython_api([CONST_STRING, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0)
@jit.dont_look_inside # direct use of _get_errno()
def PyOS_string_to_double(space, s, endptr, w_overflow_exception):
"""Convert a string s to a double, raising a Python
More information about the pypy-commit
mailing list