Benjamin Peterson
8f7b94eae9
use stack macros
2009-06-28 16:14:07 +00:00
Benjamin Peterson
b8338ab92c
add two generic macros for peeking and setting in the stack
2009-06-28 16:08:02 +00:00
Benjamin Peterson
1a4ceb2f4b
fix grammar
2009-06-23 01:18:57 +00:00
Benjamin Peterson
d9920c255d
remove tmpname support since it's no longer used
2009-06-21 23:03:36 +00:00
Benjamin Peterson
f67caf8523
don't need to add the name 'lambda' as assigned
2009-06-21 23:01:07 +00:00
Benjamin Peterson
5ecf57adcf
remove unused 'encoding' member from the compiler struct
2009-06-17 03:23:04 +00:00
Benjamin Peterson
8fa3e933c1
update ast version
2009-06-13 20:30:48 +00:00
Benjamin Peterson
a72be3b325
when no module is given in a 'from' relative import, make ImportFrom.module NULL
2009-06-13 20:23:33 +00:00
Benjamin Peterson
52c4bec76b
give a better error message when deleting ()
2009-06-13 17:08:53 +00:00
Benjamin Peterson
5d1ff94b9e
set Print.values to NULL if there are no values
2009-06-13 16:19:19 +00:00
Benjamin Peterson
d1f5a59edb
allow importing from a module named None if it has an 'as' clause
2009-06-13 13:06:21 +00:00
Benjamin Peterson
565e1b6bb7
prevent import statements from assigning to None
2009-06-13 03:46:30 +00:00
Benjamin Peterson
4afbba3d34
keep the slice.step field as NULL if no step expression is given
2009-06-13 01:40:00 +00:00
Alexandre Vassalotti
a6e3474d02
Add const qualifier to PyErr_SetFromErrnoWithFilename and to
...
PyErr_SetFromErrnoWithUnicodeFilename.
2009-06-12 20:57:12 +00:00
Benjamin Peterson
4efb5d0b82
remove check for case handled in sub-function
2009-06-11 22:29:23 +00:00
Benjamin Peterson
b266481ed8
revert r73361
2009-06-11 17:49:38 +00:00
Benjamin Peterson
e5fa5fe8fc
remove duplicate check
2009-06-11 16:25:52 +00:00
Benjamin Peterson
a5a5728cf0
remove error checks already done in set_context()
2009-06-08 23:44:13 +00:00
Benjamin Peterson
8ea4ded9a6
remove useless assertion
2009-06-08 22:18:32 +00:00
Antoine Pitrou
46dbe27f7e
Issue #5330 : C functions called with keyword arguments were not reported by
...
the various profiling modules (profile, cProfile). Patch by Hagen Fürstenau.
2009-05-30 21:27:00 +00:00
Jeffrey Yasskin
7937d939b1
Fix nearly all compilation warnings under Apple gcc-4.0. Tested with OPT="-g
...
-Wall -Wstrict-prototypes -Werror" in both --with-pydebug mode and --without.
There's still a batch of non-prototype warnings in Xlib.h that I don't know how
to fix.
2009-05-29 03:44:31 +00:00
Philip Jenvey
dd0388a1c2
further hint to where the open docs really are
2009-05-28 03:12:16 +00:00
Benjamin Peterson
aafa18aa05
teach the peepholer about SETUP_WITH
2009-05-26 12:49:59 +00:00
Georg Brandl
944f684ce6
Allow multiple context managers in one with statement, as proposed
...
in http://codereview.appspot.com/53094 and accepted by Guido.
The construct is transformed into multiple With AST nodes so that
there should be no problems with the semantics.
2009-05-25 21:02:56 +00:00
Benjamin Peterson
49a6b0ef70
take into account the fact that SETUP_WITH pushes a finally block
2009-05-25 20:12:57 +00:00
Benjamin Peterson
1880d8b823
add a SETUP_WITH opcode
...
It speeds up the with statement and correctly looks up the special
methods involved.
2009-05-25 13:13:44 +00:00
Benjamin Peterson
87e5006d8c
handle errors from _PyObject_LookupSpecial when __get__ fails
2009-05-25 02:40:21 +00:00
Jeffrey Yasskin
655d835415
Issue #6042 :
...
lnotab-based tracing is very complicated and isn't documented very well. There
were at least 3 comment blocks purporting to document co_lnotab, and none did a
very good job. This patch unifies them into Objects/lnotab_notes.txt which
tries to completely capture the current state of affairs.
I also discovered that we've attached 2 layers of patches to the basic tracing
scheme. The first layer avoids jumping to instructions that don't start a line,
to avoid problems in if statements and while loops. The second layer
discovered that jumps backward do need to trace at instructions that don't
start a line, so it added extra lnotab entries for 'while' and 'for' loops, and
added a special case for backward jumps within the same line. I replaced these
patches by just treating forward and backward jumps differently.
2009-05-23 23:23:01 +00:00
Benjamin Peterson
e5afa3b24b
support building with subversion 1.7 #6094
2009-05-23 19:24:37 +00:00
Hirokazu Yamamoto
b24bb27d22
Issue #3527 : Removed Py_WIN_WIDE_FILENAMES which is not used any more.
2009-05-17 02:52:09 +00:00
R. David Murray
525cffcd7e
Move news item to correct section, remove spurious 'see below'
...
from docstring.
2009-05-13 13:07:14 +00:00
R. David Murray
a3ec697cbd
Issue 5994: add docstrings to marshal.
2009-05-13 00:30:29 +00:00
Benjamin Peterson
4c1fe51ca0
don't ignore exceptions from _PyObject_LengthHint
2009-05-09 19:17:59 +00:00
Benjamin Peterson
af1692a266
convert some more special methods to use _PyObject_LookupSpecial
2009-05-09 16:36:39 +00:00
Jeffrey Yasskin
f7f858d141
Issue 5954, PyFrame_GetLineNumber:
...
Most uses of PyCode_Addr2Line
(http://www.google.com/codesearch?q=PyCode_Addr2Line ) are just trying to get
the line number of a specified frame, but there's no way to do that directly.
Forcing people to go through the code object makes them know more about the
guts of the interpreter than they should need.
The remaining uses of PyCode_Addr2Line seem to be getting the line from a
traceback (for example,
http://www.google.com/codesearch/p?hl=en#u_9_nDrchrw/pygame-1.7.1release/src/base.c&q=PyCode_Addr2Line ),
which is replaced by the tb_lineno field. So we may be able to deprecate
PyCode_Addr2Line entirely for external use.
2009-05-08 22:23:21 +00:00
Eric Smith
a985a3aee4
Issue #5920 : Changed format.__float__ and complex.__float__ to use a precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson.
2009-05-05 18:26:08 +00:00
Mark Dickinson
01fce5adc0
Don't use PyOS_strnicmp for NaN and Inf detection: it's locale-aware.
2009-05-03 22:33:34 +00:00
Mark Dickinson
777e4ff503
Eliminate some locale-dependent calls to isspace and tolower.
2009-05-03 20:59:48 +00:00
Eric Smith
9139cc6a3b
Issue #1588 : Add complex.__format__.
2009-04-30 00:58:58 +00:00
Mark Dickinson
df108ca324
Remove format_float and use _PyOS_double_to_string instead.
2009-04-29 21:56:53 +00:00
Mark Dickinson
92fcc9c991
Issue #5864 : format(1234.5, '.4') gives misleading result
...
(Backport of r72109 from py3k.)
2009-04-29 20:41:00 +00:00
Eric Smith
94cc00ce4d
Silence warning on Windows.
2009-04-28 07:33:09 +00:00
Eric Smith
cac7af6863
Issue #5793 : rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
2009-04-27 19:04:37 +00:00
Mark Dickinson
e73cbe7a4e
Fix typo in function name
2009-04-26 19:54:55 +00:00
Mark Dickinson
6d6b220215
Backport r71967 changes from py3k to trunk.
...
(Internal plumbing changes for float parsing.)
2009-04-26 16:04:05 +00:00
Eric Smith
068f06568b
Issue #5835 , deprecate PyOS_ascii_formatd.
...
If anyone wants to clean up the documentation, feel free. It's my first documentation foray, and it's not that great.
Will port to py3k with a different strategy.
2009-04-25 21:40:15 +00:00
Mark Dickinson
95bc980d9e
Issue #5816 :
...
- simplify parsing and printing of complex numbers
- make complex(repr(z)) round-tripping work for complex
numbers involving nans, infs, or negative zeros
- don't accept some of the stranger complex strings
that were previously allowed---e.g., complex('1..1j')
2009-04-24 12:46:53 +00:00
Eric Smith
aca19e6a74
Backport of some of the work in r71665 to trunk. This reworks much of
...
int, long, and float __format__(), and it keeps their implementation
in sync with py3k.
Also added PyOS_double_to_string. This is the "fallback" version
that's also available in trunk, and should be kept in sync with that
code. I'll add an issue to document PyOS_double_to_string in the C
API.
There are many internal cleanups. Externally visible changes include:
- Implement PEP 378, Format Specifier for Thousands Separator, for
floats, ints, and longs.
- Issue #5515 : 'n' formatting for ints, longs, and floats handles
leading zero formatting poorly.
- Issue #5772 : For float.__format__, don't add a trailing ".0" if
we're using no type code and we have an exponent.
2009-04-22 13:29:05 +00:00
Mark Dickinson
1bdf7e9cab
Issue #1869 : Fix a couple of minor round() issues.
2009-04-18 14:59:42 +00:00
Mark Dickinson
8e5446f902
Backport r71704 (add configure check for C99 round function) to trunk.
2009-04-18 14:41:37 +00:00
Mark Dickinson
4beb89b9f7
copysign shouldn't be declared as static in pymath.c
2009-04-18 14:13:43 +00:00
Georg Brandl
6c59e72576
#5580 : no need to use parentheses when converterr() argument is actually a type description.
2009-04-05 11:54:07 +00:00
Matthias Klose
edb5e1e09e
- Issue #3845 : In PyRun_SimpleFileExFlags avoid invalid memory access with
...
short file names.
2009-04-04 14:18:13 +00:00
Antoine Pitrou
789be0c0a0
Issue #2396 : backport the memoryview object.
2009-04-02 21:18:34 +00:00
Georg Brandl
d3f03fa715
PyErr_NormalizeException may not set an error, so convert the PyErr_SetObject
...
call on hitting the recursion limit into just assigning it to the arguments provided.
2009-04-02 18:09:04 +00:00
Brett Cannon
238cedcd63
Fix two issues introduced by issue #71031 by changing the signature of
...
PyImport_AppendInittab() to take a const char *.
2009-04-02 03:34:53 +00:00
Brett Cannon
c4f90ebea7
PyImport_AppendInittab() took a char * as a first argument even though that
...
string was stored beyond the life of the call. Changed the signature to be
const char * to help make this point.
Closes issue #1419652 .
2009-04-02 03:17:39 +00:00
Benjamin Peterson
985951df7f
fix error handling
2009-04-02 02:52:46 +00:00
Georg Brandl
4b5c53aba5
In PyErr_GivenExceptionMatches, temporarily bump the recursion
...
limit, so that in the most common case PyObject_IsSubclass will
not raise a recursion error we have to ignore anyway.
2009-04-02 02:47:44 +00:00
Brett Cannon
15ba4dae5a
_warnings was importing itself to get an attribute. That's bad if warnings gets
...
called in a thread that was spawned by an import itself.
Last part to close #1665206 .
2009-04-01 18:03:59 +00:00
Jesse Noller
42f9b4e5b4
Issue 5619: Pass MS CRT debug flags into subprocesses
2009-03-31 22:20:35 +00:00
Jeremy Hylton
2696275348
Add check for PyDict_Update() error.
2009-03-31 15:04:15 +00:00
Jeremy Hylton
88f1c04215
Global statements from one function leaked into parallel functions.
...
Re http://bugs.python.org/issue4315
The symbol table used the same name dictionaries to recursively
analyze each of its child blocks, even though the dictionaries are
modified during analysis. The fix is to create new temporary
dictionaries via the analyze_child_block(). The only information that
needs to propagate back up is the names of the free variables.
Add more comments and break out a helper function. This code doesn't
get any easier to understand when you only look at it once a year.
2009-03-31 13:48:15 +00:00
Mark Dickinson
efc82f7e8e
Issue #4258 : Use 30-bit digits for Python longs, on 64-bit platforms.
...
Backport of r70459.
2009-03-20 15:51:55 +00:00
Benjamin Peterson
6ffe852f90
fix strange errors when setting attributes on tracebacks #4034
2009-03-18 20:52:15 +00:00
Nick Coghlan
8eba5ed0d9
Make marshalling errors a little more informative as to what went wrong
2009-03-15 03:24:46 +00:00
Brett Cannon
6c4cff0f32
Require implementations for warnings.showwarning() support the 'line' argument.
...
Was a DeprecationWarning for not supporting it since Python 2.6.
Closes issue #3652 .
2009-03-11 04:51:06 +00:00
Jeffrey Yasskin
68d6852006
Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
...
POP_JUMP_IF_{TRUE,FALSE} and JUMP_IF_{TRUE,FALSE}_OR_POP. This avoids executing
a POP_TOP on each conditional and sometimes allows the peephole optimizer to
skip a JUMP_ABSOLUTE entirely. It speeds up list comprehensions significantly.
2009-02-28 19:03:21 +00:00
Collin Winter
8725dce2ae
Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example.
2009-02-20 19:30:41 +00:00
Mark Dickinson
c97c9096ed
Issue #4575 : fix Py_IS_INFINITY macro to work correctly on x87 FPUs.
...
It now forces its argument to double before testing for infinity.
2009-02-09 14:18:43 +00:00
Mark Dickinson
9e58a37252
Silence 'arg may be used uninitialized in this function' warning from gcc.
2009-02-08 17:33:11 +00:00
Eric Smith
81fe09344c
Implement issue #4285 , convert sys.version_info to a named
...
tuple. Patch by Ross Light.
2009-02-06 00:48:26 +00:00
Raymond Hettinger
b516370bcb
Issue 1242657: list(obj) can swallow KeyboardInterrupt.
2009-02-02 21:50:13 +00:00
Benjamin Peterson
12554cb224
more flags which only work for function blocks
2009-01-31 23:54:38 +00:00
Benjamin Peterson
da9327faf7
add explanatory comment
2009-01-31 23:43:25 +00:00
Mark Hammond
9f4f56d4e8
On Windows, use the Python 'Activation Context' when loading extensions
...
to avoid problems loading the CRT from a private assembly. Via bug 4566.
2009-01-27 23:12:23 +00:00
Benjamin Peterson
78821ddf8c
fix building the core with --disable-unicode
...
I changed some bytearray methods to use strings instead of unicode like bytes_repr
Also, bytearray.fromhex() can take strings as well as unicode
2009-01-25 17:15:10 +00:00
Benjamin Peterson
e18ef194d9
allow unicode keyword arguments for the ** syntax #4978
2009-01-20 14:21:16 +00:00
Amaury Forgeot d'Arc
59ce042766
#4077 : No need to append \n when calling Py_FatalError
...
+ fix a declaration to make it match the one in pythonrun.h
2009-01-17 20:18:59 +00:00
Martin v. Löwis
e3422fae8a
Issue #4893 : Use NT threading on CE.
2009-01-12 08:11:24 +00:00
Martin v. Löwis
1b3bef21b0
Issue #4915 : Port sysmodule to Windows CE.
2009-01-12 07:57:11 +00:00
Martin v. Löwis
b3b7d859b3
Issue #4279 : Fix build of parsermodule under Cygwin.
2009-01-11 09:26:54 +00:00
Kristján Valur Jónsson
abb70e9c9f
Issue 4906: Preserve windows error state across PyThread_get_key_value
2009-01-10 12:14:31 +00:00
Kristján Valur Jónsson
0e91938e58
Issue 4293: Make Py_AddPendingCall() thread safe
2009-01-09 20:31:26 +00:00
Kristján Valur Jónsson
3b2a6b819d
Issue 3677: Fix import from UNC paths on Windows.
2009-01-09 20:10:59 +00:00
Kristján Valur Jónsson
00f2df495a
Issue 3582. Improved thread support and TLS for Windows
2009-01-09 20:03:27 +00:00
Antoine Pitrou
e96d4ea4e2
Issue #1180193 : When importing a module from a .pyc (or .pyo) file with
...
an existing .py counterpart, override the co_filename attributes of all
code objects if the original filename is obsolete (which can happen if the
file has been renamed, moved, or if it is accessed through different paths).
Patch by Ziga Seilnacht and Jean-Paul Calderone.
2009-01-06 18:10:47 +00:00
Martin v. Löwis
0fa10b3cd5
Issue #4817 : Remove unused function PyOS_GetLastModificationTime.
2009-01-03 17:19:26 +00:00
Benjamin Peterson
796798b29c
fix compilation on non-Windows platforms
2009-01-02 20:47:27 +00:00
Martin v. Löwis
5344c99734
Issue #4075 : Use OutputDebugStringW in Py_FatalError.
2009-01-02 20:32:55 +00:00
Benjamin Peterson
d6baa70b96
welcome to 2009, Python!
2009-01-01 17:29:49 +00:00
Benjamin Peterson
8d5934b25d
#4748 lambda generators shouldn't return values
2008-12-27 18:24:11 +00:00
Benjamin Peterson
4caef5c7e2
fix #4720 : the format to PyArg_ParseTupleAndKeywords can now start with '|'
2008-12-22 20:51:15 +00:00
Antoine Pitrou
d0c3515bc5
Issue #2183 : Simplify and optimize bytecode for list comprehensions.
2008-12-17 00:38:28 +00:00
Amaury Forgeot d'Arc
ad9b5992e3
#4559 : When a context manager's __exit__() method returns an object whose
...
conversion to bool raises an exception, 'with' loses that exception.
Reviewed by Jeffrey Yasskin.
Already ported to 2.5, will port to 2.6 and 3.0
2008-12-10 23:22:49 +00:00
Jeffrey Yasskin
2d873bd68b
Issue 4597: Fix several cases in EvalFrameEx where an exception could be
...
"raised" without setting x, err, or why to let the eval loop know.
2008-12-08 18:55:24 +00:00
Mark Dickinson
422ce06b9c
Issue #4461 : Safety check in parsenumber (ast.c)
2008-12-05 17:59:46 +00:00
Jeffrey Yasskin
fd8a1ec486
Speed up Python (according to pybench and 2to3-on-itself) by 1-2% by caching
...
whether any thread has tracing turned on, which saves one load instruction in
the fast_next_opcode path in PyEval_EvalFrameEx(). See issue 4477.
2008-12-03 06:46:45 +00:00
Benjamin Peterson
9e6310d936
always check the return value of NEW_IDENTIFIER
2008-11-25 03:43:14 +00:00
Amaury Forgeot d'Arc
dc61901dd2
#3996 : On Windows, PyOS_CheckStack is supposed to protect the interpreter from
...
stack overflow. But doing this, it always crashes when the stack is nearly full.
Reviewed by Martin von Loewis. Will backport to 2.6.
2008-11-22 20:01:18 +00:00