Commit Graph

1872 Commits

Author SHA1 Message Date
Jason Tishler fac083d14a Patch 775605: Cygwin pthread_sigmask() workaround patch
Cygwin's pthread_sigmask() implementation appears to be buggy. This
patch works around this problem by using sigprocmask() instead.

This patch is implemented in a general way so it could be used by other
platforms too. If this approach is deemed too risky, then I can work up
a patch that just hacks Python/thread_pthread.h for Cygwin.

Note that I tested this patch against 2.3c1 under Red Hat Linux 8.0 too.

[snip]
And finally, I need someone to regenerate pyconfig.h.in and configure
with the same versions of the autotools that are normally used by
Python.

Neal kindly regenerated pyconfig.h.in and configure for me.
2003-07-22 15:20:49 +00:00
Mark Hammond 5f4e8ca376 Correct previous patch looking for warnings module: sys.modules, not
sys.__modules__.
2003-07-16 01:54:38 +00:00
Mark Hammond edd07737d7 Fix [ 771097 ] frozen programs fail due to implicit import of "warnings".
If the initial import of warnings fails, clear the error.  When the module
is actually needed, if the original import failed, see if it has managed
to find its way to sys.modules yet and if so, remember it.
2003-07-15 23:03:55 +00:00
Jeremy Hylton 1955fcf67a SF patch 763201: handling of SyntaxErrors in symbol table build
Fixes for three related bugs, including errors that caused a script to
be ignored without printing an error message.  The key problem was a bad
interaction between syntax warnings and syntax errors.  If an
exception was already set when a warning was issued, the warning could
clobber the exception.

The PyErr_Occurred() check in issue_warning() isn't entirely
satisfying (the caller should know whether there was already an
error), but a better solution isn't immediately obvious.

Bug fix candidate.
2003-07-15 20:23:26 +00:00
Martin v. Löwis f9ce67d65f Initialize thread_id to 0 in unthreaded build. Fixes #770247. 2003-07-13 10:41:53 +00:00
Fred Drake 1e5fc55c4d - fix typo
- there's a weird variable name here (zimpimport), but I'll leave that
  for someone that's familiar with the ZIP import support
2003-07-11 15:01:02 +00:00
Tim Peters e5e065b669 New function sys.getcheckinterval(), to complement setcheckinterval(). 2003-07-06 18:36:54 +00:00
Tim Peters 2e7e7df969 An Anonymous Coward on c.l.py posted a little program with bizarre
behavior, creating many threads very quickly.  A long debugging session
revealed that the Windows implementation of PyThread_start_new_thread()
was choked with "laziness" errors:

1. It checked MS _beginthread() for a failure return, but when that
   happened it returned heap trash as the function result, instead of
   an id of -1 (the proper error-return value).

2. It didn't consider that the Win32 CreateSemaphore() can fail.

3. When creating a great many threads very quickly, it's quite possible
   that any particular bootstrap call can take virtually any amount of
   time to return.  But the code waited for a maximum of 5 seconds, and
   didn't check to see whether the semaphore it was waiting for got
   signaled.  If it in fact timed out, the function could again return
   heap trash as the function result.  This is actually what confused
   the test program, as the heap trash usually turned out to be 0, and
   then multiple threads all got id 0 simultaneously, confusing the
   hell out of threading.py's _active dict (mapping id to thread
   object).  A variety of baffling behaviors followed from that.

WRT #1 and #2, error returns are checked now, and "thread.error: can't
start new thread" gets raised now if a new thread (or new semaphore)
can't be created.  WRT #3, we now wait for the semaphore without a
timeout.

Also removed useless local vrbls, folded long lines, and changed callobj
to a stack auto (it was going thru malloc/free instead, for no discernible
reason).

Bugfix candidate.
2003-07-04 04:40:45 +00:00
Neal Norwitz c5131bc256 Fix SF #762455, segfault when sys.stdout is changed in getattr
Will backport.
2003-06-29 14:48:32 +00:00
Guido van Rossum b8b6d0c2c6 Add PyThreadState_SetAsyncExc(long, PyObject *).
A new API (only accessible from C) to interrupt a thread by sending it
an exception.  This is not always effective, but might help some people.
Requested by Just van Rossum and Alex Martelli.  It is intentional
that you have to write your own C extension to call it from Python.

Docs will have to wait.
2003-06-28 21:53:52 +00:00
Jeremy Hylton c44dbc46fe Better error message 2003-06-21 21:35:25 +00:00
Raymond Hettinger b9572c3456 Removed bytecode transformation for sequence packing/unpacking.
It depended on the previously removed basic block checker to
prevent a jump into the middle of the transformed block.

