mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
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.
This commit is contained in:
parent
675e1d0a0d
commit
58c82f0b56
4 changed files with 15 additions and 10 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
test_xrl
|
test_xreadline
|
||||||
AttributeError
|
AttributeError (expected)
|
||||||
TypeError
|
TypeError (expected)
|
||||||
RuntimeError xreadlines object accessed out of order
|
RuntimeError (expected): xreadlines object accessed out of order
|
||||||
|
|
|
||||||
|
|
@ -18,25 +18,26 @@ lineno = 0
|
||||||
try:
|
try:
|
||||||
xreadlines.xreadlines(Null())[0]
|
xreadlines.xreadlines(Null())[0]
|
||||||
except AttributeError, detail:
|
except AttributeError, detail:
|
||||||
print "AttributeError"
|
print "AttributeError (expected)"
|
||||||
else:
|
else:
|
||||||
print "Did not throw attribute error"
|
print "Did not throw attribute error"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xreadlines.xreadlines(XReader)[0]
|
xreadlines.xreadlines(XReader)[0]
|
||||||
except TypeError, detail:
|
except TypeError, detail:
|
||||||
print "TypeError"
|
print "TypeError (expected)"
|
||||||
else:
|
else:
|
||||||
print "Did not throw type error"
|
print "Did not throw type error"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xreadlines.xreadlines(XReader())[1]
|
xreadlines.xreadlines(XReader())[1]
|
||||||
except RuntimeError, detail:
|
except RuntimeError, detail:
|
||||||
print "RuntimeError", detail
|
print "RuntimeError (expected):", detail
|
||||||
else:
|
else:
|
||||||
print "Did not throw runtime error"
|
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']
|
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()):
|
for line in xreadlines.xreadlines(XReader()):
|
||||||
if line != xresult[lineno]: print "line %d differs" % lineno
|
if line != xresult[lineno]:
|
||||||
lineno = lineno + 1
|
print "line %d differs" % lineno
|
||||||
|
lineno += 1
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ static PyMethodDef xreadlines_methods[] = {
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
DL_EXPORT(void)
|
||||||
initxreadlines(void)
|
initxreadlines(void)
|
||||||
{
|
{
|
||||||
PyObject *m;
|
PyObject *m;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ extern void initmsvcrt(void);
|
||||||
extern void init_locale(void);
|
extern void init_locale(void);
|
||||||
#endif
|
#endif
|
||||||
extern void init_codecs(void);
|
extern void init_codecs(void);
|
||||||
|
extern void initxreadlines(void);
|
||||||
|
|
||||||
|
/* XXX tim: what's the purpose of ADDMODULE MARKER? */
|
||||||
/* -- ADDMODULE MARKER 1 -- */
|
/* -- ADDMODULE MARKER 1 -- */
|
||||||
|
|
||||||
extern void PyMarshal_Init(void);
|
extern void PyMarshal_Init(void);
|
||||||
|
|
@ -92,7 +94,9 @@ struct _inittab _PyImport_Inittab[] = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{"_codecs", init_codecs},
|
{"_codecs", init_codecs},
|
||||||
|
{"xreadlines", initxreadlines},
|
||||||
|
|
||||||
|
/* XXX tim: what's the purpose of ADDMODULE MARKER? */
|
||||||
/* -- ADDMODULE MARKER 2 -- */
|
/* -- ADDMODULE MARKER 2 -- */
|
||||||
|
|
||||||
/* This module "lives in" with marshal.c */
|
/* This module "lives in" with marshal.c */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue