Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subclassing the bool from long instead int object. #1424

Open
wants to merge 6 commits into
base: py3
Choose a base branch
from

Conversation

Daetalus
Copy link
Contributor

@Daetalus Daetalus commented Jul 1, 2017

In Python 2, the bool object is essentially an int object. In Python 3, it is long object. This PR subclass the bool object from long instead of the int. Preparing for removing the int object completely.

@Daetalus
Copy link
Contributor Author

Daetalus commented Jul 3, 2017

@kmod

complex_cls->tp_mro = BoxedTuple::create({ complex_cls, object_cls });
long_cls->tp_mro = BoxedTuple::create({ long_cls, object_cls });
bool_cls->tp_mro = BoxedTuple::create({ bool_cls, int_cls, object_cls });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to update this to be long_cls instead of int_cls.

@kmod
Copy link
Collaborator

kmod commented Jul 8, 2017

Looks awesome! Let's get a small test file set up, something like this:

long_ = type(1L)
assert isinstance(True, long_)
assert issubclass(bool, long_)
print(bool.__bases__)

In Python 2, the bool object just a int object. In Python 3, the bool object become long object. So change the bool object to the subclass of long object, prepare for other Python 3 updates.
If any tests ready to python 3, we need to add 'py3ready' flag in the beginning of the file
cmake 2 can not build target Ninja.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants