Commit Graph

127 Commits

Author SHA1 Message Date
Guido van Rossum ce11393136 Remove some unused variables from gethostbyaddr_ex and gethostbyaddr,
discovered by Marc Lemburg.
1998-09-13 15:52:13 +00:00
Guido van Rossum 954e3cab0a Removed unused variables. 1998-08-06 03:21:15 +00:00
Guido van Rossum bcc207484a Changes for BeOS, QNX and long long, by Chris Herborth. 1998-08-04 22:53:56 +00:00
Guido van Rossum 7d896ab1bb Added gethostbyname_ex(), which returns the same kind of data as
gethostbyaddr().  (Plain gethostbyname() returns only the IP address.)
This moves the code shared by gethostbyaddr() and gethostbyname_ex()
to a subroutine.

Original patch by Dan Stromberg; some tweaks by GvR.
1998-08-04 22:16:43 +00:00
Guido van Rossum 82a5c66a51 Added copious docstrings, plus two minor layout tweaks. 1998-07-07 20:45:43 +00:00
Guido van Rossum 578de30fd7 Some systems (e.g. Linux) use enums for some symbols (like IPPROTO_IP)
so that our #ifdef test has the wrong effect.  Substitute hardcoded
values for some important symbols (but not for the whole range -- some
are pretty obscure so it's not worth it).
1998-05-28 20:18:18 +00:00
Guido van Rossum 4f199eaa6e Threading speedup patches by Christopher Lindblad <cjl@infoseek.com>. 1998-04-09 20:56:35 +00:00
Guido van Rossum 32c575da0a Left-aligned preprocessor directives and changed C++ comments to C
comments.
1997-12-02 20:37:32 +00:00
Guido van Rossum 8e9ebfd337 os2 patch by Jeff Rush 1997-11-22 21:53:48 +00:00
Barry Warsaw 0d2d759d8c PySocketSock_methods: Added "connect_ex" so the method can actually be
called!
1997-11-20 21:39:02 +00:00
Guido van Rossum fc4255db75 Add s.connect_ex() which returns errno instead of raising an exception. 1997-11-19 18:57:13 +00:00
Guido van Rossum 0cb96de269 Apply two changes, systematically:
(1) Use PyErr_NewException("module.class", NULL, NULL) to create the
    exception object.

(2) Remove all calls to Py_FatalError(); instead, return or
    ignore the errors -- the import code now checks PyErr_Occurred()
    after calling a module's init function, so it's no longer a
    fatal error for the initialization to fail.

Also did some small cleanups, e.g. removed unnecessary test for
"already initialized" from initfpectl(), and unified
initposix()/initnt().

I haven't checked this very thoroughly, so while the changes are
pretty trivial -- beware of untested code!
1997-10-01 04:29:29 +00:00
Guido van Rossum 91ba64ddd9 socket_type -> SocketType 1997-06-02 22:18:09 +00:00
Guido van Rossum 3b4b6fc602 Add socket.socket_type, as discussed on c.l.p. 1997-05-21 14:37:37 +00:00
Guido van Rossum fe28fa05e9 Remove the last three uses of PyArg_GetInt() from the source. 1997-05-15 19:09:26 +00:00
Guido van Rossum aa948df877 In makesockaddr(), if we don't know the address family, don't raise an
exception -- return it as a tuple.  Seems useful in promiscuous mode.
1997-05-07 17:41:48 +00:00
Guido van Rossum 644a12b00c Tweaks to keep the Microsoft compiler quier. 1997-04-09 19:24:53 +00:00
Barry Warsaw 752300bbdf Check of return values and proper error handling. 1997-01-03 17:18:10 +00:00
Guido van Rossum 25405c786b Added the new getprotobyname() call to the module overview at the top. 1996-12-19 16:42:52 +00:00
Guido van Rossum 3901d85277 Added getprotobyname() interface. 1996-12-19 16:35:04 +00:00
Guido van Rossum fb4130d1f1 Added extern decl for gethostname() to keep gcc -Wall happy. 1996-12-10 15:17:08 +00:00
Guido van Rossum a376cc5cc8 Keep gcc -Wall happy. 1996-12-05 23:43:35 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum 084814624d Don't close an already closed socket. 1996-10-12 14:07:22 +00:00
Guido van Rossum 6f489d989d Slightly different Windows ifdefs 1996-06-28 20:15:15 +00:00
Guido van Rossum 8d665e6b51 changed windows test symbols; removed debug printf from sockets 1996-06-26 18:22:49 +00:00
Guido van Rossum be32c8921c More rational support for Windows (tested on Roj's NT 3.5 machine only).
Use PyArg_ParseTuple() where it makes sense.
1996-06-20 16:25:29 +00:00
Guido van Rossum 006bf91530 ntohs, ntohl, htons, htonl -- thanks to Lance 1996-06-12 04:04:55 +00:00
Guido van Rossum d639d4d6d6 more changes for Windows, sigh 1996-06-12 04:04:22 +00:00
Guido van Rossum 65af28a0f4 Calculate length of AF_UNIX addr struct portably in getsockaddrarg(). 1996-06-11 18:36:33 +00:00
Guido van Rossum 53a9bf8164 Get rid of obsolete allowbroadcast().
Avoid core dumps in resizestring().
1996-06-11 18:35:24 +00:00
Guido van Rossum 5555854e85 Windows/PC changes 1996-05-23 22:54:50 +00:00
Guido van Rossum dc1c64a148 remove unused variables 1996-02-27 15:21:19 +00:00
Jack Jansen 508537b9c9 Include GUSI.h if using gusi-sockets 1996-02-14 15:57:45 +00:00
Guido van Rossum ca42b1673b clear addr buffer before calling getsockname 1996-01-12 01:36:05 +00:00
Guido van Rossum 7c53b77733 plug some leaks 1995-09-13 18:39:47 +00:00
Guido van Rossum 30b6b2b032 add setblocking(); NT changes; null-terminate Unix path 1995-06-14 22:28:08 +00:00
Guido van Rossum 27e177d005 fixed up comments describing interface 1995-03-16 15:43:47 +00:00
Guido van Rossum 6b14491bb4 mode and optional bufsize for makefile() 1995-03-14 15:05:13 +00:00
Guido van Rossum 5f05eb421a add INADDR_* symbols 1995-02-17 15:11:07 +00:00
Guido van Rossum 3fdf58b5cc add socket related constants 1995-02-07 15:39:52 +00:00
Guido van Rossum a597dde3f1 cosmetic changes so these modules will work with the strict new naming scheme 1995-01-10 20:56:29 +00:00
Guido van Rossum ca9b323c52 better test for existence of hstrerror() 1995-01-10 16:30:54 +00:00
Guido van Rossum 524b588553 Added 1995 to copyright message.
Setup.in: clarified Tk comments somewhat.
structmodule.c: use memcpy() instead of double precision assignment.
1995-01-04 19:10:35 +00:00
Guido van Rossum 3bbc62e9c2 Another bulky set of minor changes.
Note addition of gethostbyaddr() and improved repr() for sockets,
renaming of md5.md5() to md5.new(), and fixing of leaks in threads.
1995-01-02 19:30:30 +00:00
Guido van Rossum 73624e9c3b new style 1994-10-10 17:59:00 +00:00
Guido van Rossum 14ed0b2cd3 * Modules/xxmodule.c: integrated with xxobject.c by Jack
* Modules/(posix,socket}module.c: more NT changes
1994-09-29 09:50:09 +00:00
Guido van Rossum e4485b064d 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.
1994-09-07 14:32:49 +00:00
Guido van Rossum 6a3eb5f14d Changes to make it work and compile on NT, by Mark Hammond.
(NT changes for posixmodule.c re-invented by Guido.)
1994-08-18 15:42:46 +00:00
Guido van Rossum c65a525cdc * Modules/{Setup.in,Makefile.pre.in}: renamed some modules to
shorter names (dropped the "module" from the name): sunaudiodev,
	imgformat, audioop, imageop, imgfile

	* Modules/stropmodule.c (strop_rindex): make rindex('abc', '') do
	the right thing (i.e. return 3 instead of 0)

	* Modules/socketmodule.c: disabled allowbroadcast() socket method
1994-08-05 13:44:50 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum b376a4ad18 * timemodule.c: Add hack for Solaris 2.
* posixmodule.c: don't prototype getcwd() -- it's not portable...
* mappingobject.c: double-check validity of last_name_char in
  dict{lookup,insert,remove}.
* arraymodule.c: need memmove only for non-STDC Suns.
* Makefile: comment out HTML_LIBS and XT_USE by default
* pythonmain.c: don't prototype getopt() -- it's not standardized
* socketmodule.c: cast flags arg to {get,set}sockopt() and addrbuf arg to
  recvfrom() to (ANY*).
* pythonrun.c (initsigs): fix prototype, make it static
* intobject.c (LONG_BIT): only #define it if not already defined
* classobject.[ch]: remove all references to unused instance_convert()
* mappingobject.c (getmappingsize): Don't return NULL in int function.
1993-11-23 17:53:17 +00:00
Guido van Rossum 234f942aef * Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Added $(SYSDEF) to its build rule in Makefile.
* cgensupport.[ch], modsupport.[ch]: removed some old stuff.  Also
  changed files that still used it...  And made several things static
  that weren't but should have been...  And other minor cleanups...
* listobject.[ch]: add external interfaces {set,get}listslice
* socketmodule.c: fix bugs in new send() argument parsing.
* sunaudiodevmodule.c: added flush() and close().
1993-06-17 12:35:49 +00:00
Guido van Rossum 18c9a4f8ea * socketmodule.c: fix long-standing bug in recvfrom() -- addrlen
wasn't initialized.
1993-05-25 12:16:29 +00:00
Guido van Rossum eb6b33a837 * classobject.c: in instance_getattr, don't make a method out of a
function found as instance data.
* socketmodule.c: added 'flags' argument sendto/recvfrom, rewrite
  argument parsing in send/recv.
* More changes related to access (terminology change: owner instead of
  class; allow any object as owner; local/global variables are owned
  by their dictionary, only class/instance data is owned by the class;
  "from...import *" now only imports objects with public access; etc.)
1993-05-25 09:38:27 +00:00
Guido van Rossum 9575a44575 * Microscopic corrections to make things compile on the Cray APP.
* Removed one use of $> in Makefile and warned about others.
  Added configurable lines in Makefile to change CC and AR.
1993-04-07 14:06:14 +00:00
Guido van Rossum e537240c25 * Changed many files to use mkvalue() instead of newtupleobject().
* Fixcprt.py: added [-y file] option, do only files younger than file.
* modsupport.[ch]: added vmkvalue().
* intobject.c: use mkvalue().
* stringobject.c: added "formatstring"; renamed string* to string_*;
  ceval.c: call formatstring for string % value.
* longobject.c: close memory leak in divmod.
* parsetok.c: set result node to NULL when returning an error.
1993-03-16 12:15:04 +00:00
Guido van Rossum 6f5afc9a73 * ceval.c: ifdef out the last argument passing compat hack.
* Fixed memory leaks in socket, select and sv modules: mkvalue("O", v)
  does INCREF(v) so if v is brand new it should be XDECREF'd
1993-02-05 09:46:15 +00:00
Guido van Rossum 5f59d6018e * mymalloc.h: always allocate one extra byte, since some malloc's
return NULL for malloc(0) or realloc(p, 0).  (This should be done
  differently than wasting one byte, but alas...)
* Moved "add'l libraries" option in Makefile to an earlier place.
* Remove argument compatibility hacks (b) and (c).
* Add grey2mono, dither2mono and mono2grey to imageop.
* Dup the fd in socket.fromfd().
* Added new modules mpz, md5 (by JH, requiring GNU MP 1.2).  Affects
  Makefile and config.c.
* socketmodule.c: added socket.fromfd(fd, family, type, [proto]),
  converted socket() to use of getargs().
1992-12-14 16:59:51 +00:00
Guido van Rossum 2a7178efe1 socketmodule.c: added socket.fromfd(fd, family, type, [proto]);
converted socket() to use of getargs().
1992-12-08 13:38:24 +00:00
Guido van Rossum c89705d697 * config.c: Added audioop to lists.
* Makefile: change default source directory
* socketmodule.c: added getsockname and getpeername
* bltinmodule.c: corrected typo in type() error message
* Added new built-in functions str() and repr(): repr(x) == `x`;
  str(x) == x if x is a string, otherwise str(x) == repr(x).
* Added joinfields to stropmodule.c (string.join calls joinfields now)
1992-11-26 08:54:07 +00:00
Guido van Rossum aee087946d Made struct a standard built-in module; added string args to {set,get}sockopt;
added gl.gversion().
1992-09-08 09:05:33 +00:00
Guido van Rossum ff4949eeee * Makefile: cosmetics
* socketmodule.c: get rid of makepair(); fix makesocketaddr to fix
  broken recvfrom()
* socketmodule: get rid of getStrarg()
* ceval.h: move eval_code() to new file eval.h, so compile.h is no
  longer needed.
* ceval.c: move thread comments to ceval.h; always make save/restore
  thread functions available (for dynloaded modules)
* cdmodule.c, listobject.c: don't include compile.h
* flmodule.c: include ceval.h
* import.c: include eval.h instead of ceval.h
* cgen.py: add forground(); noport(); winopen(""); to initgl().
* bltinmodule.c, socketmodule.c, fileobject.c, posixmodule.c,
  selectmodule.c:
  adapt to threads (add BGN/END SAVE macros)
* stdwinmodule.c: adapt to threads and use a special stdwin lock.
* pythonmain.c: don't include getpythonpath().
* pythonrun.c: use BGN/END SAVE instead of direct calls; also more
  BGN/END SAVE calls etc.
* thread.c: bigger stack size for sun; change exit() to _exit()
* threadmodule.c: use BGN/END SAVE macros where possible
* timemodule.c: adapt better to threads; use BGN/END SAVE; add
  longsleep internal function if BSD_TIME; cosmetics
1992-08-05 19:58:53 +00:00
Guido van Rossum 25bec8c8dc Sometimes, recvfrom() returns an empty address; this is not an error.
Also, get rid of makepair() in favor of mkvalue().
1992-08-05 19:00:45 +00:00
Guido van Rossum ed233a5696 Changes for new UNIX-specific built-in module 'select' and new header for
interfaces to variants of select() system call, "myselect.h".  This includes
adding fileno() methods to files, sockets and stdwin.
1992-06-23 09:07:03 +00:00
Guido van Rossum 710e1df585 Some UNIX types want the exact size of the address structure 1992-06-12 10:39:36 +00:00
Guido van Rossum 0e69587dc0 Added {get,set}sockopt(). allowbroadcast is now obsolete. 1992-06-05 15:11:30 +00:00
Guido van Rossum bab9d03855 Copyright for 1992 added 1992-04-05 14:26:55 +00:00
Guido van Rossum d15b73353f Lint fixes. 1992-03-27 17:22:00 +00:00
Guido van Rossum 9c16d7fbac Cal get*Str*arg() instead of get*str*arg(), until the code is fixed. 1992-01-27 16:49:54 +00:00
Guido van Rossum 0bb1a51925 AIX fix. 1991-11-27 14:55:18 +00:00
Guido van Rossum e0e5edcb6e Added allowbroadcast() 1991-10-20 20:22:28 +00:00
Guido van Rossum 54ba21bd76 Make Socktype global so old and new compilers will like it. 1991-09-10 14:57:12 +00:00
Guido van Rossum 8119447fbe Add gethostname() and s.avail(). 1991-07-27 21:42:02 +00:00
Guido van Rossum 4dd2a7e45b Connection sockets now have the proper family/type/proto values.
Fix argument handling bug in socket(f,t,p) call.
Fix some comments.
1991-07-01 18:51:33 +00:00
Guido van Rossum 30a685f0fe Many changes to the interface, and added comments. 1991-06-27 15:51:29 +00:00
Guido van Rossum 6574b3ee25 Initial revision 1991-06-25 21:36:08 +00:00