-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
The File object's readat and writeat function could not use long parameters.
The problems are as followed:
User traceback:
Exception (with type 'exceptions.OverflowError'): Python int too large to convert to C long
The test file is as followed:
if "test.txt" in listfiles():
removefile("test.txt")
myfile=openfile("test.txt",True) #Open a file
myfile.writeat("1234", 0)
data = myfile.readat(2**32, 0)
myfile.close()
However from the file https://github.com/SeattleTestbed/docs/blob/master/EducationalAssignments/SetMaxFileSizePartOne.md#building-the-security-layer
It seems it should allow long type in all the functions including setmaxfilesize, writeat, readat.
# The code here sets up type checking and variable hiding for you. You should not need to change anything below here.
sec_file_def = {"obj-type":SecureFile,
"name":"SecureFile",
"setmaxfilesize":{"type":"func","args":(int,long, type(None)),"exceptions":Exception,"return":(type(None)),"target":SecureFile.setmaxfilesize},
"writeat":{"type":"func","args":(str,(int,long)),"exceptions":Exception,"return":(int,type(None)),"target":SecureFile.writeat},
"readat":{"type":"func","args":((int,long,type(None)),(int,long)),"exceptions":Exception,"return":str,"target":SecureFile.readat},
"close":{"type":"func","args":None,"exceptions":None,"return":(bool,type(None)),"target":SecureFile.close}
}
Metadata
Metadata
Assignees
Labels
No labels