Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upExtend the socket module #1176
Extend the socket module #1176
Comments
Hi, I would like to contribute to extending the socket module. Are there any remaining methods which are not assigned to anybody? Should I open another issue and specify which method I want, preventing others from doing the same thing? Or which method is the first priority? |
@posutsai you could add a series of checkboxes in this issue, and mention what you implement. There is not a fixed list, but there is a helper script to determine the missing methods, called I think it is good to mention here what you will start on. |
I would recommend trying to implement the methods needed by
|
@palaviv According to the document on the official Python website, I have referred to the implementation of Could you give me some hint to implement the function? Sorry for asking such an elementary question, since I just start to learn rust and try to understand it deeper by solving a real problem. |
Hi @posutsai , Your best option at this point would be to use fn setsockopt(level: PyIntRef, optname: PyObjectRef, value: OptionalArg<PyObjectRef>, optlen: OptionalArg<PyObjectRef>, vm: &VirtualMachine) {
// handle value and optlen combinations here:
if value.is(vm.get_none()) {
if let Present = oplen {
} else {
return Err(vm.new_type_error("optlen must be supplied when value is None"));
}
} else {
if let Present = oplen {
return Err(vm.new_type_error("optlen must not be supplied when value is not None"));
}
}
} We did not yet build function polymorphism macros into rustpython, and rust does not support it, so this is currently the way to go forwards. |
The
socket
module is still incomplete. Many methods and types are missing. To add methods to this module, edit the filevm/src/stdlib/socket.rs
accordingly.