-
-
Notifications
You must be signed in to change notification settings - Fork 748
Ensuring PALP fails consistently without returning misleading data #41414
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
base: develop
Are you sure you want to change the base?
Conversation
|
@fchapoton so what do you think does this fix it? |
|
The design of this method is a little weird so I may be overlooking some complication, but I think it would be much simpler if we did the cache check at the beginning of the method, for example: if self._points is not None:
return self._points(*args, **kwds)
# rest of the function
M = self.lattice()
nv = self.n_vertices()
points = self._vertices
...
if len(points) > nv:
points = PointCollection(points, M)
self._points = points
return self._points(*args, **kwds)From what I understand PALP already raises an exception when it fails. So long as the premature |
|
your approach is valid but i kind went this way to only cache on success so i completely avoid any garbage value that might happen, so if everything goes smoothly then i cache otherwise it's just empty |
|
Sure, that is the goal. In my example,
When the class is initiated, Putting that aside for the moment, why catch and re-raise the exception? |
|
I simplified the code structure
|
| current.set_immutable() | ||
| points.append(current) | ||
| if self.dim() > 1: | ||
| result = self. poly_x("p", reduce_dimension=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like an extra space snuck in here between self. and poly_x.
| current.set_immutable() | ||
| for j in range(nv, m.ncols()): | ||
| current = M.element_class( | ||
| M, [m[i, j] for i in range(M. rank())]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
| for j in range(nv, m.ncols()): | ||
| current = M.element_class( | ||
| M, [m[i, j] for i in range(M. rank())]) | ||
| current. set_immutable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
|
Aside from three little typos it LGTM. Can you please add a doctest for the issue in #41400? |
|
i fixed typo i just got used smashing the space button :) |
Co-authored-by: Frédéric Chapoton <[email protected]>
|
Documentation preview for this PR (built with commit c0906c3; changes) is ready! 🎉 |
Description
it addresses issue #41400
where PALP fails and in the first call for n_points it fails (good)
second time it returns the number of vertices (wrong)
Changes
tests