[svn:parrot] r39207 - branches/io_rewiring/src/io

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Thu May 28 00:30:46 UTC 2009


Author: whiteknight
Date: Thu May 28 00:30:45 2009
New Revision: 39207
URL: https://trac.parrot.org/parrot/changeset/39207

Log:
[io_rewiring] Parrot_io_open checks for PMCs that does 'file'

Modified:
   branches/io_rewiring/src/io/api.c

Modified: branches/io_rewiring/src/io/api.c
==============================================================================
--- branches/io_rewiring/src/io/api.c	Thu May 28 00:28:06 2009	(r39206)
+++ branches/io_rewiring/src/io/api.c	Thu May 28 00:30:45 2009	(r39207)
@@ -120,8 +120,12 @@
 
     if (PMC_IS_NULL(pmc))
         new_filehandle = pmc_new(interp, enum_class_FileHandle);
-    else
+    else {
+        if (!VTABLE_does(interp, pmc, CONST_STRING(interp, "file")))
+            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
+                "Can only open a PMC that does 'file'");
         new_filehandle = pmc;
+    }
 
     flags = Parrot_io_parse_open_flags(interp, mode);
     filehandle = PIO_OPEN(interp, new_filehandle, path, flags);


More information about the parrot-commits mailing list