| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
There was a problem hiding this comment.
I also don't know a good way to fix this, but a leak with an unraisable error message is better than a crash.
I plan to merge in about a week if there are no objections.
Sorry, something went wrong.
|
This change needs a test. test_non_continuous_buffer in Lib/test/pickletester.py can be an indirect test (it should be modified for this), but since this change does not use pickle.PickleBuffer, it needs more direct test that only uses memoryview. I am not sure that this is a right solution, but the test will help us to decide. |
Sorry, something went wrong.
It's really hard to trigger the crash using just memoryview because we first need to construct an exported buffer that will clear the view. I tried, but I failed. def test_circular_reference_gc(self):
mv = memoryview(b"foobar")
error = None
unraisable_exception = None
def custom_unraisablehook(unraisable):
nonlocal unraisable_exception
unraisable_exception = unraisable
def func():
try:
pb = pickle.PickleBuffer(mv)
raise CustomError
except CustomError as e:
# Ensure `error` references the exception
error = e
func()
del mv
prev_unraisablehook = sys.unraisablehook
sys.unraisablehook = custom_unraisablehook
support.gc_collect()
self.assertEqual(unraisable_exception.exc_type, BufferError)
self.assertIsInstance(unraisable_exception.exc_value, BufferError)
self.assertEqual(str(unraisable_exception.exc_value), 'memoryview has 1 exported buffer')
sys.unraisablehook = prev_unraisablehook |
Sorry, something went wrong.
Co-authored-by: Victor Stinner <vstinner@python.org>
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
#123898 uses a different solution. Trying to break a reference loop is a normal situation, it should not produce error reports (the user cannot do anything about this in any case), so _memory_release() should not even be called if self->exports != 0. That PR also contains tests. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Issues
Main Causes
Next
I have no idea if this is a good way to fix this.But thank for any dev who reviewed this PR.