Clears SF 757818: tuple assignment -- SystemError: unknown opcode
2003-06-20 16:13:17 +00:00
Neil Schemenauer 00b0966f20 Don't use the module object setattr when importing submodules. Instead,
operate on the module dictionary directly.  This prevents spurious
depreciation warnings from being raised if a submodule name shadows
a builtin name.
2003-06-16 21:03:07 +00:00
Neil Schemenauer c4b570f218 Use fast_next_opcode shortcut for forward jump opcodes (it's safe and
gives a small speedup).
2003-06-01 19:21:12 +00:00
Raymond Hettinger 40174c358f SF bug #733667: kwargs handled incorrectly
The fast_function() inlining optimization only
applies when there are zero keyword arguments.
2003-05-31 07:04:16 +00:00
Neil Schemenauer ca2a2f11d0 Don't use fast_next_opcode for JUMP_* opcodes. This fixes the problem
reported by Kurt B. Kaiser.
2003-05-30 23:59:44 +00:00
Jack Jansen 4eb45e7804 Added functions CFObj_New and CFObj_Convert, general functions to convert
between CF objects and their Python representation. Fixes 734695.
2003-05-27 21:39:58 +00:00
Neal Norwitz a1d654e13a SF bug #644345, Poor error message for augmented assign
Update error message.  Hopefully this is clearer to some people.
2003-05-22 22:00:04 +00:00
Jeremy Hylton f9415e6245 Use macro to get length of list.
Remove comment about how code used to work.
2003-05-22 16:22:33 +00:00
Jeremy Hylton 521482d84f Remove comment with very long lines that explained what the code used
to do.

XXX Please be careful when checking in patches to avoid checking in
junk that explains what the patched code used to do.
2003-05-22 15:47:02 +00:00
Jeremy Hylton 4d508adae3 Fix for SF [ 734869 ] Lambda functions in list comprehensions
The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module.  Repair by move tmpname into the symtable entry.

Bugfix candidate.
2003-05-21 17:34:50 +00:00
Tim Peters 12d55a7caa cmp_type(): The grammar stopped allowing '=' as a comparison operator
about a decade ago.  Put the code still allowing for it in cmp_type()
out of its lonely misery.
2003-05-12 19:16:52 +00:00
Martin v. Löwis a94568a753 Patch #734231: Update RiscOS support. In particular, correct
riscospath.extsep, and use os.extsep throughout.
2003-05-10 07:36:56 +00:00
Martin v. Löwis 5467d4c0e3 Patch #612627: Add encoding attribute to file objects, and determine
the terminal encoding on Windows and Unix.
2003-05-10 07:10:12 +00:00
Martin v. Löwis cd12bfc142 Patch #708604: Check more function results. Will backport to 2.2. 2003-05-03 10:53:08 +00:00
Martin v. Löwis e6bbb4d16f Patch #684981: Add cleanup capability for argument parsers. Fixes 501716. 2003-05-03 10:00:22 +00:00
Martin v. Löwis c16f3bd8a3 Patch #708495: Port more stuff to OpenVMS. 2003-05-03 09:14:54 +00:00
Martin v. Löwis 9e29625a1b Patch #729300: Disable error message if Python is not built for threads. 2003-05-01 05:25:29 +00:00
Michael W. Hudson 26848a34d1 Use Tim's suggestion to fix
[ 708901 ] Lineno calculation sometimes broken

A one line patch to compile.c and a rather-more-than-one-line patch
to test_dis.  Hey ho.

Possibly a backport candidate -- tho' lnotab is less used in 2.2...
2003-04-29 17:07:36 +00:00
Michael W. Hudson 58ee2af48e Armin Rigo's fix & test for
[ 729622 ] line tracing hook errors

