[issue15979] Improve timeit documentation

2012-09-20 Thread Ezio Melotti

Ezio Melotti added the comment:

The sh syntax highlight can be enabled with:

.. code-block:: sh

   $ ...

--

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



[issue15977] Memory leak in _ssl.c

2012-09-20 Thread Daniel Sommermann

Daniel Sommermann added the comment:

This patch looks good to me (it's exactly how I fixed it in my local build), 
although I'm not sure how to approve your patch so you can push it to the 
upstream.

--

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



[issue15980] Non-escaped '\n' in docstrings

2012-09-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here are patches that escapes '\n' in docstrings of LWPCookieJar and (for 2.7 
only) of email.

--
assignee: docs@python
components: Documentation
files: escape_nl2.patch
keywords: patch
messages: 170794
nosy: docs@python, ezio.melotti, storchaka
priority: normal
severity: normal
status: open
title: Non-escaped '\n' in docstrings
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file27229/escape_nl2.patch

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



[issue15980] Non-escaped '\n' in docstrings

2012-09-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Added file: http://bugs.python.org/file27230/escape_nl2-2.7.patch

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



[issue15944] memoryviews and ctypes

2012-09-20 Thread Stefan Krah

Stefan Krah added the comment:

As I understand it, you prefer memoryviews where the format is
purely informational, whereas we now have typed memoryviews.

Typed memoryviews are certainly useful, in fact they are
present in Cython, see here for examples:

http://docs.cython.org/src/userguide/memoryviews.html


I can see only one obvious benefit of ignoring the format: All possible
formats are accepted. What I don't understand is why this ...

  m[0] = b'\x00\x00\x00\x01'

... should be preferable to:

  m[0] = 1



If you think that typed memoryviews are a mistake, I suggest raising
the issue on python-dev as soon as possible (3.3 is due soon). All
memoryview operations are now based on values instead of bit patterns,
see for example #15573.

--

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



[issue15977] Memory leak in _ssl.c

2012-09-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2bdc8c8ea42e by Christian Heimes in branch 'default':
Issue #15977: Fix memory leak in Modules/_ssl.c when the function 
_set_npn_protocols() is called multiple times
http://hg.python.org/cpython/rev/2bdc8c8ea42e

--
nosy: +python-dev

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



[issue15977] Memory leak in _ssl.c

2012-09-20 Thread Christian Heimes

Christian Heimes added the comment:

Georg, here is another candidate for the new release candidate.

Daniel, two equal patches are good enough as a patch review. The fix is simple 
and straight forward, too. Thanks for your report!

--
assignee:  - georg.brandl
nosy: +georg.brandl
resolution:  - fixed
stage: patch review - committed/rejected
status: open - pending

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



[issue15981] improve documentation of __hash__

2012-09-20 Thread Max

New submission from Max:

In dev/reference/datamodel#object.__hash__, there are two paragraphs that seem 
inconsistent. The first paragraph seems to say that a class that overrides 
__eq__() *should* explicitly flag itself as unhashable. The next paragraph says 
that a class that overrides __eq__() *will be* flagged unhashable by default. 
Which one is it?

Here are the two paragraphs:

Classes which inherit a __hash__() method from a parent class but change the 
meaning of __eq__() such that the hash value returned is no longer appropriate 
(e.g. by switching to a value-based concept of equality instead of the default 
identity based equality) can explicitly flag themselves as being unhashable by 
setting __hash__ = None in the class definition. Doing so means that not only 
will instances of the class raise an appropriate TypeError when a program 
attempts to retrieve their hash value, but they will also be correctly 
identified as unhashable when checking isinstance(obj, collections.Hashable) 
(unlike classes which define their own __hash__() to explicitly raise 
TypeError).

If a class that overrides __eq__() needs to retain the implementation of 
__hash__() from a parent class, the interpreter must be told this explicitly by 
setting __hash__ = ParentClass.__hash__. Otherwise the inheritance of 
__hash__() will be blocked, just as if __hash__ had been explicitly set to None.

--
assignee: docs@python
components: Documentation
messages: 170798
nosy: docs@python, max
priority: normal
severity: normal
status: open
title: improve documentation of __hash__
type: enhancement
versions: Python 3.3

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



[issue15982] asyncore.dispatcher does not handle windows socket error code correctly (namely WSAEWOULDBLOCK 10035)

2012-09-20 Thread Nicolai Ehemann

New submission from Nicolai Ehemann:

There are some differences between win32 and other os socket implementations. 
One specific I found is that in windows, non-blocking socket apis will return 
WSAEWOULDBLOCK or 10035 instead of EWOULDBLOCK.

This causes recv() in asyncore.dispatcher to raise an unhandled exception 
instead of continuing gracefully.

The fix could maybe be as simple as replacing line 384 in asyncore.py:
  data = self.socket.recv(buffer_size)
with
  try:
data = self.socket.recv(buffer_size)
  except socket.error as e:
if 10035 == e.errno:
  pass
else:
  raise e

The differences between windows and unix non-blocking sockets are summarized 
quite nice here: http://itamarst.org/writings/win32sockets.html

The original documentation from microsoft can be found here: 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx

--
components: Library (Lib)
messages: 170799
nosy: McNetic
priority: normal
severity: normal
status: open
title: asyncore.dispatcher does not handle windows socket error code correctly 
(namely WSAEWOULDBLOCK 10035)
type: behavior
versions: Python 3.2

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



[issue15978] asyncore: included batteries don't fit

2012-09-20 Thread chrysn

chrysn added the comment:

i'm aware this is ambitious, and hope that at least the individual sub-agendas 
will be manageable. as for vague, i can enhance it (i'd start refining the 
individual sub-agendas -- or do you think the big picture needs more details 
too?).

integration of frameworks is hard, i know. for some libraries, it might not 
even be feasible, or it could be that it'd be easier to write a new server than 
integrating into the existing one. (eg it might be easier to refactor http 
servers into a generic and a blocking part first, and then offer a 
http.server.AsyncServer in parallel to the existing implementation). that's why 
i'd like to try to get a rough roadmap instead of hacking ahead :-)

nevertheless, the current situation is not satisfying -- we have a versatile 
http client module, and yet who wants to fetch asynchronously is left with a 
stub implementation in the asyncore docs. that's not what one would expect from 
the batteries included catchphrase.

we don't need all of that implemented *right now*, but maybe we can do better 
than implementing it never.

--

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



[issue15276] unicode format does not really work in Python 2.x

2012-09-20 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue15276] unicode format does not really work in Python 2.x

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

