summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-08-04 18:28:44 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-08-04 18:28:44 (GMT)
commitcd280fb59c6dfc84e0a138039e541ef46df7fb0b (patch)
treeef2fd2f8b57368739c7b31ee9c9d44c8598c9740 /Parser
parent2c3f9c6f04009f01aec1e10a1b6f926372d0f8fe (diff)
downloadcpython-cd280fb59c6dfc84e0a138039e541ef46df7fb0b.zip
cpython-cd280fb59c6dfc84e0a138039e541ef46df7fb0b.tar.gz
cpython-cd280fb59c6dfc84e0a138039e541ef46df7fb0b.tar.bz2
Group statements properly.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index b1a9ee1..0ae093e 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -319,13 +319,15 @@ fp_readl(char *s, int size, struct tok_state *tok)
PyObject* buf = tok->decoding_buffer;
if (buf == NULL) {
buf = PyObject_CallObject(tok->decoding_readline, NULL);
- if (buf == NULL) return error_ret(tok);
+ if (buf == NULL)
+ return error_ret(tok);
} else {
tok->decoding_buffer = NULL;
}
utf8 = PyUnicode_AsUTF8String(buf);
Py_DECREF(buf);
- if (utf8 == NULL) return error_ret(tok);
+ if (utf8 == NULL)
+ return error_ret(tok);
else {
const char* str = PyString_AsString(utf8);
assert(strlen(str) < (size_t)size); /* XXX */
@@ -352,15 +354,18 @@ fp_setreadl(struct tok_state *tok, const char* enc)
PyObject *reader, *stream, *readline;
stream = PyFile_FromFile(tok->fp, tok->filename, "rb", NULL);
- if (stream == NULL) return 0;
+ if (stream == NULL)
+ return 0;
reader = PyCodec_StreamReader(enc, stream, NULL);
Py_DECREF(stream);
- if (reader == NULL) return 0;
+ if (reader == NULL)
+ return 0;
readline = PyObject_GetAttrString(reader, "readline");
Py_DECREF(reader);
- if (readline == NULL) return 0;
+ if (readline == NULL)
+ return 0;
tok->decoding_readline = readline;
return 1;
@@ -386,7 +391,7 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
{
char *line;
int warn = 0, badchar = 0;
- for (;;)
+ for (;;) {
if (tok->decoding_state < 0) {
/* We already have a codec associated with
this input. */
@@ -406,6 +411,7 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
return error_ret(tok);
assert(tok->decoding_state != 0);
}
+ }
if (line != NULL && tok->lineno < 2 && !tok->read_coding_spec) {
if (!check_coding_spec(line, strlen(line), tok, fp_setreadl)) {
return error_ret(tok);