FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix _ctypes.Array base and metaclass by youknowone · Pull Request #5620 · RustPython/RustPython · GitHub

Fix _ctypes.Array base and metaclass - #5620

Merged
youknowone merged 4 commits into
RustPython:mainfrom
youknowone:ctypes
Mar 27, 2025
Merged

Fix _ctypes.Array base and metaclass#5620
youknowone merged 4 commits into
RustPython:mainfrom
youknowone:ctypes

Conversation

Copy link
Copy Markdown
Member

@arihant2math could you review this PR?

youknowone requested a review from coolreader18 March 25, 2025 00:50
youknowone changed the title Fix _ctypes.Array base and metacalss Fix _ctypes.Array base and metaclass Mar 25, 2025
arihant2math mentioned this pull request Mar 25, 2025
28 tasks

arihant2math left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The following causes different results in python and this branch:

from _ctypes import _SimpleCData

class c_short(_SimpleCData):
    _type_ = "h"
print(c_short.__mul__(5))

Python:

<class '__main__.c_short_Array_5'>

RustPython:

Traceback (most recent call last):
  File "tmp.py", line 6, in <module>
    print(c_short.__mul__(5))
TypeError: unexpected payload for __repr__

Note that on main the repr is simply incorrect (I haven't checked explicitly, but in previous testing, that is what I saw).

I don't think the cpython implementation PyCArrayType does anything special, so I assume this is a general rustpython compatibility.

Copy link
Copy Markdown
Member Author

ah, this is #1979

Copy link
Copy Markdown
Contributor

That seems to no longer occur for that case, but I suppose there might have been a bug in that patch.

youknowone merged commit cd89aa5 into RustPython:main Mar 27, 2025
youknowone deleted the ctypes branch March 27, 2025 10:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL