| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Fix PyBytesWriter_Format() error handling: restore the writer to its previous state on error. Add an unit test injecting MemoryError. Fix PyBytesWriter_FinishWithSize() to return an empty bytearray when use_bytearray is set and size is 0, instead of always returning an empty bytes object. Fix test_capi.test_bytes: always check writer finish result type, to make sure that _PyBytesWriter_CreateByteArray() always create bytearray objects. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit 24ea85a)
|
Without this fix, bytearray.fromhex() and bytearray.__mod__() can return a bytes object instead of a bytearray object. Current behavior (wrong): $ ./python
>>> bytearray.fromhex('')
b''
>>> bytearray(b'') % ()
b''
Correct behavior (with this fix): $ ./python
>>> bytearray.fromhex('')
bytearray(b'')
>>> bytearray(b'') % ()
bytearray(b'')
|
Sorry, something went wrong.
|
I was curious so I checked the the Git history to see when the bug was introduced: the bug is as old as the introduction of the PyBytesWriter C API (one year ago), commit adb4140. |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good to me. Feels like maybe should have been a couple different NEWS entries for the different bugs
Sorry, something went wrong.
Oh right, I added a second NEWS entry. |
Sorry, something went wrong.
|
test_tkinter failed on "Tests / Windows (free-threading) / Build and test (x64, switch-case)" CI job, but it passed on other Windows CI jobs. It loooks like a flaky test. FAIL: test_boundary_values_accepted (test.test_tkinter.test_simpledialog.QueryDialogTest.test_boundary_values_accepted)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\cpython\cpython\Lib\test\test_tkinter\test_simpledialog.py", line 246, in test_boundary_values_accepted
self.assertEqual(d.result, 10)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
AssertionError: None != 10
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fix PyBytesWriter_Format() error handling: restore the writer to its previous state on error. Add an unit test injecting MemoryError.
Fix PyBytesWriter_FinishWithSize() to return an empty bytearray when use_bytearray is set and size is 0, instead of always returning an empty bytes object.
Fix test_capi.test_bytes: always check writer finish result type, to make sure that _PyBytesWriter_CreateByteArray() always create bytearray objects.
(cherry picked from commit 24ea85a)