mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
that the module-specific components are in the section for that module. cursesmodule.c: patched it so it actually works. tkintermodule.c: call Py_AtExit instead of atexit(). signalmodule.c: converted to new naming style; added BGN/END SAVE around pause() call. socketmodule.c: added setblocking() after Tommy Burnette.
This commit is contained in:
parent
a142613678
commit
e4485b064d
5 changed files with 252 additions and 202 deletions
|
@ -63,6 +63,7 @@ Socket methods:
|
|||
- s.recvfrom(nbytes [,flags]) --> string, sockaddr
|
||||
- s.send(string [,flags]) --> nbytes
|
||||
- s.sendto(string, [flags,] sockaddr) --> nbytes
|
||||
- s.setblocking(1 | 0) --> None
|
||||
- s.shutdown(how) --> None
|
||||
- s.close() --> None
|
||||
|
||||
|
@ -80,6 +81,7 @@ Socket methods:
|
|||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
@ -441,6 +443,34 @@ BUILD_FUNC_DEF_2(sock_allowbroadcast,sockobject *,s, object *,args)
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef NT
|
||||
|
||||
/* s.setblocking(1 | 0) method */
|
||||
|
||||
static object *
|
||||
sock_setblocking(s, args)
|
||||
sockobject *s;
|
||||
object *args;
|
||||
{
|
||||
int block;
|
||||
int delay_flag;
|
||||
if (!getintarg(args, &block))
|
||||
return NULL;
|
||||
BGN_SAVE
|
||||
delay_flag = fcntl (s->sock_fd, F_GETFL, 0);
|
||||
if (block)
|
||||
delay_flag &= (~O_NDELAY);
|
||||
else
|
||||
delay_flag |= O_NDELAY;
|
||||
fcntl (s->sock_fd, F_SETFL, delay_flag);
|
||||
END_SAVE
|
||||
|
||||
INCREF(None);
|
||||
return None;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* s.setsockopt() method.
|
||||
With an integer third argument, sets an integer option.
|
||||
With a string third argument, sets an option from a buffer;
|
||||
|
@ -812,6 +842,9 @@ static struct methodlist sock_methods[] = {
|
|||
{"accept", (method)sock_accept},
|
||||
#if 0
|
||||
{"allowbroadcast", (method)sock_allowbroadcast},
|
||||
#endif
|
||||
#ifndef NT
|
||||
{"setblocking", (method)sock_setblocking},
|
||||
#endif
|
||||
{"setsockopt", (method)sock_setsockopt},
|
||||
{"getsockopt", (method)sock_getsockopt},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue