[issue1686597] descrintro: error describing __new__ behavior

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Fixed in pydotorg rev. 10972.

--
assignee:  - georg.brandl
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

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



[issue1734164] sqlite3 causes memory read error

2007-08-24 Thread Gerhard Häring

Gerhard Häring added the comment:

This was already reported upstream at 
http://initd.org/tracker/pysqlite/ticket/205

It's a bug in the SQLite version of the DLL is shipped with Python 2.5 
on Windows. Updating the DLL to a newer version would help.

In the meantime, users can just download the newest DLL from the SQLite 
site and replace the one shipped by Python with it.

--
assignee:  - ghaering
nosy: +ghaering

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



[issue1276378] tarfile: adding filed that use direct device addressing

2007-08-24 Thread Lars Gustäbel

Lars Gustäbel added the comment:

Closing this due to lack of interest. This is no tarfile issue. If
direct device addressing should be supported by Python, os.stat() would
be the place to implement it.

--
resolution:  - wont fix
status: open - closed

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



[issue1728488] -q (quiet) option for python interpreter

2007-08-24 Thread Georg Brandl

Changes by Georg Brandl:


--
superseder:  - -q (quiet) option for python interpreter

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



[issue1757062] Pickle fails on BeautifulSoup's navigableString instances

2007-08-24 Thread Christophe Michel

Christophe Michel added the comment:

I started by isolating the most minimalist code that triggers the error.
If you play a bit with NavigableString, you will end up with the
attached code.

As expected, this program fails with RuntimeError: maximum recursion
depth exceeded
The evil recursion proceeds as follows :

  File C:\Python25\lib\pickle.py, line 1364, in dump
Pickler(file, protocol).dump(obj)

Initial call to dump(), as intended.

  File C:\Python25\lib\pickle.py, line 224, in dump
self.save(obj)

save() calls obj.__reduce_ex(), obj being our EvilString instance.

This function is defined in copyreg.py, line 58 and following my
example, returns a tuple containing three elements:
1) the _reconstructor function, as defined in copyreg.py, line 46
2) a tuple : (class '__main__.EvilString', type 'unicode',
'__main__.EvilString' instance at 0x)
   First element is the actual class of obj, second is the base class,
and third is the current instance (known as state).
3) an empty dict {}

  File C:\Python25\lib\pickle.py, line 331, in save
self.save_reduce(obj=obj, *rv)

save_reduce() calls self.save() twice:
- first on the func argument, which is the _reconstructor function. This
call works as intended
- next on the tuple (class '__main__.EvilString', type 'unicode',
'__main__.EvilString' instance at 0x)

  File C:\Python25\lib\pickle.py, line 403, in save_reduce
save(args)
  File C:\Python25\lib\pickle.py, line 286, in save
f(self, obj) # Call unbound method with explicit self

save() finds out its argument is a Tuple, and calls save_tuple()
appropriately

  File C:\Python25\lib\pickle.py, line 564, in save_tuple
save(element)

... and save_tuple() calls save() on each element of the tuple.
See what's wrong ?
This means calling save() again on the EvilString instance. Which, in
turn, will call save_reduce() on it, and so on.

The problem lies in _reduce_ex(), in the definition of the state of the
object:

copyreg.py, lines 65 to 70:
if base is object:
state = None
else:
if base is self.__class__:
raise TypeError, can't pickle %s objects % base.__name__
state = base(self)

When this code gets executed on an EvilString instance, base is the type
'unicode'.
Since it's not an object, and since it's not the actual class EvilString
either, the following line gets executed:
state=base(self)

Which corresponds to unicode(self), or self.__unicode__, which returns
an EvilString instance, not a variable of type unicode.
And there starts the recursion.

I don't know if this is flaw in the design of _reduce_ex, or a flaw
inherent to having __unicode__(self) returning self.
My guess is the latter is right.

--
nosy: +altherac

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

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



[issue1765375] setup.py trashes LDFLAGS

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Thanks for the report, fixed in rev. 57389, 57390 (2.5).

--
assignee:  - georg.brandl
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

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



[issue1765558] small improvement for peephole conditional jump optimizer

