Skip to content

feat: port to mojo nightly 20250426 #9

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

Merged
merged 2 commits into from
Apr 28, 2025

Conversation

winding-lines
Copy link
Collaborator

The following changes are affecting us:

  1. Python lists are not created from literals anymore, one need to create them explicitly
  2. A String api has changed
  3. The compiler complained about assigning a new pointer to new ptr in grow, I implemented a swap method since that seems more correct anyway.

Let me know what you think.

@@ -29,6 +29,19 @@ struct Buffer(Movable):
self.size = existing.size
self.owns = existing.owns

fn swap(mut self, mut other: Self):
Copy link
Owner

Choose a reason for hiding this comment

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

Can you cover this method explicitly with a test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call, added.

@@ -23,7 +23,8 @@ def test_schema_from_pyarrow():
def test_primitive_array_from_pyarrow():
var pa = Python.import_module("pyarrow")
var pyarr = pa.array(
[1, 2, 3, 4, 5], mask=[False, False, False, False, True]
PythonObject.list(1, 2, 3, 4, 5),
Copy link
Owner

Choose a reason for hiding this comment

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

Ouch, can you point me to the relevant mojo change?

Copy link
Collaborator Author

@winding-lines winding-lines Apr 28, 2025

Choose a reason for hiding this comment

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

I am not sure exactly which one is the main commit but these are in the stream:

Somewhat related, the string changes: modular/modular@edbbc46

Copy link
Collaborator Author

@winding-lines winding-lines Apr 28, 2025

Choose a reason for hiding this comment

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

This is the changelog https://github.com/modular/max/blob/main/mojo/docs/changelog.md#standard-library-changes

PythonObject is no longer implicitly constructible from tuple or list literals, e.g. var x : PythonObject = [1, 2, "foo"] is no longer accepted. Instead, please use named constructors like var x = Python.list(1, 2, "foo"). We hope to re-enable the syntax in the future as the standard library matures.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for the pointers! This is unfortunate but maybe we can restore it later on.

@kszucs kszucs merged commit 7e4b5e1 into kszucs:main Apr 28, 2025
1 check passed
@winding-lines winding-lines deleted the mojo-20250426 branch April 28, 2025 18:34
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