Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(226)

Unified Diff: Modules/_io/stringio.c

Issue 20435: Discrepancy between io.StringIO and _pyio.StringIO with univeral newlines
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_memoryio.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/_io/stringio.c Wed Jan 29 11:45:31 2014 +0200
+++ b/Modules/_io/stringio.c Wed Jan 29 12:16:31 2014 +0200
@@ -735,14 +735,12 @@
else
value_len = 0;
if (value_len > 0) {
- /* This is a heuristic, for newline translation might change
- the string length. */
- if (resize_buffer(self, 0) < 0)
+ if (resize_buffer(self, value_len) < 0)
return -1;
+ if (!PyUnicode_AsUCS4(value, self->buf, value_len, 0))
+ return -1;
+ self->string_size = self->pos = value_len;
self->state = STATE_REALIZED;
- self->pos = 0;
- if (write_str(self, value) < 0)
- return -1;
}
else {
/* Empty stringio object, we can start by accumulating */
« no previous file with comments | « Lib/test/test_memoryio.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+