Serhiy Storchaka
505ff755d7
Issue #20437 : Fixed 21 potential bugs when deleting objects references.
2014-02-09 13:33:53 +02:00
Victor Stinner
fdeb6ec45a
Issue #14432 : Remove the thread state field from the frame structure. Fix a
...
crash when a generator is created in a C thread that is destroyed while the
generator is still used. The issue was that a generator contains a frame, and
the frame kept a reference to the Python state of the destroyed C thread. The
crash occurs when a trace function is setup.
2013-12-13 02:01:38 +01:00
Antoine Pitrou
8933521b3d
Fix refleak introduced by 4f730c045f5f (issue #18408 ) and unveiled by 95eea8624d05 (issue #16596 ).
2013-11-23 14:05:23 +01:00
Guido van Rossum
8820c239f7
Better behavior when stepping over yield[from]. Fixes issue 16596. By Xavier de Gaye.
2013-11-21 11:30:06 -08:00
Victor Stinner
cab75e3e1e
Issue #19512 : PRINT_EXPR bytecode now uses an identifier to get sys.displayhook
...
to only create the "displayhook" string once
2013-11-06 22:38:37 +01:00
Benjamin Peterson
96c03df771
merge 3.3
2013-10-29 22:25:55 -04:00
Benjamin Peterson
8f169489c4
update comment
2013-10-29 22:25:06 -04:00
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.
2013-10-29 01:19:37 +01:00
Victor Stinner
8d19767403
Close #19199 : Remove ``PyThreadState.tick_counter`` field
2013-10-09 14:53:01 +02:00
Antoine Pitrou
1cfa0ba883
Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.
2013-10-07 20:40:59 +02:00
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.
2013-10-07 20:38:51 +02:00
Antoine Pitrou
9ed5f27266
Issue #18722 : Remove uses of the "register" keyword in C code.
2013-08-13 20:18:52 +02:00
Antoine Pitrou
58720d6145
Issue #17934 : Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles.
2013-08-05 23:26:40 +02:00
Christian Heimes
895bdfb16e
Add missing check of PyDict_SetItem()'s return value in PyEval_EvalCodeEx()
...
CID 486647
2013-07-20 14:48:21 +02:00
Christian Heimes
0bd447f847
Add missing check of PyDict_SetItem()'s return value in PyEval_EvalCodeEx()
...
CID 486647
2013-07-20 14:48:10 +02:00
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.
2013-07-18 01:41:08 +02:00
Victor Stinner
f243ee4055
Issue #18408 : add more assertions on PyErr_Occurred() in ceval.c to detect bugs
...
earlier
2013-07-16 01:02:12 +02:00
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.
2013-07-15 21:16:27 +02:00
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.
2013-07-12 11:22:26 -04:00
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
2013-07-12 00:11:58 +02:00
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.
2013-07-10 13:57:55 +02:00
Victor Stinner
0ff0f54dd4
Issue #18408 : Fix call_function() of ceval.c to handle PyTuple_New() failure
...
(in load_args()), ex: MemoryError.
2013-07-08 22:27:42 +02:00
Brett Cannon
679ecb565b
Issue #15767 : back out 8a0ed9f63c6e, finishing the removal of
...
ModuleNotFoundError.
2013-07-04 17:51:50 -04:00
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.
2013-06-12 16:59:46 -04:00
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).
2013-05-16 23:48:01 +02:00
Benjamin Peterson
e8e14591eb
rather than passing locals to the class body, just execute the class body in the proper environment
2013-05-16 14:37:25 -05:00
Benjamin Peterson
e1b4cbc422
when arguments are cells clear the locals slot (backport of #17927 )
2013-05-14 22:31:26 -05:00
Benjamin Peterson
159ae41da6
when an argument is a cell, set the local copy to NULL (see #17927 )
2013-05-12 18:16:06 -05:00
Guido van Rossum
6832c81d5d
#17927 : Keep frame from referencing cell-ified arguments.
2013-05-10 08:47:42 -07:00
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).
2013-05-05 23:47:09 +02:00
Benjamin Peterson
3b0431dc60
check local class namespace before reaching for cells ( closes #17853 )
2013-04-30 09:41:40 -04:00
R David Murray
f097f175dd
Merge #17413 : make sure settrace funcs get passed exception instances for 'value'.
...
Patch by Ingrid Cheung and Brendan McLoughlin.
2013-04-19 12:57:54 -04:00
R David Murray
3583761bcd
#17413 : make sure settrace funcs get passed exception instances for 'value'.
...
Patch by Ingrid Cheung and Brendan McLoughlin.
2013-04-19 12:56:57 -04:00
Ezio Melotti
04a29554c1
#17032 : The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum.
2013-03-03 15:12:44 +02:00
Benjamin Peterson
1ef876cd28
evaluate positional defaults before keyword-only defaults ( closes #16967 )
2013-02-10 09:29:59 -05:00
Benjamin Peterson
51f4616f6e
revert #16672 for incorrect semantics
2013-01-23 08:38:47 -05:00
Benjamin Peterson
6f0c94df50
improve tracing performance when f_trace is NULL ( closes #16672 )
...
Patch by Xavier de Gaye.
2012-12-24 11:53:30 -06:00
Benjamin Peterson
9272279afd
use error label instead of breaking eval loop ( closes #16693 )
2012-12-15 12:51:05 -05:00
Benjamin Peterson
fe1bcb64cd
move more variable declarations to the top of blocks
2012-10-12 11:40:01 -04:00
Benjamin Peterson
f208df3618
move declaration to top of block
2012-10-12 11:37:56 -04:00
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 .
2012-10-12 11:34:51 -04:00
Benjamin Peterson
00f86f2202
add some missing DISPATCH()
2012-10-10 14:10:33 -04:00
Benjamin Peterson
b37df519c7
fix yield from return value on custom iterators ( closes #15568 )
2012-08-06 17:53:09 -07:00
Nick Coghlan
c40bc09942
Issue #13783 : the PEP 380 implementation no longer expands the public C API
2012-06-17 15:15:49 +10:00
Benjamin Peterson
d1ab6089ff
check return for error
2012-06-01 11:18:22 -07:00
Benjamin Peterson
d5a1c44455
PEP 415: Implement suppression of __context__ display with an exception attribute
...
This replaces the original PEP 409 implementation. See #14133 .
2012-05-14 22:09:31 -07:00
Benjamin Peterson
1138944888
only incref when using borrowing functions
2012-04-26 00:26:37 -04:00
Benjamin Peterson
7d95e40721
Implement PEP 412: Key-sharing dictionaries ( closes #13903 )
...
Patch from Mark Shannon.
2012-04-23 11:24:50 -04:00
Antoine Pitrou
bf35c156b4
Fix refleak: PyObject_GetItem returns a new reference, not a borrowed one like PyDict_GetItem.
2012-04-19 18:21:04 +02:00
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__.
2012-04-19 00:57:45 +02:00
Brett Cannon
368b4b7405
Guard an LLTRACE variable to silence an unused variable warning.
2012-04-02 12:17:59 -04:00
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.
2012-03-26 22:10:51 +02:00
Benjamin Peterson
302e7902c8
use identifier api
2012-03-20 23:17:04 -04:00
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.
2012-03-15 15:37:39 -05:00
Nick Coghlan
ab7bf2143e
Close issue #6210 : Implement PEP 409
2012-02-26 17:49:52 +10:00
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.
2012-01-22 11:24:29 -05:00
Amaury Forgeot d'Arc
0a239e9191
Fix compilation with C89 compilers (Windows...)
2012-01-13 21:08:49 +01:00
Benjamin Peterson
0296a56520
NULL and no exception set from tp_iternext means StopIteration
2012-01-13 14:54:31 -05:00
Nick Coghlan
1f7ce62bd6
Implement PEP 380 - 'yield from' ( closes #11682 )
2012-01-13 21:43:40 +10:00
Antoine Pitrou
86a36b500a
PEP 3155 / issue #13448 : Qualified name for classes and functions.
2011-11-25 18:56:07 +01:00
Martin v. Löwis
1c67dd9b15
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
2011-10-14 15:16:45 +02:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Victor Stinner
d2a915dbf6
ceval.c: restore str+=str optimization
2011-10-02 20:34:20 +02:00
Benjamin Peterson
811c2f1369
remove "fast-path" for (i)adding strings
...
These were just an artifact of the old unicode concatenation hack and likely
just penalized other kinds of adding. Also, this fixes __(i)add__ on string
subclasses.
2011-09-30 21:31:21 -04:00
Victor Stinner
bec0fda264
Remove commented code: str+=str is no more super-optimized
2011-10-01 01:26:08 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Charles-François Natali
f23339a7bb
Issue 12620: Make pendingbusy flag static to Py_MakePendingCalls().
2011-07-23 18:15:43 +02:00
Benjamin Peterson
76f7f4d979
excise the remains of STOP_CODE, which hasn't done anything useful for years
2011-07-17 22:49:50 -05:00
Benjamin Peterson
e92cd0ce98
merge 3.2 ( #11627 )
2011-07-15 14:10:35 -05:00
Benjamin Peterson
5afa03a72e
catch nasty exception classes with __new__ that doesn't return a exception ( closes #11627 )
...
Patch from Andreas Stührk.
2011-07-15 14:09:26 -05:00
Benjamin Peterson
9bfd0dee9b
no one passes NULL here (or should anyway)
2011-07-03 17:06:32 -05:00
Benjamin Peterson
878802435d
convert generator exc state functions into static functions
2011-07-03 16:48:31 -05:00
Benjamin Peterson
536feac7f8
merge 3.2
2011-07-03 16:27:41 -05:00
Benjamin Peterson
ac91341333
never retain a generator's caller's exception state on the generator after a yield/return
...
This requires some trickery to properly save the exception state if the
generator creates its own exception state.
2011-07-03 16:25:11 -05:00
Benjamin Peterson
7b7099c36f
merge 3.2 ( #12475 )
2011-07-03 13:48:36 -05:00
Benjamin Peterson
83195c3f0c
restore a generator's caller's exception state both on yield and (last) return
...
This prevents generator exception state from leaking into the caller.
Closes #12475 .
2011-07-03 13:44:00 -05:00
Benjamin Peterson
9003760991
map cells to arg slots at code creation time ( closes #12399 )
...
This removes nested loops in PyEval_EvalCodeEx.
2011-06-25 22:54:45 -05:00
Benjamin Peterson
e109c70860
give the names of missing positional or keyword-only arguments ( closes #12356 )
2011-06-24 09:37:26 -05:00
Benjamin Peterson
b204a42383
greatly improve argument parsing error messages ( closes #12265 )
2011-06-05 22:04:07 -05:00
Antoine Pitrou
fc20b0c65c
Issue #1856 : Avoid crashes and lockups when daemon threads run while the
...
interpreter is shutting down; instead, these threads are now killed when
they try to take the GIL.
2011-05-04 20:04:29 +02:00
Antoine Pitrou
0d5e52d346
Issue #1856 : Avoid crashes and lockups when daemon threads run while the
...
interpreter is shutting down; instead, these threads are now killed when
they try to take the GIL.
2011-05-04 20:02:30 +02:00
Victor Stinner
0a5f65ab0a
Issue #7330 , #10833 : Replace %100s by %.100s and %200s by %.200s
...
I suppose that the author would like to truncate the type name, not get a
string of 100/200 characters.
2011-03-22 01:09:21 +01:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00
Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Ezio Melotti
b88ed1549e
#11565 : Merge with 3.2.
2011-03-16 11:38:59 +02:00
Brett Cannon
b94767ff44
Issue #8914 : fix various warnings from the Clang static analyzer v254.
2011-02-22 20:15:44 +00:00
Victor Stinner
ed4c71112a
Remove filename variable from ceval.c
...
Issue #11168 : Remove filename debug variable from PyEval_EvalFrameEx().
It encoded the Unicode filename to UTF-8, but the encoding fails on
undecodable filename (on surrogate characters) which raises an unexpected
UnicodeEncodeError on recursion limit.
2011-02-21 21:05:50 +00:00
David Malcolm
8ad4cd90e9
Merged revisions 87796 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87796 | david.malcolm | 2011-01-06 12:01:36 -0500 (Thu, 06 Jan 2011) | 6 lines
Issue #10655 : Fix the build on PowerPC on Linux with GCC when building with
timestamp profiling (--with-tsc): the preprocessor test for the PowerPC
support now looks for "__powerpc__" as well as "__ppc__": the latter seems to
only be present on OS X; the former is the correct one for Linux with GCC.
........
2011-01-06 17:36:32 +00:00
David Malcolm
f1397ad399
Issue #10655 : Fix the build on PowerPC on Linux with GCC when building with
...
timestamp profiling (--with-tsc): the preprocessor test for the PowerPC
support now looks for "__powerpc__" as well as "__ppc__": the latter seems to
only be present on OS X; the former is the correct one for Linux with GCC.
2011-01-06 17:01:36 +00:00
Martin v. Löwis
4d0d471a80
Merge branches/pep-0384.
2010-12-03 20:14:31 +00:00
Georg Brandl
e5b99f0fb3
Remove redundant includes of headers that are already included by Python.h.
2010-11-30 09:41:01 +00:00
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
2010-10-17 20:54:53 +00:00
Victor Stinner
a00064576a
ceval.c: catch recursion error on _PyUnicode_AsString(co->co_filename)
2010-10-13 10:48:55 +00:00
Benjamin Peterson
aa7fbd9564
revert r85003, poorly considered; breaks tests
2010-09-25 03:25:42 +00:00
Benjamin Peterson
81437c9025
don't count keyword arguments as positional #9943
2010-09-25 03:14:33 +00:00
Antoine Pitrou
1df1536fb9
Issue #9828 : Destroy the GIL in Py_Finalize(), so that it gets properly
...
re-created on a subsequent call to Py_Initialize(). The problem (a crash)
wouldn't appear in 3.1 or 2.7 where the GIL's structure is more trivial.
2010-09-13 14:16:46 +00:00
Benjamin Peterson
e208b7c5b1
typo
2010-09-10 23:53:14 +00:00
Benjamin Peterson
d0de25d731
use Py_REFCNT
2010-09-10 23:52:42 +00:00
Benjamin Peterson
d2be5b4fe4
remove gil_drop_request in --without-threads
2010-09-10 22:47:02 +00:00