Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-105733: Deprecate ctypes SetPointerType() and ARRAY()#105734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 1 commit intopython:mainfromvstinner:ctypes_deprecate
Jun 13, 2023

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedJun 13, 2023
edited by github-actionsbot
Loading

@vstinner
Copy link
MemberAuthor

A code search onSetPointerType in PyPI top 5,000 projects (2023-04-13) found 0 matching lines (in 0 projects).

A code search onctypes.ARRAY regex in PyPI top 5,000 projects (2023-04-13) found 0 matching lines (in 0 projects).

It seems like a very low number of projects will be affected by this change.

cc@hugovk

@vstinnervstinnerenabled auto-merge (squash)June 13, 2023 17:59
@vstinnervstinner merged commit2211454 intopython:mainJun 13, 2023
@vstinnervstinner deleted the ctypes_deprecate branchJune 13, 2023 18:35
@vstinner
Copy link
MemberAuthor

Thanks for the review@hugovk.

hugovk reacted with rocket emoji

Comment on lines 316 to 319
def ARRAY(typ, len):
import warnings
warnings._deprecated("ctypes.ARRAY", remove=(3, 15))
return typ * len
Copy link
Member

Choose a reason for hiding this comment

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

Do you think there's a high expected maintenance overhead or security risk here?

Per PEP 387:

If the expected maintenance overhead and security risk of the deprecated behavior is small (e.g. an old function is reimplemented in terms of a new, more general one), it can stay indefinitely (or until the situation changes).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

it's not a big maintenance burden nor a securty issue, why do you ask?

Copy link
Member

Choose a reason for hiding this comment

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

I ask to see if there's a special reason forremove=(3, 15), or if it can be relaxed.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

What do you propose? To postpone the removal to Python 3.16?

On PyPI top 8,000 projects (at 2024-03-16), I found only 2 projects using ctypes.ARRAY. I search for regexctypes.ARRAY|\<ARRAY\> (and excluded unrelated lines).

  • astroid (3.1.0)
  • pwntools (4.12.0)

It's about two lines:

astroid-3.1.0.tar.gz: astroid-3.1.0/tests/brain/test_ctypes.py: ctypes.ARRAY(3, 2)pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/adb/bootloader.py: imgarray = ctypes.ARRAY(img_info, self.num_images)

Before the function was only deprecated with a comment:

# XXX DeprecateddefARRAY(typ,len):returntyp*len

Copy link
Member

Choose a reason for hiding this comment

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

I'll propose to follow the part of PEP 387 I quoted above. Alternatively, since this does break known projects, to soft-deprecate instead.

But I plan to propose that in the beta period, right now I'm only gathering info. Thanks for the answer!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@encukouencukouencukou left review comments

@hugovkhugovkhugovk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@vstinner@encukou@hugovk@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp