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

bpo-30987 - Support for ISO-TP protocol in SocketCAN#2956

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
tiran merged 13 commits intopython:masterfrompylessard:fix-issue-30987
Aug 28, 2017
Merged

bpo-30987 - Support for ISO-TP protocol in SocketCAN#2956

tiran merged 13 commits intopython:masterfrompylessard:fix-issue-30987
Aug 28, 2017

Conversation

pylessard
Copy link
Contributor

@pylessardpylessard commentedJul 31, 2017
edited
Loading

This Pull Request add the support of CAN ISO-TP address extensions in the socket module by enhancinggetsockaddrarg andgetsockname.

Note to core developpers : I believe this pull request should be backported back to Python 3.3 where SocketCAN support have been added.

https://bugs.python.org/issue30987

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed thePSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username onbugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please followthe steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@pylessardpylessard changed the titleFix issue 30987bpo-30987Jul 31, 2017
@pylessardpylessard changed the titlebpo-30987bpo-30987 - Support for ISO-TP protocol in SocketCANJul 31, 2017
@pylessard
Copy link
ContributorAuthor

After second thoughts, only thegetsockaddress interface should be included in Python.
The constant incan-isotp should com from a third party module.
Will do the change and reopen the pull request

@pylessardpylessard reopened thisAug 3, 2017
@pylessard
Copy link
ContributorAuthor

pylessard commentedAug 3, 2017
edited
Loading

Pull request is re-open. All dependencies over the third party project have been removed.
getsockname interface has been enhanced with ISO-TP protocol support to be consistent with thebind method input format.

Copy link
Member

@tirantiran left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. Your patch looks mostly fine, good work! I added notes for some style nit picks and a missingifdef check.

@@ -6993,6 +7055,8 @@ PyInit__socket(void)
PyModule_AddIntMacro(m, CAN_SFF_MASK);
PyModule_AddIntMacro(m, CAN_EFF_MASK);
PyModule_AddIntMacro(m, CAN_ERR_MASK);

PyModule_AddIntMacro(m, CAN_ISOTP);
Copy link
Member

Choose a reason for hiding this comment

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

This needs a#ifdef CAN_ISOTP.

@@ -1913,6 +1927,54 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
Py_DECREF(interfaceName);
return 1;
}
#endif

#if defined(CAN_ISOTP)
Copy link
Member

Choose a reason for hiding this comment

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

#ifdef CAN_ISOTP

@@ -1869,7 +1882,9 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
}
#endif

#if defined(AF_CAN) && defined(CAN_RAW) && defined(CAN_BCM)
#if defined(AF_CAN)
Copy link
Member

Choose a reason for hiding this comment

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

Please use ifdef for simple checks:#ifdef AF_CAN

def testBind(self):
try:
with socket.socket(socket.PF_CAN, socket.SOCK_DGRAM, socket.CAN_ISOTP) as s:
addr = (self.interface,0x123,0x456)
Copy link
Member

Choose a reason for hiding this comment

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

Style nit pick:addr = self.interface, 0x123, 0x456

# most systems limit IFNAMSIZ to 16, take 1024 to be sure
with socket.socket(socket.PF_CAN, socket.SOCK_DGRAM, socket.CAN_ISOTP) as s:
self.assertRaisesRegex(OSError, 'interface name too long',
s.bind, ('x' * 1024,1,2))
Copy link
Member

Choose a reason for hiding this comment

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

Please use

with self.assertRaisesRegex(OSError, 'interface name too long'):    s.bind(('x' * 1024, 1, 2))

to make it more readable.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI didn't expect the Spanish Inquisition!. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@pylessard
Copy link
ContributorAuthor

I didn't expect the Spanish Inquisition!

@bedevere-bot
Copy link

Nobody expects the Spanish Inquisition!

@tiran: please review the changes made to this pull request.

@tiran
Copy link
Member

Your PR is still missing a space after comma intest_socket.py,280141c#diff-30065f853d7944a19b3e17b55db67733 . Let's follow PEP 8 for new code.

@pylessard
Copy link
ContributorAuthor

pylessard commentedAug 27, 2017
edited
Loading

@tiran Changes done sir!

Copy link
Member

@tirantiran left a comment

Choose a reason for hiding this comment

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

perfect! 🥇

@tirantiran merged commita30f6d4 intopython:masterAug 28, 2017
GadgetSteve pushed a commit to GadgetSteve/cpython that referenced this pull requestSep 10, 2017
* Added support for CAN_ISOTP protocol* Added unit tests for CAN ISOTP* Updated documentation for ISO-TP protocol* Removed trailing whitespace in documentation* Added blurb NEWS.d file* updated Misc/ACKS* Fixed broken unit test that was using isotp const outside of skippable section* Removed dependecy over third party project* Added implementation for getsockname + unit tests* Missing newline at end of ACKS file* Accidentally inserted a type in ACKS file* Followed tiran changes review#1 recommendations* Added spaces after comma
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tirantirantiran 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.

5 participants
@pylessard@the-knights-who-say-ni@bedevere-bot@tiran@Mariatta

[8]ページ先頭

©2009-2025 Movatter.jp