[issue1249] PEP 3137 patch: make PyBytes/PyUnicode ==/!= comparisons return False
New submission from Thomas Lee: Initial patch attached. -- components: Interpreter Core files: bytes-unicode-return-false-r1.patch messages: 56284 nosy: thomas.lee severity: normal status: open title: PEP 3137 patch: make PyBytes/PyUnicode ==/!= comparisons return False type: rfe versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1249 __Index: Objects/bytesobject.c === --- Objects/bytesobject.c (revision 58387) +++ Objects/bytesobject.c (working copy) @@ -964,8 +964,8 @@ error, even if the comparison is for equality. */ if (PyObject_IsInstance(self, (PyObject*)PyUnicode_Type) || PyObject_IsInstance(other, (PyObject*)PyUnicode_Type)) { -PyErr_SetString(PyExc_TypeError, can't compare bytes and str); -return NULL; +Py_INCREF(Py_False); +return Py_False; } self_size = _getbuffer(self, self_bytes); Index: Lib/test/test_bytes.py === --- Lib/test/test_bytes.py (revision 58387) +++ Lib/test/test_bytes.py (working copy) @@ -132,10 +132,10 @@ # Bytes can't be compared to Unicode! # Test this for all expected byte orders and Unicode character sizes -self.assertRaises(TypeError, lambda: b\0a\0b\0c == abc) -self.assertRaises(TypeError, lambda: b\0\0\0a\0\0\0b\0\0\0c == abc) -self.assertRaises(TypeError, lambda: ba\0b\0c\0 == abc) -self.assertRaises(TypeError, lambda: ba\0\0\0b\0\0\0c\0\0\0 == abc) +self.assertEqual(b\0a\0b\0c == abc, False) +self.assertEqual(b\0\0\0a\0\0\0b\0\0\0c == abc, False) +self.assertEqual(ba\0b\0c\0 == abc, False) +self.assertEqual(ba\0\0\0b\0\0\0c\0\0\0 == abc, False) def test_nohash(self): self.assertRaises(TypeError, hash, bytes()) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1249] PEP 3137 patch: PyBytes/PyUnicode comparisons
Thomas Lee added the comment: Revised patch - originally misinterpreted what was required here. bytes() == str() now returns False, bytes() != str() now returns True. -- title: PEP 3137 patch: make PyBytes/PyUnicode ==/!= comparisons return False - PEP 3137 patch: PyBytes/PyUnicode comparisons __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1249 __Index: Objects/bytesobject.c === --- Objects/bytesobject.c (revision 58389) +++ Objects/bytesobject.c (working copy) @@ -964,8 +964,9 @@ error, even if the comparison is for equality. */ if (PyObject_IsInstance(self, (PyObject*)PyUnicode_Type) || PyObject_IsInstance(other, (PyObject*)PyUnicode_Type)) { -PyErr_SetString(PyExc_TypeError, can't compare bytes and str); -return NULL; +PyErr_Clear(); +Py_INCREF(Py_NotImplemented); +return Py_NotImplemented; } self_size = _getbuffer(self, self_bytes); Index: Lib/test/test_bytes.py === --- Lib/test/test_bytes.py (revision 58389) +++ Lib/test/test_bytes.py (working copy) @@ -130,12 +130,14 @@ self.assertEqual(str8(abc) bab, False) self.assertEqual(str8(abc) = bab, False) -# Bytes can't be compared to Unicode! +# Byte comparisons with unicode should always fail! # Test this for all expected byte orders and Unicode character sizes -self.assertRaises(TypeError, lambda: b\0a\0b\0c == abc) -self.assertRaises(TypeError, lambda: b\0\0\0a\0\0\0b\0\0\0c == abc) -self.assertRaises(TypeError, lambda: ba\0b\0c\0 == abc) -self.assertRaises(TypeError, lambda: ba\0\0\0b\0\0\0c\0\0\0 == abc) +self.assertEqual(b\0a\0b\0c == abc, False) +self.assertEqual(b\0\0\0a\0\0\0b\0\0\0c == abc, False) +self.assertEqual(ba\0b\0c\0 == abc, False) +self.assertEqual(ba\0\0\0b\0\0\0c\0\0\0 == abc, False) +self.assertEqual(bytes() == str(), False) +self.assertEqual(bytes() != str(), True) def test_nohash(self): self.assertRaises(TypeError, hash, bytes()) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1249] PEP 3137 patch: PyBytes/PyUnicode comparisons
Changes by Guido van Rossum: -- assignee: - gvanrossum nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1249 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1249] PEP 3137 patch: PyBytes/PyUnicode comparisons
Guido van Rossum added the comment: Thanks! This patch looks fine, except the PyClear() call is unnecessary. I suppose you copied it from the similar return clauses further down, but there they clear an exception set by the _getbuffer() call. But just calling PyObject_IsInstance() cannot set an exception. Committed revision 58390. -- resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1249 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1247] PEP 3137 patch (repr, names, parser)
Guido van Rossum added the comment: GHave you two agreed yet as to which patch(es) I should look at? -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1247 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1631171] implement warnings module in C
Brett Cannon added the comment: I just tried Neal's version of _warnings.c and it has the same failures, so they are not my fault. =) _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1631171 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1247] PEP 3137 patch (repr, names, parser)
Christian Heimes added the comment: Guido van Rossum wrote: Guido van Rossum added the comment: GHave you two agreed yet as to which patch(es) I should look at? Please commit Alexandres patch. His patch for bytesobject.c is based on my patch. It's more complete and a bit better than mine, too. I'm going to create a new patch for the other tasks later. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1247 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1225] IDLE - Fix: pressing Ctrl+C while printing exception - stuck
Kurt B. Kaiser added the comment: r58396 Thanks for the patch! -- assignee: - kbk priority: - normal resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1225 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1713041] fix for 1712742: corrects pprint's handling of 'depth'
Raghuram Devarakonda added the comment: I was just searching for all my issues and found this one. Can some one please apply pprint.patch? Thanks. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1713041 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1250] Building external modules using Sun Studio 12
New submission from anilj: When compiling matplotlib, ditutils defaults to using /opt/SUNWspro/bin/cc but it needs to use /opt/SUNWspro/bin/CC for compiling c++ files. % python2.5 setup.py build building for GTK requires pygtk; you must be able to import gtk in your build/install environmentTKAgg requires TkInter running build running build_py copying lib/matplotlib/mpl-data/matplotlibrc - build/lib.solaris-2.10-i86pc-2.5/matplotlib/mpl-data running build_ext building 'matplotlib._agg' extension /opt/SUNWspro/bin/cc -DNDEBUG -O -fast -xipo -xtarget=opteron -Kpic -Iagg23/include -Isrc -Iswig -I/usr/local/include/python2.5 -c src/agg.cxx -o build/temp.solaris-2.10-i86pc-2.5/src/agg.o cc: No input file specified, no output generated error: command '/opt/SUNWspro/bin/cc' failed with exit status 1 % python2.5 setup.py build --help-compiler building for GTK requires pygtk; you must be able to import gtk in your build/install environmentTKAgg requires TkInter List of available compilers: --compiler=bcpp Borland C++ Compiler --compiler=cygwin Cygwin port of GNU C Compiler for Win32 --compiler=emx EMX port of GNU C Compiler for OS/2 --compiler=mingw32 Mingw32 port of GNU C Compiler for Win32 --compiler=msvc Microsoft Visual C++ --compiler=mwerks MetroWerks CodeWarrior --compiler=unix standard UNIX-style compiler Doesn't look like I can override the default compiler using the above options. Thanks. -- components: Distutils messages: 56293 nosy: anilj severity: normal status: open title: Building external modules using Sun Studio 12 type: compile error versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1250 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1247] PEP 3137 patch (repr, names, parser)
Guido van Rossum added the comment: I don't think I can check these in yet; right now they are inconsistent. But I will check them in when they are ready. -- assignee: - gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1247 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1251] ssl module doesn't support non-blocking handshakes
New submission from Chris Stawarz: The current version of the ssl module doesn't support non-blocking creation of SSLSocket objects. The reason for this is that the SSL handshaking (SSL_connect/SSL_accept) takes place during the construction of the SSLContext object (in newPySSLObject). This means that if the socket being wrapped is non-blocking, and the handshake fails with SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE, then the entire SSLContext is scrapped, and newPySSLObject must be run again in its entirety. Unfortunately, restarting from scratch on the same socket appears to confuse the remote host, and the new attempt fails. The attached patch fixes this problem by removing the handshaking code from newPySSLObject and adding a do_handshake method to SSLContext. It also adds a new parameter (do_handshake_on_connect) to the SSLSocket constructor and the wrap_socket function. The default value of the parameter is True, which preserves the current behavior of the module by immediately calling do_handshake after sslwrap. If do_handshake_on_connect is set to False, then the caller is responsible for calling do_handshake. This allows code that uses non-blocking sockets to first create the SSLSocket and then iteratively call do_handshake and select.select until the process completes (which is exactly how non-blocking reads and writes are handled). -- components: Documentation, Library (Lib), Tests files: ssl_nonblocking_handshake_patch.txt messages: 56295 nosy: chris.stawarz severity: normal status: open title: ssl module doesn't support non-blocking handshakes type: rfe versions: Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1251 __Index: Doc/library/ssl.rst === --- Doc/library/ssl.rst (revision 58397) +++ Doc/library/ssl.rst (working copy) @@ -54,7 +54,7 @@ network connection. This error is a subtype of :exc:`socket.error`, which in turn is a subtype of :exc:`IOError`. -.. function:: wrap_socket (sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None) +.. function:: wrap_socket (sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None, do_handshake_on_connect=True) Takes an instance ``sock`` of :class:`socket.socket`, and returns an instance of :class:`ssl.SSLSocket`, a subtype of :class:`socket.socket`, which wraps the underlying socket in an SSL context. @@ -98,6 +98,10 @@ See the discussion of :ref:`ssl-certificates` for more information about how to arrange the certificates in this file. + The parameter ``do_handshake_on_connect`` is a boolean that indicates whether a TLS/SSL + handshake should be initiated as soon as the socket is connected. If False, the + socket's :meth:`do_handshake` method must be called to perform a handshake. + The parameter ``ssl_version`` specifies which version of the SSL protocol to use. Typically, the server chooses a particular protocol version, and the client must adapt to the server's choice. Most of the versions are not interoperable @@ -289,7 +293,11 @@ number of secret bits being used. If no connection has been established, returns ``None``. +.. method:: SSLSocket.do_handshake() + Perform a TLS/SSL handshake. + + .. index:: single: certificates .. index:: single: X509 certificate Index: Lib/ssl.py === --- Lib/ssl.py (revision 58397) +++ Lib/ssl.py (working copy) @@ -86,7 +86,8 @@ def __init__(self, sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, - ssl_version=PROTOCOL_SSLv23, ca_certs=None): + ssl_version=PROTOCOL_SSLv23, ca_certs=None, + do_handshake_on_connect=True): socket.__init__(self, _sock=sock._sock) if certfile and not keyfile: keyfile = certfile @@ -101,11 +102,14 @@ self._sslobj = _ssl.sslwrap(self._sock, server_side, keyfile, certfile, cert_reqs, ssl_version, ca_certs) +if do_handshake_on_connect: +self.do_handshake() self.keyfile = keyfile self.certfile = certfile self.cert_reqs = cert_reqs self.ssl_version = ssl_version self.ca_certs = ca_certs +self.do_handshake_on_connect = do_handshake_on_connect def read(self, len=1024): @@ -189,6 +193,12 @@ self._sslobj = None socket.close(self) +def do_handshake(self): + +Perform a TLS/SSL handshake. + +self._sslobj.do_handshake() + def connect(self, addr): Connects to remote ADDR, and then wraps the connection in @@ -202,6 +212,8
[issue1130] Idle - Save (buffer) - closes IDLE and does not save file (Windows XP)
Kurt B. Kaiser added the comment: r58398. Thanks for the report. Solution a little different than Tal Einat's. Please test. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1130 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Brett Cannon added the comment: I went ahead and had Vim do a global search-and-replace on the names and ditched the typedefs; the patch is uploaded. I have not yet run the test suite, though, which is why I have not committed it. But if it passes I will just check it in. -- assignee: - brett.cannon __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ dict_cleanup.diff Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1775388] Display CallTips for classes using metaclasses.
Kurt B. Kaiser added the comment: Appears this was fixed at r55818, though with a typo. Module heavily rewritten since then to use the inspect module. The example below now works without further changes. -- resolution: - out of date status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1775388 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1713252] character set in Japanese on Ubuntu distribution
Kurt B. Kaiser added the comment: absent further response, closing as unreproducible. -- assignee: - kbk keywords: +patch nosy: +kbk resolution: fixed - works for me status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1713252 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Brett Cannon added the comment: Applied my patch in r58399. Thanks for noticing the inconsistency, anthon! -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1130] Idle - Save (buffer) - closes IDLE and does not save file (Windows XP)
Tal Einat added the comment: Your solution is better than my suggestion, but has two minor bugs: 1) eol_convention must be initialized somewhere. For instance, opening a new editor window (Ctrl+N) and saving it fails because self.eol_convention is not defined. I agree that is shouldn't be a class attribute, but it must be intialized in __init__. 2) You meant chars = self.encode(text), right? (otherwise the eol change is discraded...) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1130 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1710718] Ctrl+Shift block marking by words
Kurt B. Kaiser added the comment: Ctrl- right does jump to the ends. Behaviour is slightly strange, but useful. Let Tk handle it. -- keywords: +patch resolution: - works for me status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1710718 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1691411] Duplicate preferences menu item/Tk Aqua 8.4.14
Changes by Kurt B. Kaiser: -- assignee: - ronaldoussoren nosy: +ronaldoussoren _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1691411 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1691411] Duplicate preferences menu item/Tk Aqua 8.4.14
Changes by Kurt B. Kaiser: -- keywords: +patch _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1691411 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1725576] IDLE - cursor color configuration bug
Kurt B. Kaiser added the comment: r58403. Thanks for the patch! -- assignee: - kbk nosy: +kbk resolution: - accepted status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1725576 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1659326] Minor pasting patch
Kurt B. Kaiser added the comment: r58404. Thanks for the patch! -- assignee: - kbk nosy: +kbk resolution: - accepted status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1659326 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1252] IDLE - patch Delegator to support callables
New submission from Tal Einat: Add an __call__ magic method to Delegator so that it can delegate to callables. This will raise the required exception if the delegate isn't callable. The built-in callable() method will now return True for any Delegator. Before this patch it always returns False, which is wrong if the delegate is callable, so callable() doesn't really work on Delegator instances in both cases. I couldn't see how this could be harmful. Also make the Delegator class a new-style class. This patch is required for the Squeezer and ShellLogger IDLE extensions found on PyPI to be able to co-exist. -- components: IDLE files: IDLE_Delegator.071010.patch messages: 56305 nosy: kbk, taleinat severity: normal status: open title: IDLE - patch Delegator to support callables type: behavior versions: Python 2.5, Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1252 __ IDLE_Delegator.071010.patch Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1253] IDLE - Percolator overhaul
New submission from Tal Einat: The Percolator class has been very hard to figure out, and has been a source of confusion for users wanting to hack IDLE. This patch makes Percolator a generally useful class which inherits from Delegator. It also adds a new class, TkTextPercolator, which inherits from Percolator and does all of the Text widget specific stuff. The code has been refactored, cleaned up, and the in-code comments have been improved. UndoDelegator.py, ColorDelegator.py and EditorWindow.py have been updated as needed. Also, the code using ColorDelegator in EditorWindow.py has been slightly modified to work better with the Percolator. I've done some testing (only on WinXP but nothing here is platform specific) and this seems to work without a hitch. This patch is required for the Squeezer and ShellLogger IDLE extensions found on PyPI to be able to co-exist. -- components: IDLE files: IDLE_Percolator.071010.patch messages: 56306 nosy: kbk, taleinat severity: normal status: open title: IDLE - Percolator overhaul type: behavior versions: Python 2.5, Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1253 __ IDLE_Percolator.071010.patch Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1251] ssl module doesn't support non-blocking handshakes
Guido van Rossum added the comment: Assigning to Bill Janssen. -- assignee: - janssen nosy: +gvanrossum, janssen __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1251 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1253] IDLE - Percolator overhaul
Guido van Rossum added the comment: It's been too long since I wrote this code to be able to review, but I'm glad that it still gets some love and attention. Here's to hoping that your patch gets applied. -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1253 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1251] ssl module doesn't support non-blocking handshakes
Bill Janssen added the comment: By a bit of synchronicity, I've been looking at non-blocking SSL issues all day. Thanks, Chris. I'll take a look and fold it in. There are a number of other issues here, too, such as changing the socket's blocking- ness after it's wrapped (which asyncore does). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1251 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com