I fixed a similar bug in Python 3.3: issue #13706.

changeset:   75231:f89e2f4cda88
user:Victor Stinner victor.stin...@haypocalc.com
date:Fri Feb 24 00:37:51 2012 +0100
files:   Include/unicodeobject.h Lib/test/test_format.py 
Objects/stringlib/asciilib.h Objects/stringlib/localeutil.h 
Objects/stringlib/stringdefs.h Objects/stringlib/ucs1lib.h 
description:
Issue #13706: Fix format(int, n) for locale with non-ASCII thousands separator

 * Decode thousands separator and decimal point using PyUnicode_DecodeLocale()
   (from the locale encoding), instead of decoding them implicitly from latin1
 * Remove _PyUnicode_InsertThousandsGroupingLocale(), it was not used
 * Change _PyUnicode_InsertThousandsGrouping() API to return the maximum
   character if unicode is NULL
 * Replace MIN/MAX macros by Py_MIN/Py_MAX
 * stringlib/undef.h undefines STRINGLIB_IS_UNICODE
 * stringlib/localeutil.h only supports Unicode

--

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



[issue15276] unicode format does not really work in Python 2.x

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

 I can't reproduce this with Python 2.7.3.
  locale.setlocale(locale.LC_NUMERIC, 'fr_FR')
 'fr_FR'
  u'{:n}'.format(1)
 u'10 000'

I don't understand why, but the all french locales are the same. Some french 
locale uses the standard ASCII space (U+0020) as thousand seperator, others 
use the non-breaking space (U+00A0). I suppose that some systems prefer to 
avoid non-ASCII characters to avoid Unicode issues.

On Ubuntu 12.04, locale.localeconv()['thousands_sep'] is chr(32) for the locale 
fr_FR.utf8.

You may need to install other locales to test this issue. For example, the 
ps_AF locale uses U+066b as the decimal point and the thousands separator.

I chose to not fix the issue in Python 3.2 because it needs to change too much 
code (and I don't want to introduce a regression and 3.2 code is very different 
than 3.3). You should upgrade to Python 3.3, or reimplement the Unicode 
format() function for numbers using locale.localeconv() ('thousands_sep', 
'decimal_point' and 'grouping') :-/

Or find a more motivated developer. Or I can do the job if you pay me ;-)

(Read also the issue #13706 for more information.)

--

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



[issue15973] Segmentation fault on timezone comparison

2012-09-20 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Alexander, did you send a contributor agreement?. I don't see it in the tracker 
:-??

--

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



[issue15972] wrong error message for os.path.getsize

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

It looks like os.stat() and os.path.getsize() converts the list into a byte 
string. It does something like:

 x=[]; y=bytes(x); print(y.decode(ascii))

 x=[65, 66, 67]; y=bytes(x); print(y.decode(ascii))
ABC
 x=[None]; y=bytes(x); print(y.decode(ascii))
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'NoneType' object cannot be interpreted as an integer

--
nosy: +haypo

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



[issue15972] wrong error message for os.path.getsize

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

Functions of the os module uses PyUnicode_FSConverter() function (which uses 
PyBytes_Check() on bytes) in Python 3.2, whereas PyBytes_FromObject() is used 
in Python 3.3. Related change:

changeset:   77597:27f9c26fdd8b
user:Larry Hastings la...@hastings.org
date:Fri Jun 22 16:30:09 2012 -0700
files:   Doc/library/os.rst Lib/os.py Lib/shutil.py Lib/test/support.py 
Lib/test/test_os.py Lib/test/test_posix.py Lib/test/test_shutil.py Misc/NEWS 
Modules/posixmodule.c
description:
Issue #14626: Large refactoring of functions / parameters in the os module.
Many functions now support dir_fd and follow_symlinks parameters;
some also support accepting an open file descriptor in place of of a path
string.  Added os.support_* collections as LBYL helpers.  Removed many
functions only previously seen in 3.3 alpha releases (often starting with
f or l, or ending with at).  Originally suggested by Serhiy Storchaka;
implemented by Larry Hastings.

--
nosy: +larry, storchaka

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



[issue15972] wrong error message for os.path.getsize

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

Set the priority to release blocker until it is decided if this issue is a 
regression, or a new feature :-)

--
priority: normal - release blocker

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



[issue15960] logging.shutdown should cope with IO errors from handler.release methods

