Your message dated Mon, 23 Nov 2015 22:00:26 +0000
with message-id <[email protected]>
and subject line Bug#608287: fixed in pysendfile 2.0.1-1
has caused the Debian Bug report #608287,
regarding python-sendfile: Please add a Python 3 version
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
608287: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608287
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python-sendfile
Severity: wishlist

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have made a (not very strongly tested, though) Python 3 port of
py-sendfile (I've already sent the patch upstream, too.)  I'd appreciate
a python3 version in Debian.

cheers
- -- vbi


- -- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (700, 'testing'), (600, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.37-rc5-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk0bcIsACgkQKqpm2L3fmXpHegCfUwLF7W9AfbRn6NEgtPTV3tV6
LcoAoI7B8Newn8fRU7BuAI1uPDYnJ2OT
=RttH
-----END PGP SIGNATURE-----
diff --git a/sendfilemodule.c b/sendfilemodule.c
--- a/sendfilemodule.c
+++ b/sendfilemodule.c
@@ -286,20 +286,41 @@
     {NULL, NULL, 0, NULL}        /* Sentinel */
 };
 
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef SendfileModuleDef = {
+    PyModuleDef_HEAD_INIT,
+    "sendfile",
+    NULL,
+    -1,
+    SendfileMethods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+#endif
+
 static void
 insint (PyObject *d, char *name, int value)
 {
-    PyObject *v = PyInt_FromLong((long) value);
+    PyObject *v = PyLong_FromLong((long) value);
     if (!v || PyDict_SetItemString(d, name, v))
         PyErr_Clear();
 
     Py_XDECREF(v);
 }
 
+#if PY_MAJOR_VERSION >= 3
+PyMODINIT_FUNC
+PyInit_sendfile(void)
+{
+    PyObject *m = PyModule_Create(&SendfileModuleDef);
+#else
 PyMODINIT_FUNC
 initsendfile(void)
 {
     PyObject *m = Py_InitModule("sendfile", SendfileMethods);
+#endif
 
     PyObject *d = PyModule_GetDict (m);
 
@@ -310,4 +331,8 @@
 #endif
     PyModule_AddStringConstant(m, "__doc__", "Direct interface to FreeBSD and Linux sendfile(2), for sending file data to a socket directly via the kernel.");
     PyModule_AddStringConstant(m, "__version__", "1.2.4");
+
+#if PY_MAJOR_VERSION >= 3
+    return m;
+#endif
 }
diff --git a/test.py b/test.py
--- a/test.py
+++ b/test.py
@@ -1,17 +1,21 @@
-import SocketServer, os, socket, sendfile
+try:
+    from socketserver import BaseRequestHandler, ThreadingTCPServer
+except ImportError:
+    from SocketServer import BaseRequestHandler, ThreadingTCPServer
+import os, socket, sendfile
 datafile = open('sendfilemodule.c', 'rb')
 datafileblocksize = os.fstat(datafile.fileno()).st_blksize
-print datafileblocksize
-class handler(SocketServer.BaseRequestHandler):
+print(datafileblocksize)
+class handler(BaseRequestHandler):
 	def handle (self):
 		if sendfile.has_sf_hdtr:
 			#print sendfile.sendfile(self.request.fileno(), datafile.fileno(), 0, 0, (["HTTP/1.1 200 OK\r\n", "Content-Type: text/html\r\n", "Connection: close\r\n\r\n"], 'test'))
-			print sendfile.sendfile(self.request.fileno(), datafile.fileno(), 0, 0, ["HTTP/1.1 200 OK\r\n", "Content-Type: text/html\r\n", "Connection: close\r\n\r\n"])
+			print(sendfile.sendfile(self.request.fileno(), datafile.fileno(), 0, 0, ["HTTP/1.1 200 OK\r\n", "Content-Type: text/html\r\n", "Connection: close\r\n\r\n"]))
 			#print sendfile.sendfile(self.request.fileno(), datafile.fileno(), 0, 0, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n", 'test')
 		else:
-			print sendfile.sendfile(self.request.fileno(), datafile.fileno(), 0, 0)
+			print(sendfile.sendfile(self.request.fileno(), datafile.fileno(), 0, 0))
 		self.request.close()
-SocketServer.ThreadingTCPServer.request_queue_size = socket.SOMAXCONN
-SocketServer.ThreadingTCPServer.allow_reuse_address = True
-server = SocketServer.ThreadingTCPServer (('', 8079), handler)
+ThreadingTCPServer.request_queue_size = socket.SOMAXCONN
+ThreadingTCPServer.allow_reuse_address = True
+server = ThreadingTCPServer (('', 8079), handler)
 server.serve_forever()

--- End Message ---
--- Begin Message ---
Source: pysendfile
Source-Version: 2.0.1-1

We believe that the bug you reported is fixed in the latest version of
pysendfile, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
W. Martin Borgert <[email protected]> (supplier of updated pysendfile package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sun, 22 Nov 2015 10:23:17 +0000
Source: pysendfile
Binary: python-sendfile python-sendfile-dbg python3-sendfile 
python3-sendfile-dbg
Architecture: source amd64
Version: 2.0.1-1
Distribution: unstable
Urgency: low
Maintainer: Ghe Rivero <[email protected]>
Changed-By: W. Martin Borgert <[email protected]>
Description:
 python-sendfile - Python interface to sendfile(2)
 python-sendfile-dbg - Python interface to sendfile(2) (debug)
 python3-sendfile - Python interface to sendfile(2)
 python3-sendfile-dbg - Python interface to sendfile(2) (debug)
Closes: 608287 805139 805140
Changes:
 pysendfile (2.0.1-1) unstable; urgency=low
 .
   * Create a git repository in collab-maint, using git-dpm
   * Add homepage and VCS information (Closes: #805140)
   * Add myself to Uploaders - feel free to revert
   * Add support for Python 3 (Closes: #608287)
   * New upstream version (Closes: #805139)
   * Fixed lintians
Checksums-Sha1:
 daabd9f86eb25be86bd3534d1f2c03966edb8147 2199 pysendfile_2.0.1-1.dsc
 5809a74f7d1ee26a9caa7ebb02cd3d8debffa54c 14613 pysendfile_2.0.1.orig.tar.gz
 86737be767623e8c0c38c5a26150fdab34d0cccc 2596 pysendfile_2.0.1-1.debian.tar.xz
 2a1ebaf3277c5d5a63aab3e9ffff9f53ba301879 5834 
python-sendfile-dbg_2.0.1-1_amd64.deb
 58a9739b8fb70019f2f2e4ee3feb655dbc26512c 9086 python-sendfile_2.0.1-1_amd64.deb
 631afddeed234c21830adfc04fb0efca2444ad98 6228 
python3-sendfile-dbg_2.0.1-1_amd64.deb
 c580e0162c4d59588f9d8bdeca9eff4027d13b13 9396 
python3-sendfile_2.0.1-1_amd64.deb
Checksums-Sha256:
 268ea311890d50449674640aef4e083e0607d6c169f4ef9550f31d2746dff285 2199 
pysendfile_2.0.1-1.dsc
 f4ca8a7f0be67e3d710c0633dd9aadab6881203c31cb9eb9be4f10361ad3f937 14613 
pysendfile_2.0.1.orig.tar.gz
 aa8002c93308854cc59eb0fc94b42e1d2355b3efe832c39d7d7e6856a7664fdc 2596 
pysendfile_2.0.1-1.debian.tar.xz
 fb23386e48c69645921af24f1e5a7561c3653a08339ef512a6c61630e72989e3 5834 
python-sendfile-dbg_2.0.1-1_amd64.deb
 c9faf444d9f636fccc1b54e9b949407d5a6b8681b2f401cb68b505bc63c15ed9 9086 
python-sendfile_2.0.1-1_amd64.deb
 2191d17d408c1a74311ff8886aad89e21f32cd6cfa6fbb15dc756b983a678c5a 6228 
python3-sendfile-dbg_2.0.1-1_amd64.deb
 88a71e9f73adcddf27edbeaa0beb20dd89f8f6048caa29a88c374b375651f49a 9396 
python3-sendfile_2.0.1-1_amd64.deb
Files:
 db5af34a50490efd227f4114e2f2cea7 2199 python optional pysendfile_2.0.1-1.dsc
 928b468e0676c3f90a824b472fbaf4b3 14613 python optional 
pysendfile_2.0.1.orig.tar.gz
 30d3b99540ccbf799ad702a7e1806fde 2596 python optional 
pysendfile_2.0.1-1.debian.tar.xz
 293e7084209de96d3392caf2367e3998 5834 debug extra 
python-sendfile-dbg_2.0.1-1_amd64.deb
 8fd94d9f119acdc1ad4b669f779ce727 9086 python optional 
python-sendfile_2.0.1-1_amd64.deb
 b9d00713614dd3dca8b7b605bccb89d0 6228 debug extra 
python3-sendfile-dbg_2.0.1-1_amd64.deb
 43bf495070c5a5acb74ad63d92606a7e 9396 python optional 
python3-sendfile_2.0.1-1_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWUad/AAoJEOPgocKGuWPqVMAP/3xaJ5ysnxFClDasDBOK0qWB
L3LqSgPzG1LqD8CaZ0qwhqpCCoY4w1IBAW3DMSoFOT9ri9S7MOTYAZSNP7abD4lU
NdsXOZA4uaBwgMTh5HYPhdY8bx+zPEJN++jqAvG/yKMlXteF2gEZmfxdJdYEzUc4
peO+iLGFDW+lgAhRhEezF1cDZqqZ9OZ3J8jcVB8fVajKIsB4WGJ/vykn+shb8sws
oMUK6d7VhE4qYVCJ14nyM9eWChfdlAVj8/bckDZMbNKFLeHvUmDU5bLjfd91Zs07
XCI1oLOd0nnEs9vJsWrvO1cPBPImFaYfkakWW4vUj90leWhW63EfUpcIjBO7+iDR
bgGbQLB/MZOjLcxQHwBl/vCcsSaTGRtMGEmecjmZFPyu54VSMriVgTFLZlg2/nUE
PT02skLpZBRoqx118vIp/xcqcTrYI252IZztAd+rDnXuZYIIlT2wJxGrwyGAHizy
y1bfRfebwna8A+lwgjs+Ilt5k6KeYZxsbqLanEb/yW/c0eIdh9ASHObbqlykwl84
t5VOMMPf8gGKasHSmo3Yqb5yQzn7M8R56xYWGHhSfnLpQQBayvN7YaBkM9tnEKeK
XqF3FnlfIbJ3+GHZZjSIUXFBwbo5aMQomaY6XxiyihRcJH0IiSBD+HoIuEhMwroe
fEHcgBtWPYQlQauGJ11e
=dHXf
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to