2007-08-24 Thread Georg Brandl

Changes by Georg Brandl:


--
assignee:  - rhettinger

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



[issue1764986] generic and more efficient removal of unreachable code

2007-08-24 Thread Georg Brandl

Changes by Georg Brandl:


--
assignee:  - rhettinger

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



[issue1757062] Pickle fails on BeautifulSoup's navigableString instances

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

This is indeed tricky. The docs say __unicode__ should return a Unicode
object, so I'm inclined to blame BeautifulSoup.

Asking Neal for a second opinion.

--
assignee:  - nnorwitz
nosy: +georg.brandl

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



[issue1010] Broken bug tracker url

2007-08-24 Thread Nir Soffer

New submission from Nir Soffer:

In http://docs.python.org/lib/about.html, the link to Python Bug Tracker 
point to the old close tracker in sourceforge.net. Should be replaced to 
bugs.python.org.

--
components: Documentation
messages: 55253
nosy: nirs
severity: normal
status: open
title: Broken bug tracker url
versions: Python 2.5

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



[issue1011] Wrong documentation for rfc822.Message.getheader

2007-08-24 Thread Nir Soffer

New submission from Nir Soffer:

In http://docs.python.org/lib/message-objects.html, getheader doc say:

 Like getrawheader(name), but strip leading and trailing whitespace. 
Internal whitespace is not stripped. The optional default argument can 
be used to specify a different default to be returned when there is no 
header matching name.

However, getheader is not like getrawheader. getheader return the *last* 
header seen, using the message dict. getrawheader retruns the *first* 
header line seen, searching through the list of parsed header lines.

The text should also note that getheader is faster and the preferred way 
to get parsed headers.

--
components: Documentation
messages: 55254
nosy: nirs
severity: normal
status: open
title: Wrong documentation for rfc822.Message.getheader
versions: Python 2.5

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



[issue1753371] Open always create new tab or new browser

2007-08-24 Thread Ilan Peleg


Ilan Peleg
 added the comment:

Hi there,
I Have only 2 lines in my programs which related to webbrowser.py.

1) import webbrowser
2) webbrowser.open(windowsPath) # Called many times.

In the following browsers [FastBrowser,Firefox,IE7,FrontPage] new tab 
is created after each call. In IE6 new window is created.

Most of the time that behavior (many tabs) is nice feature but in some 
scenarios it looks bad. I simply wish to have new tabs only when I ask 
it.

Thanks
Ilan.

--
type:  - behavior

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



[issue1753371] Open always create new tab or new browser

2007-08-24 Thread Ilan Peleg


Ilan Peleg
 added the comment:

Just to make sure I'm clear.
I don't wish new tabs neither new windows.
I wish all calls to webbrowser.open(path) to go the same tab or to the 
same window when tabs are not supported or not requested.
Ilan.

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



[issue1002] Patch to rename HTMLParser module to lower_case

2007-08-24 Thread O.R.Senthil Kumaran

O.R.Senthil Kumaran added the comment:

what is this and other series of patches you have submitted, paulsmith?
I fail to understand. Why is the need for changing Library? You are just
adding up SPAM here.

--
nosy: +orsenthil

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



[issue1002] Patch to rename HTMLParser module to lower_case

2007-08-24 Thread Paul Smith

Paul Smith added the comment:

I am participating in the Python Sprint here at Google, and was just
going through the Py3k Sprint Tasks spreadsheet, one of them being to
rename standard library modules which use CamelCase to
lower_and_underscore, the more modern naming.

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



[issue1007] [py3k] Fix dumbdbm, which fixes test_shelve (for me); instrument other tests so we catch this sooner (and more directly)

2007-08-24 Thread Collin Winter

Changes by Collin Winter:


--
versions: +Python 3.0 -Python 2.6

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



[issue1002] Patch to rename HTMLParser module to lower_case

2007-08-24 Thread O.R.Senthil Kumaran

O.R.Senthil Kumaran added the comment:

But your standalone diffs will break things and dependencies with
other modules, so I was worried about them. Are you taking care of them all?

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



