Commit graph

45 commits

Author SHA1 Message Date
Victor Stinner aac29af678
bpo-45434: pyport.h no longer includes <stdlib.h> (GH-28914)
Include <stdlib.h> explicitly in C files.

Python.h includes <wchar.h>.
2021-10-13 19:25:53 +02:00
Dong-hee Na ddef3bdc7b
bpo-40950: Port nis module to multiphase initialization (GH-20811) 2020-06-12 11:26:00 +09:00
Zackery Spytz a2e3585e79 bpo-35356: Fix a possible reference leak in nis.maps(). (GH-10808) 2018-11-30 09:40:16 +02:00
Serhiy Storchaka 62be74290a
bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)
Fix invalid function cast warnings with gcc 8
for method conventions different from METH_NOARGS, METH_O and
METH_VARARGS excluding Argument Clinic generated code.
2018-11-27 13:27:31 +02:00
Siddhesh Poyarekar 55edd0c185 bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments.  This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
2018-04-29 21:59:33 +03:00
Serhiy Storchaka f7eae0adfc [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302)
Based on patch by Victor Stinner.

Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters.
2017-06-28 08:30:06 +03:00
Raymond Hettinger 9f4b8605e6 Issue #24300: Minor refactoring. 2015-07-24 00:43:44 -04:00
Victor Stinner f024d263b4 Issue #23685: Fix usage of PyMODINIT_FUNC in _json, _scproxy, nis, pyexpat
_codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw
modules.

pyexpat.c doesn't need to redeclare PyMODINIT_FUNC, it's already declared in
Include/pyport.h.
2015-03-17 17:48:27 +01:00
Brett Cannon eb175c473d Remove a redundant assignment.
Found by LLVM/clang 2.9.
2011-06-06 20:24:11 -07:00
Martin v. Löwis 5ea823cf55 Decode NIS data to fs encoding, using the surrogate error handler. 2010-08-19 09:11:51 +00:00
Martin v. Löwis dfaf9ec93a Restore GIL in nis_cat in case of error. 2010-08-18 16:12:23 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Amaury Forgeot d'Arc 783f86ecb1 Merged revisions 73873 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73873 | amaury.forgeotdarc | 2009-07-07 08:49:41 +0200 (mar., 07 juil. 2009) | 2 lines

  #6420: Fix a compilation warning in the nis module, for OpenBSD and FreeBSD.
........
2009-07-07 06:51:26 +00:00
Amaury Forgeot d'Arc 451a356f11 Merged revisions 64685 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64685 | amaury.forgeotdarc | 2008-07-03 01:40:28 +0200 (Thu, 03 Jul 2008) | 3 lines

  Try a blind fix to nismodule which fails on the solaris10 3.0 buildbot:
  the GIL must be re-acquired in the callback function
........
2008-07-02 23:44:19 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00
Martin v. Löwis d24fdbcff3 Use s# instead of t# for nis_match. 2007-08-30 10:21:51 +00:00
Neal Norwitz efaf629026 Use unicode (hope it's right, I can't test it) 2007-08-26 21:43:00 +00:00
Martin v. Löwis 15e62742fa Revert backwards-incompatible const changes. 2006-02-27 16:46:16 +00:00
Martin v. Löwis 57a34e8026 Patch #1422385: Changes to nis module to support multiple NIS domains 2006-02-04 19:12:37 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Brett Cannon f6067ec336 Add an #ifdef __APPLE__ around typedef of foreachfunc to match Apple's
incorrect declaration for ypall_callback in /usr/include/rpcsvc/ypcInt.h .
Shouldn't hurt any code since the differences are unsigned long instead of int and
void * instead of char *.  Removes warning about improper function pointer
assignment during compilation.
2004-07-10 00:57:37 +00:00
Neal Norwitz 662390681e SF #633013, Fix NIS causing interpreter core dump
Prevent the lengths passed to PyString_FromStringAndSize()
from being negative in some cases.
2002-11-04 23:21:09 +00:00
Neal Norwitz ba3a16c6c3 Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
  Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Please review.  All tests pass, but some modules don't have tests.
