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-132987: Support __index__() in the socket module#133093

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

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedApr 28, 2025
edited by bedevere-appbot
Loading

ntohl(), htonl(), if_indextoname(), getaddrinfo() now useindex() if available.

Also fix the Argument Clinic names for module-level functions (although this does not affect the user).

ntohl(), htonl(), if_indextoname(), getaddrinfo() now use __index__() ifavailable.Also fix the Argument Clinic names for module-level functions (althoughthis does not affect the user).
@serhiy-storchaka
Copy link
MemberAuthor

As a side effect, ValueError is now raised instead of OverflowError for negative values. See also#74020.

Comment on lines +654 to +660
class uint16_converter(CConverter):
type = "uint16_t"
converter = '_PyLong_UInt16_Converter'

class uint32_converter(CConverter):
type = "uint32_t"
converter = '_PyLong_UInt32_Converter'
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to move uint16_t and uint32_t converters directly to Argument Clinic as built-in converters?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I am going to do this in more general way in a separate issue. There are other converters defined in different files.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, it makes sense.

}

UNSIGNED_INT_CONVERTER(UInt16, uint16_t)
UNSIGNED_INT_CONVERTER(UInt32, uint32_t)
Copy link
Member

Choose a reason for hiding this comment

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

You might use PyLong_AsUInt32() for this converter.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

No, PyLong_AsUInt32 cannot be used as a converter. It has wrong signature and returns wrong value.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Co-authored-by: Victor Stinner <vstinner@python.org>
@serhiy-storchakaserhiy-storchaka merged commit4265854 intopython:mainApr 29, 2025
41 checks passed
@serhiy-storchakaserhiy-storchaka deleted the socket-unsigned-int-index branchApril 29, 2025 16:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner left review comments

@encukouencukouAwaiting requested review from encukou

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

Successfully merging this pull request may close these issues.

2 participants
@serhiy-storchaka@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp