]> granicus.if.org Git - python/commitdiff
Assorted xreadlines problems:
authorTim Peters <tim.peters@gmail.com>
Tue, 9 Jan 2001 23:26:39 +0000 (23:26 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 9 Jan 2001 23:26:39 +0000 (23:26 +0000)
    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
Lib/test/test_xreadline.py
Modules/xreadlinesmodule.c
PC/config.c

index 217bca090c9694223f016f0c3839203e034f8ef9..2b84210a5be3b8fc568023c3b1342f0450e4e6ec 100644 (file)
@@ -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
index 84f7ba42b08f7267dd6416de4f26f8b78aef5d6c..6f2de7e68003e1b45355129c602ca847fd7491ff 100644 (file)
@@ -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
index c50dd06c6cc75d6ddfe2d987e418edacef16f45b..dc74f5dc435d3fd89dd5a3a4ec2c413a82deb040 100644 (file)
@@ -109,7 +109,7 @@ static PyMethodDef xreadlines_methods[] = {
        {NULL, NULL}
 };
 
-void
+DL_EXPORT(void)
 initxreadlines(void)
 {
        PyObject *m;
index 6d6a79fc2c5e0b62ca8e975fb45a4515167cb02f..c96eb26af1e94c472ac3838ed57c4813656fb45f 100644 (file)
@@ -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 */