Antoine Pitrou
8933521b3d
Fix refleak introduced by 4f730c045f5f (issue #18408 ) and unveiled by 95eea8624d05 (issue #16596 ).
12 years ago
Guido van Rossum
8820c239f7
Better behavior when stepping over yield[from]. Fixes issue 16596. By Xavier de Gaye.
12 years ago
Victor Stinner
cab75e3e1e
Issue #19512 : PRINT_EXPR bytecode now uses an identifier to get sys.displayhook
to only create the "displayhook" string once
12 years ago
Benjamin Peterson
8f169489c4
update comment
12 years ago
Victor Stinner
41bb43a71e
Issue #18408 : Add a new PyFrame_FastToLocalsWithError() function to handle
exceptions when merging fast locals into f_locals of a frame.
PyEval_GetLocals() now raises an exception and return NULL on failure.
12 years ago
Victor Stinner
8d19767403
Close #19199 : Remove ``PyThreadState.tick_counter`` field
12 years ago
Antoine Pitrou
59c900d3bf
Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.
12 years ago
Antoine Pitrou
9ed5f27266
Issue #18722 : Remove uses of the "register" keyword in C code.
13 years ago
Antoine Pitrou
58720d6145
Issue #17934 : Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles.
13 years ago
Christian Heimes
0bd447f847
Add missing check of PyDict_SetItem()'s return value in PyEval_EvalCodeEx()
CID 486647
13 years ago
Victor Stinner
ace47d7efd
Issue #18408 : PyEval_EvalFrameEx() and PyEval_CallObjectWithKeywords() now fail
with an assertion error if they are called with an exception set
(PyErr_Occurred()).
If these functions are called with an exception set, the exception may be
cleared and so the caller looses its exception.
Add also assertions to PyEval_CallObjectWithKeywords() and call_function() to
check if the function succeed with no exception set, or the function failed
with an exception set.
13 years ago
Victor Stinner
f243ee4055
Issue #18408 : add more assertions on PyErr_Occurred() in ceval.c to detect bugs
earlier
13 years ago
Victor Stinner
7eab0d000c
Issue #18408 : Fix PyEval_EvalFrameEx() for MemoryError
Don't pass a NULL traceback to PyException_SetTraceback(): pass Py_None.
Passing NULL would raise a new exception.
13 years ago
Brett Cannon
a79e4fb38d
Issue #18342 : Use the repr of a module name for ``from ... import
...`` when an ImportError occurs.
Other cases had already been switched over to using the repr.
Thanks to Tomasz Maćkowiak for the patch.
13 years ago
Victor Stinner
365b693adc
Issue #18408 : ceval.c: in debug mode, convert the PyErr_Occurred() check on
exception (when getting NULL) to an assertion to detect bugs earlier
13 years ago
Victor Stinner
aaa8ed8b84
Issue #18408 : Fix call_exc_trace(): if the traceback is NULL, use None when
building the tuple (type, value, traceback) passed to the callback.
PyTuple_Pack() does crash if an argument is NULL.
13 years ago
Victor Stinner
0ff0f54dd4
Issue #18408 : Fix call_function() of ceval.c to handle PyTuple_New() failure
(in load_args()), ex: MemoryError.
13 years ago
Brett Cannon
679ecb565b
Issue #15767 : back out 8a0ed9f63c6e, finishing the removal of
ModuleNotFoundError.
13 years ago
Brett Cannon
b1611e2772
Issue #15767 : Introduce ModuleNotFoundError, a subclass of
ImportError.
The exception is raised by import when a module could not be found.
Technically this is defined as no viable loader could be found for the
specified module. This includes ``from ... import`` statements so that
the module usage is consistent for all situations where import
couldn't find what was requested.
This should allow for the common idiom of::
try:
import something
except ImportError:
pass
to be updated to using ModuleNotFoundError and not accidentally mask
ImportError messages that should propagate (e.g. issues with a
loader).
This work was driven by the fact that the ``from ... import``
statement needed to be able to tell the difference between an
ImportError that simply couldn't find a module (and thus silence the
exception so that ceval can raise it) and an ImportError that
represented an actual problem.
13 years ago
Victor Stinner
d3dfd0e433
Fix a compilater warning on Windows 64-bit
idx variable is used for a tuple indexn so use Py_ssize_t (not int).
13 years ago
Benjamin Peterson
e8e14591eb
rather than passing locals to the class body, just execute the class body in the proper environment
13 years ago
Benjamin Peterson
e1b4cbc422
when arguments are cells clear the locals slot (backport of #17927 )
13 years ago
Benjamin Peterson
159ae41da6
when an argument is a cell, set the local copy to NULL (see #17927 )
13 years ago
Guido van Rossum
6832c81d5d
#17927 : Keep frame from referencing cell-ified arguments.
13 years ago
Antoine Pitrou
8408cea0cd
Issue #17094 : Clear stale thread states after fork().
Note that this is a potentially disruptive change since it may
release some system resources which would otherwise remain
perpetually alive (e.g. database connections kept in thread-local
storage).
13 years ago
Benjamin Peterson
3b0431dc60
check local class namespace before reaching for cells ( closes #17853 )
13 years ago
R David Murray
3583761bcd
#17413 : make sure settrace funcs get passed exception instances for 'value'.
Patch by Ingrid Cheung and Brendan McLoughlin.
13 years ago
Ezio Melotti
04a29554c1
#17032 : The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum.
13 years ago
Benjamin Peterson
1ef876cd28
evaluate positional defaults before keyword-only defaults ( closes #16967 )
13 years ago
Benjamin Peterson
51f4616f6e
revert #16672 for incorrect semantics
13 years ago
Benjamin Peterson
6f0c94df50
improve tracing performance when f_trace is NULL ( closes #16672 )
Patch by Xavier de Gaye.
13 years ago
Benjamin Peterson
9272279afd
use error label instead of breaking eval loop ( closes #16693 )
13 years ago
Benjamin Peterson
fe1bcb64cd
move more variable declarations to the top of blocks
13 years ago
Benjamin Peterson
f208df3618
move declaration to top of block
13 years ago
Benjamin Peterson
31a58ff1c3
ceval cleanup
- Make many variables local to the opcode; Kill u, v, w, and x.
- Force every opcode to end with DISPATCH or jump to error handling.
- Simplify error handling.
- Check error statuses in more places.
Closes #16191 .
13 years ago
Benjamin Peterson
00f86f2202
add some missing DISPATCH()
13 years ago
Benjamin Peterson
b37df519c7
fix yield from return value on custom iterators ( closes #15568 )
14 years ago
Nick Coghlan
c40bc09942
Issue #13783 : the PEP 380 implementation no longer expands the public C API
14 years ago
Benjamin Peterson
d1ab6089ff
check return for error
14 years ago
Benjamin Peterson
d5a1c44455
PEP 415: Implement suppression of __context__ display with an exception attribute
This replaces the original PEP 409 implementation. See #14133 .
14 years ago
Benjamin Peterson
1138944888
only incref when using borrowing functions
14 years ago
Benjamin Peterson
7d95e40721
Implement PEP 412: Key-sharing dictionaries ( closes #13903 )
Patch from Mark Shannon.
14 years ago
Antoine Pitrou
bf35c156b4
Fix refleak: PyObject_GetItem returns a new reference, not a borrowed one like PyDict_GetItem.
14 years ago
Victor Stinner
b0b224233e
Issue #14385 : Support other types than dict for __builtins__
It is now possible to use a custom type for the __builtins__ namespace, instead
of a dict. It can be used for sandboxing for example. Raise also a NameError
instead of ImportError if __build_class__ name if not found in __builtins__.
14 years ago
Brett Cannon
368b4b7405
Guard an LLTRACE variable to silence an unused variable warning.
14 years ago
Victor Stinner
3c1e48176e
Issue #14383 : Add _PyDict_GetItemId() and _PyDict_SetItemId() functions
These functions simplify the usage of static constant Unicode strings.
Generalize the usage of _Py_Identifier in ceval.c and typeobject.c.
14 years ago
Benjamin Peterson
302e7902c8
use identifier api
14 years ago
Benjamin Peterson
2afe6aeae8
perform yield from delegation by repeating YIELD_FROM opcode ( closes #14230 )
This allows generators that are using yield from to be seen by debuggers. It
also kills the f_yieldfrom field on frame objects.
Patch mostly from Mark Shannon with a few tweaks by me.
14 years ago
Nick Coghlan
ab7bf2143e
Close issue #6210 : Implement PEP 409
14 years ago
Benjamin Peterson
ce79852077
use the static identifier api for looking up special methods
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
14 years ago