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
1f83af96
Commit
1f83af96
authored
Oct 18, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix default string value representation in auto-embedded signatures
parent
57bdf48b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
Cython/Compiler/AutoDocTransforms.py
Cython/Compiler/AutoDocTransforms.py
+16
-7
tests/run/embedsignatures.pyx
tests/run/embedsignatures.pyx
+0
-4
No files found.
Cython/Compiler/AutoDocTransforms.py
View file @
1f83af96
...
...
@@ -3,9 +3,7 @@ from Cython.Compiler.Nodes import DefNode, CFuncDefNode
from
Cython.Compiler.Errors
import
CompileError
from
Cython.Compiler.StringEncoding
import
EncodedString
from
Cython.Compiler
import
Options
from
Cython.Compiler
import
PyrexTypes
from
Cython.Compiler
import
PyrexTypes
,
ExprNodes
class
EmbedSignature
(
CythonTransform
):
...
...
@@ -16,15 +14,26 @@ class EmbedSignature(CythonTransform):
self
.
class_node
=
None
def
_fmt_arg_defv
(
self
,
arg
):
if
not
arg
.
default
:
default_val
=
arg
.
default
if
not
default_val
:
return
None
try
:
denv
=
self
.
denv
# XXX
ctval
=
arg
.
default
.
compile_time_value
(
self
.
denv
)
return
'%r'
%
ctval
ctval
=
default_val
.
compile_time_value
(
self
.
denv
)
repr_val
=
'%r'
%
ctval
if
isinstance
(
default_val
,
ExprNodes
.
UnicodeNode
):
if
repr_val
[:
1
]
!=
'u'
:
return
u'u%s'
%
repr_val
elif
isinstance
(
default_val
,
ExprNodes
.
BytesNode
):
if
repr_val
[:
1
]
!=
'b'
:
return
u'b%s'
%
repr_val
elif
isinstance
(
default_val
,
ExprNodes
.
StringNode
):
if
repr_val
[:
1
]
in
(
'u'
,
'b'
):
repr_val
[
1
:]
return
repr_val
except
Exception
:
try
:
return
arg
.
default
.
name
# XXX
return
default_val
.
name
# XXX
except
AttributeError
:
return
'<???>'
...
...
tests/run/embedsignatures.pyx
View file @
1f83af96
...
...
@@ -137,10 +137,6 @@ __doc__ = ur"""
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"u'spam'"
,
u"'spam'"
)
cdef
class
Ext
:
def
__init__
(
self
,
a
,
b
,
c
=
None
):
...
...
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