[issue5127] UnicodeEncodeError - I can't even see license

2009-02-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

There were non-ascii characters in the Windows license file. This was
corrected with r67860.


 I believe that chr(0x1) and chr(0x11000) should have the 
 opposite behavior.

This other problem is because on a narrow unicode build,
Py_UNICODE_ISPRINTABLE takes a 16bit integer.
And indeed, 

 unicodedata.category(chr(0x1 % 65536))
'Cc'
 unicodedata.category(chr(0x11000 % 65536))
'Lo'

--
nosy: +amaury.forgeotdarc

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



[issue1875] if 0: return not raising SyntaxError

2009-02-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Here is a patch that properly raises SyntaxError when 'return' or  
'yield' statements appear outside a function.

I did not bother to update the (deprecated) compiler package: it seems 
to be completely foreign to this kind of checks...

 dis.dis(compiler.compile(return 1, module.py, exec))
  1   0 LOAD_CONST   1 (1)
  3 RETURN_VALUE
  4 LOAD_CONST   0 (None)
  7 RETURN_VALUE

--
assignee:  - amaury.forgeotdarc
keywords: +needs review, patch
resolution: fixed - 
status: closed - open
Added file: http://bugs.python.org/file12926/return_outside_func.patch

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



[issue5131] pprint doesn't know how to print a set or a defaultdict

2009-02-02 Thread Nick Craig-Wood

New submission from Nick Craig-Wood n...@craig-wood.com:

I noticed this the other day when debugging a program that neither set()
nor defaultdict() pprint() properly

Same under 3.1 and 2.5 (Not tried 2.6/2.7 but I assume it is the same)

 pprint(set(range(100)))
set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
91, 92, 93, 94, 95, 96, 97, 98, 99])

 from collections import defaultdict
 pprint(defaultdict(int).fromkeys(range(100)))
defaultdict(None, {0: None, 1: None, 2: None, 3: None, 4: None, 5: None,
6: None, 7: None, 8: None, 9: None, 10: None, 11: None, 12: None, 13:
None, 14: None, 15: None, 16: None, 17: None, 18: None, 19: None, 20:
None, 21: None, 22: None, 23: None, 24: None, 25: None, 26: None, 27:
None, 28: None, 29: None, 30: None, 31: None, 32: None, 33: None, 34:
None, 35: None, 36: None, 37: None, 38: None, 39: None, 40: None, 41:
None, 42: None, 43: None, 44: None, 45: None, 46: None, 47: None, 48:
None, 49: None, 50: None, 51: None, 52: None, 53: None, 54: None, 55:
None, 56: None, 57: None, 58: None, 59: None, 60: None, 61: None, 62:
None, 63: None, 64: None, 65: None, 66: None, 67: None, 68: None, 69:
None, 70: None, 71: None, 72: None, 73: None, 74: None, 75: None, 76:
None, 77: None, 78: None, 79: None, 80: None, 81: None, 82: None, 83:
None, 84: None, 85: None, 86: None, 87: None, 88: None, 89: None, 90:
None, 91: None, 92: None, 93: None, 94: None, 95: None, 96: None, 97:
None, 98: None, 99: None})


--
components: Library (Lib)
messages: 80948
nosy: ncw
severity: normal
status: open
title: pprint doesn't know how to print a set or a defaultdict
type: feature request
versions: Python 2.5, Python 3.1

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



[issue1815] Distutils add ability to skip build [Feature Request]

2009-02-02 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

right, nothing to fix here, the feature is available

--
resolution:  - rejected
status: open - closed

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



[issue4804] Python on Windows disables all C runtime library assertions

2009-02-02 Thread Mark Hammond

Mark Hammond mhamm...@users.sourceforge.net added the comment:

 Python shouldn't (IMHO) crahs, even if you give bogus input to
 python functions.  

But it doesn't actually crash does it?  It throws an assertion dialog,
which sucks when the machine is unattended - which is why it is a
problem for the buildbots - but otherwise if you hit 'ignore', things
keep working IIUC?

 Making sure that it doesn't crash in the test suite is 
 not enough, I think.

I think it is enough.  The tests are explicitly checking insane input to
these functions but in the real world such assertions blowing would
almost certainly be demonstrating a real bug.  pywin32 has a similar
issue - one or 2 tests cause such an assertion failure, but outside of
the test suite, such assertions should always be enabled IMO.  I'd even
advocate the assertions are disabled only for the individual tests known
to throw such errors and enabled for the rest.

Hirokazu Yamamoto's suggestion sounds reasonable too, but still doesn't
change my mind that it *is* reasonable to leave these assertions enabled
in the general case, and thus the idea isn't really necessary IMO.

Martin has the final say on what actually gets accepted though :)

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



[issue4879] Allow buffering for HTTPResponse

2009-02-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

This causes failures in test_urllib2net.

The fix is easy: a handful of
-self.assertTrue(u.fp._sock.gettimeout() is None)
+self.assertTrue(u.fp.raw._sock.gettimeout() is None)

But doesn't this show a backward-incompatible change?
or is the _sock member an implementation detail anyway?

--
nosy: +amaury.forgeotdarc

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2009-02-02 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
priority:  - low
stage:  - needs patch
type:  - feature request

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



[issue5119] wide character parameter handling in ctypes

2009-02-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

ctypes cannot guess the function signature, and does not know if the function 
expects strings or unicodes.

In your examples,
 ctypes.windll.user32.MessageBoxW(handle, text, caption, type)
will accept everything you pass, and create C values depending on the types of 
the 
actual values of the parameters: when you pass a unicode, ctypes uses a 
wchar_t* 
buffer; when you pass a narrow string, ctypes uses a char* buffer (and is wrong 
in 
this case).

