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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
c2e89fdd
Commit
c2e89fdd
authored
Dec 30, 2010
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:vitek/cython
parents
7bdafc9e
e0d366d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
2 deletions
+125
-2
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+10
-2
tests/bugs.txt
tests/bugs.txt
+1
-0
tests/run/decorators_T593.pyx
tests/run/decorators_T593.pyx
+114
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
c2e89fdd
...
...
@@ -139,7 +139,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
h_code
.
putln
(
""
)
h_code
.
putln
(
"#endif"
)
h_code
.
copyto
(
open_new_file
(
result
.
h_file
))
f
=
open_new_file
(
result
.
h_file
)
try
:
h_code
.
copyto
(
f
)
finally
:
f
.
close
()
def
generate_public_declaration
(
self
,
entry
,
h_code
,
i_code
):
h_code
.
putln
(
"%s %s;"
%
(
...
...
@@ -222,7 +226,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
h_code
.
putln
(
""
)
h_code
.
putln
(
"#endif"
)
h_code
.
copyto
(
open_new_file
(
result
.
api_file
))
f
=
open_new_file
(
result
.
api_file
)
try
:
h_code
.
copyto
(
f
)
finally
:
f
.
close
()
def
generate_cclass_header_code
(
self
,
type
,
h_code
):
h_code
.
putln
(
"%s DL_IMPORT(PyTypeObject) %s;"
%
(
...
...
tests/bugs.txt
View file @
c2e89fdd
...
...
@@ -18,6 +18,7 @@ ipow_crash_T562
pure_mode_cmethod_inheritance_T583
genexpr_iterable_lookup_T600
for_from_pyvar_loop_T601
decorators_T593
# CPython regression tests that don't current work:
pyregr.test_threadsignals
...
...
tests/run/decorators_T593.pyx
0 → 100644
View file @
c2e89fdd
"""
>>> am_i_buggy
False
>>> Foo
False
"""
def
testme
(
func
):
try
:
am_i_buggy
return
True
except
NameError
:
return
False
@
testme
def
am_i_buggy
():
pass
def
testclass
(
klass
):
try
:
Foo
return
True
except
NameError
:
return
False
@
testclass
class
Foo
:
pass
def
called_deco
(
a
,
b
,
c
):
def
count
(
f
):
a
.
append
(
(
b
,
c
)
)
return
f
return
count
L
=
[]
@
called_deco
(
L
,
5
,
c
=
6
)
@
called_deco
(
L
,
c
=
3
,
b
=
4
)
@
called_deco
(
L
,
1
,
2
)
def
wrapped_func
(
x
):
"""
>>> L
[(1, 2), (4, 3), (5, 6)]
>>> wrapped_func(99)
99
>>> L
[(1, 2), (4, 3), (5, 6)]
"""
return
x
def
class_in_closure
(
x
):
"""
>>> C1, c0 = class_in_closure(5)
>>> C1().smeth1()
(5, ())
>>> C1.smeth1(1,2)
(5, (1, 2))
>>> C1.smeth1()
(5, ())
>>> c0.smeth0()
1
>>> c0.__class__.smeth0()
1
"""
class
ClosureClass1
(
object
):
@
staticmethod
def
smeth1
(
*
args
):
return
x
,
args
class
ClosureClass0
(
object
):
@
staticmethod
def
smeth0
():
return
1
return
ClosureClass1
,
ClosureClass0
()
def
class_not_in_closure
():
"""
>>> c = class_not_in_closure()
>>> c.smeth0()
1
>>> c.__class__.smeth0()
1
"""
class
ClosureClass0
(
object
):
@
staticmethod
def
smeth0
():
return
1
return
ClosureClass0
()
class
ODict
(
dict
):
def
__init__
(
self
):
dict
.
__init__
(
self
)
self
.
_order
=
[]
dict
.
__setitem__
(
self
,
'_order'
,
self
.
_order
)
def
__setitem__
(
self
,
key
,
value
):
dict
.
__setitem__
(
self
,
key
,
value
)
self
.
_order
.
append
(
key
)
class
Base
(
type
):
@
staticmethod
def
__prepare__
(
*
args
,
**
kwargs
):
return
ODict
()
class
Bar
(
metaclass
=
Base
):
"""
>>> Bar._order
['__module__', '__doc__', 'bar']
"""
@
property
def
bar
(
self
):
return
0
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