pycares 4.6.1__cp310-cp310-win32.whl → 4.8.0__cp310-cp310-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pycares/__init__.py CHANGED
@@ -28,6 +28,8 @@ ARES_FLAG_STAYOPEN = _lib.ARES_FLAG_STAYOPEN
28
28
  ARES_FLAG_NOSEARCH = _lib.ARES_FLAG_NOSEARCH
29
29
  ARES_FLAG_NOALIASES = _lib.ARES_FLAG_NOALIASES
30
30
  ARES_FLAG_NOCHECKRESP = _lib.ARES_FLAG_NOCHECKRESP
31
+ ARES_FLAG_EDNS = _lib.ARES_FLAG_EDNS
32
+ ARES_FLAG_NO_DFLT_SVR = _lib.ARES_FLAG_NO_DFLT_SVR
31
33
 
32
34
  # Nameinfo flag values
33
35
  ARES_NI_NOFQDN = _lib.ARES_NI_NOFQDN
@@ -332,7 +334,8 @@ class Channel:
332
334
  rotate: bool = False,
333
335
  local_ip: Union[str, bytes, None] = None,
334
336
  local_dev: Optional[str] = None,
335
- resolvconf_path: Union[str, bytes, None] = None):
337
+ resolvconf_path: Union[str, bytes, None] = None,
338
+ event_thread: bool = False) -> None:
336
339
 
337
340
  channel = _ffi.new("ares_channel *")
338
341
  options = _ffi.new("struct ares_options *")
@@ -373,6 +376,8 @@ class Channel:
373
376
  if sock_state_cb:
374
377
  if not callable(sock_state_cb):
375
378
  raise TypeError("sock_state_cb is not callable")
379
+ if event_thread:
380
+ raise RuntimeError("sock_state_cb and event_thread cannot be used together")
376
381
 
377
382
  userdata = _ffi.new_handle(sock_state_cb)
378
383
 
@@ -383,6 +388,14 @@ class Channel:
383
388
  options.sock_state_cb_data = userdata
384
389
  optmask = optmask | _lib.ARES_OPT_SOCK_STATE_CB
385
390
 
391
+ if event_thread:
392
+ if not ares_threadsafety():
393
+ raise RuntimeError("c-ares is not built with thread safety")
394
+ if sock_state_cb:
395
+ raise RuntimeError("sock_state_cb and event_thread cannot be used together")
396
+ optmask = optmask | _lib.ARES_OPT_EVENT_THREAD
397
+ options.evsys = _lib.ARES_EVSYS_DEFAULT
398
+
386
399
  if lookups:
387
400
  options.lookups = _ffi.new('char[]', ascii_bytes(lookups))
388
401
  optmask = optmask | _lib.ARES_OPT_LOOKUPS
@@ -422,6 +435,11 @@ class Channel:
422
435
  def cancel(self) -> None:
423
436
  _lib.ares_cancel(self._channel[0])
424
437
 
438
+ def reinit(self) -> None:
439
+ r = _lib.ares_reinit(self._channel[0])
440
+ if r != _lib.ARES_SUCCESS:
441
+ raise AresError(r, errno.strerror(r))
442
+
425
443
  @property
426
444
  def servers(self) -> list[str]:
427
445
  servers = _ffi.new("struct ares_addr_node **")
@@ -847,6 +865,15 @@ class ares_addrinfo_result(AresResult):
847
865
  _lib.ares_freeaddrinfo(ares_addrinfo)
848
866
 
849
867
 