[issue1010] Broken bug tracker url

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Fixed in rev. 57394.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

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



[issue1011] Wrong documentation for rfc822.Message.getheader

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Thanks, fixed in rev. 57395.

--
assignee:  - georg.brandl
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

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



[issue1012] Broken URL at Doc/install/index.rst

2007-08-24 Thread O.R.Senthil Kumaran

New submission from O.R.Senthil Kumaran:

* [EMAIL PROTECTED] [2007-08-24 06:12:52]:

 hyperlink site module documentation in   Section 4.1  on page
 http://docs.python.org/inst/search-path.html  leads to a nonexistent
 page.

 Regards
 jitendra nair

1) This needs to be fixed in the online doc,
2) Attaching a patch for the current trunk.

--
components: Documentation
files: module-site-url.patch
messages: 55262
nosy: orsenthil
severity: minor
status: open
title: Broken URL at Doc/install/index.rst
versions: Python 2.5, Python 2.6

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1012
__Index: Doc/install/index.rst
===
--- Doc/install/index.rst	(revision 57393)
+++ Doc/install/index.rst	(working copy)
@@ -625,7 +625,7 @@
 Paths can be absolute or relative, in which case they're relative to the
 directory containing the :file:`.pth` file.  Any directories added to the search
 path will be scanned in turn for :file:`.pth` files.  See `site module
-documentation http://www.python.org/dev/doc/devel/lib/module-site.html`_ for
+documentation http://www.python.org/doc/devel/lib/module-site.html`_ for
 more information.
 
 A slightly less convenient way is to edit the :file:`site.py` file in Python's
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1006] Refactor test_winreg.py to use unittest.

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Thanks! Committed as rev. 57397.

--
assignee:  - georg.brandl
nosy: +georg.brandl
resolution:  - accepted
status: open - closed

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



[issue1008] Refactor test_signal.py to use unittest.

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Fixed and committed as rev. 57399.

--
nosy: +georg.brandl
resolution:  - accepted
status: open - closed

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



[issue736962] Port tests to unittest (Part 2)

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

The patches in here have long been applied, and the remaining converts
are handled using individual issues.

--
nosy: +georg.brandl
status: open - closed


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

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



[issue1399935] enhance unittest to define tests that *should* fail

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Shouldn't the decorator name be lowercase?

--
nosy: +georg.brandl

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



[issue1703379] Refactor test_frozen.py to use unittest.

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

I've already ported this test a little differently before seeing this patch.

--
nosy: +georg.brandl
resolution:  - out of date
status: open - closed

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



[issue1671298] Refactor test_class to use unittest lib

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

I've figured out the problem with your call stack: the comparison of
callLst with the expected calls adds more calls to callLst, leading to a
failing comparison.

I've fixed this, but the new test still fails with regrtest -R:: -- will
investigate.

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



[issue1671298] Refactor test_class to use unittest lib

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

Argh, the test modified the state of one of its classes.

Fixed that and committed now as rev. 57409.

--
assignee: collinwinter - georg.brandl
resolution:  - accepted
status: open - closed

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1671298
_
___
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

2007-08-24 Thread Georg Brandl

Changes by Georg Brandl:


--
assignee:  - loewis

_
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



[issue1013] eval error

2007-08-24 Thread Ray Ward

New submission from Ray Ward:

 eval(9)
9
Works but.
 eval(09)
Traceback (most recent call last):
  File stdin, line 1, in module
  File string, line 1
09
^
SyntaxError: invalid token

--
messages: 55272
nosy: Rayfward
severity: normal
status: open
title: eval error
type: behavior
versions: Python 2.5

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



[issue1013] eval error

2007-08-24 Thread Georg Brandl

Georg Brandl added the comment:

This is not a bug. Integers beginning with 0 are octal literals in Python 2.x,
and 9 is not a valid octal digit.

Closing as Invalid.

--
nosy: +georg.brandl
resolution:  - invalid
status: open - closed

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



[issue1014] cgi: parse_qs and parse_qsl misbehave on empty strings

2007-08-24 Thread David Jessup

New submission from David Jessup:

