From 58c82f0b56e79e1682018dbb22fa1afd4f67a464 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 9 Jan 2001 23:26:39 +0000 Subject: 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. --- Lib/test/output/test_xreadline | 8 ++++---- Lib/test/test_xreadline.py | 11 ++++++----- Modules/xreadlinesmodule.c | 2 +- PC/config.c | 4 ++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Lib/test/output/test_xreadline b/Lib/test/output/test_xreadline index 217bca0..2b84210 100644 --- a/Lib/test/output/test_xreadline +++ b/Lib/test/output/test_xreadline @@ -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 diff --git a/Lib/test/test_xreadline.py b/Lib/test/test_xreadline.py index 84f7ba4..6f2de7e 100644 --- a/Lib/test/test_xreadline.py +++ b/Lib/test/test_xreadline.py @@ -18,25 +18,26 @@ lineno = 0 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 diff --git a/Modules/xreadlinesmodule.c b/Modules/xreadlinesmodule.c index c50dd06..dc74f5d 100644 --- a/Modules/xreadlinesmodule.c +++ b/Modules/xreadlinesmodule.c @@ -109,7 +109,7 @@ static PyMethodDef xreadlines_methods[] = { {NULL, NULL} }; -void +DL_EXPORT(void) initxreadlines(void) { PyObject *m; diff --git a/PC/config.c b/PC/config.c index 6d6a79f..c96eb26 100644 --- a/PC/config.c +++ b/PC/config.c @@ -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); @@ -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 */ -- cgit v0.12