Parser.Tabular handles Stdio.File objects bad
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=5792
Reported by Erik Dahl erikd@roxen.com
Pike v7.8 release 468 running Hilfe v3.5 (Incremental Pike Frontend)
> Parser.Tabular(Stdio.File("data.csv"), Stdio.File("format.csv"));
Does not work.
If you changes those into Stdio.FILE object everything is fine.
The line that contains this statement is the fishy one:
(input=Stdio.FILE())->assign(input);
These changes helped me (maybe there are better ways?):
diff -u Tabular.pike.orig Tabular.pike
--- Tabular.pike.orig 2010-11-11 01:02:43.000000000 +0100
+++ Tabular.pike 2010-11-11 01:13:47.000000000 +0100
@@ -666,8 +666,11 @@
input="";
if(stringp(input))
input=Stdio.FakeFile(input);
- if(!input->unread)
- (input=Stdio.FILE())->assign(input);
+ if(!input->unread) {
+ Stdio.FILE tmpf = Stdio.FILE();
+ tmpf->assign(input);
+ input = tmpf;
+ }
int started=0;
int lineno=0;
string beginend="Tabular description ";