In Python 2.4.4, cgi.parse_qs(qs='', strict_parsing=True) errors out:

Traceback (most recent call last):
  File stdin, line 1, in ?
  File /usr/lib/python2.4/cgi.py, line 183, in parse_qs
for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
  File /usr/lib/python2.4/cgi.py, line 217, in parse_qsl
raise ValueError, bad query field: %r % (name_value,)
ValueError: bad query field: ''

To the best of my knowledge, this is bad behavior, since a large
percentage of URLs actually used have empty query strings.

--
components: Extension Modules
messages: 55274
nosy: dljessup
severity: normal
status: open
title: cgi:  parse_qs and parse_qsl misbehave on empty strings
type: behavior
versions: Python 2.4

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



[issue1015] [PATCH] Updated patch for rich dict view (dict().keys()) comparisons

2007-08-24 Thread Keir Mierle

New submission from Keir Mierle:

This an updated version of the patch I submitted earlier to python-3000;
it is almost identical except it extends the test case to cover more of
the code.

--
components: Interpreter Core
files: dictview_richcompare_ver2.diff
messages: 55275
nosy: keir
severity: normal
status: open
title: [PATCH] Updated patch for rich dict view (dict().keys()) comparisons
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1015
__Index: Objects/dictobject.c
===
--- Objects/dictobject.c	(revision 57414)
+++ Objects/dictobject.c	(working copy)
@@ -2371,6 +2371,7 @@
 # define PyDictViewSet_Check(obj) \
 	(PyDictKeys_Check(obj) || PyDictItems_Check(obj))
 