I spot checked various functions to try to make sure nothing broke.
2002-03-31 15:27:00 +00:00
Martin v. Löwis 43b936d08c Patch #477750: Use METH_ constants in Modules. 2002-01-17 23:15:58 +00:00
Thomas Wouters e75e6d06d2 Move declaration of 'clnt_create()' NIS function to pyport.h, as it's
supposed to be declared in system include files (with a proper prototype.)
Should be moved to a platform-specific block if anyone finds out which
broken platforms need it :-)
2001-01-21 23:34:12 +00:00
Thomas Wouters bd4bc4e9e9 Even more ANSIfication: fix as many function pointers and declarations as
possible.
2000-07-22 23:57:55 +00:00
Thomas Wouters f3f33dcf03 Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
and a couple of functions that were missed in the previous batches. Not
terribly tested, but very carefully scrutinized, three times.

All these were found by the little findkrc.py that I posted to python-dev,
which means there might be more lurking. Cases such as this:

long
func(a, b)
	long a;
	long b; /* flagword */
{

and other cases where the last ; in the argument list isn't followed by a
newline and an opening curly bracket. Regexps to catch all are welcome, of
course ;)
2000-07-21 06:00:07 +00:00
Peter Schneider-Kamp 39e0e5a180 ANSI-fication 2000-07-10 13:12:27 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Guido van Rossum 61b705a570 Patch by Fred Gansevles (the module's original author).
This patch fixes 3 small problems.
1) If a map is used which is generated with 'makedbm -a',
   the trailing '\0' is now handled correctely.
2) The nis.maps() function skipped the first map in the output list.
3) The library '-lnsl' is added in Setup.in (needed on Linux glibc2 and
   Solaris systems. Maybe on other systems too?)

[I note that this still doesn't work when you are using NIS+ --GvR]
2000-02-29 15:52:40 +00:00
Guido van Rossum 7e48898d86 Use the t# format where appropriate. Greg Stein. 1998-10-08 02:25:24 +00:00
Guido van Rossum c501583dfa Make gcc -Wall happy. 1998-10-07 16:36:14 +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
Barry Warsaw 4bc9d39560 Nailed a couple of memory leaks, caught by Purify. 1997-01-09 22:22:05 +00:00
Barry Warsaw 1abda0fb12 cat and puste errors 1996-12-11 01:00:46 +00:00
Barry Warsaw 3696c524a4 nis_maplist(): Use check of yp_get_default_domain() return value
that's used in other parts of this module.

nis_maps(): use PyArg_NoArgs().
1996-12-11 00:29:14 +00:00
Barry Warsaw adbf4e66df Renamed, and bug fixed:
Two interesting problems in nis_maplist().  First, it is possible that
clnt_create() will return NULL.  This was being caught, but no Python
error was being set.  I use clnt_spcreateerror() to generate the value
of the exception.

But why would clnt_create() fail?  It's because no server was being
found.  And why was this?  It was because nis_maplist() tried only to
get the NIS master for the first map in the aliases list, which is
passwd.byname, and guess what?  That's the one NIS map CNRI does *not*
export!  So the yp_master() call was failing to return a valid
server.  I now cycle through all the map aliases until I find a valid
master.  If not, a different exception is set.

I'm not sure this is the completely correct way to do all this, but
short of rewriting the entire nismodule.c (to expose the proper API to
Python), it should do the trick.
1996-12-11 00:15:58 +00:00
Guido van Rossum 259552dbd9 Added ``extern int get_default_domain();'' for SGI, to keep gcc -Wall happy. 1996-12-09 18:46:28 +00:00
Guido van Rossum 8a170cbed6 Rearrange include headers (needed on some platforms). 1996-08-08 19:11:41 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum e77a757094 * nismodule.c: database keys and values can contain null bytes. be more
careful about these.
* arraymodule.c: added 8 byte swap; added 'i' format character; added
  reverse() method; rename read/write to fromfile/tofile.
* config.c: Set version to 0.9.9++.
* rotormodule.c (r_rand): declare k1..k5 as unsigned longs so the shifts
  will have a well-defined effect independent of word size.
* bltinmodule.c: renamed bagof() to filter().
1993-11-03 15:01:26 +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 3562d52e93 Added error handling and free resources. 1992-08-12 15:26:16 +00:00
Guido van Rossum 9de7a01e0e NIS interface by Fred Gansevles <Fred.Gansevles@cs.utwente.nl>. 1992-08-12 14:57:12 +00:00