<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Modules/socketmodule.c, branch misc-acks-comment</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/'/>
<entry>
<title>bpo-38282: Rewrite getsockaddrarg() helper function (GH-16698)</title>
<updated>2019-10-10T19:30:20+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2019-10-10T19:30:20+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=d565fb9828ee9c494bb7a80057a08e4738273e30'/>
<id>d565fb9828ee9c494bb7a80057a08e4738273e30</id>
<content type='text'>
Rewrite getsockaddrarg() helper function of socketmodule.c (_socket
module) to prevent a false alarm when compiling codde using GCC with
_FORTIFY_SOURCE=2. Pass a pointer of the sock_addr_t union, rather
than passing a pointer to a sockaddr structure.

Add "struct sockaddr_tipc tipc;" to the sock_addr_t union.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rewrite getsockaddrarg() helper function of socketmodule.c (_socket
module) to prevent a false alarm when compiling codde using GCC with
_FORTIFY_SOURCE=2. Pass a pointer of the sock_addr_t union, rather
than passing a pointer to a sockaddr structure.

Add "struct sockaddr_tipc tipc;" to the sock_addr_t union.</pre>
</div>
</content>
</entry>
<entry>
<title>closes bpo-37405: Make socket.getsockname() always return a tuple for AF_CAN. (GH-14392)</title>
<updated>2019-09-12T10:02:48+00:00</updated>
<author>
<name>bggardner</name>
<email>brent@ebrent.net</email>
</author>
<published>2019-09-12T10:02:48+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=954900a3f98a8c0dea14dd575490237f3f8626b3'/>
<id>954900a3f98a8c0dea14dd575490237f3f8626b3</id>
<content type='text'>
This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-15999: Always pass bool instead of int to socket.setblocking(). (GH-15621)</title>
<updated>2019-09-01T09:12:52+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2019-09-01T09:12:52+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=5eca7f3f3836cc734dfe8dc5ec669f3b4e9333fe'/>
<id>5eca7f3f3836cc734dfe8dc5ec669f3b4e9333fe</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Unmark files as executable that can't actually be executed. (GH-15353)</title>
<updated>2019-08-21T04:53:59+00:00</updated>
<author>
<name>Greg Price</name>
<email>gnprice@gmail.com</email>
</author>
<published>2019-08-21T04:53:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=9ece4a5057d52c42a8a064a6c0c7f923267fb3db'/>
<id>9ece4a5057d52c42a8a064a6c0c7f923267fb3db</id>
<content type='text'>
There are plenty of legitimate scripts in the tree that begin with a
`#!`, but also a few that seem to be marked executable by mistake.

Found them with this command -- it gets executable files known to Git,
filters to the ones that don't start with a `#!`, and then unmarks
them as executable:

    $ git ls-files --stage \
      | perl -lane 'print $F[3] if (!/^100644/)' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          || chmod a-x "$f"; \
        done

Looking at the list by hand confirms that we didn't sweep up any
files that should have the executable bit after all.  In particular

 * The `.psd` files are images from Photoshop.

 * The `.bat` files sure look like things that can be run.
   But we have lots of other `.bat` files, and they don't have
   this bit set, so it must not be needed for them.



Automerge-Triggered-By: @benjaminp</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are plenty of legitimate scripts in the tree that begin with a
`#!`, but also a few that seem to be marked executable by mistake.

Found them with this command -- it gets executable files known to Git,
filters to the ones that don't start with a `#!`, and then unmarks
them as executable:

    $ git ls-files --stage \
      | perl -lane 'print $F[3] if (!/^100644/)' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          || chmod a-x "$f"; \
        done

Looking at the list by hand confirms that we didn't sweep up any
files that should have the executable bit after all.  In particular

 * The `.psd` files are images from Photoshop.

 * The `.bat` files sure look like things that can be run.
   But we have lots of other `.bat` files, and they don't have
   this bit set, so it must not be needed for them.



Automerge-Triggered-By: @benjaminp</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37811: FreeBSD, OSX: fix poll(2) usage in sockets module (GH-15202)</title>
<updated>2019-08-14T21:21:48+00:00</updated>
<author>
<name>Artem Khramov</name>
<email>akhramov@pm.me</email>
</author>
<published>2019-08-14T21:21:48+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=28146206578ebe1b84b48e6f255738a227058c04'/>
<id>28146206578ebe1b84b48e6f255738a227058c04</id>
<content type='text'>
FreeBSD implementation of poll(2) restricts the timeout argument to be
either zero, or positive, or equal to INFTIM (-1).