868
+ def ares_threadsafety() -> bool:
869
+ """
870
+ Check if c-ares was compiled with thread safety support.
871
+
872
+ :return: True if thread-safe, False otherwise.
873
+ :rtype: bool
874
+ """
875
+ return bool(_lib.ares_threadsafety())
876
+
850
877
  __all__ = (
851
878
  "ARES_FLAG_USEVC",
852
879
  "ARES_FLAG_PRIMARY",
@@ -856,6 +883,8 @@ __all__ = (
856
883
  "ARES_FLAG_NOSEARCH",
857
884
  "ARES_FLAG_NOALIASES",
858
885
  "ARES_FLAG_NOCHECKRESP",
886
+ "ARES_FLAG_EDNS",
887
+ "ARES_FLAG_NO_DFLT_SVR",
859
888
 
860
889
  # Nameinfo flag values
861
890
  "ARES_NI_NOFQDN",
@@ -903,6 +932,7 @@ __all__ = (
903
932
  "ARES_VERSION",
904
933
  "AresError",
905
934
  "Channel",
935
+ "ares_threadsafety",
906
936
  "errno",
907
937
  "__version__"
908
938
  )
pycares/_cares.pyd CHANGED
Binary file
pycares/_version.py CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- __version__ = '4.6.1'
2
+ __version__ = '4.8.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycares
3
- Version: 4.6.1
3
+ Version: 4.8.0
4
4
  Summary: Python interface for c-ares
5
5
  Home-page: http://github.com/saghul/pycares
6
6
  Author: Saúl Ibarra Corretgé
@@ -0,0 +1,12 @@
1
+ pycares/__init__.py,sha256=HW5ZP40mcZS4OacgdYM3yMEwCmg-Mf62rlsslb7pnjo,33758
2
+ pycares/__main__.py,sha256=-WwwGX4NQ8hpOqrNuCy59quCQJt7IAwQXdQjga5s4WA,2880
3
+ pycares/_cares.pyd,sha256=2y6Sg0S6ZehoZRmV6uM_-qpXXSz-vrGLw2Frc1smcrA,218112
4
+ pycares/_version.py,sha256=PDP4J6LUC78yYPTz7-gw425AL_1QMvSLs8NWrNcxbbM,25
5
+ pycares/errno.py,sha256=32f2SnSjYACq7peW9Iqb7cvDvwup6LDpNMWGHWhLnWI,2340
6
+ pycares/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ pycares/utils.py,sha256=ZzjEdkygbU3_B1g4SVwlDS949PhttJG2gK735_6G5Ps,1344
8
+ pycares-4.8.0.dist-info/licenses/LICENSE,sha256=ZzIVbIpf5QFzaiLCDSjxhvH5EViAWLVO-W4ZgBzWvb8,1090
9
+ pycares-4.8.0.dist-info/METADATA,sha256=e--e95_lvcw89okQpbeHect6WCMTcIwKIluteJxlq7A,4622
10
+ pycares-4.8.0.dist-info/WHEEL,sha256=Qd7hExuqqhTHY8ZY2HQiydJHD4P68DWXBWaQAYI4U90,97
11
+ pycares-4.8.0.dist-info/top_level.txt,sha256=nIeo7L2XUVBQZO2YE6pH7tlKaBWTfmmRcXbqe_NWYCw,15
12
+ pycares-4.8.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.1)
2
+ Generator: setuptools (80.3.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-cp310-win32
5
5
 
@@ -1,12 +0,0 @@
1
- pycares/__init__.py,sha256=FUE_1XczxLUO4f9jWARbumO4oAWM4eF1UBS9Cs0EiQw,32626
2
- pycares/__main__.py,sha256=-WwwGX4NQ8hpOqrNuCy59quCQJt7IAwQXdQjga5s4WA,2880
3
- pycares/_cares.pyd,sha256=SeteHxMp10E9reJeP60JPQvMelp3tfnoXSDUjd-oJNU,106496
4
- pycares/_version.py,sha256=nMxGyGYNJ1000wnb1Janrs5k6aKCiMEh6a7VTHwXuaI,25
5
- pycares/errno.py,sha256=32f2SnSjYACq7peW9Iqb7cvDvwup6LDpNMWGHWhLnWI,2340
6
- pycares/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- pycares/utils.py,sha256=ZzjEdkygbU3_B1g4SVwlDS949PhttJG2gK735_6G5Ps,1344
8
- pycares-4.6.1.dist-info/licenses/LICENSE,sha256=ZzIVbIpf5QFzaiLCDSjxhvH5EViAWLVO-W4ZgBzWvb8,1090
9
- pycares-4.6.1.dist-info/METADATA,sha256=RA-2SXrzVC5VSMorEwbeyn1F8QTt2tpHQxwVsh1plp8,4622
10
- pycares-4.6.1.dist-info/WHEEL,sha256=X7QxByNzhG-DDExpcYrisGuyyFVb2eTY78S8gjFvqjI,97
11
- pycares-4.6.1.dist-info/top_level.txt,sha256=nIeo7L2XUVBQZO2YE6pH7tlKaBWTfmmRcXbqe_NWYCw,15
12
- pycares-4.6.1.dist-info/RECORD,,