+/* Return 1 if self is a subset of other */
 static int
 all_contained_in(PyObject *self, PyObject *other)
 {
@@ -2398,41 +2399,61 @@
 static PyObject *
 dictview_richcompare(PyObject *self, PyObject *other, int op)
 {
+Py_ssize_t len_self, len_other;
+PyObject *result;
+
 	assert(self != NULL);
 	assert(PyDictViewSet_Check(self));
 	assert(other != NULL);
-	if ((op == Py_EQ || op == Py_NE) 
-	(PyAnySet_Check(other) || PyDictViewSet_Check(other)))
-	{
-		Py_ssize_t len_self, len_other;
-		int ok;
-		PyObject *result;
 
-		len_self = PyObject_Size(self);
-		if (len_self  0)
-			return NULL;
-		len_other = PyObject_Size(other);
-		if (len_other  0)
-			return NULL;
-		if (len_self != len_other)
-			ok = 0;
-		else if (len_self == 0)
-			ok = 1;
-		else
-			ok = all_contained_in(self, other);
-		if (ok  0)
-			return NULL;
-		if (ok == (op == Py_EQ))
-			result = Py_True;
-		else
-			result = Py_False;
-		Py_INCREF(result);
-		return result;
-	}
-	else {
+if (!PyAnySet_Check(other)  !PyDictViewSet_Check(other)) {
 		Py_INCREF(Py_NotImplemented);
 		return Py_NotImplemented;
-	}
+}
+
+len_self = PyObject_Size(self);
+if (len_self  0)
+return NULL;
+len_other = PyObject_Size(other);
+if (len_other  0)
+return NULL;
+
+result = Py_False;
+switch(op) {
+	  case Py_NE:
+		if (len_self != len_other ||
+		len_self == 0 ||
+		!all_contained_in(self, other))
+			result = Py_True;
+		break;
+	  case Py_EQ:
+		if (len_self == len_other 
+		(len_self == 0 || all_contained_in(self, other)))
+			result = Py_True; 
+		break;
+	  case Py_LT:
+		if (len_self  len_other 
+		all_contained_in(self, other))
+			result = Py_True;
+		break;
+	  case Py_LE:
+		if (len_self = len_other 
+		all_contained_in(self, other))
+			result = Py_True;
+		break;
+	  case Py_GT:
+		if (len_self  len_other 
+		all_contained_in(other, self))
+			result = Py_True;
+		break;
+	  case Py_GE:
+		if (len_self = len_other 
+		all_contained_in(other, self))
+			result = Py_True;
+		break;
+}
+Py_INCREF(result);
+return result;
 }
 
 /*** dict_keys ***/
Index: Lib/test/test_dict.py
===
--- Lib/test/test_dict.py	(revision 57414)
+++ Lib/test/test_dict.py	(working copy)
@@ -398,6 +398,47 @@
 else:
 self.fail( didn't raise Exc)
 
+def test_keys_contained(self):
+# Test rich comparisons against dict key views, which should behave the
+# same as sets.
+empty = dict()
+empty2 = dict()
+smaller = {1:1, 2:2}
+larger = {1:1, 2:2, 3:3}
+larger2 = {1:1, 2:2, 3:3}
+larger3 = {4:1, 2:2, 3:3}
+
+self.assert_(smaller.keys()   larger.keys())
+self.assert_(smaller.keys() = larger.keys())
+self.assert_(larger.keys()   smaller.keys())
+self.assert_(larger.keys() = smaller.keys())
+
+self.assertFalse(smaller.keys() = larger.keys())
+self.assertFalse(smaller.keys()   larger.keys())
+self.assertFalse(larger.keys()  = smaller.keys())
+self.assertFalse(larger.keys()smaller.keys())
+
+self.assertFalse(smaller.keys()   larger3.keys())
+self.assertFalse(smaller.keys() = larger3.keys())
+self.assertFalse(larger3.keys()   smaller.keys())
+self.assertFalse(larger3.keys() = smaller.keys())
+
+# Inequality strictness
+self.assertTrue(larger2.keys() = larger.keys())
+self.assertTrue(larger2.keys() = larger.keys())
+self.assertFalse(larger2.keys()  larger.keys())
+self.assertFalse(larger2.keys()  larger.keys())
+
+self.assertEquals(larger.keys(), larger2.keys())
+self.assertNotEquals(smaller.keys(), larger.keys())
+
+# There is an optimization on the zero-element case.
+self.assertEquals(empty.keys(), empty2.keys())
+self.assertNotEquals(empty.keys(), smaller.keys())
+
+# With the same size, an elementwise compare happens
+

[issue1007] [py3k] Fix dumbdbm, which fixes test_shelve (for me); instrument other tests so we catch this sooner (and more directly)

2007-08-24 Thread Gregory P. Smith

Gregory P. Smith added the comment:

looks like someone already committed the one liner dumbdbm latin-1 fix.
 But the meat of this patch is the unit test improvements.

I had to fix test_whichdb to exclude dumbdbm as that has no file for
whichdb to test.

committed to py3k as r57419

--
nosy: +greg
resolution:  - accepted
status: open - closed

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



[issue1015] [PATCH] Updated patch for rich dict view (dict().keys()) comparisons

2007-08-24 Thread Guido van Rossum

Guido van Rossum added the comment:

Checked in (after substantial changes, pairing with Keir).

--
assignee:  - gvanrossum
nosy: +gvanrossum

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



[issue1016] [PATCH] Updated fix for string to unicode fixes in time and datetime

2007-08-24 Thread Ero Carrera

New submission from Ero Carrera:

Small patch for the references leak in datetime and changed a strlen to
PyUnicode_GET_SIZE() in time

--
files: time_datetime_pystring_patch_2.diff
messages: 55279
nosy: ero.carrera
severity: normal
status: open
title: [PATCH] Updated fix for string to unicode fixes in time and datetime
versions: Python 3.0

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

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



[issue1017] [PATCH] Add set operations (and, or, xor, subtract) to dict views

2007-08-24 Thread Keir Mierle

New submission from Keir Mierle:

This patch adds set operations  | ^ - to dict views ({}.keys(),
{}.items()). A set is returned.

--
components: Interpreter Core
files: dictview_set_operations.diff
messages: 55280
nosy: keir
severity: normal
status: open
title: [PATCH] Add set operations (and, or, xor, subtract) to dict views
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1017
__Index: Objects/dictobject.c
===
--- Objects/dictobject.c	(revision 57422)
+++ Objects/dictobject.c	(working copy)
@@ -2489,6 +2489,97 @@
 	(objobjproc)dictkeys_contains,	/* sq_contains */
 };
 
+static PyObject*
+dictviews_sub(PyObject* self, PyObject *other) 
+{
+	PyObject *result = PySet_New(self);
+	PyObject *tmp;
+	if (result == NULL)
+		return NULL;
+
+	tmp = PyObject_CallMethod(result, difference_update, O, other);
+	if (tmp == NULL) {
+		Py_DECREF(result);
+		return NULL;
+	}
+
+	Py_DECREF(tmp);
+	return result;
+}
+
+static PyObject*
+dictviews_and(PyObject* self, PyObject *other) 
+{
+	PyObject *result = PySet_New(self);
+	PyObject *tmp;
+	if (result == NULL)
+		return NULL;
+
+	tmp = PyObject_CallMethod(result, intersection_update, O, other);
+	if (tmp == NULL) {
+		Py_DECREF(result);
+		return NULL;
+	}
+
+	Py_DECREF(tmp);
+	return result;
+}
+
+static PyObject*
+dictviews_or(PyObject* self, PyObject *other) 
+{
+	PyObject *result = PySet_New(self);
+	PyObject *tmp;
+	if (result == NULL)
+		return NULL;
+
+	tmp = PyObject_CallMethod(result, update, O, other);
+	if (tmp == NULL) {
+		Py_DECREF(result);
+		return NULL;
+	}
+
+	Py_DECREF(tmp);
+	return result;
+}
+
+static PyObject*
+dictviews_xor(PyObject* self, PyObject *other) 
+{
+	PyObject *result = PySet_New(self);
+	PyObject *tmp;
+	if (result == NULL)
+		return NULL;
+
+	tmp = PyObject_CallMethod(result, symmetric_difference_update, O, other);
+	if (tmp == NULL) {
+		Py_DECREF(result);
+		return NULL;
+	}
+
+	Py_DECREF(tmp);
+	return result;
+}
+
+static PyNumberMethods dictviews_as_number = {
+	0,/*nb_add*/
+	(binaryfunc)dictviews_sub,	/*nb_subtract*/
+	0,/*nb_multiply*/
+	0,/*nb_remainder*/
+	0,/*nb_divmod*/
+	0,/*nb_power*/
+	0,/*nb_negative*/
+	0,/*nb_positive*/
+	0,/*nb_absolute*/
+	0,/*nb_bool*/
+	0,/*nb_invert*/
+	0,/*nb_lshift*/
+	0,/*nb_rshift*/
+	(binaryfunc)dictviews_and,	/*nb_and*/
+	(binaryfunc)dictviews_xor,	/*nb_xor*/
+	(binaryfunc)dictviews_or,	/*nb_or*/
+};
+
 static PyMethodDef dictkeys_methods[] = {
  	{NULL,		NULL}		/* sentinel */
 };
@@ -2505,7 +2596,7 @@
 	0,	/* tp_setattr */
 	0,	/* tp_compare */
 	0,	/* tp_repr */
-	0,	/* tp_as_number */
+	dictviews_as_number,			/* tp_as_number */
 	dictkeys_as_sequence,			/* tp_as_sequence */
 	0,	/* tp_as_mapping */
 	0,	/* tp_hash */
@@ -2589,7 +2680,7 @@
 	0,	/* tp_setattr */
 	0,	/* tp_compare */
 	0,	/* tp_repr */
-	0,	/* tp_as_number */
+	dictviews_as_number,			/* tp_as_number */
 	dictitems_as_sequence,			/* tp_as_sequence */
 	0,	/* tp_as_mapping */
 	0,	/* tp_hash */
Index: Lib/test/test_dict.py
===
--- Lib/test/test_dict.py	(revision 57422)
+++ Lib/test/test_dict.py	(working copy)
@@ -458,6 +458,21 @@
 self.assertRaises(RuntimeError, lambda: d2.items()  d3.items())
 self.assertRaises(RuntimeError, lambda: d3.items()  d2.items())
 
+def test_dictview_set_operations(self):
+k1 = {1:1, 2:2}.keys()
+k2 = {1:1, 2:2, 3:3}.keys()
+k3 = {4:4}.keys()
+
+self.assertEquals(k1 - k2, set())
+self.assertEquals(k1 - k3, {1,2})
+self.assertEquals(k2 - k1, {3})
+self.assertEquals(k3 - k1, {4})
+self.assertEquals(k1  k2, {1,2})
+self.assertEquals(k1  k3, set())
+self.assertEquals(k1 | k2, {1,2,3})
+self.assertEquals(k1 ^ k2, {3})
+self.assertEquals(k1 ^ k3, {1,2,4})
+
 def test_missing(self):
 # Make sure dict doesn't have a __missing__ method
 self.assertEqual(hasattr(dict, __missing__), False)
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1017] [PATCH] Add set operations (and, or, xor, subtract) to dict views

