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
623c071a
Commit
623c071a
authored
Feb 17, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
b13f8350
39c0eea9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
21 deletions
+7
-21
Cython/Compiler/AutoDocTransforms.py
Cython/Compiler/AutoDocTransforms.py
+3
-3
tests/run/extern_builtins_T258.pyx
tests/run/extern_builtins_T258.pyx
+4
-18
No files found.
Cython/Compiler/AutoDocTransforms.py
View file @
623c071a
...
...
@@ -20,7 +20,7 @@ class EmbedSignature(CythonTransform):
try
:
denv
=
self
.
denv
# XXX
ctval
=
default_val
.
compile_time_value
(
self
.
denv
)
repr_val
=
'%r'
%
ctval
repr_val
=
repr
(
ctval
)
if
isinstance
(
default_val
,
ExprNodes
.
UnicodeNode
):
if
repr_val
[:
1
]
!=
'u'
:
return
u'u%s'
%
repr_val
...
...
@@ -28,8 +28,8 @@ class EmbedSignature(CythonTransform):
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
:]
if
repr_val
[:
1
]
in
'ub'
:
re
turn
re
pr_val
[
1
:]
return
repr_val
except
Exception
:
try
:
...
...
tests/run/extern_builtins_T258.pyx
View file @
623c071a
cdef
extern
from
"Python.h"
:
ctypedef
class
__builtin__
.
str
[
object
PyStringObject
]:
cdef
long
ob_shash
ctypedef
class
__builtin__
.
list
[
object
PyListObject
]:
cdef
Py_ssize_t
ob_size
cdef
Py_ssize_t
allocated
ctypedef
class
__builtin__
.
dict
[
object
PyDictObject
]:
pass
cdef
str
s
=
"abc"
cdef
Py_ssize_t
Py_SIZE
(
object
o
)
cdef
list
L
=
[
1
,
2
,
4
]
cdef
dict
d
=
{
'A'
:
'a'
}
def
test_list
(
list
L
):
"""
>>> test_list(list(range(10)))
...
...
@@ -23,18 +20,7 @@ def test_list(list L):
>>> test_list(list_subclass([1,2,3]))
True
"""
return
L
.
ob_size
<=
L
.
allocated
def
test_str
(
str
s
):
"""
>>> test_str("abc")
True
>>> class str_subclass(str): pass
>>> test_str(str_subclass("xyz"))
True
"""
cdef
char
*
ss
=
s
return
hash
(
s
)
==
s
.
ob_shash
return
Py_SIZE
(
L
)
<=
L
.
allocated
def
test_tuple
(
tuple
t
):
"""
...
...
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