2012-09-20 Thread Nick Coghlan

Nick Coghlan added the comment:

Dan and Amit worked out a patch for ConcurrentLogHandler 
(https://bugzilla.redhat.com/show_bug.cgi?id=858912) so I'm OK with rejecting 
this one.

--

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



[issue12750] datetime.strftime('%s') should respect tzinfo

2012-09-20 Thread Mümin Öztürk

Mümin Öztürk added the comment:

I made a patch for datetime.strftime('%s'). it takes tzinfo into consideration.


 datetime.datetime(1970,1,1).strftime(%s)   
'-7200'

 datetime.datetime(1970,1,1, tzinfo=datetime.timezone.utc).strftime(%s)
'0'

datetime.date still behave as naive datetime.datetime
 datetime.date(1970,1,1).strftime(%s)
'-7200'

--
keywords: +patch
nosy: +mumino
Added file: http://bugs.python.org/file27231/strftime.patch

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-09-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Well, here is a new patch. The five new macros moved to pymacros.h and used in 
more files.

--
Added file: http://bugs.python.org/file27232/align_operations2.patch

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



[issue14783] Make int() and str() docstrings correct

2012-09-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It may be worth rewrite int() and str() so that the first argument was 
positional-only argument?

--

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

Apologies; I got distracted from the main point of this issue with the strict 
aliasing stuff, and then it fell off the to-do list.  Unassigning;  Antoine or 
Victor, do you want to take this?

--
assignee: mark.dickinson - 

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



[issue15983] multiprocessing JoinableQueue's join function with timeout

2012-09-20 Thread Karl Bicker

New submission from Karl Bicker:

The multiprocessing.JoinableQueue's function join() should have a timeout 
argument so that one can check on other things while waiting for a queue to 
finish.

As join() uses a condition to wait anyway, a timeout is easily implemented and 
passed to the Condidition.wait(). Patch is attached.

--
components: Library (Lib)
files: JoinableQueue_with_timeout.patch
keywords: patch
messages: 170812
nosy: legordian
priority: normal
severity: normal
status: open
title: multiprocessing JoinableQueue's join function with timeout
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file27233/JoinableQueue_with_timeout.patch

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



[issue15983] multiprocessing JoinableQueue's join function with timeout

2012-09-20 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
versions:  -Python 3.1

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



[issue15960] logging.shutdown should cope with IO errors from handler.release methods

2012-09-20 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--
assignee:  - vinay.sajip
resolution:  - wont fix
stage:  - committed/rejected
status: open - closed

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



[issue14783] Make int() and str() docstrings correct

2012-09-20 Thread Ezio Melotti

Ezio Melotti added the comment:

That would be backward incompatible, and there might be some valid (corner) 
cases to pass it as a keyword.  Since people are usually not supposed to use it 
as a keyword arg, it doesn't matter much if the name is different if that makes 
the docs more understandable.  If someone tries to do int(number=10) and gets 
an error it would likely switch to the simpler int(10).  If he really needs 
keyword args he can always check the code.

That said, I don't have a strong opinion about this, so if people think that x 
should be used, it's fine with me.

--

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



[issue15954] No error checking after using of the wcsxfrm()

2012-09-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 No, I think the appropriate error is ValueError, at least if errno is EINVAL.

With what message?

 msvcrt gives EILSEQ or ERANGE, but never EINVAL. EILSEQ is returned if 
 LCMapString failed, and ERANE if the output buffer is too small.

I don't see where ERANE can be returned. If the output buffer is too small then 
the required buffer size (not including terminating null-char) should be 
returned.

I see the same issue with wcscoll() in locale.strcoll().

An alternative solution is in case of an error to return the original string 
(in locale.strxfrm) and to compare strings without regard locale (in 
locale.strcoll).

--

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



[issue15973] Segmentation fault on timezone comparison

2012-09-20 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

 Alexander, did you send a contributor agreement?

At least twice. :-)

--
keywords: +patch
priority: normal - high
stage: needs patch - commit review
Added file: http://bugs.python.org/file27234/issue15973.diff

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



[issue15981] improve documentation of __hash__

2012-09-20 Thread R. David Murray

R. David Murray added the comment:

This has already been fixed, and the change is visible in the online 
documentation.

--
nosy: +r.david.murray
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - confusing docs with regard to __hash__

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



[issue15983] multiprocessing JoinableQueue's join function with timeout

2012-09-20 Thread Richard Oudkerk

Changes by Richard Oudkerk shibt...@gmail.com:


--
nosy: +sbt

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-09-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Mark, please open a new discussion, so we don't lose it and that was the place 
for discussion.

--

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



[issue15944] memoryviews and ctypes

2012-09-20 Thread David Beazley

David Beazley added the comment:

There's probably a bigger discussion about memoryviews for a rainy day.  
However, the number one thing that would save all of this in my book would be 
to make sure cast('B') is universally supported regardless of format including 
endianness--especially in the standard library. For example, being able to do 
this:

 a = array.array('d',[1.0, 2.0, 3.0, 4.0])
 m = memoryview(a).cast('B')
 m[0:4] = b'\x00\x01\x02\x03'
 a
array('d', [1.000112050316, 2.0, 3.0, 4.0])
 

Right now, it doesn't work for ctypes.  For example:

 import ctypes
 a = (ctypes.c_double * 4)(1,2,3,4)
 a