with massaging from me to integrate test into test suite.
2003-04-29 16:18:47 +00:00
Raymond Hettinger f4cf76dd5e Revert the previous enhancement to the bytecode optimizer.
The additional code complexity and new NOP opcode were not worth it.
2003-04-24 05:45:23 +00:00
Alex Martelli a9b9c9fa9f some more error-message enhancements 2003-04-23 13:34:35 +00:00
Alex Martelli f471d4783a complete and clarify some error messages for range() 2003-04-23 13:00:44 +00:00
Mark Hammond 6cb9029a22 PyGILState cleanup was too early - destructors called via module cleanup may use the API. 2003-04-22 11:18:00 +00:00
Alex Martelli 41c9f880d8 fixed a potential refcount bug (thanks Raymond!). 2003-04-22 09:24:48 +00:00
Alex Martelli a70b19147f Adding new built-in function sum, with docs and tests. 2003-04-22 08:12:33 +00:00
Raymond Hettinger 060641d511 Improved the bytecode optimizer.
* Can now test for basic blocks.
* Optimize inverted comparisions.
* Optimize unary_not followed by a conditional jump.
* Added a new opcode, NOP, to keep code size constant.
* Applied NOP to previous transformations where appropriate.

Note, the NOP would not be necessary if other functions were
added to re-target jump addresses and update the co_lnotab mapping.
That would yield slightly faster and cleaner bytecode at the
expense of optimizer simplicity and of keeping it decoupled
from the line-numbering structure.
2003-04-22 06:49:11 +00:00
Tim Peters cf615b5275 handle_system_exit(): This leaked the current exception info, in
particular leaving the traceback object (and everything reachable
from it) alive throughout shutdown.  The patch is mostly from Guido.

Bugfix candidate.
2003-04-19 18:47:02 +00:00
Mark Hammond 8d98d2cb95 New PyGILState_ API - implements pep 311, from patch 684256. 2003-04-19 15:41:53 +00:00
Martin v. Löwis 910ae6283a Patch #716969: Detect thread creation failure. Will backport to 2.2. 2003-04-19 07:44:52 +00:00
Martin v. Löwis 1509a152b3 Patch #711835: Remove unnecessary lock operations. Will backport to 2.2. 2003-04-18 11:11:09 +00:00
Guido van Rossum fce26e7f9f Roll back changes to 'h' format code -- too much breaks. Other
changes stay.
2003-04-18 00:12:30 +00:00
Jack Jansen dbd6503e97 dded missing k and K format specifiers to Py_BuildValue and friends. 2003-04-17 22:01:10 +00:00
Jack Jansen 84c2b1b9aa Oops, 'k' is the new format code for un unchecked 32 bit quantity,
not 'K'.
2003-04-17 20:44:21 +00:00
Jack Jansen ecc6635ae4 Converted manually written code to the new K format specifier.
Untested, but at least it still compiles.
2003-04-17 20:40:07 +00:00
Tim Peters 269b2a6797 _Py_PrintReferences(): Changed to print object address at start of each
new line.

New pvt API function _Py_PrintReferenceAddresses():  Prints only the
addresses and refcnts of the live objects.  This is always safe to call,
because it has no dependence on Python's C API.

Py_Finalize():  If envar PYTHONDUMPREFS is set, call (the new)
_Py_PrintReferenceAddresses() right before dumping final pymalloc stats.
We can't print the reprs of the objects here because too much of the
interpreter has been shut down.  You need to correlate the addresses
displayed here with the object reprs printed by the earlier
PYTHONDUMPREFS call to _Py_PrintReferences().
2003-04-17 19:52:29 +00:00
Thomas Heller a4ea603b05 SF # 595026: support for masks in getargs.c.
New functions:
  unsigned long PyInt_AsUnsignedLongMask(PyObject *);
  unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);
  unsigned long PyLong_AsUnsignedLongMask(PyObject *);
  unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);

New and changed format codes:

b unsigned char 0..UCHAR_MAX
B unsigned char none **
h unsigned short 0..USHRT_MAX
H unsigned short none **
i int INT_MIN..INT_MAX
I * unsigned int 0..UINT_MAX
l long LONG_MIN..LONG_MAX
k * unsigned long none
L long long LLONG_MIN..LLONG_MAX
K * unsigned long long none

Notes:

* New format codes.

** Changed from previous "range-and-a-half" to "none"; the
range-and-a-half checking wasn't particularly useful.

New test test_getargs2.py, to verify all this.
2003-04-17 18:55:45 +00:00
Guido van Rossum e13ddc9ec8 - New C API PyGC_Collect(), same as calling gc.collect().
- Call this in Py_Finalize().
- Expand the Misc/NEWS text on PY_LONG_LONG.
2003-04-17 17:29:22 +00:00
Guido van Rossum 66ebd91244 A missing piece of the PEP 269 patch: add PyParser_SetError(), a
wrapper around err_input().
2003-04-17 16:02:26 +00:00
Tim Peters d08e3824d4 Trimmed trailing whitespace. 2003-04-17 15:24:21 +00:00