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
Kirill Smelkov
cython
Commits
5b2513aa
Commit
5b2513aa
authored
Dec 31, 2018
by
Jeroen Demeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only generate __qualname__ in Python versions supporting it
parent
8e7406a0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
12 deletions
+17
-12
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+4
-0
runtests.py
runtests.py
+1
-0
tests/run/decorators_T593.pyx
tests/run/decorators_T593.pyx
+2
-2
tests/run/locals_T732.pyx
tests/run/locals_T732.pyx
+2
-2
tests/run/metaclass.pyx
tests/run/metaclass.pyx
+8
-8
No files found.
Cython/Utility/ObjectHandling.c
View file @
5b2513aa
...
...
@@ -913,8 +913,10 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
if
(
PyDict_SetItem
(
dict
,
PYIDENT
(
"__module__"
),
modname
)
<
0
)
return
NULL
;
#if PY_VERSION_HEX >= 0x03030000
if
(
PyDict_SetItem
(
dict
,
PYIDENT
(
"__qualname__"
),
qualname
)
<
0
)
return
NULL
;
#endif
/* Python2 __metaclass__ */
metaclass
=
__Pyx_PyDict_GetItemStr
(
dict
,
PYIDENT
(
"__metaclass__"
));
...
...
@@ -974,7 +976,9 @@ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases,
/* Required here to emulate assignment order */
if
(
unlikely
(
PyObject_SetItem
(
ns
,
PYIDENT
(
"__module__"
),
modname
)
<
0
))
goto
bad
;
#if PY_VERSION_HEX >= 0x03030000
if
(
unlikely
(
PyObject_SetItem
(
ns
,
PYIDENT
(
"__qualname__"
),
qualname
)
<
0
))
goto
bad
;
#endif
if
(
unlikely
(
doc
&&
PyObject_SetItem
(
ns
,
PYIDENT
(
"__doc__"
),
doc
)
<
0
))
goto
bad
;
return
ns
;
bad:
...
...
runtests.py
View file @
5b2513aa
...
...
@@ -428,6 +428,7 @@ VER_DEP_MODULES = {
(3,3) : (operator.lt, lambda x: x in ['build.package_compilation',
'run.yield_from_py33',
'pyximport.pyximport_namespace',
'run.qualname',
]),
(3,4): (operator.lt, lambda x: x in ['run.py34_signature',
'run.test_unicode', # taken from Py3.7, difficult to backport
...
...
tests/run/decorators_T593.pyx
View file @
5b2513aa
...
...
@@ -110,8 +110,8 @@ class Base(type):
class
Bar
(
metaclass
=
Base
):
"""
>>>
Bar._order
['__module__', '__
qualname__', '__
doc__', 'bar']
>>>
[n for n in Bar._order if n != "__qualname__"]
['__module__', '__doc__', 'bar']
"""
@
property
def
bar
(
self
):
...
...
tests/run/locals_T732.pyx
View file @
5b2513aa
...
...
@@ -23,8 +23,8 @@ def test_class_locals_and_dir():
>>> klass = test_class_locals_and_dir()
>>> 'visible' in klass.locs and 'not_visible' not in klass.locs
True
>>>
klass.names
['__module__', '
__qualname__', '
visible']
>>>
[n for n in klass.names if n != "__qualname__"]
['__module__', 'visible']
"""
not_visible
=
1234
class
Foo
:
...
...
tests/run/metaclass.pyx
View file @
5b2513aa
...
...
@@ -69,8 +69,8 @@ class Py3ClassMCOnly(object, metaclass=Py3MetaclassPlusAttr):
321
>>> obj.metaclass_was_here
True
>>>
obj._order
['__module__', '__
qualname__', '__
doc__', 'bar', 'metaclass_was_here']
>>>
[n for n in obj._order if n != "__qualname__"]
['__module__', '__doc__', 'bar', 'metaclass_was_here']
"""
bar
=
321
...
...
@@ -81,8 +81,8 @@ class Py3InheritedMetaclass(Py3ClassMCOnly):
345
>>> obj.metaclass_was_here
True
>>>
obj._order
['__module__', '__
qualname__', '__
doc__', 'bar', 'metaclass_was_here']
>>>
[n for n in obj._order if n != "__qualname__"]
['__module__', '__doc__', 'bar', 'metaclass_was_here']
"""
bar
=
345
...
...
@@ -109,8 +109,8 @@ class Py3Foo(object, metaclass=Py3Base, foo=123):
123
>>> obj.bar
321
>>>
obj._order
['__module__', '__
qualname__', '__
doc__', 'bar', 'foo']
>>>
[n for n in obj._order if n != "__qualname__"]
['__module__', '__doc__', 'bar', 'foo']
"""
bar
=
321
...
...
@@ -122,8 +122,8 @@ class Py3FooInherited(Py3Foo, foo=567):
567
>>> obj.bar
321
>>>
obj._order
['__module__', '__
qualname__', '__
doc__', 'bar', 'foo']
>>>
[n for n in obj._order if n != "__qualname__"]
['__module__', '__doc__', 'bar', 'foo']
"""
bar
=
321
...
...
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