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
efac47de
Commit
efac47de
authored
Apr 26, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor code cleanup
parent
5270e1e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+20
-16
No files found.
Cython/Compiler/ExprNodes.py
View file @
efac47de
...
...
@@ -70,24 +70,28 @@ constant_value_not_set = object()
# error messages when coercing from key[0] to key[1]
coercion_error_dict
=
{
# string related errors
(
Builtin
.
unicode_type
,
Builtin
.
bytes_type
)
:
"Cannot convert Unicode string to 'bytes' implicitly, encoding required."
,
(
Builtin
.
unicode_type
,
Builtin
.
str_type
)
:
"Cannot convert Unicode string to 'str' implicitly. This is not portable and requires explicit encoding."
,
(
Builtin
.
unicode_type
,
PyrexTypes
.
c_char_ptr_type
)
:
"Unicode objects only support coercion to Py_UNICODE*."
,
(
Builtin
.
unicode_type
,
PyrexTypes
.
c_uchar_ptr_type
)
:
"Unicode objects only support coercion to Py_UNICODE*."
,
(
Builtin
.
bytes_type
,
Builtin
.
unicode_type
)
:
"Cannot convert 'bytes' object to unicode implicitly, decoding required"
,
(
Builtin
.
bytes_type
,
Builtin
.
str_type
)
:
"Cannot convert 'bytes' object to str implicitly. This is not portable to Py3."
,
(
Builtin
.
bytes_type
,
Builtin
.
basestring_type
)
:
"Cannot convert 'bytes' object to basestring implicitly. This is not portable to Py3."
,
(
Builtin
.
bytes_type
,
PyrexTypes
.
c_py_unicode_ptr_type
)
:
"Cannot convert 'bytes' object to Py_UNICODE*, use 'unicode'."
,
(
Builtin
.
basestring_type
,
Builtin
.
bytes_type
)
:
"Cannot convert 'basestring' object to bytes implicitly. This is not portable."
,
(
Builtin
.
str_type
,
Builtin
.
unicode_type
)
:
"str objects do not support coercion to unicode, use a unicode string literal instead (u'')"
,
(
Builtin
.
str_type
,
Builtin
.
bytes_type
)
:
"Cannot convert 'str' to 'bytes' implicitly. This is not portable."
,
(
Builtin
.
str_type
,
PyrexTypes
.
c_char_ptr_type
)
:
"'str' objects do not support coercion to C types (use 'bytes'?)."
,
(
Builtin
.
str_type
,
PyrexTypes
.
c_uchar_ptr_type
)
:
"'str' objects do not support coercion to C types (use 'bytes'?)."
,
(
Builtin
.
str_type
,
PyrexTypes
.
c_py_unicode_ptr_type
)
:
"'str' objects do not support coercion to C types (use 'unicode'?)."
,
(
PyrexTypes
.
c_char_ptr_type
,
Builtin
.
unicode_type
)
:
"Cannot convert 'char*' to unicode implicitly, decoding required"
,
(
PyrexTypes
.
c_uchar_ptr_type
,
Builtin
.
unicode_type
)
:
"Cannot convert 'char*' to unicode implicitly, decoding required"
,
(
unicode_type
,
str_type
):
(
"Cannot convert Unicode string to 'str' implicitly."
" This is not portable and requires explicit encoding."
),
(
unicode_type
,
bytes_type
):
"Cannot convert Unicode string to 'bytes' implicitly, encoding required."
,
(
unicode_type
,
PyrexTypes
.
c_char_ptr_type
):
"Unicode objects only support coercion to Py_UNICODE*."
,
(
unicode_type
,
PyrexTypes
.
c_uchar_ptr_type
):
"Unicode objects only support coercion to Py_UNICODE*."
,
(
bytes_type
,
unicode_type
):
"Cannot convert 'bytes' object to unicode implicitly, decoding required"
,
(
bytes_type
,
str_type
):
"Cannot convert 'bytes' object to str implicitly. This is not portable to Py3."
,
(
bytes_type
,
basestring_type
):
(
"Cannot convert 'bytes' object to basestring implicitly."
" This is not portable to Py3."
),
(
bytes_type
,
PyrexTypes
.
c_py_unicode_ptr_type
):
"Cannot convert 'bytes' object to Py_UNICODE*, use 'unicode'."
,
(
basestring_type
,
bytes_type
):
"Cannot convert 'basestring' object to bytes implicitly. This is not portable."
,
(
str_type
,
unicode_type
):
(
"str objects do not support coercion to unicode,"
" use a unicode string literal instead (u'')"
),
(
str_type
,
bytes_type
):
"Cannot convert 'str' to 'bytes' implicitly. This is not portable."
,
(
str_type
,
PyrexTypes
.
c_char_ptr_type
):
"'str' objects do not support coercion to C types (use 'bytes'?)."
,
(
str_type
,
PyrexTypes
.
c_uchar_ptr_type
):
"'str' objects do not support coercion to C types (use 'bytes'?)."
,
(
str_type
,
PyrexTypes
.
c_py_unicode_ptr_type
):
"'str' objects do not support coercion to C types (use 'unicode'?)."
,
(
PyrexTypes
.
c_char_ptr_type
,
unicode_type
):
"Cannot convert 'char*' to unicode implicitly, decoding required"
,
(
PyrexTypes
.
c_uchar_ptr_type
,
unicode_type
):
"Cannot convert 'char*' to unicode implicitly, decoding required"
,
}
def
find_coercion_error
(
type_tuple
,
default
,
env
):
err
=
coercion_error_dict
.
get
(
type_tuple
)
if
err
is
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