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
Gwenaël Samain
cython
Commits
38d0c5b8
Commit
38d0c5b8
authored
Oct 30, 2018
by
Stefan Behnel
Committed by
GitHub
Oct 30, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2684 from fkohlgrueber/func_decorator_co_firstlineno_fix
fix co_firstlineno for functions that have decorators
parents
e233427b
097ff5e3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
11 deletions
+30
-11
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
tests/errors/cfunc_directive_in_pyclass.pyx
tests/errors/cfunc_directive_in_pyclass.pyx
+1
-1
tests/errors/e_autotestdict.pyx
tests/errors/e_autotestdict.pyx
+1
-1
tests/errors/pure_errors.py
tests/errors/pure_errors.py
+1
-1
tests/errors/tree_assert.pyx
tests/errors/tree_assert.pyx
+4
-4
tests/run/annotation_typing.pyx
tests/run/annotation_typing.pyx
+3
-3
tests/run/cyfunction.pyx
tests/run/cyfunction.pyx
+19
-0
No files found.
Cython/Compiler/Parsing.py
View file @
38d0c5b8
...
...
@@ -3367,7 +3367,7 @@ def _reject_cdef_modifier_in_py(s, name):
def
p_def_statement
(
s
,
decorators
=
None
,
is_async_def
=
False
):
# s.sy == 'def'
pos
=
s
.
position
()
pos
=
decorators
[
0
].
pos
if
decorators
else
s
.
position
()
# PEP 492 switches the async/await keywords on in "async def" functions
if
is_async_def
:
s
.
enter_async
()
...
...
tests/errors/cfunc_directive_in_pyclass.pyx
View file @
38d0c5b8
...
...
@@ -7,5 +7,5 @@ class Pyclass(object):
pass
_ERRORS
=
"""
6
:4: cfunc directive is not allowed here
5
:4: cfunc directive is not allowed here
"""
tests/errors/e_autotestdict.pyx
View file @
38d0c5b8
...
...
@@ -7,5 +7,5 @@ def foo():
pass
_ERRORS
=
u"""
6
:0: The autotestdict compiler directive is not allowed in function scope
5
:0: The autotestdict compiler directive is not allowed in function scope
"""
tests/errors/pure_errors.py
View file @
38d0c5b8
...
...
@@ -53,5 +53,5 @@ def pyfunc(x): # invalid
_ERRORS
=
"""
44:22: Calling gil-requiring function not allowed without gil
45:24: Calling gil-requiring function not allowed without gil
4
9
:0: Python functions cannot be declared 'nogil'
4
8
:0: Python functions cannot be declared 'nogil'
"""
tests/errors/tree_assert.pyx
View file @
38d0c5b8
...
...
@@ -11,8 +11,8 @@ def test():
_ERRORS
=
u"""
9
:0: Expected path '//ComprehensionNode' not found in result tree
9
:0: Expected path '//ComprehensionNode//FuncDefNode' not found in result tree
9
:0: Unexpected path '//NameNode' found in result tree
9
:0: Unexpected path '//SimpleCallNode' found in result tree
5
:0: Expected path '//ComprehensionNode' not found in result tree
5
:0: Expected path '//ComprehensionNode//FuncDefNode' not found in result tree
5
:0: Unexpected path '//NameNode' found in result tree
5
:0: Unexpected path '//SimpleCallNode' found in result tree
"""
tests/run/annotation_typing.pyx
View file @
38d0c5b8
...
...
@@ -242,7 +242,7 @@ _WARNINGS = """
218:29: Ambiguous types in annotation, ignoring
# BUG:
46:6: 'pytypes_cpdef' redeclared
12
1
:0: 'struct_io' redeclared
1
56
:0: 'struct_convert' redeclared
1
75
:0: 'exception_default' redeclared
12
0
:0: 'struct_io' redeclared
1
49
:0: 'struct_convert' redeclared
1
68
:0: 'exception_default' redeclared
"""
tests/run/cyfunction.pyx
View file @
38d0c5b8
...
...
@@ -391,3 +391,22 @@ cdef class TestOptimisedBuiltinMethod:
def
call
(
self
,
arg
,
obj
=
None
):
(
obj
or
self
).
append
(
arg
+
1
)
# optimistically optimised => uses fast fallback method call
def
do_nothing
(
f
):
"""Dummy decorator for `test_firstlineno_decorated_function`"""
return
f
@
do_nothing
@
do_nothing
def
test_firstlineno_decorated_function
():
"""
check that `test_firstlineno_decorated_function` starts 5 lines below `do_nothing`
>>> test_firstlineno_decorated_function()
5
"""
l1
=
do_nothing
.
__code__
.
co_firstlineno
l2
=
test_firstlineno_decorated_function
.
__code__
.
co_firstlineno
return
l2
-
l1
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