File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1503,12 +1503,12 @@ pub const List = extern struct {
15031503
15041504 // Return true if p is a list object or an instance of a subtype of the list type. This function always succeeds.
15051505 pub inline fn check (obj : * const Object ) bool {
1506- return c .PyList_Check (@constCast (@ptrCast (obj ))) != 0 ;
1506+ return c .PyList_Check (@as ([ * c ] c . PyObject , @ constCast (@ptrCast (obj ) ))) != 0 ;
15071507 }
15081508
15091509 // Return true if p is a list object, but not an instance of a subtype of the list type. This function always succeeds.
15101510 pub inline fn checkExact (obj : * const Object ) bool {
1511- return c .PyList_Check (@constCast (@ptrCast (obj ))) != 0 ;
1511+ return c .PyList_Check (@as ([ * c ] c . PyObject , @ constCast (@ptrCast (obj ) ))) != 0 ;
15121512 }
15131513
15141514 // Return a new empty dictionary, or NULL on failure.
@@ -1520,6 +1520,12 @@ pub const List = extern struct {
15201520 return error .PyError ;
15211521 }
15221522
1523+ // Create a new copy of this list
1524+ // Returns new reference
1525+ pub inline fn copy (self : * List ) ! * List {
1526+ return self .getSlice (0 , self .sizeUnchecked ());
1527+ }
1528+
15231529 // Same as length but no error checking
15241530 pub inline fn size (self : * List ) ! usize {
15251531 const r = self .sizeUnchecked ();
You can’t perform that action at this time.
0 commit comments