karpierz / libpcap

Python binding for the libpcap C library.
BSD 3-Clause "New" or "Revised" License
54 stars 14 forks source link

use msvcrt.get_osfhandle instead of libc._get_osfhandle #15

Closed crackevil closed 3 days ago

crackevil commented 3 days ago

libc._get_osfhandle in _pcap.py returns -1 on multiple version msvcrt runtime installed system.

from python's ctypes lib document

Note

Accessing the standard C library through cdll.msvcrt will use an outdated version of the library that may be incompatible with the one being used by Python. Where possible, use native Python functionality, or else import and use the msvcrt module.

since comment in _pcap.py, calls to msvcrt should keep align with runtime one, so use msvcrt.get_osfhandle make sense much more.

karpierz commented 3 days ago

Fixed in 1.11.0b13 Thank you very much :)