__main__.c_double_Array_4 object at 0x1006a7cb0
 m = memoryview(a).cast('B')
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: memoryview: source format must be a native single character format 
prefixed with an optional '@'
 

As some background, being able to work with a byte view of memory is 
important for a lot of problems involving I/O, data interchange, and related 
problems where being able to accurately construct/deconstruct the underlying 
memory buffers is more useful than actually interpreting their contents.

--

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



[issue15944] memoryviews and ctypes

2012-09-20 Thread David Beazley

David Beazley added the comment:

One followup note---I think it's fine to punt on cast('B') if the memoryview is 
non-contiguous.  That's a rare case that's probably not as common.

--

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-20 Thread Skip Montanaro

Skip Montanaro added the comment:

LGTM

--
nosy: +skip.montanaro

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



[issue15984] Wrong documentation for PyUnicode_FromObject()

2012-09-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

In the documentation it is written that PyUnicode_FromObject() is a shortcut 
for PyUnicode_FromEncodedObject(). But PyUnicode_FromObject() is not call 
PyUnicode_FromEncodedObject() direct nor indirect. PyUnicode_FromObject() works 
only with unicode and unicode subclass objects, PyUnicode_FromEncodedObject() 
is not works with unicode objects.

--
assignee: docs@python
components: Documentation
messages: 170821
nosy: docs@python, storchaka
priority: normal
severity: normal
status: open
title: Wrong documentation for PyUnicode_FromObject()
versions: Python 3.3

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-20 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Chris Jerdonek

New submission from Chris Jerdonek:

The documentation for round() says:

round(x[, n])
Return the floating point value x rounded to n digits after the decimal point. 
If n is omitted, it defaults to zero. Delegates to x.__round__(n).

