Commit Graph

193 Commits

Author SHA1 Message Date
Christian Heimes b6e43af669
bpo-28134: Auto-detect socket values from file descriptor (#1349)
Fix socket(fileno=fd) by auto-detecting the socket's family, type,
and proto from the file descriptor. The auto-detection can be overruled
by passing in family, type, and proto explicitly.

Without the fix, all socket except for TCP/IP over IPv4 are basically broken:

>>> s = socket.create_connection(('www.python.org', 443))
>>> s
<socket.socket fd=3, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('2003:58:bc4a:3b00:56ee:75ff:fe47:ca7b', 59730, 0, 0), raddr=('2a04:4e42:1b::223', 443, 0, 0)>
>>> socket.socket(fileno=s.fileno())
<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('2003:58:bc4a:3b00::%2550471192', 59730, 0, 2550471192), raddr=('2a04:4e42:1b:0:700c:e70b:ff7f:0%2550471192', 443, 0, 2550471192)>

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-29 22:37:58 +01:00
Yury Selivanov f11b460d87
bpo-32373: Add socket.getblocking() method. (#4926) 2018-01-28 17:27:38 -05:00
Yury Selivanov 0ceb717689
Revert "bpo-32221: makeipaddr(): remove interface part + speedup (GH-4724)" (#5394)
This reverts commit 47c0b1f7d4.
2018-01-28 16:08:32 -05:00
Коренберг Марк 47c0b1f7d4 bpo-32221: makeipaddr(): remove interface part + speedup (GH-4724) 2018-01-27 17:20:50 -05:00
Christian Heimes d0e31b980f
bpo-32454: socket closefd (#5048)
Add close(fd) function to the socket module

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-27 09:54:13 +01:00
Yury Selivanov 9818142b1b
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877) 2017-12-18 20:02:54 -05:00
caavery effc12f8e9 bpo-27584: New addition of vSockets to the python socket module (#2489)
* bpo-27584: New addition of vSockets to the python socket module

Support for AF_VSOCK on Linux only

* bpo-27584: Fixes for V2

Fixed syntax and naming problems.
Fixed #ifdef AF_VSOCK checking
Restored original aclocal.m4

* bpo-27584: Fixes for V3

Added checking for fcntl and thread modules.

* bpo-27584: Fixes for V4

Fixed white space error

* bpo-27584: Fixes for V5

Added back comma in (CID, port).

* bpo-27584: Fixes for V6

Added news file.
socket.rst now reflects first Linux introduction of AF_VSOCK.
Fixed get_cid in test_socket.py.
Replaced PyLong_FromLong with PyLong_FromUnsignedLong in socketmodule.c
Got rid of extra AF_VSOCK #define.
Added sockaddr_vm to sock_addr.

* bpo-27584: Fixes for V7

Minor cleanup.

* bpo-27584: Fixes for V8

Put back #undef AF_VSOCK as it is  necessary when vm_sockets.h is not installed.
2017-09-06 15:18:10 -07:00
Pier-Yves Lessard a30f6d45ac bpo-30987 - Support for ISO-TP protocol in SocketCAN (#2956)
* 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
2017-08-28 10:32:44 +02:00
Nathaniel J. Smith 1e2147b9d7 bpo-29728: Provide socket.TCP_NOTSENT_LOWAT (#477)
* Provide socket.TCP_NOTSENT_LOWAT
* New TCP option available on recent MacOS and Linux.
* Document addition of TCP_NOTSENT_LOWAT
2017-03-22 20:56:55 -07:00
Victor Stinner 0e830455cb Merge 3.6 2017-01-23 12:34:00 +01:00
Victor Stinner 01f5ae7b76 Issue #26273: Document TCP_USER_TIMEOUT and TCP_CONGESTION 2017-01-23 12:30:00 +01:00
Martin Panter 446a498a63 Merge doc fixes from 3.6 2017-01-14 09:56:00 +00:00
Martin Panter 4659ddc433 Merge doc fixes from 3.5 2017-01-14 09:54:57 +00:00
Martin Panter 8f1378366e Avoid line breaks after hyphens, otherwise they are turned into spaces 2017-01-14 08:24:20 +00:00
Serhiy Storchaka 853ec5d408 Issue #21818: Fixed references to classes that have names matching with module
names.
2016-12-02 23:15:42 +02:00
Serhiy Storchaka b6a6b45458 Issue #21818: Fixed references to classes that have names matching with module
names.
2016-12-02 23:15:22 +02:00
Serhiy Storchaka ee1b01a41b Issue #21818: Fixed references to classes that have names matching with module
names.
2016-12-02 23:13:53 +02:00
Serhiy Storchaka c2e9983060 Issue #19795: Mark up None as literal text. 2016-10-19 16:39:36 +03:00
Serhiy Storchaka 989db5c880 Issue #19795: Mark up None as literal text. 2016-10-19 16:37:13 +03:00
Serhiy Storchaka 6a7d3480fc Issue #28332: Deprecated silent truncations in socket.htons and socket.ntohs.
Original patch by Oren Milman.
2016-10-02 12:34:40 +03:00
R David Murray 6b46ec7733 #26209: Clarify type of *localaddr*/*remoteadr* in smtpd docs. 2016-09-07 14:01:23 -04:00
R David Murray 2195d537b3 Merge: #26209: Clarify type of *localaddr*/*remoteadr* in smtpd docs. 2016-09-07 14:02:11 -04:00
Christian Heimes 8c21ab0ab9 Issue #27744: correct comment and markup 2016-09-06 00:07:02 +02:00
Christian Heimes dffa3949c7 Issue #27744: Add AF_ALG (Linux Kernel crypto) to socket module. 2016-09-05 23:54:41 +02:00
R David Murray bdfa0ebff7 #26907: add some missing getsockopt constants.
Patch by Christian Heimes, reviewed by Martin Panter.
2016-08-23 21:12:40 -04:00
Martin Panter 8bde911115 Issue #27626: Merge spelling fixes from 3.5 2016-07-28 01:30:58 +00:00
Martin Panter eb9957065a Issue #27626: Spelling fixes in docs, comments and internal names
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Steve Dower ea93ac013d Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes. 2016-06-17 12:52:18 -07:00
Terry Jan Reedy 4da945f361 Merge Issue #22558. 2016-06-11 15:06:08 -04:00
Terry Jan Reedy fa089b9b0b Issue #22558: Add remaining doc links to source code for Python-coded modules.
Reformat header above separator line (added if missing) to a common format.
Patch by Yoni Lavi.
2016-06-11 15:02:54 -04:00
Kushal Das c79b06c35c Issue #19234: Merge from 3.5 2016-06-04 10:21:36 -07:00
Kushal Das 89beb27061 Issue #19234: Documents socket.fileno() returns -1 on failure 2016-06-04 10:20:12 -07:00
Martin Panter a497774b71 Issue #24911: Merge socket context manager doc from 3.5 2016-04-24 04:55:00 +00:00
Martin Panter e37fc18b3c Issue #24911: All socket objects are context managers; update examples 2016-04-24 04:24:36 +00:00
Martin Panter 50ab1a3694 Issue #26685: Raise OSError if closing a socket fails 2016-04-11 00:38:12 +00:00
Georg Brandl 5d94134040 Closes #25910: fix dead and permanently redirected links in the docs. Thanks to SilentGhost for the patch. 2016-02-26 19:37:12 +01:00
Georg Brandl 8c16cb9f65 Closes #26435: fix syntax in directives. Thanks to Jakub Stasiak. 2016-02-25 20:17:45 +01:00
Berker Peksag 3fe64d0c5c Issue #16915: Clarify that mode parameter of socket.makefile() does not accept
the same values as open().
2016-02-18 17:34:00 +02:00
Berker Peksag 253739daf4 Fix a markup error in socket.rst 2016-01-30 19:23:29 +02:00
Berker Peksag 744fdfbf9a Issue #5626: Remove misleading comment from socket.gethostname() documentation
A machine can have more than one IP addresses so
socket.gethostbyname(socket.gethostname()) probably won't return the correct
one.
2016-01-20 08:45:37 +02:00
Serhiy Storchaka a84f6c3dd3 Issue #25523: Merge a-to-an corrections from 3.4. 2015-11-02 14:39:05 +02:00
Serhiy Storchaka d65c9496da Issue #25523: Further a-to-an corrections. 2015-11-02 14:10:23 +02:00
Martin Panter 2eb819f7a8 Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5 2015-11-02 04:04:57 +00:00
Martin Panter 7462b64911 Issue #25523: Correct "a" article to "an" article
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Berker Peksag ce88d82ec2 Issue #16802: Document fileno parameter of socket.socket()
Patch by Henrik Heimbuerger and Bar Harel.
2015-10-08 06:34:31 +03:00
Berker Peksag 24a610984d Issue #16802: Document fileno parameter of socket.socket()
Patch by Henrik Heimbuerger and Bar Harel.
2015-10-08 06:34:01 +03:00
Martin Panter ba1125246c Issue #25043: Merge Bluetooth doc from 3.4 into 3.5 2015-09-11 23:19:10 +00:00
Martin Panter ea7266d7c6 Issue #25043: Document BDADDR_ and HCI_ Bluetooth socket constants
Patch from Tim Tisdall.
2015-09-11 23:14:57 +00:00
Martin Panter daabed5d49 Issue #24984: Merge BTPROTO_SCO doc fix from 3.4 into 3.5 2015-09-11 02:29:35 +00:00
Martin Panter d8302624c9 Issue #24984: BTPROTO_SCO supports only bytes objects 2015-09-11 02:23:41 +00:00