[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Multiple copies of timeoutsocket.py in Debian packages



* Olivier Berger <olivier.berger@telecom-sudparis.eu>, 2014-01-29, 10:25:
Yeah, timeoutsocket.py looks like something that should have died a decade ago. In Python ≥ 2.3 you can set default timeout or a per-socket timeout without help of this library.

planet-venus, python-feedvalidator and rawdog already use the proper Python interfaces, and only fall back to timeoutsocket when they are not available:
http://sources.debian.net/src/python-feedvalidator/0~svn1022-2/feedvalidator/__init__.py#L8
http://sources.debian.net/src/planet-venus/0~git9de2109-1/planet/spider.py#L378
http://sources.debian.net/src/rawdog/2.13.dfsg.1-1/rawdoglib/feedparser.py#L103


I'm wondering, in similar cases, if there is anything that should be done for these packages, like patching the code to remove the embedded copy and get rid of the import check, since our Python versions in Debian are recent enough ? This would eliminate uncertainty...

I would remove the embedded copy from Debian binary packages, and then poke upstream to drop the obsolete code…

or maybe things should just be kept in the current state... Maybe that's not worth the worry in general.

… but others' laziness may vary. :-P

plucker and spikeproxy would have to be ported to the “new” API.
I guess that would be worth a bug report, then ?

I'm glad you volunteered to file them. ;-)

Beware that spikeproxy's copy is slightly modified; see the attached diff.

--
Jakub Wilk
--- plucker-1.8/parser/python/PyPlucker/helper/timeoutsocket.py	2002-10-10 23:57:45.000000000 +0200
+++ spkproxy-1.4.8/timeoutsocket.py	2003-04-08 17:22:38.000000000 +0200
@@ -286,6 +286,8 @@
         if self._blocking:
             r,w,e = select.select([],[sock],[], self._timeout)
             if not w:
+                #no raising for me!
+                return 0
                 raise Timeout("Send timed out")
         return sock.send(data, flags)
     # end send
@@ -295,6 +297,8 @@
         if self._blocking:
             r,w,e = select.select([sock], [], [], self._timeout)
             if not r:
+                #I don't want to raise anything
+                return ""
                 raise Timeout("Recv timed out")
         return sock.recv(bufsize, flags)
     # end recv

Reply to: