Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ImportHook cleanup + PyObject.Length exception #1400

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 5 commits into from
Feb 27, 2021

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Feb 26, 2021

What does this implement/fix? Explain your changes.

Import

  • adds validation to PyImportTest
  • before restoring original __import__, validates, that __import__ was not replaced by a third party (only in DEBUG build)
  • drops unsupported _PyObject_GetDictPtr in favor of PyObject_GenericGetDict

PyObject

  • Length() method now raises an exception when object does not support concept of length (was returning 0).

@filmor
Copy link
Member

filmor commented Feb 27, 2021

Why do you run the validation only in DEBUG mode?

@lostmsu lostmsu merged commit f2dc8f1 into pythonnet:master Feb 27, 2021
@lostmsu lostmsu deleted the cleanup/21-02-25 branch February 27, 2021 20:52
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