[issue1571] Better description of 'L' repr removal in What's New

2007-12-08 Thread Ori Avtalion

New submission from Ori Avtalion:

The common stumbling blocks section reads:

* Code that unconditionally strips the trailing ``L`` from the
``repr()`` of a long integer will chop off the last digit instead.


This explains a problem and a fix without any reason (one has to guess
it from context).
It should first mention that the 'L' is no longer displayed.

--
components: Documentation
messages: 58293
nosy: salty-horse
severity: minor
status: open
title: Better description of 'L' repr removal in What's New
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1571
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1572] 404 report of SimpleXMLRPCServer is broken

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

I disabled test_404 in test_xmlrpc.py r59423

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1572
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1538] Avoid string copy when split char doesn't match

2007-12-08 Thread Skip Montanaro

Skip Montanaro added the comment:

In the absence of any more feedback, I checked this in as r59420.

--
resolution:  - accepted
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1538
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1266570] PEP 349: allow str() to return unicode

2007-12-08 Thread Neil Schemenauer

Neil Schemenauer added the comment:

On Sat, Dec 08, 2007 at 05:14:45AM -, Alexandre Vassalotti wrote:
 The PEP has been deferred and the patch is out of date.  So, is this
 change still wanted?

I still think it would make things easier for people using Unicode
with Python 2.x.  However, there does not seem to be much community
interest in the change.

  Neil

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1266570
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1571] Better description of 'L' repr removal in What's New

2007-12-08 Thread Christian Heimes

Changes by Christian Heimes:


--
assignee:  - georg.brandl
keywords: +py3k
nosy: +georg.brandl
priority:  - normal

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1571
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1510] help for file/open should state which is prefered.

2007-12-08 Thread Skip Montanaro

Skip Montanaro added the comment:

updated docstrings for file and open (r59417).

--
nosy: +skip.montanaro
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1510
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1572] 404 report of SimpleXMLRPCServer is broken

2007-12-08 Thread Christian Heimes

New submission from Christian Heimes:

Exception happened during processing of request from ('127.0.0.1', 55017)
Traceback (most recent call last):
  File /home/heimes/dev/python/py3k/Lib/SocketServer.py, line 222, in
handle_request
self.process_request(request, client_address)
  File /home/heimes/dev/python/py3k/Lib/SocketServer.py, line 241, in
process_request
self.finish_request(request, client_address)
  File /home/heimes/dev/python/py3k/Lib/SocketServer.py, line 254, in
finish_request
self.RequestHandlerClass(request, client_address, self)
  File /home/heimes/dev/python/py3k/Lib/SocketServer.py, line 522, in
__init__
self.handle()
  File /home/heimes/dev/python/py3k/Lib/BaseHTTPServer.py, line 330,
in handle
self.handle_one_request()
  File /home/heimes/dev/python/py3k/Lib/BaseHTTPServer.py, line 324,
in handle_one_request
method()
  File /home/heimes/dev/python/py3k/Lib/SimpleXMLRPCServer.py, line
430, in do_POST
self.report_404()
  File /home/heimes/dev/python/py3k/Lib/SimpleXMLRPCServer.py, line
486, in report_404
self.wfile.write(response)
  File /home/heimes/dev/python/py3k/Lib/socket.py, line 220, in write
return self._sock.send(b)
TypeError: send() argument 1 must be bytes or read-only buffer, not str


After I altered the response to bytes:

  File /home/heimes/dev/python/py3k/Lib/SimpleXMLRPCServer.py, line
430, in do_POST
self.report_404()
  File /home/heimes/dev/python/py3k/Lib/SimpleXMLRPCServer.py, line
489, in report_404
self.connection.shutdown(0)
socket.error: [Errno 107] Transport endpoint is not connected


--
components: Library (Lib)
keywords: py3k
messages: 58296
nosy: tiran
priority: normal
severity: normal
status: open
title: 404 report of SimpleXMLRPCServer is broken
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1572
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Alexandre Vassalotti

Changes by Alexandre Vassalotti:


--
versions: +Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Alexandre Vassalotti

New submission from Alexandre Vassalotti:

I found that the parser fails to handle correctly the (incorrect) case
where the single-star (*), used for delimiting keyword-only arguments,
is immediately followed by a **keywords parameter:

 def f(*, **kw):
