| 630 | } |
| 631 | |
| 632 | Object::ObjectType |
| 633 | Object::objectType() const |
| 634 | { |
| 635 | // clang-format off |
| 636 | constexpr long subclass_mask = |
| 637 | (Pystack_TPFLAGS_INT_SUBCLASS |
| 638 | | Pystack_TPFLAGS_LONG_SUBCLASS |
| 639 | | Pystack_TPFLAGS_LIST_SUBCLASS |
| 640 | | Pystack_TPFLAGS_TUPLE_SUBCLASS |
| 641 | | Pystack_TPFLAGS_BYTES_SUBCLASS |
| 642 | | Pystack_TPFLAGS_UNICODE_SUBCLASS |
| 643 | | Pystack_TPFLAGS_DICT_SUBCLASS |
| 644 | | Pystack_TPFLAGS_BASE_EXC_SUBCLASS |
| 645 | | Pystack_TPFLAGS_TYPE_SUBCLASS); |
| 646 | // clang-format on |
| 647 | |
| 648 | const long subclass_flags = d_flags & subclass_mask; |
| 649 | |
| 650 | if (subclass_flags == Pystack_TPFLAGS_BYTES_SUBCLASS) { |
| 651 | return d_manager->versionIsAtLeast(3, 0) ? ObjectType::BYTES : ObjectType::STRING; |
| 652 | } else if (subclass_flags == Pystack_TPFLAGS_UNICODE_SUBCLASS) { |
| 653 | return ObjectType::STRING; |
| 654 | } else if (subclass_flags == Pystack_TPFLAGS_INT_SUBCLASS) { |
| 655 | if (d_classname == "bool") { |
| 656 | return ObjectType::INT_BOOL; |
| 657 | } |
| 658 | return ObjectType::INT; |
| 659 | } else if (subclass_flags == Pystack_TPFLAGS_LONG_SUBCLASS) { |
| 660 | if (d_classname == "bool") { |
| 661 | return ObjectType::LONG_BOOL; |
| 662 | } |
| 663 | return ObjectType::LONG; |
| 664 | } else if (subclass_flags == Pystack_TPFLAGS_TUPLE_SUBCLASS) { |
| 665 | return ObjectType::TUPLE; |
| 666 | } else if (subclass_flags == Pystack_TPFLAGS_LIST_SUBCLASS) { |
| 667 | return ObjectType::LIST; |
| 668 | } else if (subclass_flags == Pystack_TPFLAGS_DICT_SUBCLASS) { |
| 669 | return ObjectType::DICT; |
| 670 | } else if (d_classname == "float") { |
| 671 | return ObjectType::FLOAT; |
| 672 | } else if (d_classname == "NoneType") { |
| 673 | return ObjectType::NONE; |
| 674 | } else if (d_classname == "code") { |
| 675 | return ObjectType::CODE; |
| 676 | } |
| 677 | return ObjectType::OTHER; |
| 678 | } |
| 679 | |
| 680 | Object::PythonObject |
| 681 | Object::toConcreteObject() const |
no test coverage detected