Skip to content

Commit

Permalink
Assorted xreadlines problems:
Browse files Browse the repository at this point in the history
    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.
  • Loading branch information
tim-one committed Jan 9, 2001
1 parent 675e1d0 commit 58c82f0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Lib/test/output/test_xreadline
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_xrl
AttributeError
TypeError
RuntimeError xreadlines object accessed out of order
test_xreadline
AttributeError (expected)
TypeError (expected)
RuntimeError (expected): xreadlines object accessed out of order
11 changes: 6 additions & 5 deletions Lib/test/test_xreadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@ class Null: pass
try:
xreadlines.xreadlines(Null())[0]
except AttributeError, detail:
print "AttributeError"
print "AttributeError (expected)"
else:
print "Did not throw attribute error"

try:
xreadlines.xreadlines(XReader)[0]
except TypeError, detail:
print "TypeError"
print "TypeError (expected)"
else:
print "Did not throw type error"

try:
xreadlines.xreadlines(XReader())[1]
except RuntimeError, detail:
print "RuntimeError", detail
print "RuntimeError (expected):", detail
else:
print "Did not throw runtime error"

xresult = ['0\n', '1\n', '2\n', '3\n', '0\n', '1\n', '2\n', '0\n', '1\n', '0\n']
for line in xreadlines.xreadlines(XReader()):
if line != xresult[lineno]: print "line %d differs" % lineno
lineno = lineno + 1
if line != xresult[lineno]:
print "line %d differs" % lineno
lineno += 1
2 changes: 1 addition & 1 deletion Modules/xreadlinesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static PyMethodDef xreadlines_methods[] = {
{NULL, NULL}
};

void
DL_EXPORT(void)
initxreadlines(void)
{
PyObject *m;
Expand Down
4 changes: 4 additions & 0 deletions PC/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ extern void initmsvcrt(void);
extern void init_locale(void);
#endif
extern void init_codecs(void);
extern void initxreadlines(void);

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

extern void PyMarshal_Init(void);
Expand Down Expand Up @@ -92,7 +94,9 @@ struct _inittab _PyImport_Inittab[] = {
#endif

{"_codecs", init_codecs},
{"xreadlines", initxreadlines},

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

/* This module "lives in" with marshal.c */
Expand Down

0 comments on commit 58c82f0

Please sign in to comment.