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

Make Python plan attributes private #608

Merged
merged 6 commits into from
Jan 28, 2025

Conversation

janden
Copy link
Collaborator

@janden janden commented Jan 24, 2025

Makes all the attributes private by underscoring their names. They can still be accessed in the public interface, but only as (read-only) properties. This applies for both CPU and GPU code.

Fixes #565.

@janden janden marked this pull request as ready for review January 25, 2025 09:07
@janden janden requested a review from DiamonDinoia January 25, 2025 09:07
@DiamonDinoia
Copy link
Collaborator

if we use @Property do we need to use _dtype internally in read-only the class? AFAIK if we are reading _dtype, dtype would be enough.

@janden
Copy link
Collaborator Author

janden commented Jan 27, 2025

We can do that for all of these properties. Only issue is that the code becomes slightly ugly in places where we need to access both public and private attributes:

        ier = self._make_plan(self.type,
                              self.dim,
                              _n_modes,
                              self._isign,
                              self.n_trans,
                              self._eps,
                              byref(self._plan),
                              self._opts)

@DiamonDinoia
Copy link
Collaborator

I do not have a preference. I will trust your judgement. Once the merge conflicts are solved. I will merge the version you deem more readable.

@janden
Copy link
Collaborator Author

janden commented Jan 27, 2025

Ok. I think I'll revert the last two commits then and rebase. Once all the tests pass, feel free to merge.

@DiamonDinoia DiamonDinoia merged commit cc897a5 into flatironinstitute:master Jan 28, 2025
167 checks passed
janden added a commit to janden/finufft that referenced this pull request Jan 28, 2025
@janden janden mentioned this pull request Jan 28, 2025
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.

python plan interface: modify attributes casues segfault
2 participants