2007-08-24 Thread Keir Mierle

Changes by Keir Mierle:


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



[issue1015] [PATCH] Updated patch for rich dict view (dict().keys()) comparisons

2007-08-24 Thread Guido van Rossum

Changes by Guido van Rossum:


--
resolution:  - accepted
status: open - closed

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



[issue1017] [PATCH] Add set operations (and, or, xor, subtract) to dict views

2007-08-24 Thread Guido van Rossum

Changes by Guido van Rossum:


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



[issue1017] [PATCH] Add set operations (and, or, xor, subtract) to dict views

2007-08-24 Thread Keir Mierle

Changes by Keir Mierle:


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



[issue1017] [PATCH] Add set operations (and, or, xor, subtract) to dict views

2007-08-24 Thread Guido van Rossum

Changes by Guido van Rossum:


--
assignee:  - gvanrossum
resolution:  - accepted
status: open - closed

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



[issue1018] server-side ssl support

2007-08-24 Thread Guido van Rossum

New submission from Guido van Rossum:

Bill Janssen's patch for server-side ssl support (and certificate
support). This still needs style cleanup, but is leak-free and passes tests.

--
assignee: gvanrossum
components: Extension Modules
files: ssl-svr.diff
keywords: patch
messages: 55281
nosy: gvanrossum
severity: normal
status: open
title: server-side ssl support
type: behavior
versions: Python 2.6

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1018
__Index: Doc/library/socket.rst
===
--- Doc/library/socket.rst	(revision 57412)
+++ Doc/library/socket.rst	(working copy)
@@ -776,7 +776,15 @@
 
