summaryrefslogtreecommitdiffstats
path: root/Python/modsupport.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix more memory leaks. Will backport to 2.4.Martin v. Löwis2006-03-011-1/+5
|
* Use Py_ssize_t to count theMartin v. Löwis2006-02-161-1/+1
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-1/+6
|
* do_mkvalue(), 'I' and 'k' cases: squash legitimateTim Peters2005-12-241-2/+2
| | | | | compiler warnings about mixing signed and unsigned types in comparisons.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-18/+18
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* bug #1281408: make Py_BuildValue work with unsigned longs and long longsGeorg Brandl2005-11-241-3/+20
|
* Fix a few more memory leaksNeal Norwitz2005-11-201-0/+1
| | | | | Document more info about the benefits of configuring without pymalloc when running valgrind
* This is Pete Shinners' patch from his bug reportMichael W. Hudson2004-07-141-10/+30
| | | | | | | | [ 984722 ] Py_BuildValue loses reference counts on error I'm ever-so-slightly uneasy at the amount of work this can do with an exception pending, but I don't think that this can result in anything more serious than a strange error message.
* Getting rid of support for the ancient Apple MPW compiler.Jack Jansen2003-11-191-4/+0
|
* Patch #828384: Don't discard nested exception in AddObject.Martin v. Löwis2003-10-241-2/+3
|
* Better error messageJeremy Hylton2003-06-211-1/+7
|
* dded missing k and K format specifiers to Py_BuildValue and friends.Jack Jansen2003-04-171-0/+6
|
* Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis2003-03-291-1/+1
|
* Provide __module__ attributes for functions defined in C and Python.Jeremy Hylton2003-01-311-2/+14
| | | | | | | | | | | | | | __module__ is the string name of the module the function was defined in, just like __module__ of classes. In some cases, particularly for C functions, the __module__ may be None. Change PyCFunction_New() from a function to a macro, but keep an unused copy of the function around so that we don't change the binary API. Change pickle's save_global() to use whichmodule() if __module__ is None, but add the __module__ logic to whichmodule() since it might be used outside of pickle.
* Style consistency, so "grep ^function ..." works as expected.Fred Drake2003-01-301-2/+4
|
* Fixed potential crash: v can be NULL here, so use Py_XDECREF rather than ↵Just van Rossum2002-12-151-1/+1
| | | | Py_DECREF
* Py_InitModule4(): Accept NULL for the 'methods' argument. This makesFred Drake2002-08-141-14/+16
| | | | | sense now that extension types can support __init__ directly rather than requiring function constructors.
* Patch #554716: Use __va_copy where available.Martin v. Löwis2002-07-281-0/+4
|
* PyModule_AddObject(): Added missing exceptions.Fred Drake2002-06-171-7/+14
| | | | Closes SF bug #523473.
* Introduce two new flag bits that can be set in a PyMethodDef methodFred Drake2002-03-281-0/+7
| | | | | | | | | | | | | | | | | | | descriptor, as used for the tp_methods slot of a type. These new flag bits are both optional, and mutually exclusive. Most methods will not use either. These flags are used to create special method types which exist in the same namespace as normal methods without having to use tedious construction code to insert the new special method objects in the type's tp_dict after PyType_Ready() has been called. If METH_CLASS is specified, the method will represent a class method like that returned by the classmethod() built-in. If METH_STATIC is specified, the method will represent a static method like that returned by the staticmethod() built-in. These flags may not be used in the PyMethodDef table for modules since these special method types are not meaningful in that case; a ValueError will be raised if these flags are found in that context.
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-171-0/+4
| | | | | | | | - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
* Plug a memory leak in Py_InitModule4(): when PyDict_SetItemString() failed,Fred Drake2001-08-041-2/+6
| | | | | | the object being inserted was not being DECREFed. This closes SF bug #444486.
* This patch turns the Python API mismatch notice into a standardMarc-André Lemburg2001-07-311-5/+11
| | | | | | | | | | | | Python warning which can be catched by means of the Python warning framework. It also adds two new APIs which hopefully make it easier for Python to switch to buffer overflow safe [v]snprintf() APIs for error reporting et al. The two new APIs are PyOS_snprintf() and PyOS_vsnprintf() and work just like the standard ones in many C libs. On platforms which have snprintf(), the native APIs are used, on all other an emulation with snprintf() tries to do its best.
* Py_BuildValue(): Add "D" conversion to create a Python complex value fromFred Drake2001-03-121-0/+6
| | | | | | | a Py_complex C value. Patch by Walter Dörwald. This partially closes SF patch #407148.
* Rationalize use of limits.h, moving the inclusion to Python.h.Fred Drake2000-09-261-3/+0
| | | | | | | | Add definitions of INT_MAX and LONG_MAX to pyport.h. Remove includes of limits.h and conditional definitions of INT_MAX and LONG_MAX elsewhere. This closes SourceForge patch #101659 and bug #115323.
* Andrew Kuchling <akuchlin@mems-exchange.org>:Fred Drake2000-09-231-0/+27
| | | | | | | Add three new convenience functions to the PyModule_*() family: PyModule_AddObject(), PyModule_AddIntConstant(), PyModule_AddStringConstant(). This closes SourceForge patch #101233.
* Cast UCHAR_MAX to int before doing the comparison for overflow of theJack Jansen2000-09-151-0/+1
| | | | B format char.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* Add a test that Py_IsInitialized() in Py_InitModule4(). SeeGuido van Rossum2000-08-041-0/+2
| | | | | | | python-dev discussion. This should catch future version incompatibilities on Windows. Alas, this doesn't help for 1.5 vs. 1.6; but it will help for 1.6 vs. 2.0.
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-68/+8
| | | | declarations yet, those come later.
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-6/+6
|
* Added support for H (unsigned short) specifier in PyArg_ParseTuple andJack Jansen2000-07-061-0/+3
| | | | Py_BuildValue.
* Include limits.h if we have it.Jack Jansen2000-07-031-0/+3
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Trent Mick's Win64 changes: size_t vs. int or long; also some overflowGuido van Rossum2000-06-281-2/+9
| | | | tests.
* Brian Hooper <brian_takashi@hotmail.com>:Fred Drake2000-04-281-1/+31
| | | | | | | | | | | Here's a patch which changes modsupport to add 'u' and 'u#', to support building Unicode objects from a null-terminated Py_UNICODE *, and a Py_UNICODE * with length, respectively. [Conversion from 'U' to 'u' by Fred, based on python-dev comments.] Note that the use of None for NULL values of the Py_UNICODE* value is still in; I'm not sure of the conclusion on that issue.
* Change rare occurrences of #if HAVE_LONG_LONG to #ifdef.Guido van Rossum1999-01-251-1/+1
|
* Oops, forgot a pair of {}'s. (Greg Couch)Guido van Rossum1998-12-231-1/+2
|
* Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.Guido van Rossum1998-12-231-1/+3
| | | | Patch and suggestion by Greg Couch.
* Patch by Mark Hammond to support 64-bit ints on MS platforms.Guido van Rossum1998-08-251-1/+1
| | | | | | The MS compiler doesn't call it 'long long', it uses __int64, so a new #define, LONG_LONG, has been added and all occurrences of 'long long' are replaced with it.
* # Fix strange type (methonname instead of methodname).Guido van Rossum1998-08-081-4/+4
|
* Changes for BeOS, QNX and long long, by Chris Herborth.Guido van Rossum1998-08-041-0/+5
|
* Two error messages still used the old name of the functio mkvalue() --Guido van Rossum1998-07-071-2/+2
| | | | which is now Py_BuildValue().
* Plug memory leak in Py_BuildValue when using {...} to construct dictionaries.Guido van Rossum1997-11-201-3/+5
|
* Fix importing of shared libraries from inside packages.Guido van Rossum1997-11-191-0/+10
| | | | | | | | This is a bit of a hack: when the shared library is loaded, the module name is "package.module", but the module calls Py_InitModule*() with just "module" for the name. The shared library loader squirrels away the true name of the module in _Py_PackageContext, and Py_InitModule*() will substitute this (if the name actually matches).
* Removed fatal errors from Py_Initmodule4() (and thus fromGuido van Rossum1997-08-021-12/+12
| | | | | | | | | | | | Py_Initmodule(), which is a macro wrapper around it). The return value is now a NULL pointer if the initialization failed. This may make old modules fail with a SEGFAULT, since they don't expect this kind of failure. That's OK, since (a) it "never" happens, and (b) they would fail with a fatal error otherwise, anyway. Tons of extension modules should now check the return value of Py_Initmodule*() -- that's on my TODO list.
* Quickly renamed the remaining files -- this directory is done.Guido van Rossum1997-04-291-100/+106
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Corrected format string in api_version_warning.Sjoerd Mullender1996-01-231-1/+1
|