Use create_simple_object for a lot of use cases
This commit is contained in:
1 parent
2aa2005502
commit
3c78aad8b1
6 files changed
+15
-6
No files matched your search
@@ -22,6 +22,15 @@ def builtin_from_name(evaluator, string):
|
||||
return create(evaluator, bltn_obj)
|
||||
|
||||
|
||||
def create_simple_object(evaluator, obj):
|
||||
"""
|
||||
Only allows creations of objects that are easily picklable across Python
|
||||
versions.
|
||||
"""
|
||||
assert isinstance(obj, (int, float, str, bytes, slice, complex, type(Ellipsis)))
|
||||
return create(evaluator, obj)
|
||||
|
||||
|
||||
def create(evaluator, obj):
|
||||
return create_from_access(
|
||||
evaluator, create_access(evaluator, obj)
|
||||
|
||||
Reference in new issue
Block a user