Unless otherwise overridden, socket timeout defaults to -1. This value
is then converted to milliseconds (-1000) and used as argument to the
poll syscall. poll returns EINVAL (22), and the connection fails.

This bug was discovered during the EINTR handling testing, and the
reproduction code can be found in
https://bugs.python.org/issue23618 (see connect_eintr.py,
attached). On GNU/Linux, the example runs as expected.

This change is trivial:
If the supplied timeout value is negative, truncate it to -1.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
FreeBSD implementation of poll(2) restricts the timeout argument to be
either zero, or positive, or equal to INFTIM (-1).

Unless otherwise overridden, socket timeout defaults to -1. This value
is then converted to milliseconds (-1000) and used as argument to the
poll syscall. poll returns EINVAL (22), and the connection fails.

This bug was discovered during the EINTR handling testing, and the
reproduction code can be found in
https://bugs.python.org/issue23618 (see connect_eintr.py,
attached). On GNU/Linux, the example runs as expected.

This change is trivial:
If the supplied timeout value is negative, truncate it to -1.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-36590: Add Bluetooth RFCOMM and support for Windows. (GH-12767)</title>
<updated>2019-08-02T20:29:52+00:00</updated>
<author>
<name>Greg Bowser</name>
<email>topnotcher@gmail.com</email>
</author>
<published>2019-08-02T20:29:52+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=8fbece135d7615e836a845ca39223097046c8b8b'/>
<id>8fbece135d7615e836a845ca39223097046c8b8b</id>
<content type='text'>
Support for RFCOMM, L2CAP, HCI, SCO is based on the BTPROTO_* macros
being defined. Winsock only supports RFCOMM, even though it has a
BTHPROTO_L2CAP macro. L2CAP support would build on windows, but not
necessarily work.

This also adds some basic unittests for constants (all of which existed
prior to this commit, just not on windows) and creating sockets.

pair: Nate Duarte &lt;slacknate@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Support for RFCOMM, L2CAP, HCI, SCO is based on the BTPROTO_* macros
being defined. Winsock only supports RFCOMM, even though it has a
BTHPROTO_L2CAP macro. L2CAP support would build on windows, but not
necessarily work.

This also adds some basic unittests for constants (all of which existed
prior to this commit, just not on windows) and creating sockets.