Returns a string describing the server's certificate. Useful for debugging
purposes; do not parse the content of this string because its format can't be
-   parsed unambiguously.
+   parsed unambiguously.  And don't *trust* the content of this string, because
+   certificates aren't validated if you use the function :func:`ssl` to create an
+   SSL binding.  If you
+   need to see the content of a peer certificate, you should use the :func:`sslsocket`
+   function in the :mod:`ssl` module to create the SSL object, specifying the parameter `cert_req` as :const:`CERT_REQUIRED`,
+   and passing the name of a file containing a collection of certificates to use to validate the peer
+   certificate as the value of the `ca_certs` parameter.  Then use
+   the :meth:`getpeercert` method on that instance
+   to retrieve the contents of the certificate.
 
 
 .. method:: SSL.issuer()
@@ -785,7 +793,6 @@
debugging purposes; do not parse the content of this string because its format
can't be parsed unambiguously.
 
-
 .. _socket-example:
 
 Example
Index: Lib/socket.py
===
--- Lib/socket.py	(revision 57412)
+++ Lib/socket.py	(working copy)
@@ -49,10 +49,17 @@
 _have_ssl = False
 try:
 import _ssl
-from _ssl import *
-_have_ssl = True
 except ImportError:
 pass
+else:
+def ssl (sock, keyfile=None, certfile=None):
+import ssl as realssl
+return realssl.sslwrap_simple(sock, keyfile, certfile)
+sslerror = _ssl.sslerror
+from _ssl import SSLType, SSL_ERROR_ZERO_RETURN, SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE, \
+  SSL_ERROR_WANT_X509_LOOKUP, SSL_ERROR_SYSCALL, SSL_ERROR_SSL, SSL_ERROR_WANT_CONNECT, \
+  SSL_ERROR_EOF, SSL_ERROR_INVALID_ERROR_CODE, RAND_add, RAND_egd, RAND_status
+_have_ssl = True
 
 import os, sys
 
