Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
2ffd5060
Commit
2ffd5060
authored
Aug 27, 2019
by
Jeroen Demeyer
Committed by
Stefan Behnel
Aug 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__Pyx_GetNameInClass() should get raw attribute from __dict__ (GH-3100)
parent
3ac72f5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
7 deletions
+35
-7
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+16
-7
tests/run/cclass_assign_attr_GH3100.pyx
tests/run/cclass_assign_attr_GH3100.pyx
+19
-0
No files found.
Cython/Utility/ObjectHandling.c
View file @
2ffd5060
...
...
@@ -1180,18 +1180,27 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
static
PyObject
*
__Pyx__GetNameInClass
(
PyObject
*
nmspace
,
PyObject
*
name
);
/*proto*/
/////////////// GetNameInClass ///////////////
//@requires: PyObjectGetAttrStrNoError
//@requires: GetModuleGlobalName
static
PyObject
*
__Pyx__GetNameInClass
(
PyObject
*
nmspace
,
PyObject
*
name
)
{
PyObject
*
result
;
result
=
__Pyx_PyObject_GetAttrStrNoError
(
nmspace
,
name
);
if
(
!
result
)
{
if
(
unlikely
(
PyErr_Occurred
()))
return
NULL
;
__Pyx_GetModuleGlobalNameUncached
(
result
,
name
);
return
result
;
PyObject
*
dict
;
assert
(
PyType_Check
(
nmspace
));
#if CYTHON_USE_TYPE_SLOTS
dict
=
((
PyTypeObject
*
)
nmspace
)
->
tp_dict
;
Py_XINCREF
(
dict
);
#else
dict
=
PyObject_GetAttr
(
nmspace
,
PYIDENT
(
"__dict__"
));
#endif
if
(
likely
(
dict
))
{
result
=
PyObject_GetItem
(
dict
,
name
);
Py_DECREF
(
dict
);
if
(
result
)
{
return
result
;
}
}
PyErr_Clear
();
__Pyx_GetModuleGlobalNameUncached
(
result
,
name
);
return
result
;
}
...
...
tests/run/cclass_assign_attr_GH3100.pyx
0 → 100644
View file @
2ffd5060
cdef
class
Foo
:
"""
>>> D = Foo.__dict__
>>> D["meth"] is D["meth2"]
True
>>> D["classmeth"] is D["classmeth2"]
True
>>> D["staticmeth"] is D["staticmeth2"]
True
"""
def
meth
(
self
):
pass
@
classmethod
def
classmeth
(
cls
):
pass
@
staticmethod
def
staticmeth
():
pass
meth2
=
meth
classmeth2
=
classmeth
staticmeth2
=
staticmeth
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment