[issue1722225] Build on QNX
Martin v. Löwis added the comment: I still don't get the point of including sys/termio.h. Python does *not* use the TCGETA macro itself *at all*. Python applications may, but they can't use the included sys/termio.h, since they are written in Python, not in C. To put the question the other way: If you remove the first chunk of the patch 4 (the change to pyport.h), will Python fail to compile on QNX? If so, what is the error message. Please also address my other remarks, in particular this one: Are you willing to support a QNX port for the coming years (say, 5 years)? _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue175 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1706039] Added clearerr() to clear EOF state
Martin v. Löwis added the comment: jos, can you please provide a real name in Your Details of this tracker? We cannot accept anonymous/pseudonymous patches. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1706039 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1490190] add os.chflags() and os.lchflags() where available
Martin v. Löwis added the comment: Committed chflags.diff as r59317. -- status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1490190 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1549] Regression with __hash__ definition and rich comparison operators
Thomas Herve added the comment: I gave it a try. The following patch corrects 2 problems: * classes with only __lt__ and __gt__ defined are hashable * classes defining __eq__ get a meaningful exception. I've restricted the hash_name_op to the bare minimum, but no tests failed, so I supposed it was enough :). Please review. Added file: http://bugs.python.org/file8871/1549_1.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1549 __Index: Objects/typeobject.c === --- Objects/typeobject.c(revision 59318) +++ Objects/typeobject.c(working copy) @@ -3230,14 +3230,8 @@ type-tp_flags |= Py_TPFLAGS_DICT_SUBCLASS; } -/* Map rich comparison operators to their __xx__ namesakes */ -static char *name_op[] = { -__lt__, -__le__, +static char *hash_name_op[] = { __eq__, -__ne__, -__gt__, -__ge__, __cmp__, /* These are only for overrides_hash(): */ __hash__, @@ -3246,13 +3240,14 @@ static int overrides_hash(PyTypeObject *type) { - int i; + char **p; PyObject *dict = type-tp_dict; assert(dict != NULL); - for (i = 0; i 8; i++) { - if (PyDict_GetItemString(dict, name_op[i]) != NULL) + for (p = hash_name_op; *p; p++) { + if (PyDict_GetItemString(dict, *p) != NULL) { return 1; +} } return 0; } @@ -4846,7 +4841,7 @@ func = lookup_method(self, __hash__, hash_str); - if (func != NULL) { + if (func != NULL func != Py_None) { PyObject *res = PyEval_CallObject(func, NULL); Py_DECREF(func); if (res == NULL) @@ -4971,6 +4966,15 @@ return 0; } +static char *name_op[] = { +__lt__, +__le__, +__eq__, +__ne__, +__gt__, +__ge__, +}; + static PyObject * half_richcompare(PyObject *self, PyObject *other, int op) { Index: Lib/test/test_richcmp.py === --- Lib/test/test_richcmp.py(revision 59318) +++ Lib/test/test_richcmp.py(working copy) @@ -85,6 +85,35 @@ raise ValueError, Cannot compare vectors of different length return other + +class SimpleOrder(object): + +A simple class that defines order but not full comparison. + + +def __init__(self, value): +self.value = value + +def __lt__(self, other): +if not isinstance(other, SimpleOrder): +return True +return self.value other.value + +def __gt__(self, other): +if not isinstance(other, SimpleOrder): +return False +return self.value other.value + + +class DumbEqualityWithoutHash(object): + +A class that define __eq__, but no __hash__: it shouldn't be hashable. + + +def __eq__(self, other): +return False + + opmap = { lt: (lambda a,b: a b, operator.lt, operator.__lt__), le: (lambda a,b: a=b, operator.le, operator.__le__), @@ -330,8 +359,39 @@ for op in opmap[lt]: self.assertIs(op(x, y), True) + +class HashableTest(unittest.TestCase): + +Test hashability of classes with rich operators defined. + + +def test_simpleOrderHashable(self): + +A class that only defines __gt__ and/or __lt__ should be hashable. + +a = SimpleOrder(1) +b = SimpleOrder(2) +self.assert_(a b) +self.assert_(b a) +self.assert_(a.__hash__ is not None) + +def test_notHashableException(self): + +If a class is not hashable, it should raise a TypeError with an +understandable message. + +a = DumbEqualityWithoutHash() +try: +hash(a) +except TypeError, e: +self.assertEquals(str(e), + unhashable type: 'DumbEqualityWithoutHash') +else: +raise test_support.TestFailed(Should not be here) + + def test_main(): -test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest) +test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest, HashableTest) if __name__ == __main__: test_main() ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1706039] Added clearerr() to clear EOF state
John Smith added the comment: What's in a name? :p Done, anyway. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1706039 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1552] fromfd() and socketpair() should return wrapped sockets
Thomas Herve added the comment: This is a nice enhancement. I attach a quick patch to add tests for that. -- nosy: +therve Added file: http://bugs.python.org/file8872/1552_test_socket.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1552 __Index: Lib/test/test_socket.py === --- Lib/test/test_socket.py (revision 59319) +++ Lib/test/test_socket.py (working copy) @@ -199,6 +199,8 @@ def setUp(self): self.serv, self.cli = socket.socketpair() +self.assert_(isinstance(self.serv, socket.socket)) +self.assert_(isinstance(self.cli, socket.socket)) def tearDown(self): self.serv.close() @@ -561,6 +563,7 @@ return # On Windows, this doesn't exist fd = self.cli_conn.fileno() sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM) +self.assert_(isinstance(sock, socket.socket)) msg = sock.recv(1024) self.assertEqual(msg, MSG) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1285940] socket intial recv() latency
Thomas Herve added the comment: Can we close this one? -- nosy: +therve _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1285940 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1084] ''.find() gives wrong result in Python built with ICC
Simon Anders added the comment: Update to the story: After I submitted the bug report to Intel, they investigated and quickly confirmed it to be a compiler bug, whcih they then managed to fix. I have just got an e-mail from Intel that the newest available version of ICC, namely version l_cc_c_10.1.008, contains the fix. In principle the problem should vanish now, but I have not found the time to verify that. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1084 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1554] [patch] socketmodule cleanups: allow the use of keywords in socket functions
New submission from Thomas Herve: I attach a patch where I use PyArg_ParseTupleAndKeywords in socketmodule where ARGSUSED was mentioned, or removed ARGSUSED if keywords already used. -- components: Library (Lib) files: socket_keywords.diff messages: 58189 nosy: therve severity: normal status: open title: [patch] socketmodule cleanups: allow the use of keywords in socket functions type: rfe versions: Python 2.6 Added file: http://bugs.python.org/file8873/socket_keywords.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1554 __Index: Modules/socketmodule.c === --- Modules/socketmodule.c (revision 59319) +++ Modules/socketmodule.c (working copy) @@ -945,7 +945,6 @@ The family field of the sockaddr structure is inspected to determine what kind of address it really is. */ -/*ARGSUSED*/ static PyObject * makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto) { @@ -2817,7 +2816,6 @@ /* Initialize a new socket object. */ -/*ARGSUSED*/ static int sock_initobj(PyObject *self, PyObject *args, PyObject *kwds) { @@ -2898,9 +2896,8 @@ /* Python interface to gethostname(). */ -/*ARGSUSED*/ static PyObject * -socket_gethostname(PyObject *self, PyObject *unused) +socket_gethostname(PyObject *self) { char buf[1024]; int res; @@ -2921,14 +2918,15 @@ /* Python interface to gethostbyname(name). */ -/*ARGSUSED*/ static PyObject * -socket_gethostbyname(PyObject *self, PyObject *args) +socket_gethostbyname(PyObject *self, PyObject *args, PyObject *kwds) { char *name; sock_addr_t addrbuf; - if (!PyArg_ParseTuple(args, s:gethostbyname, name)) + static char *keywords[] = {host, NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, s:gethostbyname, keywords, name)) return NULL; if (setipaddr(name, SAS2SA(addrbuf), sizeof(addrbuf), AF_INET) 0) return NULL; @@ -3080,9 +3078,8 @@ /* Python interface to gethostbyname_ex(name). */ -/*ARGSUSED*/ static PyObject * -socket_gethostbyname_ex(PyObject *self, PyObject *args) +socket_gethostbyname_ex(PyObject *self, PyObject *args, PyObject *kwds) { char *name; struct hostent *h; @@ -3107,7 +3104,9 @@ #endif #endif /* HAVE_GETHOSTBYNAME_R */ - if (!PyArg_ParseTuple(args, s:gethostbyname_ex, name)) + static char *keywords[] = {host, NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, s:gethostbyname_ex, keywords, name)) return NULL; if (setipaddr(name, (struct sockaddr *)addr, sizeof(addr), AF_INET) 0) return NULL; @@ -3152,9 +3151,8 @@ /* Python interface to gethostbyaddr(IP). */ -/*ARGSUSED*/ static PyObject * -socket_gethostbyaddr(PyObject *self, PyObject *args) +socket_gethostbyaddr(PyObject *self, PyObject *args, PyObject *kwds) { #ifdef ENABLE_IPV6 struct sockaddr_storage addr; @@ -3182,7 +3180,9 @@ int al; int af; - if (!PyArg_ParseTuple(args, s:gethostbyaddr, ip_num)) + static char *keywords[] = {host, NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, s:gethostbyaddr, keywords, ip_num)) return NULL; af = AF_UNSPEC; if (setipaddr(ip_num, sa, sizeof(addr), af) 0) @@ -3244,13 +3244,15 @@ This only returns the port number, since the other info is already known or not useful (like the list of aliases). */ -/*ARGSUSED*/ static PyObject * -socket_getservbyname(PyObject *self, PyObject *args) +socket_getservbyname(PyObject *self, PyObject *args, PyObject *kwds) { char *name, *proto=NULL; struct servent *sp; - if (!PyArg_ParseTuple(args, s|s:getservbyname, name, proto)) + + static char *keywords[] = {servicename, protocolname, NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, s|s:getservbyname, keywords, name, proto)) return NULL; Py_BEGIN_ALLOW_THREADS sp = getservbyname(name, proto); @@ -3274,14 +3276,16 @@ This only returns the service name, since the other info is already known or not useful (like the list of aliases). */ -/*ARGSUSED*/ static PyObject * -socket_getservbyport(PyObject *self, PyObject *args) +socket_getservbyport(PyObject *self, PyObject *args, PyObject *kwds) { unsigned short port; char *proto=NULL; struct servent *sp; - if (!PyArg_ParseTuple(args, H|s:getservbyport, port, proto)) + + static char *keywords[] = {servicename, protocolname, NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, H|s:getservbyport, keywords, port, proto)) return NULL; Py_BEGIN_ALLOW_THREADS sp = getservbyport(htons(port), proto); @@ -3304,9 +3308,8 @@ This only returns the protocol number, since the other info is already known
[issue1554] [patch] socketmodule cleanups: allow the use of keywords in socket functions
Martin v. Löwis added the comment: What problem(s) does this solve? -- nosy: +loewis __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1554 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1554] [patch] socketmodule cleanups: allow the use of keywords in socket functions
Thomas Herve added the comment: It's not really for solving a problem, it's an enhancement to allow the functions to be called with keyword parameters. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1554 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
ianaré added the comment: OK I see that now. For what it's worth, I tested the code on win2000, XP, and ubuntu using the shutil.move command on files and folders (so that it uses either copy2 or copytree). Apart from the original bug in ubuntu (copy from ext3 to ntfs-3g) it is fine. I've made further modifications to allow for not showing permission errors. Should I file these under a new report? Many thanks. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1545 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1555] Print-media stylesheet for sphinx docs incomplete
New submission from Tim Golden: The print-media stylesheet in the sphinx docs did not completely eliminate the on-screen layout. The attached patch is against r59327 of sphinx/style/default.css and has been tested against html, htmlhelp and web under native Win32. -- components: Documentation tools (Sphinx) files: defaults-r59327.patch messages: 58193 nosy: tim.golden severity: minor status: open title: Print-media stylesheet for sphinx docs incomplete versions: Python 3.0 Added file: http://bugs.python.org/file8874/defaults-r59327.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1555 __Index: style/default.css === --- style/default.css (revision 59327) +++ style/default.css (working copy) @@ -782,9 +782,13 @@ div.documentwrapper { width: 100%; } - -div.body { -margin: 0; + + div.document, + div.documentwrapper, + div.bodywrapper, + div.body { +margin: 0; + width : 100%; } div.sidebar, ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1555] Print-media stylesheet for sphinx docs incomplete
Georg Brandl added the comment: Thanks, committed as r59328. -- nosy: +georg.brandl resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1555 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
ianaré added the comment: sorry, should have clarified, I tested with this code: copy2 try: copystat(src, dst) except OSError, err: if WindowsError is not None and isinstance(err, WindowsError): pass else: raise copytree try: copystat(src, dst) except OSError, err: if WindowsError is not None and isinstance(err, WindowsError): pass else: errors.extend((src, dst, str(why))) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1545 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1554] [patch] socketmodule cleanups: allow the use of keywords in socket functions
Martin v. Löwis added the comment: And what problem is solved by the removal of ARGSUSED? For the functions whose signatures you changed, can you please add documentation and test changes as well (where necessary)? Please don't remove the arguments PyObject* on METHO_NOARGS functions; that is incorrect. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1554 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda added the comment: The change looks fine as per yesterday's discussion. Can you submit the actual patch? it needs to include check for WindowsError name. BTW, I would put a comment when the exception is being ignored on windows. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1545 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue469773] Write 'Using Python on Platform X' documents
Georg Brandl added the comment: Okay, now we have documents for Unix, Windows and Mac! -- status: pending - closed Tracker [EMAIL PROTECTED] http://bugs.python.org/issue469773 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1554] [patch] socketmodule cleanups: allow the use of keywords in socket functions
Thomas Herve added the comment: Alright I'll add tests to the modified functions. I don't think I have to change documentation because I kept the same name for the parameters, but I'll check. Looking at the patch more, maybe it doesn't make sense on the functions taking only one parameter though :). I'll probably remove that. Regarding ARGSUSED, I thought it was here to note functions using PyArg_ParseTuple instead of PyArg_ParseTupleAndKeywords, but looking at the svn history it seems wrong. I can put it back if there is another semantic. For METH_NOARGS, do you have a pointer to explain that? http://docs.python.org/ext/node22.html, for example, show an example of METH_NOARGS with a function without arguments. Does that have other incidence? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1554 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1005] Patches to rename Queue module to queue
Brett Cannon added the comment: Yes, thanks for the patches, Paul! Guido sent out an email today saying that the reorg will probably be the main focus of the next Py3K release after 3.0a2. So hopefully they won't go too stale. And I just realized it might end up being best to roll Queue into threading or collections. Probably won't know until it actually happens. =) -- assignee: brett.cannon - collinwinter nosy: +collinwinter __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1005 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
ianaré added the comment: Sorry about that. Here is the output from $ svn diff I've also made modifications to allow to ignore the permission errors (defaults to no) - should I post here or file new report? Added file: http://bugs.python.org/file8876/shutil.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1545 __Index: Lib/shutil.py === --- Lib/shutil.py (revision 59335) +++ Lib/shutil.py (working copy) @@ -9,6 +9,12 @@ import stat from os.path import abspath +# To ignore WindowsError on non-Windows systems +try: +WindowsError +except NameError: +WindowsError = None + __all__ = [copyfileobj,copyfile,copymode,copystat,copy,copy2, copytree,move,rmtree,Error] @@ -91,7 +97,14 @@ if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) copyfile(src, dst) -copystat(src, dst) +try: +copystat(src, dst) +except OSError, err: +# Copying file access times may fail on Windows +if WindowsError is not None and isinstance(err, WindowsError): +pass +else: +raise def copytree(src, dst, symlinks=False): @@ -131,11 +144,12 @@ errors.extend(err.args[0]) try: copystat(src, dst) -except WindowsError: -# can't copy file access times on Windows -pass except OSError, why: -errors.extend((src, dst, str(why))) +# Copying file access times may fail on Windows +if WindowsError is not None and isinstance(err, WindowsError): +pass +else: +errors.extend((src, dst, str(why))) if errors: raise Error, errors ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1400] Py3k's print() flushing problem
Guido van Rossum added the comment: In r59341 I added a flush of stdout and stderr at the end of each command that restores the following behavior: n = sys.stdout.write('X') X I still need to change io.py to properly implement line buffering though; the current implementation is wrong. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1400 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1539] test_collections: failing refleak test
Changes by Guido van Rossum: -- priority: normal - high __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1539 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1553] An errornous __length_hint__ can make list() raise a SystemError
Raymond Hettinger added the comment: Please post the patch here. I'll take a look to see if it should be backported. -- assignee: - rhettinger nosy: +rhettinger __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1553 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com