Neal Norwitz
0f5aed4e41
Remove compiler warning
2004-06-13 20:32:17 +00:00
Neal Norwitz
d85c452604
Make private function static
2004-06-13 20:31:49 +00:00
Martin v. Löwis
737ea82a5a
Patch #774665 : Make Python LC_NUMERIC agnostic.
2004-06-08 18:52:54 +00:00
Martin v. Löwis
f30d60edbc
Patch #510695 : Add TSC profiling for the VM.
2004-06-08 08:17:44 +00:00
Thomas Heller
25653242fe
Fix a refcount bug in an obscure code corner.
...
Already backported.
2004-06-07 15:04:10 +00:00
Raymond Hettinger
f2c0830585
SF bug #963956 : Bad error mesage when subclassing a module
...
Add a more informative message for the common user mistake of subclassing
from a module name rather than another class (i.e. random instead of
random.random).
2004-06-05 06:16:22 +00:00
Martin v. Löwis
e440e47e91
Patch #957398 : Add public API for Generator Object/Type.
2004-06-01 15:22:42 +00:00
Fred Drake
8759090562
starting to add comments to explain what's here
2004-05-28 20:21:36 +00:00
Raymond Hettinger
354433a59d
SF patch #872326 : Generator expression implementation
...
(Code contributed by Jiwon Seo.)
The documentation portion of the patch is being re-worked and will be
checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's
rationale for the design decisions on binding behavior (as described in
in his patch comments and in discussions on python-dev).
The test file, test_genexps.py, is written in doctest format and is
meant to exercise all aspects of the the patch. Further additions are
welcome from everyone. Please stress test this new feature as much as
possible before the alpha release.
2004-05-19 08:20:33 +00:00
Anthony Baxter
c3d931685b
forward-port 1.17.12.1
2004-05-13 11:54:19 +00:00
Raymond Hettinger
c8aa08b172
Some (but not all) of the why code bitfield tests ran faster as
...
separate equality tests. Now, all are set to their best timing.
2004-04-11 14:59:33 +00:00
Raymond Hettinger
5bed456056
Revert 2.393, elimination of pre-decrementing, which
...
did not stand-up to additional timings.
2004-04-10 23:34:17 +00:00
Raymond Hettinger
7eddd78a15
Use continue instead of break whereever possible.
2004-04-07 14:38:08 +00:00
Raymond Hettinger
d3b836d202
* Improve readability and remove data dependencies by converting
...
pre-increment forms to post-increment forms. Post-incrementing
also eliminates the need for negative array indices for oparg fetches.
* In exception handling code, check for class based exceptions before
the older string based exceptions.
2004-04-07 13:17:27 +00:00
Raymond Hettinger
467a698bd2
Small code improvements for readability, code size, and/or speed.
...
BINARY_SUBSCR:
* invert test for normal case fall through
* eliminate err handling code by jumping to slow_case
LOAD_LOCALS:
* invert test for normal case fall through
* continue instead of break for the non-error case
STORE_NAME and DELETE_NAME:
* invert test for normal case fall through
LOAD_NAME:
* continue instead of break for the non-error case
DELETE_FAST:
* invert test for normal case fall through
LOAD_DEREF:
* invert test for normal case fall through
* continue instead of break for the non-error case
2004-04-07 11:39:21 +00:00
Raymond Hettinger
7c9586545e
Simplify previous checkin (bitfields for WHY codes).
...
Restores the self-documenting enum declaration.
2004-04-06 10:11:10 +00:00
Raymond Hettinger
06032cb664
Coded WHY flags as bitfields (taking inspiration from tp_flags).
...
This allows multiple flags to be tested in a single compare
which eliminates unnecessary compares and saves a few bytes.
2004-04-06 09:37:35 +00:00
Tim Peters
8a5c3c76be
Since the fast_yield branch target was introduced, it appears that most
...
tests of "why" against WHY_YIELD became useless. This patch removes them,
but assert()s that why != WHY_YIELD everywhere such a test was removed.
The test suite ran fine under a debug build (i.e., the asserts never
triggered).
2004-04-05 19:36:21 +00:00
Jeremy Hylton
d4ceb31664
Bump the magic number to avoid sharing bytecode between 2.3 and 2.4.
...
Revise the long comment that explained details of the magic number
in gory detail.
2004-04-01 02:45:22 +00:00
Andrew MacIntyre
da4d6cb573
OS/2 VACPP build updates/fixes
2004-03-29 11:53:38 +00:00
Armin Rigo
01ab279056
Marshal clean-up (SF patch #873224 )
2004-03-26 15:09:27 +00:00
Nicholas Bastin
2786d90617
A few more PyThreadState_Get to PyThreadState_GET conversions
2004-03-25 02:16:23 +00:00
Nicholas Bastin
e5662aedef
Changed random calls to PyThreadState_Get() to use the macro
2004-03-24 22:22:12 +00:00
Nicholas Bastin
c69ebe8d50
Enable the profiling of C functions (builtins and extensions)
2004-03-24 21:57:10 +00:00
Martin v. Löwis
83969eeeeb
Decref all if ensure_fromlist fails. Fixes #876533 .
...
Backported to 2.3.
2004-03-23 16:28:13 +00:00
Armin Rigo
5d2c68359b
Lost reference.
2004-03-22 20:16:58 +00:00
Armin Rigo
bf57a14522
Fix SF bug #765624 .
2004-03-22 19:24:58 +00:00
Armin Rigo
80d937e986
Fix for line events in the case:
...
def f(a):
if a:
print 5
else:
pass
2004-03-22 17:52:53 +00:00
Nicholas Bastin
a7604bf1b4
Moved tracebackobject to traceback.h, Closes SF Bug #497067
2004-03-21 18:37:23 +00:00
Raymond Hettinger
ff5bc50bb0
Improve byte coding for multiple assignments.
...
Gives 30% speedup on "a,b=1,2" and 25% on "a,b,c=1,2,3".
2004-03-21 15:12:00 +00:00
Armin Rigo
9dbf9084e8
Cancelled checkin, sorry.
2004-03-20 21:50:13 +00:00
Armin Rigo
1515fc2a01
A 2% speed improvement with gcc on low-endian machines. My guess is that this
...
new pattern for NEXTARG() is detected and optimized as a single (*short)
loading.
2004-03-20 20:03:17 +00:00
Raymond Hettinger
fba1cfc49a
LIST_APPEND is predicably followed by JUMP_ABSOLUTE.
...
Reduces loop overhead by an additional 10%.
2004-03-12 16:33:17 +00:00
Raymond Hettinger
2d783e9b16
Move the code for BREAK and CONTINUE_LOOP to be near FOR_ITER.
...
Makes it more likely that all loop operations are in the cache
at the same time.
2004-03-12 09:12:22 +00:00
Raymond Hettinger
db0de9e7ca
Speedup for-loops by inlining PyIter_Next(). Saves duplicate tests
...
and a function call resulting in a 15% reduction of total loop overhead
(as measured by timeit.Timer('pass')).
2004-03-12 08:41:36 +00:00
Raymond Hettinger
f114a3ae63
Refactor and optimize code for UNPACK_SEQUENCE.
...
* Defer error handling for wrong number of arguments to the
unpack_iterable() function. Cuts the code size almost in half.
* Replace function calls to PyList_Size() and PyTuple_Size() with
their smaller and faster macro counterparts.
* Move the constant structure references outside of the inner loops.
2004-03-08 23:25:30 +00:00
Raymond Hettinger
dd80f76265
SF patch #910929 : Optimize list comprehensions
...
Add a new opcode, LIST_APPEND, and apply it to the code generation for
list comprehensions. Reduces the per-loop overhead by about a third.
2004-03-07 07:31:06 +00:00
Hye-Shik Chang
30e97dbe96
SF Patch #902444 : Use process scope thread on FreeBSD. System scope
...
is too expensive on FreeBSD's KSE threading infrastructure and
even test_threadedimport fails on default setting.
2004-03-04 06:35:57 +00:00
Skip Montanaro
6babcc2ad4
typo
2004-03-03 08:42:23 +00:00
Skip Montanaro
786ea6bc23
Add pystack definition to Misc/gdbinit with some explanation of its behavior
...
and add flag comments to ceval.c and main.c alerting people to the coupling
between pystack and the layout of those files.
2004-03-01 15:44:05 +00:00
Michael W. Hudson
ecfeb7f095
This is my patch #876198 plus a NEWS entry and a header frob.
...
Remove the ability to use (from C) arbitrary objects supporting the
read buffer interface as the co_code member of code objects.
2004-02-12 15:28:27 +00:00
Skip Montanaro
7befb9966e
remove support for missing ANSI C header files (limits.h, stddef.h, etc).
2004-02-10 16:50:21 +00:00
Raymond Hettinger
a72169871d
SF patch #884022 : dynamic execution profiling vs opcode prediction
...
(Contributed by Andrew I MacIntyre.)
disables opcode prediction when dynamic execution
profiling is in effect, so the profiling counters at
the top of the main interpreter loop in eval_frame()
are updated for each opcode.
2004-02-08 19:59:27 +00:00
Skip Montanaro
f1afe6682c
Remove support for systems defining Py_PTHREAD_D[467] in
...
Python/thread_pthread.h.
2004-02-07 13:00:18 +00:00
Raymond Hettinger
1dd8309246
SF patch #864059 : optimize eval_frame
...
Simplified version of Neal Norwitz's patch which adds gotos for
opcodes that set "why". This skips a number of tests where the
outcome of the tests are known in advance.
2004-02-06 18:32:33 +00:00
Hye-Shik Chang
ff83c2bacc
Fix input() builtin function to respect compiler flags.
...
(SF patch 876178, patch by mwh, unittest by perky)
2004-02-02 13:39:01 +00:00
Skip Montanaro
b9949dbe6c
Remove support for DYNIX, IRIX 4, --with-sgi-dl, --with-dl-dld
2004-01-17 04:04:13 +00:00
Skip Montanaro
4d474becd8
remove DGUX support.
2004-01-17 00:29:32 +00:00
Raymond Hettinger
b86269db45
Apply pre-sizing optimization to a broader class of objects.
...
Formerly, the length was only fetched from sequence objects.
Now, any object that reports its length can benefit from pre-sizing.
2004-01-04 11:00:08 +00:00
Raymond Hettinger
77f3c87113
Apply map/zip pre-sizing optimization to a broader class of objects.
...
Formerly, the length was only fetched from sequence objects.
Now, any object that reports its length can benefit from pre-sizing.
2004-01-04 08:54:44 +00:00
Jeremy Hylton
ecd9129c94
Add comment to mollify Tim.
2004-01-02 23:25:32 +00:00
Hye-Shik Chang
7db07e6972
Fix gcc 3.3 warnings related to Py_UNICODE_WIDE.
2003-12-29 01:36:01 +00:00
Raymond Hettinger
64958a15d7
Guido grants a Christmas wish:
...
sorted() becomes a regular function instead of a classmethod.
2003-12-17 20:43:33 +00:00
Fred Drake
d75ede3238
Remove the PendingDeprecationWarning from apply(). apply() will
...
remain deprecated in the documentation.
2003-12-05 17:34:27 +00:00
Tim Peters
1d7323e4e7
Py_Finalize(): disabled the second call of cyclic gc, and added extensive
...
comments about why both calls to cyclic gc here can cause problems.
I'll backport to 2.3 maint. Since the calls were introduced in 2.3,
that will be the end of it.
2003-12-01 21:35:27 +00:00
Guido van Rossum
6c9e130524
- Removed FutureWarnings related to hex/oct literals and conversions
...
and left shifts. (Thanks to Kalle Svensson for SF patch 849227.)
This addresses most of the remaining semantic changes promised by
PEP 237, except for repr() of a long, which still shows the trailing
'L'. The PEP appears to promise warnings for operations that
changed semantics compared to Python 2.3, but this is not
implemented; we've suffered through enough warnings related to
hex/oct literals and I think it's best to be silent now.
2003-11-29 23:52:13 +00:00
Jack Jansen
eddc1449ba
Getting rid of all the code inside #ifdef macintosh too.
2003-11-20 01:44:59 +00:00
Jack Jansen
4bae2d5e46
Getting rid of code dependent on GUSI or the MetroWerks compiler.
2003-11-19 22:52:23 +00:00
Jack Jansen
a53f4eba19
Getting rid of code conditional on TARGET_API_MAC_*.
2003-11-19 16:34:04 +00:00
Jack Jansen
37249c5524
WITHOUT_FRAMEWORKS conditional code bites the dust: this was for
...
pre-carbon MacOS9 support.
2003-11-19 15:32:46 +00:00
Jack Jansen
fb2765666f
Getting rid of support for the ancient Apple MPW compiler.
2003-11-19 15:24:47 +00:00
Jack Jansen
6196322066
MacOS9 support is gone.
2003-11-19 14:55:33 +00:00
Raymond Hettinger
a690a9967e
* Migrate set() and frozenset() from the sandbox.
...
* Install the unittests, docs, newsitem, include file, and makefile update.
* Exercise the new functions whereever sets.py was being used.
Includes the docs for libfuncs.tex. Separate docs for the types are
forthcoming.
2003-11-16 16:17:49 +00:00
Martin v. Löwis
f56d015a71
Patch #804543 : strdup saved locales. Backported to 2.3.
2003-11-13 07:43:21 +00:00
Raymond Hettinger
85c20a41df
Implement and apply PEP 322, reverse iteration
2003-11-06 14:06:48 +00:00
Jeremy Hylton
904ed86a77
Make undetected error on stack unwind a fatal error.
2003-11-05 17:29:35 +00:00
Armin Rigo
2b3eb4062c
Deleting cyclic object comparison.
...
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
2003-10-28 12:05:48 +00:00
Alex Martelli
a253e183b8
regressing the performance bugfix -- Guido wants the performance bug left
...
alone, because there can be no guarantee re the semantics of += vs + .
2003-10-25 23:24:14 +00:00
Armin Rigo
1d313ab9d1
oh dear. Wrong manipulation. Committed a version of ceval.c from my
...
no-cyclic-comparison patch at the same time as errors.c.
Reverting ceval.c to the previous revision.
2003-10-25 14:33:09 +00:00
Armin Rigo
092381a979
Made function declaration a proper C prototype
2003-10-25 14:29:27 +00:00
Alex Martelli
a2777d3a55
Changed builtin_sum to use PyNumber_InPlaceAdd (same semantics, but fixes
...
a performance bug in sum(manylists)), same as in 2.3 maintenance branch.
2003-10-25 12:49:56 +00:00
Raymond Hettinger
5cf6394b12
Use PyArg_UnpackTuple() where possible.
2003-10-25 06:41:37 +00:00
Martin v. Löwis
f8d59d28e0
Patch #828384 : Don't discard nested exception in AddObject.
2003-10-24 20:05:32 +00:00
Walter Dörwald
f0dfc7ac5c
Fix a bunch of typos in documentation, docstrings and comments.
...
(From SF patch #810751 )
2003-10-20 14:01:56 +00:00
Martin v. Löwis
dd7eb146a8
Patch #792869 : Clarify error message for parameters declared global,
...
rename LOCAL_GLOBAL to PARAM_GLOBAL.
2003-10-18 22:05:25 +00:00
Raymond Hettinger
8ae4689657
Simplify and speedup uses of Py_BuildValue():
...
* Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a) --> PyTuple_New(0)
* Py_BuildValue("O", a) --> Py_INCREF(a)
2003-10-12 19:09:37 +00:00
Jeremy Hylton
9832613beb
Fix SF bug [ 808594 ] leak on lambda with duplicate arguments error.
...
Refactor code so that one helper routine sets error location and
increments st_errors.
Bug fix candidate.
2003-09-22 04:26:44 +00:00
Martin v. Löwis
70849f84a0
Patch #805613 : Fix usage of the PTH library.
2003-09-20 11:13:36 +00:00
Raymond Hettinger
cc1798e0c0
Improve the leak fix so that PyTuple_New is only called when needed.
2003-09-16 04:27:52 +00:00
Jeremy Hylton
364f6becad
Correct check of PyUnicode_Resize() return value.
2003-09-16 03:17:16 +00:00
Jeremy Hylton
1aad9c7dad
Reflow long lines and reformat.
2003-09-16 03:10:59 +00:00
Raymond Hettinger
37a724d718
Fix leak discovered in test_new by Michael Hudson.
...
Will backport to 2.3.1
2003-09-15 21:43:16 +00:00
Martin v. Löwis
e81e9b1d3b
Patch #794826 : Add __file__ in dynamically loaded modules for multiple
...
interpreters. Fixes #698282 . Will backport to 2.3.
2003-09-04 18:45:59 +00:00
Jason Tishler
6bc06eca70
Bug #794140 : cygwin builds do not embed
...
The embed2.diff patch solves the user's problem by exporting the missing
symbols from the Python core so Python can be embedded in another Cygwin
application (well, at lest vim).
2003-09-04 11:59:50 +00:00
Jeremy Hylton
376e63d5cd
Fix for SF bug [ 784075 ] Fatal Python error: unknown scope
...
Make sure the inner function is not compiled when there is a syntax
error in the default arguments.
2003-08-28 14:42:14 +00:00
Walter Dörwald
c58a3a10a9
Fix a crash: when sq_item failed the code continued blindly and used the
...
NULL pointer. (Detected by Michael Hudson, patch provided by Neal Norwitz).
Fix refcounting leak in filtertuple().
2003-08-18 18:28:45 +00:00
Walter Dörwald
e98147a8e5
Fix refcount leak in the UnicodeError constructor:
...
When parsing the constructor arguments failed, a
reference to the argument tuple was leaked.
2003-08-14 20:59:07 +00:00
Neil Schemenauer
689735562d
Make filter(bool, ...) as fast as filter(None, ...).
2003-08-14 20:37:34 +00:00
Walter Dörwald
a54b92b2eb
Add a unicode prefix to the characters in the UnicodeEncodeError and
...
UnicodeTranslateError message.
2003-08-12 17:34:49 +00:00
Walter Dörwald
fd196bd263
Enhance message for UnicodeEncodeError and UnicodeTranslateError.
...
If there is only one bad character it will now be printed in a
form that is a valid Python string.
2003-08-12 17:32:43 +00:00
Michael W. Hudson
68debc935b
Fix refcounting and cut & paste error (?) in last checkin.
...
This should go onto release23-maint, too.
2003-08-11 12:20:24 +00:00
Martin v. Löwis
a2c17c5820
Move initialization of sys.std{in,out}.encoding to Py_Initialize.
...
Verify that the encoding actually exists. Fixes #775985 .
Will backport to 2.3.
2003-08-09 09:47:11 +00:00
Raymond Hettinger
eaef615116
As discussed on python-dev, changed builtin.zip() to handle zero arguments
...
by returning an empty list instead of raising a TypeError.
2003-08-02 07:42:57 +00:00
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