[pypy-commit] pypy default: use name instead of c_name to fix translation
mattip
pypy.commits at gmail.com
Sun Feb 24 06:38:38 EST 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r96143:8d4ef4fd2096
Date: 2019-02-24 13:37 +0200
http://bitbucket.org/pypy/pypy/changeset/8d4ef4fd2096/
Log: use name instead of c_name to fix translation
diff --git a/pypy/module/cpyext/methodobject.py b/pypy/module/cpyext/methodobject.py
--- a/pypy/module/cpyext/methodobject.py
+++ b/pypy/module/cpyext/methodobject.py
@@ -62,7 +62,7 @@
def __init__(self, space, ml, w_self, w_module=None):
self.ml = ml
- self.name = rffi.charp2str(rffi.cast(rffi.CCHARP,self.ml.c_ml_name))
+ self.name = rffi.charp2str(rffi.cast(rffi.CCHARP, self.ml.c_ml_name))
self.flags = rffi.cast(lltype.Signed, self.ml.c_ml_flags)
self.w_self = w_self
self.w_module = w_module
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
@@ -151,7 +151,7 @@
dealloc=descr_dealloc,
)
-def init_descr(space, py_obj, w_type, c_name):
+def init_descr(space, py_obj, w_type, name):
"""Initialises the common fields in a PyDescrObject
Arguments:
@@ -159,12 +159,10 @@
w_type: W_TypeObject
c_name: char*
"""
- from pypy.module.cpyext.unicodeobject import PyUnicode_FromString
py_descr = cts.cast('PyDescrObject*', py_obj)
py_descr.c_d_type = cts.cast(
'PyTypeObject*', make_ref(space, w_type))
- py_descr.c_d_name = make_ref(
- space, PyUnicode_FromString(space, c_name))
+ py_descr.c_d_name = make_ref(space, space.newtext(name))
@slot_function([PyObject], lltype.Void)
def descr_dealloc(space, py_obj):
@@ -182,7 +180,7 @@
py_memberdescr = cts.cast('PyMemberDescrObject*', py_obj)
assert isinstance(w_obj, W_MemberDescr)
py_memberdescr.c_d_member = w_obj.member
- init_descr(space, py_obj, w_obj.w_type, w_obj.member.c_name)
+ init_descr(space, py_obj, w_obj.w_type, w_obj.name)
def memberdescr_realize(space, obj):
# XXX NOT TESTED When is this ever called?
@@ -207,13 +205,13 @@
# XXX how is this ever released?
assert isinstance(w_obj, W_GetSetPropertyEx)
py_getsetdescr.c_d_getset = w_obj.getset
- init_descr(space, py_obj, w_obj.w_type, w_obj.getset.c_name)
+ init_descr(space, py_obj, w_obj.w_type, w_obj.name)
def methoddescr_attach(space, py_obj, w_obj, w_userdata=None):
py_methoddescr = cts.cast('PyMethodDescrObject*', py_obj)
assert isinstance(w_obj, W_PyCFunctionObject)
py_methoddescr.c_d_method = w_obj.ml
- init_descr(space, py_obj, w_obj.w_objclass, w_obj.ml.c_ml_name)
+ init_descr(space, py_obj, w_obj.w_objclass, w_obj.name)
def classmethoddescr_realize(space, obj):
# XXX NOT TESTED When is this ever called?
More information about the pypy-commit
mailing list