In your Structure example, you do declare a kind of signature for the Structure.
ctypes is now able to convert the value you give into the declared type.

You can do the same thing with functions, if you provide the signature:

MessageBox = ctypes.windll.user32.MessageBoxW
MessageBox.argtypes = [ctypes.c_void_p, ctypes.c_wchar_p,
   ctypes.c_wchar_p, ctypes.c_int]
(or better, since this matches the documentation on msdn:)
from ctypes.wintypes import *
MessageBox.argtypes = [HWND, LPCWSTR, LPCWSTR, UINT]

And then you may indifferently pass strings or unicodes:
MessageBox(None, ucafé, drink, 0)

--
nosy: +amaury.forgeotdarc
resolution:  - works for me
status: open - pending

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



[issue1875] if 0: return not raising SyntaxError

2009-02-02 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

You should remove the error logic compile.c for return and yield in
function calls.

The problem with this approach is that every SyntaxError generated
during bytecode compilation must be moved to earlier. For example, I can
still use break and continue outside loops with your patch. The only
way I can think of around this is to compile the block anyway and remove
the extra code later. Maybe this optimization could be moved to the peep
holer?

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



[issue5084] unpickling does not intern attribute names

2009-02-02 Thread Collin Winter

Changes by Collin Winter coll...@gmail.com:


--
nosy: +collinwinter, jyasskin

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



[issue5137] SystemError when __len__ returns a non-number

2009-02-02 Thread Raymond Hettinger

New submission from Raymond Hettinger rhettin...@users.sourceforge.net:

len(obj) is not happy when obj.__len__() returns a non-number.

--
files: crasher_len.py
messages: 81024
nosy: rhettinger
priority: release blocker
severity: normal
status: open
title: SystemError when __len__ returns a non-number
type: crash
versions: Python 3.0, Python 3.1
Added file: http://bugs.python.org/file12927/crasher_len.py

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



[issue5138] File Reload for IDLE

2009-02-02 Thread Raymond Hettinger

New submission from Raymond Hettinger rhettin...@users.sourceforge.net:

IDLE would be *much* easier to use in conjunction with version control
if there were a reload option that did the equivalent of (close current
with no save, followed by open current file).

--
assignee: kbk
components: IDLE
messages: 81025
nosy: kbk, rhettinger
priority: normal
severity: normal
status: open
title: File Reload for IDLE
type: feature request
versions: Python 2.7, Python 3.1

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



[issue5139] Add combinatoric counting functions to the math module.

2009-02-02 Thread Raymond Hettinger

New submission from Raymond Hettinger rhettin...@users.sourceforge.net:

To parallel the functions in itertools, add: 

   math.combinations(n,r) -- n! / r! / (n-r)! when 0 = r = n or zero
when r  n.

   math.permutations(n,r) -- n! / (n-r)! when 0 = r = n or zero when
r  n.

   math.combinations_with_replacement(n,r) -- (n+r-1)! / r! / (n-1)!
when n  0.   And when n==0,  return 0 if r0 else 1.

These will enable an itertools user to compute the length of those
iterators.  It will also serve for general probability computations. 
Likewise, it produce binomial coefficients and multiset partitions.

Since, the math module is where we put the factorial() function, it is
the logical place for the combinatoric counting functions.

--
components: Extension Modules
messages: 81026
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Add combinatoric counting functions to the math module.
type: feature request
versions: Python 2.7, Python 3.1

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



[issue5140] Some Built-in Functions entries in Library Manual are missing Permalinks

2009-02-02 Thread Robert Yodlowski

New submission from Robert Yodlowski rbt...@gmail.com:

In 

http://docs.python.org/3.0/library/functions.html

these function entries seem to be missing Permalinks.

dict()  frozenset()  memoryview()  set()

Hope this helps. 
The Permalinks are a great idea. I hope you add lots more.

...Bob

--
assignee: georg.brandl
components: Documentation
messages: 81027
nosy: georg.brandl, rbtyod
severity: normal
status: open
title: Some Built-in Functions entries in Library Manual are missing Permalinks
versions: Python 3.0

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



[issue4124] Patch for adding default to itemgetter and attrgetter

2009-02-02 Thread Miki Tebeka

Miki Tebeka miki.teb...@gmail.com added the comment:

Hmmm, too much time has passed and my 1bit memory has overflowed since :)

IIRC it has to do with the fact that not all nodes in BeautifulSoup has a
name attribute. I wanted to count how may tr there were, so
len(filter(lambda n: n == tr, map(attrgetter(name), soup))) 
was what I wanted to do, but I got AttributeError.

The natural way to me would be 
len(filter(lambda n: n == tr, map(attrgetter(name, ), soup))) 
but instead I had to do
len(filter(lambda n: n == tr, map(lambda n: gettattr(n, name, ),
soup)))

Another thing I can think of is for usage in count/max ... when some of the
objects don't have the attribute you're looking for and it's by design
(bad one
maybe).

You'd like to be able to do:
max(map(itemgetter(time, 0)), articles)

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



[issue2459] speedup for / while / if with better bytecode

2009-02-02 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

I would like to see this go forward.  It looks promising.

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



[issue4528] test_httpservers consistently fails - OSError: [Errno 13] Permission denied (e.g. on OS X using tarball, but not svn tag r30)

2009-02-02 Thread Erkan Yilmaz

Changes by Erkan Yilmaz erka...@gmail.com:


--
title: test_httpservers consistently fails on OS X using tarball, but not svn 
tag r30 - test_httpservers consistently fails - OSError: [Errno 13] Permission 
denied (e.g. on OS X using tarball, but not svn tag r30)

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



<    1   2   3   4