Commit Graph

57 Commits

Author SHA1 Message Date
Christian Heimes 74b8e76ec1 Don't repeat yourself
Added the macros PyModule_AddIntMacro and PyModule_AddStringMacro. They shorten PyModule_AddIntConstant(m, "AF_INET", AF_INET) to PyModule_AddIntMacro(m, AF_INET)
2008-01-22 15:25:18 +00:00
Martin v. Löwis aac1316222 Add check for the PyArg_ParseTuple format, and declare
it if it is supported.
2006-10-19 10:58:46 +00:00
Skip Montanaro 3fca463627 C++ compile cleanup: proper declaration of _Py_BuildValue_SizeT 2006-04-18 00:29:29 +00:00
Martin v. Löwis 5cb6936672 Make Py_BuildValue, PyObject_CallFunction and
PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
2006-04-14 09:08:42 +00:00
Anthony Baxter 36458ee501 aargh. Don't make last minute re-organisations before checkin! 2006-04-04 12:40:38 +00:00
Anthony Baxter 46854bc7e4 PyAPI_FUNC() the PyArg_.*SizeT forms. Without this, cygwin has hysterics.
(see buildbot)
2006-04-04 12:27:20 +00:00
Martin v. Löwis 762467475d Use Py_ssize_t for PyArg_UnpackTuple arguments. 2006-03-01 04:06:10 +00:00
Neal Norwitz e42e405e08 Martin owns PEP 353 and did most of the work 2006-02-28 20:03:28 +00:00
Thomas Wouters 34aa7ba114 from __future__ import with_statement addon for 'with', mostly written by
Neal.
2006-02-28 19:02:24 +00:00
Martin v. Löwis 15e62742fa Revert backwards-incompatible const changes. 2006-02-27 16:46:16 +00:00
Martin v. Löwis 18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Jeremy Hylton af68c874a6 Add const to several API functions that take char *.
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 *.
2005-12-10 18:50:16 +00:00
Georg Brandl 02c42871cf Disallow keyword arguments for type constructors that don't use them.
(fixes bug #1119418)
2005-08-26 06:42:30 +00:00
Brett Cannon 711e7d97e4 Add PyArg_VaParseTupleAndKeywords(). Document this function and
PyArg_VaParse().

Closes patch #550732.  Thanks Greg Chapman.
2004-07-10 22:20:32 +00:00
Guido van Rossum 45ec02aed1 SF patch 576101, by Oren Tirosh: alternative implementation of
interning.  I modified Oren's patch significantly, but the basic idea
and most of the implementation is unchanged.  Interned strings created
with PyString_InternInPlace() are now mortal, and you must keep a
reference to the resulting string around; use the new function
PyString_InternImmortal() to create immortal interned strings.
2002-08-19 21:43:18 +00:00
Mark Hammond 91a681debf Excise DL_EXPORT from Include.
Thanks to Skip Montanaro and Kalle Svensson for the patches.
2002-08-12 07:21:58 +00:00
Fred Drake e4616e6752 PyArg_UnpackTuple(): New argument unpacking function suggested by Jim
Fulton, based on code Jim supplied.
2001-10-23 21:09:29 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
Fred Drake 73a3c8fae4 The addition of new parameters to functions in the Python/C API requires
that PYTHON_API_VERSION be incremented.
2001-01-25 22:13:34 +00:00
Fred Drake 9e2851566c Andrew Kuchling <akuchlin@mems-exchange.org>:
Add three new convenience functions to the PyModule_*() family:
PyModule_AddObject(), PyModule_AddIntConstant(), PyModule_AddStringConstant().

This closes SourceForge patch #101233.
2000-09-23 03:24:27 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Thomas Wouters 5f37591a16 ANSIfications: fix empty arglists, and remove the checks for
'HAVE_STDARG_PROTOTYPES' (consider it true, remove false branch)
2000-07-22 23:30:03 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Fred Drake d5c84ede06 ANSI-fication of the sources -- remove Py_PROTO! 2000-07-08 17:25:55 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Guido van Rossum 21a50bd078 Version updated to 1.6; API version to 1009. 2000-03-29 01:46:45 +00:00
Guido van Rossum f1176c4815 New version identification scheme.
The version numbers are now exported by Python.h.
Also rolled back the API version change -- it's back to 1007!
1999-01-03 12:40:24 +00:00
Guido van Rossum 43466ec7b0 Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
Guido van Rossum 7531d507c1 New API version (enough has changed!). 1998-12-03 18:18:12 +00:00
Guido van Rossum a70d160095 Define new macro Py_InitModule3(name, methods, doc) which calls
Py_InitModule4() with appropriate arguments.
1998-06-27 18:21:59 +00:00
Guido van Rossum ee6fd1c392 Add declaration for _Py_PackageContext -- needed to fix importing
of shared libraries from inside packages.
1997-11-19 18:51:35 +00:00
Guido van Rossum b4cfdfa077 Removed special Windows defines, at Mark Hammond's request. 1997-09-29 23:29:08 +00:00
Guido van Rossum 15974ad5e6 Bump MS_DLL_ID to 1.5.0. 1997-08-12 14:48:03 +00:00
Guido van Rossum 36280a7772 Added PyArg_ParseTupleAndKeywords() prototype. 1997-02-14 16:36:35 +00:00
Guido van Rossum ee5cf9b672 Bump API version due to the various speedup hacks. 1997-01-18 07:54:03 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum e449af7da9 Ellipses -> Ellipsis rename (the dictionary really says that it should
be Ellipsis!).
Bumped the API version because a linker-visible symbol is affected.
Old C code will still compile -- there's a b/w compat macro.
Similarly, old Python code will still run, builtin exports both
Ellipses and Ellipsis.
1996-10-11 16:25:41 +00:00
Guido van Rossum 2ea0b06498 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Under Windows, add MS_DLL_ID and MS_DLL_VERSION_ID for Mark H.

Independent change: if Py_TRACE_REFS is defined, rename Py_InitModule4
so so linking with incompatible modules will create a link time error.

[Backing out of previous changes (also for modsupport.c) to test
the latter at runtime.]
1996-08-22 22:55:47 +00:00
Guido van Rossum ae8a99e3f5 Two bumps for the price of one (PYTHON_API_VERSION) 1996-07-30 16:41:02 +00:00
Guido van Rossum e0dbd590ea bump api version 1996-01-12 00:49:39 +00:00
Guido van Rossum caa6380886 The great renaming, phase two: all header files have been updated to
use the new names exclusively, and the linker will see the new names.
Files that import "Python.h" also only see the new names.  Files that
import "allobjects.h" will continue to be able to use the old names,
due to the inclusion (in allobjects.h) of "rename2.h".
1995-01-12 11:45:45 +00:00
Guido van Rossum 970a0a20b8 api version checking 1995-01-09 17:47:20 +00:00
Guido van Rossum 5e56997969 initmodule2 -> initmodule3 (with doc string) 1995-01-07 11:51:27 +00:00
Guido van Rossum 5799b52008 Added 1995 copyright.
object.h: made sizes and refcnts signed ints.
stringobject.h: make getstrsize() signed int.
methodobject.h: add METH_VARARGS and METH_FREENAME flag bit definitions.
1995-01-04 19:06:22 +00:00
Guido van Rossum c5d92e1271 ceval.h: added Py_MakePendingCalls()
classobject.h: added instancebinop()
modsupport.h: added newgetargs()
rename1.h: removed Py_FPROTO
1994-09-28 15:44:39 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum a3309960a5 * Added support for X11 modules.
* Makefile: change location of FORMS library.
* posixmodule.c: turn #if 0 into #ifdef MSDOS (stuff in unistd.h or not)
* Almost all .h files: added CPP magic to avoid duplicate inclusions and
  to support inclusion from C++.
1993-07-28 09:05:47 +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 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