You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a few optional modules that were not found when I compiled Python, but if that was a problem, shouldn't test_shelve be skipped?
I assume `_dbm` is the problem but I'm not familiar with `dbm` modules.
I installed _dbm then I ran ./configure --with-pydebug and make -j"$(nproc)" and I i still have the test that fails (no more _dbm missing when I compile Python though).
Actually, the shelf automatically selects the dbm backend. I think it would be more useful if we had a feature that would specify the dbm backend when the shelf opens.
I'm confused. The TypeError appears to be because of the key being a string and then we try to encode it somehow and then use it. However the fix seems to be in the serializer, which acts on the value. Am I missing something? (I'm on mobile so hard to review)
I'm confused. The TypeError appears to be because of the key being a string and then we try to encode it somehow and then use it. However the fix seems to be in the serializer, which acts on the value. Am I missing something? (I'm on mobile so hard to review)
In the test_custom_serializer_and_deserializer, we did not anticipate encountering a negative case. As you may have noticed, this error occurs only with dbm.gnu. This is because our original serializer was not designed to support dbm.gnu. We have since updated the serializer to address this issue.
In the test_custom_incomplete_serializer_and_deserializer, incorrect behavior and type errors are expected. We were already suppressing these errors for sqlite, and have now also suppressed them for dbm.gnu.
@furkanonder
This was enough to solve the problem for me, so I think I only had one test case that was failing on my system (and not two like you mentioned? I might misunderstand something, I didn't dig too deep)? I don't know shelve enough to understand your second change in the commit of your PR but I assume it fixes the second test case that was failing?
@furkanonder This was enough to solve the problem for me, so I think I only had one test case that was failing on my system (and not two like you mentioned? I might misunderstand something, I didn't dig too deep)? I don't know shelve enough to understand your second change in the commit of your PR but I assume it fixes the second test case that was failing?
Oh I actually now understand! the error is actually the same for both the keys and the values and the traceback actually only shows the [...] part without including the = part, and thus I assumed that the error occurred due to the key not the value. Ok, I now understand the issue.
Activity
[-]test_shelve.py crashes on WSL[/-][+]test_shelve.py crashes instead of being skipped on WSL?[/+]JasonMendoza2008 commentedon Aug 15, 2025
I installed
_dbmthen I ran./configure --with-pydebugandmake -j"$(nproc)"and I i still have the test that fails (no more_dbmmissing when I compile Python though).StanFromIreland commentedon Aug 15, 2025
It most likely fell back to the Python implementation.
JasonMendoza2008 commentedon Aug 15, 2025
Yeah, reading the error message, I think the problem is this:
cpython/Lib/test/test_shelve.py
Lines 174 to 176 in 4e08a9f
JasonMendoza2008 commentedon Aug 15, 2025
Changing it to:
Makes the test case pass.
[-]test_shelve.py crashes instead of being skipped on WSL?[/-][+]test_shelve.py crashes on WSL?[/+]furkanonder commentedon Aug 16, 2025
@JasonMendoza2008
Could you please run the following diagnostic script to gather additional information?
JasonMendoza2008 commentedon Aug 16, 2025
PS: It says
heads/fix-issue-137759but I had the problem before changing anything (and the CI tests run fine in the corresponding PR opened).furkanonder commentedon Aug 17, 2025
@JasonMendoza2008
Actually two test are failing;
I've implemented a fix for the issue. Thanks for the bug report.
furkanonder commentedon Aug 17, 2025
Actually, the shelf automatically selects the dbm backend. I think it would be more useful if we had a feature that would specify the dbm backend when the shelf opens.
picnixz commentedon Aug 17, 2025
I'm confused. The TypeError appears to be because of the key being a string and then we try to encode it somehow and then use it. However the fix seems to be in the serializer, which acts on the value. Am I missing something? (I'm on mobile so hard to review)
furkanonder commentedon Aug 17, 2025
In the
test_custom_serializer_and_deserializer, we did not anticipate encountering a negative case. As you may have noticed, this error occurs only withdbm.gnu. This is because our original serializer was not designed to supportdbm.gnu. We have since updated the serializer to address this issue.In the
test_custom_incomplete_serializer_and_deserializer, incorrect behavior and type errors are expected. We were already suppressing these errors forsqlite, and have now also suppressed them fordbm.gnu.JasonMendoza2008 commentedon Aug 17, 2025
@furkanonder
This was enough to solve the problem for me, so I think I only had one test case that was failing on my system (and not two like you mentioned? I might misunderstand something, I didn't dig too deep)? I don't know shelve enough to understand your second change in the commit of your PR but I assume it fixes the second test case that was failing?
furkanonder commentedon Aug 17, 2025
Could you try running the following snippet?
This reproduces the second case for me — it fails on my machine with the following traceback:
So, I wanted to fix this test case too.
JasonMendoza2008 commentedon Aug 18, 2025
@furkanonder I get a TypeError as well indeed.
I think I was confused because:
I got this:
With this change only:
But I hadn't noticed that
test_custom_incomplete_serializer_and_deserializerwas skipped:skipped "No module named '_sqlite3'"Which is why I had always mentioned "the one" test case that was failing.
EDIT: reading through your commit, I guess you removed:
so that the test case doesn't get skipped anymore? and allows tests for an incomplete serializer/deserialized no matter the backend selected.
picnixz commentedon Aug 18, 2025
picnixz commentedon Aug 18, 2025
Oh I actually now understand! the error is actually the same for both the keys and the values and the traceback actually only shows the
[...]part without including the=part, and thus I assumed that the error occurred due to the key not the value. Ok, I now understand the issue.gh-137829: Fix shelve tests for backend compatibility (#137879)
pythongh-137829: Fix shelve tests for backend compatibility (python#1…