Fix signature and private module errors that comes from C extension modules #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I've tried to fix the bug that I've explained in issue #59.
My solution to the "no signature found" error is just to provide a default method signature that is very generic and that works on every function. This default method signature is only used when the
inspect
module can't find a method signature and it's just to prevent Pynguin from crashing. This creates a signature that is the same as for this function:However, after correcting this error, I came across two others that were very closely related to it, so I've decided to correct them here too.
First, I got :
I've searched online and I think that this module is only available from C code and not from Python code so I've added a condition that skips modules that come from C code if they are not found using the
inspect
module.Then, I got the following error:
This error comes from the
_ObjectProxyMethods
class that overrides the__module__
attribute. I think that normally, the__module__
attribute is defined on the class and not on instances. I tried to create a custom property class that would keep the existing behavior but that would add the normal behavior on the_ObjectProxyMethods
class but that custom property would only work on "normal" methods and not on dunder methods so this idea was abandoned. Instead, I've just added a condition that skips when a__module__
attribute is aproperty
instead of astr
.What do you think of this solution?
Kind regards and have a nice day!