| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
* Add failing test.
* bpo-29590: fix stack trace for gen.throw() with yield from (GH-NNNN)
When gen.throw() is called on a generator after a "yield from", the
intermediate stack trace entries are lost. This commit fixes that.
(cherry picked from commit 8b33961e4bc4020d8b2d5b949ad9d5c669300e89)
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-22020) (GH-22045)
When allocating MemoryError classes, there is some logic to use
pre-allocated instances in a freelist only if the type that is being
allocated is not a subclass of MemoryError. Unfortunately in the
destructor this logic is not present so the freelist is altered even
with subclasses of MemoryError..
(cherry picked from commit 9b648a95ccb4c3b14f1e87158f5c9f5dbb2f62c0)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
|
|
|
|
| |
Walk down the MRO backwards to find the type that originally defined the final `tp_setattro`, then make sure we are not jumping over intermediate C-level bases with the Python-level call.
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit c53b310e5926266ce267c44a168165cacd786d6e)
Co-authored-by: scoder <stefan_ml@behnel.de>
|
|
|
|
|
|
|
|
|
|
| |
(GH-21240)
The issue is triggered by the bytearray() + bytearray() operation.
Detected by GCC 10 static analysis tool.
(cherry picked from commit 61fc23ca106bc82955b0e59d1ab42285b94899e2)
Co-authored-by: stratakis <cstratak@redhat.com>
|
|
|
|
|
|
|
|
| |
"tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 148f32913573c29250dfb3f0d079eb8847633621)
Co-authored-by: scoder <stefan_ml@behnel.de>
|
|
|
|
|
|
|
|
|
|
| |
(GH-20537)
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in the "in" operator and functions
operator.contains(), operator.indexOf() and operator.countOf().
(cherry picked from commit cafe1b6e9d3594a34aba50e872d4198296ffaadf)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
| |
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 2c4928d37edc5e4aeec3c0b79fa3460b1ec9b60d)
|
|
|
|
|
| |
yet. (GH-20273) (GH-20782)
(cherry picked from commit 24b8bad6d30ae4fb37ee686a073adfa5308659f9)
|
|
|
|
| |
This is not part of the limited API but makes the buffer slots available for type specs.
(cherry picked from commit f7c4e236429606e1c982cacf24e10fc86ef4462f)
|
|
|
|
|
|
|
|
|
|
|
|
| |
PyType_FromSpec types (reverts GH-19414) (GH-20264)
Heap types now always visit the type in tp_traverse. See added docs for details.
This reverts commit 0169d3003be3d072751dd14a5c84748ab63a249f.
Automerge-Triggered-By: @encukou
(cherry picked from commit 1cf15af9a6f28750f37b08c028ada31d38e818dd)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
|
|
| |
Co-authored-by: hai shi <shihai1991@126.com>
(cherry picked from commit 3f5f61409ebf95fa606bcbb15dfaaadad6084dc6)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
This updates _PyErr_ChainStackItem() to use _PyErr_SetObject()
instead of _PyErr_ChainExceptions(). This prevents a hang in
certain circumstances because _PyErr_SetObject() performs checks
to prevent cycles in the exception context chain while
_PyErr_ChainExceptions() doesn't.
(cherry picked from commit 7c30d12bd5359b0f66c4fbc98aa055398bcc8a7e)
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
|
|
|
|
|
|
|
| |
(GH-20228)
Remove --with-experimental-isolated-subinterpreters configure option
in Python 3.9: the experiment continues in the master branch, but
it's no longer needed in 3.9.
|
|
|
|
|
|
|
|
| |
_PyErr_ChainStackItem was just added in GH-19951 (for bpo-31033).
(cherry picked from commit ff7a8b03c49153021d6de5d0b2fa8b5163059ed6)
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
|
|
|
|
|
| |
When an asyncio.Task is cancelled, the exception traceback now
starts with where the task was first interrupted. Previously,
the traceback only had "depth one."
|
|
|
|
| |
(GH-19430)
|
|
|
|
|
|
|
| |
Move PyInterpreterState.fs_codec into a new
PyInterpreterState.unicode structure.
Give a name to the fs_codec structure and use this structure in
unicodeobject.c.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous commits on bpo-29587 got exception chaining working
with gen.throw() in the `yield` case. This patch also gets the
`yield from` case working.
As a consequence, implicit exception chaining now also works in
the asyncio scenario of awaiting on a task when an exception is
already active.
Tests are included for both the asyncio case and the pure
generator-only case.
|
|
|
|
| |
Remove the _PyUnicode_ClearStaticStrings() function from the C API.
Make the function fully private (declare it with "static").
|
|
|
|
|
| |
… now that we allow subtypes of PyCFunction.
Also add PyCMethod_CheckExact() and PyCMethod_Check() for checks against the PyCMethod subtype.
|
|
|
|
| |
non-BMP characters on Windows. (GH-20053)
|
|
|
|
| |
(GH-20033)
|
|
|
|
|
| |
* Replace id->object with _PyUnicode_FromId(&id)
* Use _Py_static_string_init(str) macro to initialize statically
name_op in typeobject.c.
|
|
|
|
| |
(GH-20026)
|
|
|
|
|
| |
Avoid unnecessary overhead in _PyDict_GetItemIdWithError() by calling
_PyDict_GetItem_KnownHash() instead of the more generic PyDict_GetItemWithError(),
since we already know the hash of interned strings.
|
| |
|
|
|
|
|
|
|
|
|
| |
* bpo-37986: Improve perfomance of PyLong_FromDouble()
* Use strict bound check for safety and symmetry
* Remove possibly outdated performance claims
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
(GH-19936)
Module C state is now accessible from C-defined heap type methods (PEP 573).
Patch by Marcel Plch and Petr Viktorin.
Co-authored-by: Marcel Plch <mplch@redhat.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
|
|
| |
When Python is built with experimental isolated interpreters, disable
the list free list.
Temporary workaround until this cache is made per-interpreter.
|
|
|
|
|
|
| |
When Python is built with experimental isolated interpreters, disable
the type method cache.
Temporary workaround until the cache is made per-interpreter.
|
|
|
|
| |
objects (GH-19946)
|
|
|
|
|
|
|
|
|
| |
When Python is built with experimental isolated interpreters, disable
tuple, dict and free free lists.
Temporary workaround until these caches are made per-interpreter.
Add frame_alloc() and frame_get_builtins() subfunctions to simplify
_PyFrame_New_NoTrack().
|
|
|
|
|
|
|
| |
When Python is built in the experimental isolated subinterpreters
mode, disable Unicode singletons and Unicode interned strings since
they are shared by all interpreters.
Temporary workaround until these caches are made per-interpreter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_PyErr_ChainExceptions() now ensures that the first parameter is an
exception type, as done by _PyErr_SetObject().
* The following function now check PyExceptionInstance_Check() in an
assertion using a new _PyBaseExceptionObject_cast() helper
function:
* PyException_GetTraceback(), PyException_SetTraceback()
* PyException_GetCause(), PyException_SetCause()
* PyException_GetContext(), PyException_SetContext()
* PyExceptionClass_Name() now checks PyExceptionClass_Check() with an
assertion.
* Remove XXX comment and add gi_exc_state variable to _gen_throw().
* Remove comment from test_generators
|
|
|
|
|
|
|
| |
* bpo-40455: Remove gcc10 warning about x_digits
* bpo-40455: nit
* bpo-40455: fix logic error
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a follow-up to GH-19823 that removes the check that the
exception value isn't NULL, prior to calling _PyErr_ChainExceptions().
This enables implicit exception chaining for gen.throw() in more
circumstances.
The commit also adds a test that a particular code snippet involving
gen.throw() doesn't crash. The test shows why the new
`gi_exc_state.exc_type != Py_None` check that was added is necessary.
Without the new check, the code snippet (as well as a number of other
tests) crashes on certain platforms (e.g. Fedora but not Mac).
|
|
|
|
|
|
|
| |
Before this commit, if an exception was active inside a generator
when calling gen.throw(), that exception was lost (i.e. there was
no implicit exception chaining). This commit fixes that by
setting exc.__context__ when calling gen.throw(exc).
|
|
|
|
|
| |
(GH-19811)" (#19821)
This reverts commit 2514a632fb7d37be24c2059d0e286d35600f9795.
|
|
|
|
|
| |
Before this commit, if an exception was active inside a generator
when calling gen.throw(), then that exception was lost (i.e. there
was no implicit exception chaining). This commit fixes that.
|
|
|
| |
More robust frame.setlineno. Makes no assumptions about source->bytecode translation.
|
|
|
|
|
|
| |
New PyFrame_GetBack() function: get the frame next outer frame.
Replace frame->f_back with PyFrame_GetBack(frame) in most code but
frameobject.c, ceval.c and genobject.c.
|
|
|
|
| |
The PyThreadState_GetFrame() function now returns a strong reference
to the frame.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the following function from the C API:
* PyAsyncGen_ClearFreeLists()
* PyContext_ClearFreeList()
* PyDict_ClearFreeList()
* PyFloat_ClearFreeList()
* PyFrame_ClearFreeList()
* PyList_ClearFreeList()
* PySet_ClearFreeList()
* PyTuple_ClearFreeList()
Make these functions private, move them to the internal C API and
change their return type to void.
Call explicitly PyGC_Collect() to free all free lists.
Note: PySet_ClearFreeList() did nothing.
|
|
|
|
| |
Add super_init_without_args() sub-function. Hold a strong reference
to the frame code object while calling super_init_without_args().
|
| |
|