ImportHook cleanup + PyObject.Length exception by lostmsu · Pull Request #1400 · pythonnet/pythonnet

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@lostmsu

Copy link Copy Markdown

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 Copy Markdown

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

Reviewers

@filmor filmor filmor approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@lostmsu @filmor