Guido van Rossum
b738d26e2d
Win/CE thread support by Mark Hammond.
27 years ago
Guido van Rossum
b6987b13fe
Alas, get rid of the Win specific hack to ask the user to press Return
before exiting when an error happened. This didn't work right when
Python is invoked from a daemon.
27 years ago
Guido van Rossum
2571cc8bf5
Changes by Mark Hammond for Windows CE. Mostly of the form
#ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
27 years ago
Guido van Rossum
99fb7c70f4
Remove unused variable from complex_from_string() code.
27 years ago
Guido van Rossum
1195023b89
Patch by Nick and Stephanie Lockwood to implement complex() with a string
argument. This closes TODO item 2.19.
27 years ago
Guido van Rossum
0daf022225
New builtin buffer() creates a derived read-only buffer from any
object that supports the buffer interface (e.g. strings, arrays).
27 years ago
Guido van Rossum
701f25ef9d
Rob Riggs wrote:
"""
Spec says that on success pthread_create returns 0. It does not say
that an error code will be < 0. Linux glibc2 pthread_create() returns
ENOMEM (12) when one exceed process limits. (It looks like it should
return EAGAIN, but that's another story.)
For reference, see:
http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
"""
[I have a feeling that similar bugs were fixed before; perhaps someone
could check that all error checks no check for != 0?]
27 years ago
Guido van Rossum
eb894ebd0a
Always test for an error return (usually NULL or -1) without setting
an exception.
27 years ago
Barry Warsaw
72b715d979
(initerrors): Make sure that the exception tuples ("base-classes" when
string-based exceptions are used) reflect the real class hierarchy,
i.e. that SystemExit derives from Exception not StandardError.
27 years ago
Guido van Rossum
124eff0225
Patch by Tim Peters to improve the range checks for range() and
xrange(), especially for platforms where int and long are different
sizes (so sys.maxint isn't actually the theoretical limit for the
length of a list, but the largest C int is -- sys.maxint is the
largest Python int, which is actually a C long).
27 years ago
Guido van Rossum
66368ccc55
Patch by Tommy Burnette to accept an arbitrary sequence when "(...)"
is used in the format string, instead of requiring a tuple. This is
in line with the general trend towards accepting arbitrary sequences.
27 years ago
Barry Warsaw
3d05b1a0ae
initmain(): Nailed a memory leak. bimod must be DECREF'd!
27 years ago
Barry Warsaw
7890203f49
bltin_exc[]: EnvironmentError is not a "leaf exception", so set it's
leaf_exc flag to zero otherwise the name leaks memory.
27 years ago
Barry Warsaw
fa77e09dd0
builtin_map(): A better fix for the previous leak plug (remember
PyList_Append steals a reference even if it fails).
builtin_filter(): Had the same leak problem as builtin_map().
27 years ago
Guido van Rossum
541563ec7e
Implement -OO; "unsafe" optimization that removes docstrings.
Marc-Andre Lemburg.
27 years ago
Barry Warsaw
2133287c3e
builtin_map(): Nailed memory leak. PyList_Append() borrows a
reference, so you have to DECREF the appended value. This was a fun
one!
27 years ago
Barry Warsaw
f988e687a1
builtin_complex(): Nailed memory leak. This one's in the instance
test for classes with a __complex__() method. The attribute is pulled
out of the instance with PyObject_GetAttr() but this transfers
ownership and the function object was never DECREF'd.
27 years ago
Barry Warsaw
3879333b9e
PyImport_ReloadModule(): Nailed a small memory leak. In the
else-clause of the subname test, the parentname object was never
DECREF'd.
27 years ago
Guido van Rossum
54ecc3d24f
Patches by William Lewis for Nextstep descendants.
27 years ago
Barry Warsaw
c80baa3365
err_input(): Nailed a small memory leak. If the error is E_INTR, the
v temporary variable was never decref'd. Test this by starting up the
interpreter, hitting C-c, then immediately exiting.
Same potential leak can occur if error is E_NOMEM, since the return is
done in the case block. Added Py_XDECREF(v); to both blocks, just
before the return.
27 years ago
Barry Warsaw
54892c4b2c
_PySys_Init(): Nailed small memory leak. The stringobject created for
sys.version was missing a Py_XDECREF().
27 years ago
Guido van Rossum
3dbba6ec3a
Change rare occurrences of #if HAVE_LONG_LONG to #ifdef.
27 years ago
Guido van Rossum
a71b5f4e1d
Jim Ahlstrom patch: the module doc string is too long for 16-bit VC
1.5. Omit the second part.
28 years ago
Guido van Rossum
e23cde2f8d
Avoid overflow if possible in calculations for range(); report
unavoidable overflow as OverflowError.
28 years ago
Guido van Rossum
2c1f6be38e
Hack for Windows so that if (1) the exit status is nonzero and (2) we
think we have our own DOS box (i.e. we're not started from a command
line shell), we print a message and wait for the user to hit a key
before the DOS box is closed.
The hacky heuristic for determining whether we have our *own* DOS box
(due to Mark Hammond) is to test whether we're on line zero...
28 years ago
Guido van Rossum
df69365f5f
Ty Sarna writes:
The following patches (relative to 1.5.2b1) enable Python dynamic
loading to work on NetBSD platforms that use ELF (presnetly mips and
alpha systems). They automaticly determine wether the system is ELF or
a.out rather than using astatic list of platforms so that when other
NetBSD platforms move to ELF, python will continue to work without
change.
28 years ago
Guido van Rossum
cad3d47f1e
Chris Herborth writes:
Donn Cave tells me the PyImport_BeImageID() function isn't needed anymore.
28 years ago
Guido van Rossum
e0d7dae3b8
Add sys.hexversion, which is an integer encoding the version in hexadecimal.
In other words, hex(sys.hexversion) == 0x010502b2 for Python 1.5.2b2.
This is derived from the new variable PY_VERSION_HEX defined in patchlevel.h.
(Cute, eh?)
28 years ago
Guido van Rossum
6e0a3499ab
Use PY_VERSION instead of PATCHLEVEL.
28 years ago
Guido van Rossum
47ae028071
Call PyInitFrozenExtensions() as requested by Mark Hammond (his patch).
28 years ago
Guido van Rossum
c38e7d4c4b
Oops, forgot a pair of {}'s. (Greg Couch)
28 years ago
Guido van Rossum
d341500d8f
Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.
Patch and suggestion by Greg Couch.
28 years ago
Guido van Rossum
6058eb49ee
Improve comment for PyImport_Import() as suggested by Bill Tutt.
28 years ago
Guido van Rossum
65d5b5763c
Thanks to Chris Herborth, the thread primitives now have proper Py*
names in the source code (they already had those for the linker,
through some smart macros; but the source still had the old, un-Py names).
28 years ago
Guido van Rossum
885553e8d3
Use PyThreadState_GET() macro.
28 years ago
Guido van Rossum
18bc7c2276
Make current_tstate a global, _PyThreadState_Current. This is to
support a macro in pystate.h.
28 years ago
Guido van Rossum
1924a0677d
Chris H. writes:
If we're going to put the PyOS_strtol() proto in intobject.h we should
include it here or the symbol isn't exported on PowerPC.
28 years ago
Guido van Rossum
0e1d0e95ea
Patch by Chris Herborth:
have to use a const-correct prototype on BeOS or the compiler gets uppity.
28 years ago
Guido van Rossum
2edcf0d71c
Move the prototype for dump_counts() to before where it is used.
(This only applies when COUNT_ALLOCS is defined.)
28 years ago
Guido van Rossum
46e9705eca
Remove prototypes for PyOS_strto[u]l -- Chris Herborth.
28 years ago
Guido van Rossum
ca90605678
Add more SET_LINENO instructions in long argument lists
28 years ago
Guido van Rossum
926f7b6615
Adding thread support for BeOS by Chris Herborth.
28 years ago
Guido van Rossum
cf183acf15
Use PyInt_AS_LONG macro instead of explicit inlining.
28 years ago
Guido van Rossum
f261526423
Need to add default decl of DL_IMPORT, for mymalloc.h
28 years ago
Barry Warsaw
344864fcfb
Added new builtin standard exception: NotImplementedError (its C
counterpart is PyExc_NotImplementedError).
28 years ago
Guido van Rossum
df12a59305
Fix cosmetic bug in delattr docstring discovered by JvR.
28 years ago
Guido van Rossum
014518f66c
Whoops! One the "redundant" initializations removed by Vladimir in
the previous patch wasn't -- there was a path through the code that
bypassed all initializations. Thanks to Just for reporting the bug!
28 years ago
Guido van Rossum
50cd34888b
Remove some redundant initializations -- patch by Vladimir Marangozov.
28 years ago
Guido van Rossum
66468568df
Jim Fulton writes:
"""
I had originally not realized that PyEval_GetGlobals did not
INCREF it's return value. The fix is to add the INCREF,
as shown below.
"""
28 years ago
Guido van Rossum
e0e59829e0
When errno is zero, avoid calling strerror() and use "Error" for the
message.
28 years ago