(from http://docs.python.org/dev/library/functions.html#round )

However, we have the following:

Python 3.3.0rc2+ (default:1704deb7e6d7+, Sep 16 2012, 04:49:45) 
 round(x=4.7)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: Required argument 'number' (pos 1) not found
 round(number=4.7)
5

The second argument is also affected:

 round(5.1234, n=3)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'n' is an invalid keyword argument for this function
 round(5.1234, ndigits=3)
5.123

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 170822
nosy: cjerdonek, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: round() has wrong argument names
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

A case where fixing the names improves both accuracy *and* readability!

--
nosy: +mark.dickinson

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Context: http://issues.roundup-tracker.org/issue2550765

--
nosy: +terry.reedy

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-20 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
assignee:  - ezio.melotti

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



[issue15972] wrong error message for os.path.getsize

2012-09-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch.

Are there any tests for string and bytes arguments as filenames? I will add 
float and list there.

--
keywords: +patch
Added file: http://bugs.python.org/file27235/posix_path_converter.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15972
___diff -r ddec854843f1 Modules/posixmodule.c
--- a/Modules/posixmodule.c Thu Sep 20 09:47:41 2012 +0300
+++ b/Modules/posixmodule.c Thu Sep 20 20:50:29 2012 +0300
@@ -427,26 +427,24 @@
 #endif
 
 static int
-_fd_converter(PyObject *o, int *p, int default_value) {
-long long_value;
-if (o == Py_None) {
-*p = default_value;
-return 1;
-}
-if (PyFloat_Check(o)) {
-PyErr_SetString(PyExc_TypeError,
-integer argument expected, got float );
+_fd_converter(PyObject *o, int *p, const char *allowed)
+{
+int overflow;
+long long_value = PyLong_AsLongAndOverflow(o, overflow);
+if (PyFloat_Check(o) ||
+(long_value == -1  !overflow  PyErr_Occurred())) {
+PyErr_Clear();
+PyErr_Format(PyExc_TypeError,
+argument must be %s, not %.200s,
+allowed, Py_TYPE(o)-tp_name);
 return 0;
 }
-long_value = PyLong_AsLong(o);
-if (long_value == -1  PyErr_Occurred())
-return 0;
-if (long_value  INT_MAX) {
+if (overflow  0 || long_value  INT_MAX) {
 PyErr_SetString(PyExc_OverflowError,
 signed integer is greater than maximum);
 return 0;
 }
-if (long_value  INT_MIN) {
+if (overflow  0 || long_value  INT_MIN) {
 PyErr_SetString(PyExc_OverflowError,
 signed integer is less than minimum);
 return 0;
@@ -456,8 +454,13 @@
 }
 
 static int
-dir_fd_converter(PyObject *o, void *p) {
-return _fd_converter(o, (int *)p, DEFAULT_DIR_FD);
+dir_fd_converter(PyObject *o, void *p)
+{
+if (o == Py_None) {
+*(int *)p = DEFAULT_DIR_FD;
+return 1;
+}
+return _fd_converter(o, (int *)p, integer);
 }
 
 
@@ -634,17 +637,16 @@
 }
 else {
 PyErr_Clear();
-bytes = PyBytes_FromObject(o);
+if (PyObject_CheckBuffer(o))
+bytes = PyBytes_FromObject(o);
+else
+bytes = NULL;
 if (!bytes) {
 PyErr_Clear();
 if (path-allow_fd) {
 int fd;
-/*
- * note: _fd_converter always permits None.
- * but we've already done our None check.
- * so o cannot be None at this point.
- */
-int result = _fd_converter(o, fd, -1);
+int result = _fd_converter(o, fd,
+   string, bytes or integer);
 if (result) {
 path-wide = NULL;
 path-narrow = NULL;
@@ -705,15 +707,17 @@
 }
 
 static int
-dir_fd_unavailable(PyObject *o, void *p) {
-int *dir_fd = (int *)p;
-int return_value = _fd_converter(o, dir_fd, DEFAULT_DIR_FD);
-if (!return_value)
+dir_fd_unavailable(PyObject *o, void *p)
+{
+int dir_fd;
+if (!dir_fd_converter(o, dir_fd))
 return 0;
-if (*dir_fd == DEFAULT_DIR_FD)
-return 1;
-argument_unavailable_error(NULL, dir_fd);
-return 0;
+if (dir_fd != DEFAULT_DIR_FD) {
+argument_unavailable_error(NULL, dir_fd);
+return 0;
+}
+*(int *)p = dir_fd;
+return 1;
 }
 
 static int
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15986] memoryview: expose 'buf' attribute

2012-09-20 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
components: Interpreter Core
nosy: dabeaz, skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: memoryview: expose 'buf' attribute
type: enhancement
versions: Python 3.4

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



[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-20 Thread Julian Berman

New submission from Julian Berman:

As is, as far as I can tell, there's no way to easily compare two AST nodes to 
see if they have the same children and same fields (recursively).

I'm writing some unit tests for a NodeTransformers, so I've settled for 
comparing `ast.dump()`s of each, which is kind of dirty, but 1) works and 2) 
produces reasonable failure messages. (As a side note of what else I've tried, 
comparing, say, a list of the `iter_child_nodes` is not a good alternative, 
since the tests I'm writing are making assertions that a given node was not 
modified, which means they deepcopy the node and then want to assert that the 
transformed node is unchanged.)

I don't know the global implications of changing ast.AST.__eq__ to know if 
that's feasible (hopefully someone will comment on that), but if it isn't, 
another provided way would be nice.

--
components: Library (Lib)
messages: 170826
nosy: Julian
priority: normal
severity: normal
status: open
title: Provide a way to compare AST nodes for equality recursively
type: enhancement
versions: Python 3.3, Python 3.4

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-09-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks for the patch! These macros will be useful.

--

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



[issue15988] Inconsistency in overflow error messages of integer argument

2012-09-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

PyArg_ParseTuple raises inconsistent overflow error messages for small integer 
formats. For example:

 import _testcapi
 _testcapi.getargs_b(100)
100
 _testcapi.getargs_b(1000)
Traceback (most recent call last):
  File stdin, line 1, in module
OverflowError: unsigned byte integer is greater than maximum
 _testcapi.getargs_b(-1000)
Traceback (most recent call last):
  File stdin, line 1, in module
OverflowError: unsigned byte integer is less than minimum
 _testcapi.getargs_b(1)
Traceback (most recent call last):
  File stdin, line 1, in module
OverflowError: Python int too large to convert to C long
 _testcapi.getargs_b(-1)
Traceback (most recent call last):
  File stdin, line 1, in module
OverflowError: Python int too large to convert to C long

On platforms with 32-bit int and 64-bit long there will be more such cases.

--
components: Interpreter Core
messages: 170827
nosy: storchaka
priority: low
severity: normal
status: open
title: Inconsistency in overflow error messages of integer argument
type: enhancement
versions: Python 3.4

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Here is a patch.  Also, I checked, and there is already a test for the keyword 
arguments:

http://hg.python.org/cpython/file/dcced3bd22fe/Lib/test/test_builtin.py#l1239

--
keywords: +needs review, patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file27236/issue-15985-1-branch-default.patch

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-09-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 99112b851b25 by Antoine Pitrou in branch 'default':
Issue #15144: Fix possible integer overflow when handling pointers as integer 
values, by using Py_uintptr_t instead of size_t.
http://hg.python.org/cpython/rev/99112b851b25

--
nosy: +python-dev

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-09-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Committed in 3.3(.1).

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions: +Python 3.3 -Python 3.4

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



[issue15989] Possible integer overflow of PyLong_AsLong() results

2012-09-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

There are several places where the result of PyLong_AsLong() assigned to 
variable of type int. It can cause unknown issues on platforms with sizeof(int) 
!= sizeof(long). All 140 cases of PyLong_AsLong() usage should be checked.

--
assignee: storchaka
components: Interpreter Core
messages: 170832
nosy: storchaka
priority: normal
severity: normal
status: open
title: Possible integer overflow of PyLong_AsLong() results
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue15973] Segmentation fault on timezone comparison

2012-09-20 Thread Stefan Krah

Stefan Krah added the comment:

Looks good. It would be nice to have this in 3.3.0. There are a couple
of blockers open, so perhaps this could go in, too.

Georg, are we going to have an rc3 anyway?

--
nosy: +georg.brandl

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



[issue15990] solidify argument/parameter terminology

2012-09-20 Thread Chris Jerdonek

New submission from Chris Jerdonek:

There is currently some ambiguity in our documentation around positional and 
keyword arguments (e.g. whether positional means position-only or 
non-keyword (roughly) and whether various terms and definitions should be for 
the calling syntax or the function definition syntax or both).  For example, 
see the python-dev thread starting here:

http://mail.python.org/pipermail/python-dev/2012-September/121760.html

It would be good to nail down the preferred terminology in a central place.  I 
would suggest that the glossary is a good place to start.

For example, when there is a question about what phrase an error message should 
use or how an error message should be interpreted, it would be good if (at 
least going forward) the glossary could be used as a definitive resource.

This issue may involve making a distinction in our terminology between 
arguments (what you pass, call syntax) and parameters (what the function 
receives, function definition syntax) (see 
http://mail.python.org/pipermail/python-dev/2012-September/121771.html ).

--
assignee: docs@python
components: Documentation
messages: 170834
nosy: cjerdonek, docs@python
priority: normal
severity: normal
status: open
title: solidify argument/parameter terminology

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

Looks good to me.

--

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset eccd94d4ee77 by Mark Dickinson in branch '3.2':
Issue 15985: fix round argument names in documentation.  Thanks Chris Jerdonek.
http://hg.python.org/cpython/rev/eccd94d4ee77

New changeset ad04dd6c07f7 by Mark Dickinson in branch 'default':
Issue 15985: merge from 3.2.
http://hg.python.org/cpython/rev/ad04dd6c07f7

--
nosy: +python-dev

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e4037dd73877 by Mark Dickinson in branch '2.7':
Issue 15985: fix round argument names in documentation.  Thanks Chris Jerdonek.
http://hg.python.org/cpython/rev/e4037dd73877

--

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

Fixed.  Thanks for the patch!

--
resolution:  - fixed
status: open - closed

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



[issue15985] round() has wrong argument names

2012-09-20 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks for the quick commit, Mark. :)

--

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



[issue15991] BaseHTTPServer with ThreadingMixIn serving wrong data sometimes

2012-09-20 Thread Mikhail Afanasyev

New submission from Mikhail Afanasyev:

When using BaseHTTPServer with ThreadingMixIn, sometimes the wrong data is 
served. 

The attached script requests normal URL and URLs which are not found in 
multiple threads using wget (which only saves pages if it gets 200 OK status).
Every once in a while responses are incorrect.
 - sometimes normal URL gets a '404 not found' content with '200 OK' status.
 - sometimes, a '404 not found' page gets '200 OK' status code

The problems become much, much less frequent if ThreadingMixIn is removed.

Python 2.7.3 on ubuntu 12.04 x86_64.

--
components: Library (Lib)
files: http_server_bug.py
messages: 170840
nosy: theamk
priority: normal
severity: normal
status: open
title: BaseHTTPServer with ThreadingMixIn serving wrong data sometimes
versions: Python 2.7
Added file: http://bugs.python.org/file27237/http_server_bug.py

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



[issue15990] solidify argument/parameter terminology

2012-09-20 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
nosy: +mark.dickinson

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



[issue15990] solidify argument/parameter terminology

2012-09-20 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti
type:  - enhancement

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



[issue15992] Strict aliasing violations in Objects/unicodeobject.c

2012-09-20 Thread Mark Dickinson

New submission from Mark Dickinson:

[Broken out of the discussion in issue 15144]

Some of the newly-optimized code in Objects/unicodeobject.c contains strict 
aliasing violations;  under the C standards, this is undefined behaviour (C99 
6.5p7).

An example occurs in ascii_decode:

unsigned long value = *(const unsigned long *) _p;

Here the pointer dereference violates the strict aliasing rule.

I think these portions of Objects/unicodeobject.c should be rewritten to avoid 
the undefined behaviour.

This is not a purely theoretical problem: compilers are known to make 
optimizations based on the assumption that strict aliasing is not violated.  
Early versions of David Gay's dtoa.c gave incorrect results as a result of 
strict aliasing violations, for example; see [1].

[2] gives a stackoverflow reference explaining strict aliasing.

[1] http://patrakov.blogspot.co.uk/2009/03/dont-use-old-dtoac.html
[2] http://stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule

--
components: Interpreter Core
messages: 170841
nosy: mark.dickinson, storchaka
priority: normal
severity: normal
status: open
title: Strict aliasing violations in Objects/unicodeobject.c
type: behavior
versions: Python 3.3

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

 Mark, please open a new discussion.

Done:  issue 15992.

--

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



[issue15990] solidify argument/parameter terminology

2012-09-20 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +terry.reedy

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



[issue15959] Declaration mismatch of quick integer allocation counters

2012-09-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5ed83105731d by Mark Dickinson in branch '3.2':
Issue 15959: Fix type mismatch for quick{_neg}_int_allocs.  Thanks Serhiy 
Storchaka.
http://hg.python.org/cpython/rev/5ed83105731d

New changeset 3504cbb3e1d8 by Mark Dickinson in branch 'default':
Issue 15959: Merge from 3.2.
http://hg.python.org/cpython/rev/3504cbb3e1d8

--
nosy: +python-dev

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-20 Thread Stefan Krah

New submission from Stefan Krah:

I've installed 3.3.0-rc2 on Windows-7 64-bit using the msi installer.
I'm getting these failures in test_buffer, but I can *not* reproduce
them when I build Win-32/pgo/python.exe from source:

==
FAIL: test_memoryview_assign (test.test_buffer.TestBufferProtocol)
--
Traceback (most recent call last):
  File C:\Program Files (x86)\Python33\lib\test\test_buffer.py, line 2863,
self.assertEqual(m[i], 8)
AssertionError: 34359738368 != 8

==
FAIL: test_memoryview_struct_module (test.test_buffer.TestBufferProtocol)
--
Traceback (most recent call last):
  File C:\Program Files (x86)\Python33\lib\test\test_buffer.py, line 2476,
self.assertEqual(m[0], nd[0])
AssertionError: 15080797365275624638 != 6838299039298601293

--
components: Interpreter Core
messages: 170844
nosy: brian.curtin, loewis, skrah
priority: critical
severity: normal
status: open
title: Windows: 3.3.0-rc2.msi: test_buffer fails
versions: Python 3.3

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



[issue15994] memoryview to freed memory can cause segfault

2012-09-20 Thread Richard Oudkerk

New submission from Richard Oudkerk:

A memoryview which does not own a reference to its base object can point to 
freed or reallocated memory.  For instance the following segfaults for me on 
Windows and Linux.


import io

class File(io.RawIOBase):
def readinto(self, buf):
global view
view = buf
def readable(self):
return True

f = io.BufferedReader(File())
f.read(1)   # get view of buffer used by BufferedReader
del f   # deallocate buffer
view = view.cast('P')
L = [None] * len(view)  # create list whose array has same size
# (this will probably coincide with view)
view[0] = 0 # overwrite first item with NULL
print(L[0]) # segfault: dereferencing NULL


I realize there are easier ways to make Python segfault, so maybe this should 
not be considered a serious issue.  But I think there should be some way of 
guaranteeing that a memoryview will not try to access memory which has already 
been freed.

In #15903 skrah proposed exposing memory_release() as PyBuffer_Release().  
However, I don't think that would necessarily invalidate all exports of the 
buffer.

Alternatively, one could incref the buffered reader object and set 
mview-mbuf-obj to it.  Maybe we could have

PyMemoryView_FromMemoryEx(char *mem, Py_ssize_t size, int flags, PyObject 
*obj)

which guarantees that if obj is non-NULL then it will not be garbage collected 
before the memoryview.  This should *not* expose obj as an attribute of the 
memoryview.

--
messages: 170846
nosy: sbt, skrah
priority: normal
severity: normal
status: open
title: memoryview to freed memory can cause segfault
type: crash
versions: Python 3.4

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



[issue15959] Declaration mismatch of quick integer allocation counters

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

Fixed;  thanks for the patch!

(It seems this was fixed in Python 2 some time ago:  see issue #4850.)

--
nosy: +mark.dickinson
resolution:  - fixed
status: open - closed

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



[issue15989] Possible integer overflow of PyLong_AsLong() results

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

Getting a C int out of a Python int is currently a bit awkward.  What do you 
think about adding a PyLong_AsInt counterpart to PyLong_AsLong?  (The 
alternative is to use PyLong_AsLong and repeat the same overflow detection code 
in many places.)

--
nosy: +mark.dickinson

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



[issue15973] Segmentation fault on timezone comparison

2012-09-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9fba12ceb2fd by Alexander Belopolsky in branch '3.2':
Issue #15973: Fixed segmentation fault on timezone comparison to other types.
http://hg.python.org/cpython/rev/9fba12ceb2fd

--
nosy: +python-dev

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



[issue15973] Segmentation fault on timezone comparison

2012-09-20 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Leeaving the issue open in case it will go to 3.3.0.  Reassigning to the RM.

--
assignee: belopolsky - georg.brandl
resolution:  - fixed
stage: commit review - committed/rejected

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



[issue15989] Possible integer overflow of PyLong_AsLong() results

2012-09-20 Thread Mark Dickinson

Mark Dickinson added the comment:

In the Objects subdirectory (which is all I've looked at so far), I see issues 
in:

- fileobject.c (PyObject_AsFileDescriptor)

- structseq.c (PyLong_AsLong return value used as a Py_ssize_t;  probably safe, 
but it would be better to use PyLong_AsSsize_t).

- unicodeobject.c (one place where result assigned to something of type 
ssize_t, one where result assigned to something of type int).

--

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



[issue15990] solidify argument/parameter terminology

2012-09-20 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue15973] Segmentation fault on timezone comparison

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

Your change does not compile on Windows:

_datetimemodule.c
..\Modules\_datetimemodule.c(3247) : error C2065: 'Py_RETURN_NOTIMPLEMENTED' : 
undeclared identifier

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.2/builds/194/steps/compile/logs/stdio

--
nosy: +haypo

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



[issue15973] Segmentation fault on timezone comparison

2012-09-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f17f67f0ec4b by Alexander Belopolsky in branch '3.2':
Issue #15973: fixed 3.2 backport.
http://hg.python.org/cpython/rev/f17f67f0ec4b

--

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



[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-20 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue11454] email.message import time

2012-09-20 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue15995] Windows: 3.3.0-rc2.msi: test_lzma fails

2012-09-20 Thread Stefan Krah

New submission from Stefan Krah:

This is similar to #15993: With the installed Python from the rc2-msi
test_lzma fails. I cannot reproduce the failure with python.exe (PGO)
compiled from source:


==  
 
ERROR: test__decode_filter_properties (test.test_lzma.MiscellaneousTestCase)
 
--  
 
Traceback (most recent call last):  
 
  File C:\Python33\lib\test\test_lzma.py, line 1105, in 
test__decode_filter_properties 
lzma.FILTER_LZMA1, b]\x00\x00\x80\x00)
 
ValueError: Invalid filter ID: 4611686018427387905  
 

 
==  
 
ERROR: test_filter_properties_roundtrip (test.test_lzma.MiscellaneousTestCase)  
 
--  
 
Traceback (most recent call last):  
 
  File C:\Python33\lib\test\test_lzma.py, line 1114, in 
test_filter_properties_roundtrip   
lzma.FILTER_LZMA1, b]\x00\x00\x80\x00)
 
ValueError: Invalid filter ID: 4611686018427387905  
 

 
--

--
components: Interpreter Core
messages: 170853
nosy: brian.curtin, loewis, skrah
priority: critical
severity: normal
status: open
title: Windows: 3.3.0-rc2.msi: test_lzma fails
type: behavior
versions: Python 3.3

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



[issue15995] Windows: 3.3.0-rc2.msi: test_lzma fails

2012-09-20 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +nadeem.vawda

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

Hi Cédric!

 while True:
 yield date
-date += oneday
+try:
+date += oneday
+except OverflowError:
+break

You might add a comment explaining why we may get an OverflowError here.

I don't know the cost of adding a try/except in a loop. But the loop has 31 
iterations or less, so it's maybe better to keep the explicit try/except around 
date += oneday.

+def test_itermonthdates(self):
+# ensure itermonthdates works for all months
+list(calendar.Calendar().itermonthdates(, 12))

Please use datetime.MAXYEAR instead of this hardcoded constant.

--

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



[issue15972] wrong error message for os.path.getsize

2012-09-20 Thread Larry Hastings

Larry Hastings added the comment:

Patch looks like it'll work fine.  But please add regression tests checking 
that the error message is what we want.

Are the new error messages okay with the OP?  It looks like now it'll throw 
TypeError(argument must be string, bytes or integer, not list).

v
I'd personally prefer the Oxford Comma there (string, bytes, or integer).  
But I don't know if there is a style preference one way or the other in Python 
error messages.

--

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



[issue15995] Windows: 3.3.0-rc2.msi: test_lzma fails

2012-09-20 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-20 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue15996] pow() for complex numbers is rough around the edges

2012-09-20 Thread mattip

New submission from mattip:

complex(1., 0.) ** complex(float('inf'), 0.) raises a ZeroDivisionError. In 
general, complex_power() needs to handle more corner cases. Barring a clear 
standard for pow() in C99, the documentation for pow 3 in glibc
http://www.kernel.org/doc/man-pages/online/pages/man3/pow.3.html
seems solid for a start, however it only describes behaviour for float/double 
values.

Where would be an appropriate place to add tests? I propose adding a test-case 
file similar to cmath_testcases.txt (attached) and a test runner similar to 
test_cmath.py

--
components: Interpreter Core
files: rcomplex_testcases2.txt
messages: 170856
nosy: mark.dickinson, mattip
priority: normal
severity: normal
status: open
title: pow() for complex numbers is rough around the edges
type: behavior
Added file: http://bugs.python.org/file27238/rcomplex_testcases2.txt

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



[issue15996] pow() for complex numbers is rough around the edges

2012-09-20 Thread Alex Gaynor

Changes by Alex Gaynor alex.gay...@gmail.com:


--
nosy: +alex

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



[issue15548] Mention all new os functions in What's New in Python 3.3

2012-09-20 Thread STINNER Victor

STINNER Victor added the comment:

The doc is now complete.

--
resolution:  - fixed
status: open - closed

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-20 Thread Stefan Krah

Stefan Krah added the comment:

Both lzma and memoryview use PyLong_AsUnsignedLongLong() in the
affected code paths. I get this with the msi installed python.exe:

 import array
 a = array.array('Q', [1,2,3,4])
 m = memoryview(a)
 m[0] = 4
 m[0]
17179869184



And the correct result with the self-compiled (PGO) python.exe:

 import array
 a = array.array('Q', [1,2,3,4])
 m = memoryview(a)
 m[0] = 4
 m[0]
4

--

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-20 Thread Cédric Krier

Cédric Krier added the comment:

Fix haypo comments

--
Added file: http://bugs.python.org/file27239/calendar.patch

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



[issue15997] NotImplemented needs to be documented

2012-09-20 Thread Max

New submission from Max:

Quoting from 
http://docs.python.org/reference/datamodel.html#the-standard-type-hierarchy:

NotImplemented
This type has a single value. There is a single object with this value. This 
object is accessed through the built-in name NotImplemented. Numeric methods 
and rich comparison methods may return this value if they do not implement the 
operation for the operands provided. (The interpreter will then try the 
reflected operation, or some other fallback, depending on the operator.) Its 
truth value is true.

This is not a sufficient description of NotImplemented behavior. What does it 
mean reflected operation (I assume it is other.__eq__(self), but it needs to 
be clarified), and what does it mean or some other fallback (wouldn't 
developers need to know?). It also doesn't state what happens if the reflected 
operation or the fallback again return NotImplemented.

The rest of the documentation doesn't seem to talk about this either, despite 
several mentions of NotImplemented, with references to other sections.

This is particularly serious problem because Python's behavior changed in this 
respect not that long ago.

--
assignee: docs@python
components: Documentation
messages: 170860
nosy: docs@python, max
priority: normal
severity: normal
status: open
title: NotImplemented needs to be documented
type: enhancement
versions: Python 3.2

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



[issue15997] NotImplemented needs to be documented

2012-09-20 Thread Martin v . Löwis

Martin v. Löwis added the comment:

This must not be documented for NotImplemented, but for the operations itself. 
On the same page, it says

There are no swapped-argument versions of these methods (to be used when the 
left argument does not support the operation but the right argument does); 
rather, __lt__() and __gt__() are each other’s reflection, __le__() and 
__ge__() are each other’s reflection, and __eq__() and __ne__() are their own 
reflection.

So I'd say it's there already.

--
nosy: +loewis

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