@@ -63,17 +70,10 @@
 
 __all__ = [getfqdn]
 __all__.extend(os._get_exports_list(_socket))
-if _have_ssl:
-__all__.extend(os._get_exports_list(_ssl))
 
 _realsocket = socket
-if _have_ssl:
-_realssl = ssl
-def ssl(sock, keyfile=None, certfile=None):
-if hasattr(sock, _sock):
-sock = sock._sock
-return _realssl(sock, keyfile, certfile)
 
+
 # WSA error codes
 if sys.platform.lower().startswith(win):
 errorTab = {}
Index: Modules/_ssl.c
===
--- Modules/_ssl.c	(revision 57412)
+++ Modules/_ssl.c	(working copy)
@@ -5,9 +5,12 @@
This module is imported by socket.py. It should *not* be used
directly.
 
+   TODO:  look up C indent standard for Python and teach Emacs to do it
+
 */
 
 #include Python.h
+
 enum py_ssl_error {
 	/* these mirror ssl.h */
 	PY_SSL_ERROR_NONE, 
@@ -23,6 +26,24 @@
 	PY_SSL_ERROR_INVALID_ERROR_CODE
 };
 
+enum py_ssl_server_or_client {
+  PY_SSL_CLIENT,
+  PY_SSL_SERVER
+};
+
+enum py_ssl_cert_requirements {
+  PY_SSL_CERT_NONE,
+  PY_SSL_CERT_OPTIONAL,
+  PY_SSL_CERT_REQUIRED
+};
+
+enum py_ssl_version {
+  PY_SSL_VERSION_SSL2,
+  PY_SSL_VERSION_SSL3,
+  PY_SSL_VERSION_SSL23,
+  PY_SSL_VERSION_TLS1,
+};
+
 /* Include symbols from _socket module */
 #include socketmodule.h
 
@@ -60,7 +81,7 @@
 	PySocketSockObject *Socket;	/* Socket on which we're layered */
 	SSL_CTX* 	ctx;
 	SSL* 	ssl;
-	X509*	server_cert;
+	X509*	peer_cert;
 	char	server[X509_NAME_MAXLEN];
 	char		issuer[X509_NAME_MAXLEN];
 
@@ -71,7 +92,9 @@
 static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args);
 static int check_socket_and_wait_for_timeout(PySocketSockObject *s, 
 	 int writing);
+static PyObject *PySSL_peercert(PySSLObject *self);
 
+
 #define PySSLObject_Check(v)	(Py_Type(v) == PySSL_Type)
 
 typedef enum {
@@ -83,15 +106,21 @@
 	SOCKET_OPERATION_OK
 } timeout_state;
 
+/* Wrap error strings with filename and line # */
+#define STRINGIFY1(x) #x
+#define STRINGIFY2(x) STRINGIFY1(x)
+#define ERRSTR1(x,y,z) (x : y :  z)
+#define ERRSTR(x) ERRSTR1(_ssl.c, STRINGIFY2(__LINE__), x)
+
 /* XXX It might be helpful to augment the error message generated
below with the name of the SSL function that generated the error.
I expect it's obvious most of the time.
 

[issue1018] server-side ssl support

2007-08-24 Thread Guido van Rossum

Guido van Rossum added the comment:

And another file that has a utility to be placed in Tools/...

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

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



[issue1018] server-side ssl support

2007-08-24 Thread Guido van Rossum

Changes by Guido van Rossum:


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



[issue1018] server-side ssl support

2007-08-24 Thread Guido van Rossum

Changes by Guido van Rossum:


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



[issue1450807] Python build fails for gcc 4.x from Gnu

2007-08-24 Thread Jeffrey Yasskin

Changes by Jeffrey Yasskin:


--
nosy: +jyasskin

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



[issue1542308] Nested finally in generators don't follow PEP 342

2007-08-24 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
priority: immediate - normal

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