The Wayback Machine - https://web.archive.org/web/20220413052502/https://github.com/pythonnet/pythonnet/pull/1760
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

Miscellaneous fixes and cleanups #1760

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Copy link
Member

@filmor filmor commented Apr 9, 2022

  • Use Py.GIL directly, now that it doesn't try to init anymore
  • Modernise syntax a bit
  • Fix Py.SetArgv for systems that don't support GetCommandLineArgs
  • Modernise syntax in ClassDerived

What does this implement/fix? Explain your changes.

...

Does this close any currently open issues?

...

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Ensure you have signed the .NET Foundation CLA
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

}
return Exceptions.RaiseTypeError("invalid object");
Copy link
Member

@lostmsu lostmsu Apr 9, 2022

Choose a reason for hiding this comment

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

I think keeping input parameter validation returns before the main body is a good practice.

}

return new EventBinding(self.name, self.reg, new PyObject(ob)).Alloc();
return Exceptions.RaiseTypeError("invalid argument");
Copy link
Member

@lostmsu lostmsu Apr 9, 2022

Choose a reason for hiding this comment

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

Same, validate and quick exit.

Copy link
Member Author

@filmor filmor Apr 10, 2022

Choose a reason for hiding this comment

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

I agree with this in general, but here this would mean that instead of a single RaiseTypeError with a particular string, we need two, which does not look like an advantage to me.

Copy link
Member

@lostmsu lostmsu Apr 10, 2022

Choose a reason for hiding this comment

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

I think the old version is easier to read. Nesting makes it harder.

}
return Exceptions.RaiseTypeError("invalid target");
Copy link
Member

@lostmsu lostmsu Apr 9, 2022

Choose a reason for hiding this comment

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

Same

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.

None yet

2 participants