Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 58c82f0

Browse files
committed
Assorted xreadlines problems:
Wasn't built on Windows; not in config.c either. Module init function missing DL_EXPORT magic. test_xreadline output file obviously wrong (started w/ "test_xrl"). test program very unclear about what was expected.
1 parent 675e1d0 commit 58c82f0

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

Lib/test/output/test_xreadline

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
test_xrl
2-
AttributeError
3-
TypeError
4-
RuntimeError xreadlines object accessed out of order
1+
test_xreadline
2+
AttributeError (expected)
3+
TypeError (expected)
4+
RuntimeError (expected): xreadlines object accessed out of order

Lib/test/test_xreadline.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,26 @@ class Null: pass
1818
try:
1919
xreadlines.xreadlines(Null())[0]
2020
except AttributeError, detail:
21-
print "AttributeError"
21+
print "AttributeError (expected)"
2222
else:
2323
print "Did not throw attribute error"
2424

2525
try:
2626
xreadlines.xreadlines(XReader)[0]
2727
except TypeError, detail:
28-
print "TypeError"
28+
print "TypeError (expected)"
2929
else:
3030
print "Did not throw type error"
3131

3232
try:
3333
xreadlines.xreadlines(XReader())[1]
3434
except RuntimeError, detail:
35-
print "RuntimeError", detail
35+
print "RuntimeError (expected):", detail
3636
else:
3737
print "Did not throw runtime error"
3838

3939
xresult = ['0\n', '1\n', '2\n', '3\n', '0\n', '1\n', '2\n', '0\n', '1\n', '0\n']
4040
for line in xreadlines.xreadlines(XReader()):
41-
if line != xresult[lineno]: print "line %d differs" % lineno
42-
lineno = lineno + 1
41+
if line != xresult[lineno]:
42+
print "line %d differs" % lineno
43+
lineno += 1

Modules/xreadlinesmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static PyMethodDef xreadlines_methods[] = {
109109
{NULL, NULL}
110110
};
111111

112-
void
112+
DL_EXPORT(void)
113113
initxreadlines(void)
114114
{
115115
PyObject *m;

PC/config.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ extern void initmsvcrt(void);
4242
extern void init_locale(void);
4343
#endif
4444
extern void init_codecs(void);
45+
extern void initxreadlines(void);
4546

47+
/* XXX tim: what's the purpose of ADDMODULE MARKER? */
4648
/* -- ADDMODULE MARKER 1 -- */
4749

4850
extern void PyMarshal_Init(void);
@@ -92,7 +94,9 @@ struct _inittab _PyImport_Inittab[] = {
9294
#endif
9395

9496
{"_codecs", init_codecs},
97+
{"xreadlines", initxreadlines},
9598

99+
/* XXX tim: what's the purpose of ADDMODULE MARKER? */
96100
/* -- ADDMODULE MARKER 2 -- */
97101

98102
/* This module "lives in" with marshal.c */

0 commit comments

Comments
 (0)