File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -419,6 +419,20 @@ public static ListExtendNode create() {
419
419
}
420
420
}
421
421
422
+ // list.copy()
423
+ @ Builtin (name = "copy" , minNumOfPositionalArgs = 1 )
424
+ @ GenerateNodeFactory
425
+ public abstract static class ListCopyNode extends PythonUnaryBuiltinNode {
426
+
427
+ @ Specialization (limit = "3" )
428
+ PList copySequence (PList self ,
429
+ @ Cached SequenceStorageNodes .CopyNode copy ,
430
+ @ CachedLibrary ("self" ) PythonObjectLibrary plib ) {
431
+ return factory ().createList (plib .getLazyPythonClass (self ), copy .execute (self .getSequenceStorage ()));
432
+ }
433
+
434
+ }
435
+
422
436
// list.insert(i, x)
423
437
@ Builtin (name = "insert" , minNumOfPositionalArgs = 3 )
424
438
@ GenerateNodeFactory
Original file line number Diff line number Diff line change 38
38
# SOFTWARE.
39
39
40
40
41
- def copy (self ):
42
- return self [:]
43
-
44
-
45
- list .copy = copy
46
-
47
-
48
41
def sort (self , key = None , reverse = False ):
49
42
if reverse :
50
43
if key :
You can’t perform that action at this time.
0 commit comments