🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@den-run-ai
Copy link
Contributor

this fixes issue #131

I tested on System.Math.Abs(50.5) & System.Math.Max(50.5,50.1)

@den-run-ai
Copy link
Contributor Author

@tonyroberts tests FAILED (errors=36), any idea how to fix this?

@den-run-ai
Copy link
Contributor Author

@tonyroberts please let me know if you can merge this PR? I still need to write some tests for cases described in this issue #131.

if (pyoptype != IntPtr.Zero) { }
type = Converter.GetTypeByAlias(pyoptype);
}
//Runtime.Decref(pyoptype);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is pyoptype being leaked here? PyObject_Type returns a new reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tonyroberts I'm not sure here, I actually wanted to ask you how to clean this up, especially if there is exception thrown? That's why I have Runtime.Decref(pyoptype) commented out :)

//try {
pyoptype = Runtime.PyObject_Type(op);
/*}
catch (System.Exception) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't leave commented code - you commented it out because it was incorrect; it should be deleted instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deleted

On Tue, Feb 9, 2016 at 1:10 PM, Tony Roberts notifications@github.com
wrote:

In src/runtime/methodbinder.cs
#137 (comment):

                             op = Runtime.PyTuple_GetItem(args, n);
                         }
  •                        Type type = pi[n].ParameterType;
    
  •                        type = null;
    
  •                        if  (_methods.Length>1) {
    
  •                            IntPtr pyoptype = IntPtr.Zero;
    
  •                            //try {
    
  •                                pyoptype = Runtime.PyObject_Type(op);
    
  •                            /*}
    
  •                            catch (System.Exception) {
    

Please don't leave commented code - you commented it out because it was
incorrect; it should be deleted instead.


Reply to this email directly or view it on GitHub
https://github.com/pythonnet/pythonnet/pull/137/files#r52357482.

@tonyroberts
Copy link
Contributor

Hi @denfromufa, I've just left a couple more comments. Once you've had a chance to take a look at those you should squash these commits together into a single commit (see git rebase -i).

thanks,
Tony

@den-run-ai
Copy link
Contributor Author

@tonyroberts I use web interface in github without git - so here I'm using the option "Add more commits by pushing to the patch-2 branch on denfromufa/pythonnet":

https://github.com/denfromufa/pythonnet/tree/patch-2

I have a different source control locally.

@tonyroberts
Copy link
Contributor

I've rebased the commits and updated the commit comment to something more meaningful. See PR #151.

I don't really have the time to fix up your pull requests, so please take more care in the future and learn how to use git rebase.

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.

3 participants