Ticket #879 (new bug)

Opened 7 years ago

Last modified 7 years ago

isa does not take (correctly) namespace, pmcarray,stringarray

Reported by: jessevdam Owned by:
Priority: normal Milestone:
Component: core Version: 1.4.0
Severity: medium Keywords: isa
Cc: Language:
Patch status: new Platform: all


When running this code isa returns true while it should return false

$P1 = #object of type 'FOO::BAR::TEST'

$P3 = get_hll_namespace [ 'FOO';'BAR2';'Object']

$I1 = isa $P1,$P3

returns true must be false

$P3 = string array with elements "FOO","BAR","TEST"

$I1 = isa $P1,$P3

returns fasle must be true

I solved this problem by replacing the

VTABLE INTVAL isa_pmc(PMC *lookup)

function with the following code

VTABLE INTVAL isa_pmc(PMC *lookup) {

Hash * const isa_hash = SELF->vtable->isa_hash;

+ PMC *classobj;

STRING *pmc_name;

if (PMC_IS_NULL(lookup))

return 0;

+ classobj = Parrot_oo_get_class(interp, lookup);

+ if (PMC_IS_NULL(classobj))

+ return 0;

-+ pmc_name = VTABLE_get_string(interp, classobj);

if (!isa_hash)

return Parrot_str_equal(interp, SELF->vtable->whoami, pmc_name);

/* RT #46665 - walk mro */

return parrot_hash_exists(INTERP, isa_hash, (void*)pmc_name);


I'am not sure it's completely correct, because i do not know how the mro isa_hash is build up.

Adding this code will make 2 test failing in the t/tests/objects.t test set, because there are more bugs present, I made seperate ticket for that one

Change History

Changed 7 years ago by jessevdam

See ticket #880

Changed 7 years ago by jessevdam

t/pmc/objects.t test does not detect this faulty condition.

Changed 7 years ago by pmichaud

See also TT #8, which addresses a similar issue about various forms of class identification being inconsistent or not working properly.


Note: See TracTickets for help on using tickets.