Skip to content

Conversation

@Snowapril
Copy link
Contributor

This revision implements itemsize slots and fix best_base implementation to select proper base class when generating class.

test(123456, "*=20", '**************123456')

@unittest.expectedFailure
@run_with_locale('LC_NUMERIC', 'en_US.UTF8')
Copy link
Member

Choose a reason for hiding this comment

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

This line is not expected to be removed.

flags(BASETYPE),
with(PyRef, Comparable, Hashable, Constructor, AsNumber, Representable)
with(PyRef, Comparable, Hashable, Constructor, AsNumber, Representable),
itemsize(BigInt)
Copy link
Member

Choose a reason for hiding this comment

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

I don't get how this is intended to be used yet. How to handle it if it requires multiple fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was not intended for multiple types to be declared with itemsize.
In the pyclass code, if the number of types declared with itemsize is not one, it is planned to raise an error in a way that developers can understand. Unlike basicsize, it seems difficult to automatically infer item type for each class delcaration, so I have chosen this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm.. I think itemsize implementation is better to be moved to other PRs. It seems it does not cause wrong behavior in best_base.

@Snowapril Snowapril force-pushed the best_base branch 2 times, most recently from 0964777 to d3e7b31 Compare May 18, 2024 08:44
@Snowapril Snowapril marked this pull request as ready for review May 18, 2024 09:04
@Snowapril
Copy link
Contributor Author

I can't reproduce test_types::test_int__format__locale failure in WSL ubuntu 22.04. It also seems not related to this PR. . 😂

Comment on lines 424 to 425
if sys.platform != "darwin":
test_int__format__locale = unittest.expectedFailure(test_int__format__locale)
Copy link
Member

Choose a reason for hiding this comment

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

Reverting this will fix the failing test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh my.. That code accidentally got included in the commit. I've fixed it!

Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

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

Thank you!

Comment on lines +1375 to +1376
debug_assert!(base.is_some());
Ok(base.unwrap())
Copy link
Member

Choose a reason for hiding this comment

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

unwrap implies panic!. So debug_assert! is duplication.

Suggested change
debug_assert!(base.is_some());
Ok(base.unwrap())
Ok(base.expect("best_base must exist"))

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