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
44e76ee6
Commit
44e76ee6
authored
Aug 14, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partial revert of 1001, use builtin unicode type.
parent
b79430c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
28 deletions
+19
-28
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+2
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+14
-24
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+1
-1
No files found.
Cython/Compiler/Builtin.py
View file @
44e76ee6
...
@@ -180,9 +180,10 @@ def init_builtins():
...
@@ -180,9 +180,10 @@ def init_builtins():
init_builtin_funcs
()
init_builtin_funcs
()
init_builtin_types
()
init_builtin_types
()
init_builtin_structs
()
init_builtin_structs
()
global
list_type
,
tuple_type
,
dict_type
global
list_type
,
tuple_type
,
dict_type
,
unicode_type
list_type
=
builtin_scope
.
lookup
(
'list'
).
type
list_type
=
builtin_scope
.
lookup
(
'list'
).
type
tuple_type
=
builtin_scope
.
lookup
(
'tuple'
).
type
tuple_type
=
builtin_scope
.
lookup
(
'tuple'
).
type
dict_type
=
builtin_scope
.
lookup
(
'dict'
).
type
dict_type
=
builtin_scope
.
lookup
(
'dict'
).
type
unicode_type
=
builtin_scope
.
lookup
(
'unicode'
).
type
init_builtins
()
init_builtins
()
Cython/Compiler/ExprNodes.py
View file @
44e76ee6
...
@@ -10,7 +10,7 @@ import Naming
...
@@ -10,7 +10,7 @@ import Naming
from
Nodes
import
Node
from
Nodes
import
Node
import
PyrexTypes
import
PyrexTypes
from
PyrexTypes
import
py_object_type
,
c_long_type
,
typecast
,
error_type
from
PyrexTypes
import
py_object_type
,
c_long_type
,
typecast
,
error_type
from
Builtin
import
list_type
,
tuple_type
,
dict_type
from
Builtin
import
list_type
,
tuple_type
,
dict_type
,
unicode_type
import
Symtab
import
Symtab
import
Options
import
Options
from
Annotate
import
AnnotationItem
from
Annotate
import
AnnotationItem
...
@@ -740,7 +740,7 @@ class StringNode(ConstNode):
...
@@ -740,7 +740,7 @@ class StringNode(ConstNode):
class
UnicodeNode
(
PyConstNode
):
class
UnicodeNode
(
PyConstNode
):
# entry Symtab.Entry
# entry Symtab.Entry
type
=
PyrexTypes
.
c_
unicode_type
type
=
unicode_type
def
analyse_types
(
self
,
env
):
def
analyse_types
(
self
,
env
):
self
.
entry
=
env
.
add_string_const
(
self
.
value
)
self
.
entry
=
env
.
add_string_const
(
self
.
value
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
44e76ee6
...
@@ -1003,6 +1003,19 @@ class CStringType:
...
@@ -1003,6 +1003,19 @@ class CStringType:
return
'"%s"'
%
Utils
.
escape_byte_string
(
value
)
return
'"%s"'
%
Utils
.
escape_byte_string
(
value
)
class
CUTF8CharArrayType
(
CStringType
,
CArrayType
):
# C 'char []' type.
parsetuple_format
=
"s"
pymemberdef_typecode
=
"T_STRING_INPLACE"
is_unicode
=
1
to_py_function
=
"PyUnicode_DecodeUTF8"
exception_value
=
"NULL"
def
__init__
(
self
,
size
):
CArrayType
.
__init__
(
self
,
c_char_type
,
size
)
class
CCharArrayType
(
CStringType
,
CArrayType
):
class
CCharArrayType
(
CStringType
,
CArrayType
):
# C 'char []' type.
# C 'char []' type.
...
@@ -1023,29 +1036,6 @@ class CCharPtrType(CStringType, CPtrType):
...
@@ -1023,29 +1036,6 @@ class CCharPtrType(CStringType, CPtrType):
CPtrType
.
__init__
(
self
,
c_char_type
)
CPtrType
.
__init__
(
self
,
c_char_type
)
class
UnicodeType
(
BuiltinObjectType
):
# The Python unicode type.
is_string
=
1
is_unicode
=
1
parsetuple_format
=
"U"
def
__init__
(
self
):
BuiltinObjectType
.
__init__
(
self
,
"unicode"
,
"PyUnicodeObject"
)
def
literal_code
(
self
,
value
):
assert
isinstance
(
value
,
str
)
return
'"%s"'
%
Utils
.
escape_byte_string
(
value
)
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
if
pyrex
or
for_display
:
return
self
.
base_declaration_code
(
self
.
name
,
entity_code
)
else
:
return
"%s %s[]"
%
(
public_decl
(
"char"
,
dll_linkage
),
entity_code
)
class
ErrorType
(
PyrexType
):
class
ErrorType
(
PyrexType
):
# Used to prevent propagation of error messages.
# Used to prevent propagation of error messages.
...
@@ -1111,8 +1101,8 @@ c_longdouble_type = CFloatType(8, typestring="g")
...
@@ -1111,8 +1101,8 @@ c_longdouble_type = CFloatType(8, typestring="g")
c_null_ptr_type
=
CNullPtrType
(
c_void_type
)
c_null_ptr_type
=
CNullPtrType
(
c_void_type
)
c_char_array_type
=
CCharArrayType
(
None
)
c_char_array_type
=
CCharArrayType
(
None
)
c_unicode_type
=
UnicodeType
()
c_char_ptr_type
=
CCharPtrType
()
c_char_ptr_type
=
CCharPtrType
()
c_utf8_char_array_type
=
CUTF8CharArrayType
(
None
)
c_char_ptr_ptr_type
=
CPtrType
(
c_char_ptr_type
)
c_char_ptr_ptr_type
=
CPtrType
(
c_char_ptr_type
)
c_py_ssize_t_ptr_type
=
CPtrType
(
c_py_ssize_t_type
)
c_py_ssize_t_ptr_type
=
CPtrType
(
c_py_ssize_t_type
)
c_int_ptr_type
=
CPtrType
(
c_int_type
)
c_int_ptr_type
=
CPtrType
(
c_int_type
)
...
...
Cython/Compiler/Symtab.py
View file @
44e76ee6
...
@@ -505,7 +505,7 @@ class Scope:
...
@@ -505,7 +505,7 @@ class Scope:
else:
else:
cname = self.new_const_cname()
cname = self.new_const_cname()
if value.is_unicode:
if value.is_unicode:
c_type = PyrexTypes.c_u
nicode
_type
c_type = PyrexTypes.c_u
tf8_char_array
_type
value = value.utf8encode()
value = value.utf8encode()
else:
else:
c_type = PyrexTypes.c_char_array_type
c_type = PyrexTypes.c_char_array_type
...
...
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