cvsuser 04/12/23 20:42:00
Modified: . MANIFEST
classes complex.pmc
dynclasses pyobject.pmc
languages/python/t/pie b5.t
Added: t/dynclass pycomplex.t
Log:
t/pie/b5.t now passes
*** Note to Leo: take a look at the comment in complex.pmc as well as
the new t/dynclass/pycomplex.t test. Bug in MMD inheritance?
Revision Changes Path
1.811 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.810
retrieving revision 1.811
diff -u -r1.810 -r1.811
--- MANIFEST 23 Dec 2004 23:49:31 -0000 1.810
+++ MANIFEST 24 Dec 2004 04:41:54 -0000 1.811
@@ -2795,6 +2795,7 @@
t/benchmarks.t []
t/dynclass/pybuiltin.t []
t/dynclass/pyclass.t []
+t/dynclass/pycomplex.t []
t/dynclass/pyfunc.t []
t/dynclass/pyint.t []
t/harness []
1.16 +12 -5 parrot/classes/complex.pmc
Index: complex.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/complex.pmc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- complex.pmc 12 Dec 2004 23:03:45 -0000 1.15
+++ complex.pmc 24 Dec 2004 04:41:55 -0000 1.16
@@ -1,6 +1,6 @@
/*
Copyright: 2004 The Perl Foundation. All Rights Reserved.
-$Id: complex.pmc,v 1.15 2004/12/12 23:03:45 chromatic Exp $
+$Id: complex.pmc,v 1.16 2004/12/24 04:41:55 rubys Exp $
=head1 NAME
@@ -794,14 +794,21 @@
*/
INTVAL is_equal (PMC* value) {
- if(value->vtable->base_type == enum_class_Complex)
+MMD_Complex: {
return (INTVAL)(
RE(SELF) == RE(value) &&
IM(SELF) == IM(value)
);
- if(IM(SELF) != 0.0)
- return (INTVAL)0;
- return (RE(SELF) == VTABLE_get_number(INTERP, value));
+ }
+MMD_Float: {
+/*
+ XXX: the above really should be MMD_DEFAULT, but that causes
+ t/dynclass/pycomplex.t to fail.
+*/
+ if(IM(SELF) != 0.0)
+ return (INTVAL)0;
+ return (RE(SELF) == VTABLE_get_number(INTERP, value));
+ }
}
/*
1.15 +5 -2 parrot/dynclasses/pyobject.pmc
Index: pyobject.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pyobject.pmc,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- pyobject.pmc 23 Dec 2004 23:49:33 -0000 1.14
+++ pyobject.pmc 24 Dec 2004 04:41:56 -0000 1.15
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: pyobject.pmc,v 1.14 2004/12/23 23:49:33 rubys Exp $
+$Id: pyobject.pmc,v 1.15 2004/12/24 04:41:56 rubys Exp $
=head1 NAME
@@ -668,7 +668,10 @@
*/
void morph (INTVAL type) {
- if (type == enum_class_BigInt) type = PyBuiltin_PyLong;
+ switch (type) {
+ case enum_class_BigInt: type = PyBuiltin_PyLong; break;
+ case enum_class_Complex: type = PyBuiltin_PyComplex; break;
+ }
pmc_reuse(INTERP, SELF, type, 0);
}
1.15 +2 -5 parrot/languages/python/t/pie/b5.t
Index: b5.t
===================================================================
RCS file: /cvs/public/parrot/languages/python/t/pie/b5.t,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- b5.t 23 Dec 2004 23:49:35 -0000 1.14
+++ b5.t 24 Dec 2004 04:41:59 -0000 1.15
@@ -1,4 +1,4 @@
-# $Id: b5.t,v 1.14 2004/12/23 23:49:35 rubys Exp $
+# $Id: b5.t,v 1.15 2004/12/24 04:41:59 rubys Exp $
use strict;
use lib '../../lib';
@@ -137,10 +137,8 @@
main()
CODE
-SKIP: {
- skip("dictionaries with non-string keys", 1);
test(<<'CODE', 'check_functions complex, dict');
-show = True
+show = False # order of dictionary keys is non-deterministic
def check(a, b):
if __debug__:
@@ -164,7 +162,6 @@
if __name__ == '__main__':
main()
CODE
-}
test(<<'CODE', 'check_functions divmod');
show = True
1.1 parrot/t/dynclass/pycomplex.t
Index: pycomplex.t
===================================================================
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
# $Id: pycomplex.t,v 1.1 2004/12/24 04:42:00 rubys Exp $
=head1 NAME
t/pmc/pyint.t - Python Complex type
=head1 SYNOPSIS
% perl -Ilib t/dynclass/pyint.t
=head1 DESCRIPTION
Tests the Python Integer PMC.
=cut
use Parrot::Test tests => 1;
output_is(<< 'CODE', << 'OUTPUT', "eq");
##PIR##
.sub main @MAIN
loadlib P1, "python_group"
new $P1, "PyComplex"
new $P2, "PyComplex"
set $P1, "3+4j"
set $P2, "3+4j"
iseq $I0, $P1, $P2
print $I0
print "\n"
.end
CODE
1
OUTPUT