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
55cff2b9
Commit
55cff2b9
authored
Apr 09, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid useless str() calls for unicode string formatting
parent
2b9a018a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+8
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
55cff2b9
...
@@ -3064,9 +3064,14 @@ class FormattedValueNode(ExprNode):
...
@@ -3064,9 +3064,14 @@ class FormattedValueNode(ExprNode):
# passing a Unicode format string in Py2 forces PyObject_Format() to also return a Unicode string
# passing a Unicode format string in Py2 forces PyObject_Format() to also return a Unicode string
format_spec
=
Naming
.
empty_unicode
format_spec
=
Naming
.
empty_unicode
if
self
.
conversion_char
:
conversion_char
=
self
.
conversion_char
fn
=
self
.
find_conversion_func
(
self
.
conversion_char
)
if
conversion_char
==
's'
and
self
.
value
.
type
is
unicode_type
and
not
self
.
value
.
may_be_none
():
assert
fn
is
not
None
,
"invalid conversion character found: '%s'"
%
self
.
conversion_char
# no need to pipe unicode strings through str()
conversion_char
=
None
if
conversion_char
:
fn
=
self
.
find_conversion_func
(
conversion_char
)
assert
fn
is
not
None
,
"invalid conversion character found: '%s'"
%
conversion_char
value_result
=
'%s(%s)'
%
(
fn
,
value_result
)
value_result
=
'%s(%s)'
%
(
fn
,
value_result
)
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"PyObjectFormatAndDecref"
,
"StringTools.c"
))
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"PyObjectFormatAndDecref"
,
"StringTools.c"
))
format_func
+=
'AndDecref'
format_func
+=
'AndDecref'
...
...
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