Skip to content

Fix pystruct incompatibility and Add test_buffer.py from cpython 3.8 - #3196

Merged
DimitrisJim merged 3 commits into
RustPython:mainfrom
Snowapril:fix_pystruct
Oct 2, 2021
Merged

DimitrisJim merged 3 commits into
RustPython:mainfrom
Snowapril:fix_pystruct

Conversation

@Snowapril

@Snowapril Snowapril commented Oct 2, 2021 •

Copy link
Copy Markdown
Contributor

This revision fix the incompatibility behaviour in pystruct and add test_buffer.py from cpython 3.8.

There exists incompatibility when overflow occurred in struct.pack. Here is example

cpython

>>> import struct
>>> struct.pack('b', (1<<128)-1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
struct.error: argument out of range

rustpython

>>>>> import struct
>>>>> struct.pack('b', (1<<128)-1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to Rust i8

This minor difference make test_buffer.py stalled in this lines.

try:
    struct.pack(fmt, (1<<exp)-1)
    break
except struct.error:
    pass

test_buffer.py is use struct and _testbuffer module which is not yet implemented. Thus this test will be skipped in default


In addition, test_add_file_after_2107 in test_zipfile.py and test_b85decode_errors & test_a85decode_errors in test_base64.py now going works

Signed-off-by: snowapril <sinjihng@gmail.com>
Signed-off-by: snowapril <sinjihng@gmail.com>
@Snowapril Snowapril changed the title Fix pystruct and Add test_buffer.py from cpython 3.8 Fix pystruct incompatibility and Add test_buffer.py from cpython 3.8 Oct 2, 2021
Signed-off-by: snowapril <sinjihng@gmail.com>
@DimitrisJim
DimitrisJim merged commit 12d765f into RustPython:main Oct 2, 2021
@youknowone youknowone added the z-ca-2021 Tag to track contrubution-academy 2021 label Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

z-ca-2021 Tag to track contrubution-academy 2021

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants