-
Notifications
You must be signed in to change notification settings - Fork 23
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
Remove deprecation warning that may create errors #117
Conversation
I would remove the lines instead of commenting them. |
Well, thank @pchaillo for the PR. In the past the function was probably supposed to be used that way: Using a 'null' string instead of None to pass a None parameter was a bad idea it was probably fixed to replace it with None. As the error message says it (badly): DeprecationWarning("Attention, old_indices est à 'null', the new norm is old_indices = None") To fix the error you need to stop pass 'null' in the old_indices parameters and use None. If you want to make a PR:
|
|
I still vote for a removal : it's been a year, plus the code has been added to the library with the deprecation warning. So I think it's safe to remove it. But it would be interesting to understand why it triggers an error (and not just a warning as it's supposed to). |
The observed behavior is what is expected to be. The calling point is probably using the old convention passing "null" as parameter. This rise a DeprecationWarning. The exception, if not try-excepted, propagates through the call stack up to the top-level which is actually the SofaPython3 binding. At the place, an exception handler convert it into a Sofa.msg_error... which print an "error". And thus, depsite Sofa shows it as an Error instead of the Deprecation, the behavior is the one expected... reporting to users they are using the old API. Small test... import Sofa
def test(root=None):
if root == "null":
raise DeprecationWarning("Yo lo")
root.addChild("This should work")
def createScene(root):
root.addChild("First")
test("null")
root.addChild("Second") Results in: [ERROR] [SofaPython3::SceneLoader] Unable to completely load the scene from file '/home/dmarchal/projects/dev/sofa1/build-clang/bin/test.py'.
Python exception:
DeprecationWarning: Yo lo
At:
/home/dmarchal/projects/dev/sofa1/build-clang/bin/test.py(5): test
/home/dmarchal/projects/dev/sofa1/build-clang/bin/test.py(10): createScene |
Okay I see. |
Here is the improvement for Sofa... but it should probably be generalized to few others points and not only in the SceneLoader. sofa-framework/SofaPython3#384 |
On my computer, these 3 lines create an error after my python update (I don't know why).
To be sure to avoid them for users, I just remove it.
What do you think ?