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
f98755eb
Commit
f98755eb
authored
Mar 10, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix print implementation in Py3, make it more suitable for potential inlining
parent
4964e6d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+23
-17
No files found.
Cython/Compiler/Nodes.py
View file @
f98755eb
...
@@ -5106,7 +5106,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
...
@@ -5106,7 +5106,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
PyObject* kwargs = 0;
PyObject* kwargs = 0;
PyObject* result = 0;
PyObject* result = 0;
PyObject* end_string;
PyObject* end_string;
if (
!%(PRINT_FUNCTION)s
) {
if (
unlikely(!%(PRINT_FUNCTION)s)
) {
%(PRINT_FUNCTION)s = __Pyx_GetAttrString(%(BUILTINS)s, "print");
%(PRINT_FUNCTION)s = __Pyx_GetAttrString(%(BUILTINS)s, "print");
if (!%(PRINT_FUNCTION)s)
if (!%(PRINT_FUNCTION)s)
return -1;
return -1;
...
@@ -5117,17 +5117,21 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
...
@@ -5117,17 +5117,21 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
return -1;
return -1;
if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
goto bad;
goto bad;
if (!newline) {
end_string = PyUnicode_FromStringAndSize(" ", 1);
if (unlikely(!end_string))
goto bad;
if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
Py_DECREF(end_string);
goto bad;
}
}
Py_DECREF(end_string);
}
}
if (!newline) {
} else if (!newline) {
if (!kwargs)
if (unlikely(!%(PRINT_KWARGS)s)) {
kwargs = %(PRINT_KWARGS)s;
if (!kwargs) {
%(PRINT_KWARGS)s = PyDict_New();
%(PRINT_KWARGS)s = PyDict_New();
if
unlikely(
(!%(PRINT_KWARGS)s))
if
(unlikely
(!%(PRINT_KWARGS)s))
return -1;
return -1;
kwargs = %(PRINT_KWARGS)s;
}
end_string = PyUnicode_FromStringAndSize(" ", 1);
end_string = PyUnicode_FromStringAndSize(" ", 1);
if (unlikely(!end_string))
if (unlikely(!end_string))
goto bad;
goto bad;
...
@@ -5137,15 +5141,17 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
...
@@ -5137,15 +5141,17 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
}
}
Py_DECREF(end_string);
Py_DECREF(end_string);
}
}
kwargs = %(PRINT_KWARGS)s;
}
result = PyObject_Call(%(PRINT_FUNCTION)s, arg_tuple, kwargs);
result = PyObject_Call(%(PRINT_FUNCTION)s, arg_tuple, kwargs);
if (unlikely(kwargs) && (kwargs != %(PRINT_
FUNCTION
)s))
if (unlikely(kwargs) && (kwargs != %(PRINT_
KWARGS
)s))
Py_DECREF(kwargs);
Py_DECREF(kwargs);
if (!result)
if (!result)
return -1;
return -1;
Py_DECREF(result);
Py_DECREF(result);
return 0;
return 0;
bad:
bad:
if (kwargs != %(PRINT_
FUNCTION
)s)
if (kwargs != %(PRINT_
KWARGS
)s)
Py_XDECREF(kwargs);
Py_XDECREF(kwargs);
return -1;
return -1;
}
}
...
...
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