...   pass
... 
python: Python/ast.c:652: handle_keywordonly_args: Assertion `kwonlyargs
!= ((void *)0)' failed.
[1]7872 abort (core dumped)  ./python

--
components: Interpreter Core
keywords: py3k
messages: 58299
nosy: alexandre.vassalotti
severity: normal
status: open
title: Improper use of the keyword-only syntax makes the parser crash
type: crash

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Fixed in r59432

I've altered the assert(). It now checks if either kwonlyargs and
kwdefault or both not NULL or the next node is a DOUBLESTAR.

--
nosy: +tiran

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Changes by Christian Heimes:


--
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Err... I think it should raise a SyntaxError in this case.
See my attached patch.

--
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file8894/kwonly.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__

kwonly.patch
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc:


--
status: closed - open

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Why do you want to forbid 

def f(*, **kw)

? It's useful and it also works in release builds of Python 3.0a2. It
only breaks in debug builds because the assert() gets triggered.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

Amaury is right. def f(*, **kw): pass should raise a SyntaxError. The
keyword-only delimiter is useless since the **kw parameter already only
accepts keywords.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

 Why do you want to forbid
   def f(*, **kw)

Well, TOOWTDI and the like...
and the first time I saw it, it seemed that any number of parameters is
allowed!

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue914148] xml.sax segfault on error

2007-12-08 Thread Facundo Batista

Facundo Batista added the comment:

2007/12/8, Adam Sampson [EMAIL PROTECTED]:

 On Fri, Dec 07, 2007 at 08:07:38PM -, Facundo Batista wrote:
  There's no crash in 2.5.1 neither in the trunk.
  As 2.3 or 2.4 won't be fixed, do you think that this bug can be closed?
 
 Yep, go for it. :)
 
 Thanks very much,
 
 --
 Adam Sampson [EMAIL PROTECTED] http://offog.org/

--
resolution:  - fixed
status: open - closed


Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue914148

___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Ah, you and Amaury are right! But I don't like Amaury's error message:

SyntaxError: no name for vararg

It doesn't explain what's wrong. How about

SyntaxError: keyword only arguments require at least one keyword

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1564547] Py_signal_pipe

2007-12-08 Thread Guido van Rossum

Guido van Rossum added the comment:

I've been told to look at this one more time.

--
assignee:  - gvanrossum
nosy: +gvanrossum
resolution: rejected - 
status: closed - open

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1564547
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Kirk McDonald has an even better error message for us:

SyntaxError: Cannot specify keyword only arguments without named arguments

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Here is another error message from Thomas Wouters 'named arguments must
follow bare *'

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Right.
We should also replace the other occurence of no name for vararg.
Here is another patch, against the current revision (59434).

Added file: http://bugs.python.org/file8895/kwonly2.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__

kwonly2.patch
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1564] The set implementation should special-case PyUnicode instead of PyString

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

I've created a patch that adds optimization for PyUnicode while keeping
the existing optimization for PyString. The patch moves the optimization
trick for PyObject_Hash() into a macro and adds an optimized
_PyUnicode_Eq() to unicodeobject.c

--
assignee:  - tiran
nosy: +tiran
priority:  - normal
Added file: http://bugs.python.org/file8896/py3k_optimize_set_unicode.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1564
__Index: Include/unicodeobject.h
===
--- Include/unicodeobject.h	(Revision 59424)
+++ Include/unicodeobject.h	(Arbeitskopie)
@@ -1330,6 +1330,11 @@
 const char *right
 );
 
+PyAPI_FUNC(int) _PyUnicode_Eq(
+PyObject *left,		/* Left string */
+PyObject *right		/* Right string */
+);
+
 /* Rich compare two strings and return one of the following:
 
- NULL in case an exception was raised
Index: Objects/unicodeobject.c
===
--- Objects/unicodeobject.c	(Revision 59424)
+++ Objects/unicodeobject.c	(Arbeitskopie)
@@ -95,6 +95,9 @@
 extern C {
 #endif
 
+/* forward declarations */
+static long unicode_hash(PyUnicodeObject *);
+
 /* This dictionary holds all interned unicode strings.  Note that references
to strings in this dictionary are *not* counted in the string's ob_refcnt.
When the interned string reaches a refcnt of 0 the string deallocation
@@ -6349,6 +6352,18 @@
 return PyBool_FromLong(result);
 }
 
+/* optimized version used by Objects/setobject.c */
+int
+_PyUnicode_Eq(PyObject *o1, PyObject *o2)
+{
+	PyUnicodeObject *a = (PyUnicodeObject*) o1;
+	PyUnicodeObject *b = (PyUnicodeObject*) o2;
+	return Py_Size(a) == Py_Size(b)
+		 unicode_hash(a) == unicode_hash(b)
+		 unicode_compare(a, b) == 0;
+}
+
+
 int PyUnicode_Contains(PyObject *container,
 		   PyObject *element)
 {
Index: Objects/setobject.c
===
--- Objects/setobject.c	(Revision 59424)
+++ Objects/setobject.c	(Arbeitskopie)
@@ -50,6 +50,20 @@
 	INIT_NONZERO_SET_SLOTS(so);\
 } while(0)
 
+#define GET_HASH(hash, key) do {\
+	hash = -1;		\
+	if (PyUnicode_CheckExact(key)) {			\
+		hash = ((PyUnicodeObject *) key)-hash;		\
+	} else if (PyString_CheckExact(key)) {			\
+		hash = ((PyStringObject *) key)-ob_shash;	\
+	}			\
+	if (hash == -1) {	\
+		hash = PyObject_Hash(key);			\
+		if (hash == -1)	\
+			return -1;\
+	}			\
+	} while(0)
+
 /* Reuse scheme to save calls to malloc, free, and memset */
 #define MAXFREESETS 80
 static PySetObject *free_sets[MAXFREESETS];
@@ -145,11 +159,11 @@
 
 /*
  * Hacked up version of set_lookkey which can assume keys are always strings;
- * This means we can always use _PyString_Eq directly and not have to check to
+ * This means we can always use _PyUnicode_Eq directly and not have to check to
  * see if the comparison altered the table.
  */
 static setentry *
-set_lookkey_string(PySetObject *so, PyObject *key, register long hash)
+set_lookkey_unicode(PySetObject *so, PyObject *key, register long hash)
 {
 	register Py_ssize_t i;
 	register size_t perturb;
@@ -157,12 +171,19 @@
 	register size_t mask = so-mask;
 	setentry *table = so-table;
 	register setentry *entry;
+	int (*eq)(PyObject *, PyObject *);
 
 	/* Make sure this function doesn't have to handle non-string keys,
 	   including subclasses of str; e.g., one reason to subclass
 	   strings is to override __eq__, and for speed we don't cater to
 	   that here. */
-	if (!PyString_CheckExact(key)) {
+	if (PyUnicode_CheckExact(key)) {
+		eq = _PyUnicode_Eq;
+	}
+	else if (PyString_CheckExact(key)) {
+		eq = _PyString_Eq;
+	}
+	else {
 		so-lookup = set_lookkey;
 		return set_lookkey(so, key, hash);
 	}
@@ -173,7 +194,7 @@
 	if (entry-key == dummy)
 		freeslot = entry;
 	else {
-		if (entry-hash == hash  _PyString_Eq(entry-key, key))
+		if (entry-hash == hash  eq(entry-key, key))
 			return entry;
 		freeslot = NULL;
 	}
@@ -188,7 +209,7 @@
 		if (entry-key == key
 		|| (entry-hash == hash
 			 entry-key != dummy
-			 _PyString_Eq(entry-key, key)))
+			 eq(entry-key, key)))
 			return entry;
 		if (entry-key == dummy  freeslot == NULL)
 			freeslot = entry;
@@ -375,12 +396,8 @@
 	register long hash;
 	register Py_ssize_t n_used;
 
-	if (!PyString_CheckExact(key) ||
-	(hash = ((PyStringObject *) key)-ob_shash) == -1) {
-		hash = PyObject_Hash(key);
-		if (hash == -1)
-			return -1;
-	}
+	GET_HASH(hash, key);
+
 	assert(so-fill = so-mask);  /* at least one empty slot */
 	n_used = so-used;
 	Py_INCREF(key);
@@ -422,12 +439,9 @@
 	PyObject *old_key;
 
 	assert (PyAnySet_Check(so));
-	if (!PyString_CheckExact(key) ||
-	(hash = ((PyStringObject *) key)-ob_shash) == -1) {
-		hash = PyObject_Hash(key);
-		if (hash == -1)
-			return -1;
-	}
+
+	GET_HASH(hash, 

[issue1572] 404 report of SimpleXMLRPCServer is broken

2007-12-08 Thread Christian Heimes

Changes by Christian Heimes:


--
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1572
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1550] help('modules') broken by several 3rd party libraries (svn patch attached)

2007-12-08 Thread Christian Heimes

Changes by Christian Heimes:


--
assignee:  - ping
keywords: +patch
nosy: +ping
priority:  - normal
versions: +Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1550
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1572] 404 report of SimpleXMLRPCServer is broken

2007-12-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Is disabling a test the right solution?

--
nosy: +gvanrossum

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1572
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1572] 404 report of SimpleXMLRPCServer is broken

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

No, I've fixed the three failing or blocking tests in r59429 and r59434.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1572
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1574] Touchpad 2 Finger scroll does not work in IDLE on Mac (But scroll wheel of external mouse does)

2007-12-08 Thread Puneet Arora

Changes by Puneet Arora:


--
components: IDLE
nosy: arorap
severity: normal
status: open
title: Touchpad 2 Finger scroll does not work in IDLE on Mac (But scroll wheel 
of external mouse does)
type: behavior
versions: Python 2.5

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1574
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com