pair: Nate Duarte &lt;slacknate@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37085: Expose SocketCAN bcm_msg_head flags (#13646)</title>
<updated>2019-07-31T08:47:16+00:00</updated>
<author>
<name>karl ding</name>
<email>karlding@users.noreply.github.com</email>
</author>
<published>2019-07-31T08:47:16+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=31c4fd2a10d90beaa37d630e5f74a471e14e089d'/>
<id>31c4fd2a10d90beaa37d630e5f74a471e14e089d</id>
<content type='text'>
Expose the CAN_BCM SocketCAN constants used in the bcm_msg_head struct
flags (provided by &lt;linux/can/bcm.h&gt;) under the socket library.

This adds the following constants with a CAN_BCM prefix:

  * SETTIMER
  * STARTTIMER
  * TX_COUNTEVT
  * TX_ANNOUNCE
  * TX_CP_CAN_ID
  * RX_FILTER_ID
  * RX_CHECK_DLC
  * RX_NO_AUTOTIMER
  * RX_ANNOUNCE_RESUME
  * TX_RESET_MULTI_IDX
  * RX_RTR_FRAME
  * CAN_FD_FRAME

The CAN_FD_FRAME flag was introduced in the 4.8 kernel, while the other
ones were present since SocketCAN drivers were mainlined in 2.6.25. As
such, it is probably unnecessary to guard against these constants being
missing.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Expose the CAN_BCM SocketCAN constants used in the bcm_msg_head struct
flags (provided by &lt;linux/can/bcm.h&gt;) under the socket library.

This adds the following constants with a CAN_BCM prefix:

  * SETTIMER
  * STARTTIMER
  * TX_COUNTEVT
  * TX_ANNOUNCE
  * TX_CP_CAN_ID
  * RX_FILTER_ID
  * RX_CHECK_DLC
  * RX_NO_AUTOTIMER
  * RX_ANNOUNCE_RESUME
  * TX_RESET_MULTI_IDX
  * RX_RTR_FRAME
  * CAN_FD_FRAME

The CAN_FD_FRAME flag was introduced in the 4.8 kernel, while the other
ones were present since SocketCAN drivers were mainlined in 2.6.25. As
such, it is probably unnecessary to guard against these constants being
missing.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37345: Add formal UDPLITE support (GH-14258)</title>
<updated>2019-06-24T09:58:56+00:00</updated>
<author>
<name>Gabe Appleton</name>
<email>gabe@gabeappleton.me</email>
</author>
<published>2019-06-24T09:58:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=2ac3bab2a6e1f9e17fc0c58a26e8425bb93cb0f5'/>
<id>2ac3bab2a6e1f9e17fc0c58a26e8425bb93cb0f5</id>
<content type='text'>
At the moment you can definitely use UDPLITE sockets on Linux systems, but it would be good if this support were formalized such that you can detect support at runtime easily.

At the moment, to make and use a UDPLITE socket requires something like the following code:

```
&gt;&gt;&gt; import socket
&gt;&gt;&gt; a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
&gt;&gt;&gt; b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
&gt;&gt;&gt; a.bind(('localhost', 44444))
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.setsockopt(136, 10, 16)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.setsockopt(136, 10, 32)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.setsockopt(136, 10, 64)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
```

If you look at this through Wireshark, you can see that the packets are different in that the checksums and checksum coverages change.

With the pull request that I am submitting momentarily, you could do the following code instead:

```
&gt;&gt;&gt; import socket
&gt;&gt;&gt; a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
&gt;&gt;&gt; b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
&gt;&gt;&gt; a.bind(('localhost', 44444))
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.set_send_checksum_coverage(16)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.set_send_checksum_coverage(32)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.set_send_checksum_coverage(64)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
```

One can also detect support for UDPLITE just by checking

```
&gt;&gt;&gt; hasattr(socket, 'IPPROTO_UDPLITE')
```


https://bugs.python.org/issue37345</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
At the moment you can definitely use UDPLITE sockets on Linux systems, but it would be good if this support were formalized such that you can detect support at runtime easily.

At the moment, to make and use a UDPLITE socket requires something like the following code:

```
&gt;&gt;&gt; import socket
&gt;&gt;&gt; a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
&gt;&gt;&gt; b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
&gt;&gt;&gt; a.bind(('localhost', 44444))
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.setsockopt(136, 10, 16)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.setsockopt(136, 10, 32)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.setsockopt(136, 10, 64)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
```

If you look at this through Wireshark, you can see that the packets are different in that the checksums and checksum coverages change.

With the pull request that I am submitting momentarily, you could do the following code instead:

```
&gt;&gt;&gt; import socket
&gt;&gt;&gt; a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
&gt;&gt;&gt; b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
&gt;&gt;&gt; a.bind(('localhost', 44444))
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.set_send_checksum_coverage(16)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.set_send_checksum_coverage(32)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
&gt;&gt;&gt; b.set_send_checksum_coverage(64)
&gt;&gt;&gt; b.sendto(b'test'*256, ('localhost', 44444))
```

One can also detect support for UDPLITE just by checking

```
&gt;&gt;&gt; hasattr(socket, 'IPPROTO_UDPLITE')
```


https://bugs.python.org/issue37345</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-36974: tp_print -&gt; tp_vectorcall_offset and tp_reserved -&gt; tp_as_async (GH-13464)</title>
<updated>2019-05-31T02:13:39+00:00</updated>
<author>
<name>Jeroen Demeyer</name>
<email>J.Demeyer@UGent.be</email>
</author>
<published>2019-05-31T02:13:39+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=530f506ac91338b55cf2be71b1cdf50cb077512f'/>
<id>530f506ac91338b55cf2be71b1cdf50cb077512f</id>
<content type='text'>
Automatically replace
tp_print -&gt; tp_vectorcall_offset
tp_compare -&gt; tp_as_async
tp_reserved -&gt; tp_as_async
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Automatically replace
tp_print -&gt; tp_vectorcall_offset
tp_compare -&gt; tp_as_async
tp_reserved -&gt; tp_as_async
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37007: Implement socket.if_nametoindex(), if_indextoname() and if_nameindex() on Windows (GH-13522)</title>
<updated>2019-05-29T21:02:37+00:00</updated>
<author>
<name>Zackery Spytz</name>
<email>zspytz@gmail.com</email>
</author>
<published>2019-05-29T21:02:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=8f96c9f8ed2a4795e34b333411451e24f28f74d2'/>
<id>8f96c9f8ed2a4795e34b333411451e24f28f74d2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
