-
Notifications
You must be signed in to change notification settings - Fork 747
Try to be strict around non-copyability #2440
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,5 +232,6 @@ public string ToString(string format, IFormatProvider formatProvider) | |
} | ||
|
||
public override TypeCode GetTypeCode() => TypeCode.Int64; | ||
public override int GetHashCode() => ((PyObject)this).GetHashCode(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,8 +83,8 @@ internal static unsafe void DecrefTypeAndFree(StolenReference ob) | |
|
||
var freePtr = Util.ReadIntPtr(type, TypeOffset.tp_free); | ||
Debug.Assert(freePtr != IntPtr.Zero); | ||
var free = (delegate* unmanaged[Cdecl]<StolenReference, void>)freePtr; | ||
free(ob); | ||
var free = (delegate* unmanaged[Cdecl]<ref StolenReference, void>)freePtr; | ||
free(ref ob); | ||
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is wrong. It does not say anywhere but I'd expect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, that's probably one reason for the crashes :) |
||
|
||
Runtime.XDecref(StolenReference.DangerousFromPointer(type.DangerousGetAddress())); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### New Rules | ||
|
||
Rule ID | Category | Severity | Notes | ||
--------|----------|----------|-------------------- | ||
NoCopy99|Correction| Warning | N/A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it would just stackoverflow