[issue11610] Improved support for abstract base classes with descriptors

2011-12-06 Thread Nick Coghlan

Nick Coghlan  added the comment:

Added some review comments in Reitveld - core functionality changes look good, 
but there are some other aspects that need addressing before the patch will be 
good to go (primarily relating to only doing a minimal documented deprecation 
of the legacy APIs without actually harming their documentation, testing or 
functionality).

--

___
Python tracker 

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



[issue13524] critical error with import tempfile

2011-12-06 Thread Tim Golden

Changes by Tim Golden :


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

___
Python tracker 

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



[issue13535] Improved two's complement arithmetic support: to_signed() and to_unsigned()

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Instead of requiring bit_length(), couldn't you simply compare self to 
2**(bits-1) (for to_unsigned) and 2**bits (for to_signed)?

--
nosy: +pitrou

___
Python tracker 

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



[issue13536] ast.literal_eval fails on sets

2011-12-06 Thread Georg Brandl

Georg Brandl  added the comment:

Alex: IMO the operator support is only required for complex "literals".

--

___
Python tracker 

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



[issue13505] Bytes objects pickled in 3.x with protocol <=2 are unpickled incorrectly in 2.x

2011-12-06 Thread sbt

sbt  added the comment:

> One *dirty* trick I am thinking about would be to use something like 
> array.tostring() to construct the byte string.

array('B', ...) objects are pickled using two bytes per character, so there 
would be no advantage:

  >>> pickle.dumps(array.array('B', b"hello"), 2)
  
b'\x80\x02carray\narray\nq\x00X\x01\x00\x00\x00Bq\x01]q\x02(KhKeKlKlKoe\x86q\x03Rq\x04.'

--
nosy: +sbt

___
Python tracker 

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



[issue13537] Namedtuple instances can't be pickled in a daemonized process

2011-12-06 Thread Popa Claudiu

New submission from Popa Claudiu :

On Unix world, in a daemonized process, any namedtuple instance can't be 
pickled, failing with error:
_pickle.PicklingError: Can't pickle class X: attribute lookup __main__.t failed.
This can't be reproduced with the attached code. If I add the created class 
inside the globals dict, the pickling will work.

--
components: Library (Lib)
files: daemon.py
messages: 148912
nosy: Popa.Claudiu, rhettinger
priority: normal
severity: normal
status: open
title: Namedtuple instances can't be pickled in a daemonized process
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file23860/daemon.py

___
Python tracker 

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



[issue13537] Namedtuple instances can't be pickled in a daemonized process

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

As far as I can tell, this has nothing to do with daemon processes and all to 
do with the fact that user-defined classes have to be globally visible for 
their instances to be pickled. It is because pickles reference classes by name, 
and local names obviously don't work for that.

In other words, this is not a bug.

--
nosy: +alexandre.vassalotti, pitrou
resolution:  -> invalid
status: open -> pending
versions:  -Python 3.4

___
Python tracker 

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



[issue13538] Docstring of str() and/or behavior

2011-12-06 Thread Guillaume Bouchard

New submission from Guillaume Bouchard :

The docstring associated with str() says:

  str(string[, encoding[, errors]]) -> str
  
  Create a new string object from the given encoded string.
  encoding defaults to the current default string encoding.
  errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'.

When it is stated in the on-line documentation::

  When only object is given, this returns its nicely printable representation.

My issue comes when I tried to convert bytes to str.

As stated in the documentation, and to avoid implicit behavior, converting str 
to bytes cannot be done without giving an encoding (using bytes(my_str, 
encoding=..) or my_str.encode(...). bytes(my_str) will raise a TypeError). But 
if you try to convert bytes to str using str(my_bytes), python will returns you 
the so-called nicely printable representation of the bytes object).

ie. ::


  >>> bytes("foo")
  Traceback (most recent call last):
File "", line 1, in 
  TypeError: string argument without an encoding
  >>> str(b"foo")
  "b'foo'"

As a matter of coherency and to avoid silent errors, I suggest that str() of a 
byte object without encoding raise an exception. I think it is usually what 
people want. If one wants a *nicely printable representation* of their bytes 
object, they can call explicitly the repr() function and will quickly see that 
what they just printed is wrong. But if they want to convert a byte object to 
its unicode representation, they will prefer an exception rather than a 
silently failing converting which leads to an unicode string starting with 'b"' 
and ending with '"'.

--
components: Interpreter Core
messages: 148914
nosy: Guillaume.Bouchard
priority: normal
severity: normal
status: open
title: Docstring of str() and/or behavior
versions: Python 3.2

___
Python tracker 

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



[issue13539] A return is missing in TimeEncoding of calendar.py

2011-12-06 Thread psam

New submission from psam :

The v2.6 of __enter__() of TimeEncoding has been fixed in v2.7 in relation with 
the return of setlocale(), but for no apparent reason, its necessary returned 
value is no more there.

Patch:

def __enter__(self):
self.oldlocale = _locale.getlocale(_locale.LC_TIME)
_locale.setlocale(_locale.LC_TIME, self.locale)
+   return _locale.getlocale(_locale.LC_TIME)[1]

--
components: Library (Lib)
messages: 148915
nosy: psam
priority: normal
severity: normal
status: open
title: A return is missing in TimeEncoding of calendar.py
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue13538] Docstring of str() and/or behavior

2011-12-06 Thread R. David Murray

R. David Murray  added the comment:

I agree with you that this is inconsistent.  However, having str raise an error 
is pretty much a non-starter as a suggestion.  str always falls back to the 
repr; in general str(obj) should always return some value, otherwise the 
assumptions of a *lot* of Python code would be broken.

Personally I'm not at all sure why str takes encoding and errors arguments (I 
never use them). I'd rather there be only one way to do that, decode.  In other 
words, why do we have special case support for byte strings in the str 
conversion function?

But I don't think that can be changed either, so I think we are stuck with 
documenting the existing situation better.  Do you want to propose a doc patch?

--
assignee:  -> docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python, r.david.murray
versions: +Python 3.3

___
Python tracker 

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



[issue13538] Docstring of str() and/or behavior

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Personally I'm not at all sure why str takes encoding and errors
> arguments (I never use them).

Probably because the unicode type also did in 2.x.
And also because it makes it compatible with arbitrary buffer objects:

>>> str(memoryview(b"foo"), "ascii")
'foo'

--
nosy: +pitrou

___
Python tracker 

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



[issue13538] Docstring of str() and/or behavior

2011-12-06 Thread Guillaume Bouchard

Guillaume Bouchard  added the comment:

> str always falls back to the repr; in general str(obj) should always return 
> some value, otherwise the assumptions of a *lot* of Python code would be 
> broken.

Perhaps it may raises a warning ?

ie, the only reason encoding exists if for the conversion of bytes (or 
something which looks like bytes) to str. Do you think it may be possible to 
special case the use of str for bytes (and bytesarray) with something like this:

def str(object, encoding=None, errors=None):
if encoding is not None:
 # usual work
else:
   if isinstance(object, (bytes, bytesarray)):
 warning('Converting bytes/bytesarray to str without encoding, it 
may not be what you expect')
 return object.__str__()

But by the way, adding warnings and special case everywhere seems not too 
pythonic.

> Do you want to propose a doc patch?

The docstring for str() should looks like something like, in my frenglish way 
of writing english ::

  Create a new string object from the given encoded string.

  If object is bytes, bytesarray or a buffer-like object, encoding and error
  can be set. errors can be 'strict', 'replace' or 'ignore' and defaults to
  'strict'.

  WARNING, if encoding is not set, the object is converted to a nicely
  printable representation, which is totally different from what you may expect.

Perhaps a warning may be added in the on-line documentation, such as ::

  .. warning::
 When str() converts a bytes/bytesarray or a buffer-like object and
 *encoding* is not specified, the result will an unicode nicely printable
 representation, which is totally different from the unicode representation 
of
 you object using a specified encoding.

Whould you like a .diff on top of the current mercurial repository ?

--

___
Python tracker 

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



[issue13538] Docstring of str() and/or behavior

2011-12-06 Thread R. David Murray

R. David Murray  added the comment:

A diff would be great.

We try to use warnings sparingly, and I don't think this is a case that 
warrants it.  Possibly a .. note is worthwhile, perhaps with an example for the 
bytes case, but even that may be too much.

I also wouldn't use the wording "is totally different from what you would 
expect", since by now I do expect it :).  How about something like "the result 
will not be the decoded version of the bytes, but instead will be the repr of 
the object", with a cross link to repr.

--

___
Python tracker 

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



[issue13520] Patch to make pickle aware of __qualname__

2011-12-06 Thread sbt

sbt  added the comment:

It looks like Issue 3657 is really about builtin methods (i.e. 
builtin_function_or_method objects where __self__ is not a module).  It causes 
no problem for normal python instance methods.

If we tried the getattr approach for builtin methods too then it should only be 
used as a fallback when saving as a global will not work.

--

___
Python tracker 

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



[issue13540] Document the Action API

2011-12-06 Thread Jason R. Coombs

New submission from Jason R. Coombs :

In http://docs.python.org/dev/library/argparse.html#action, when describing an 
arbitrary action, the documentation states, "You can also specify an arbitrary 
action by passing an object that implements the Action API." This statement 
does not link to any documentation on the Action API and does not describe the 
API except to give an example.

Furthermore, the example contradicts the description. The description says 
"pass an object" but the example passes a class.

The documentation should clarify the text relating to the example and should 
document the expected interface for a custom action.

--
assignee: docs@python
components: Documentation
messages: 148921
nosy: docs@python, jason.coombs
priority: low
severity: normal
status: open
title: Document the Action API
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue13540] Document the Action API in argparse

2011-12-06 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
title: Document the Action API -> Document the Action API in argparse

___
Python tracker 

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



[issue13538] Docstring of str() and/or behavior

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, I forgot to mention it in my previous message, but there is already a 
warning that you can activate with the -b option:

$ ./python -b
Python 3.3.0a0 (default:6b6c79eba944, Dec  6 2011, 11:11:32) 
[GCC 4.5.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> str(b"")
__main__:1: BytesWarning: str() on a bytes instance
"b''"


And you can even turn it into an error with -bb:

$ ./python -bb
Python 3.3.0a0 (default:6b6c79eba944, Dec  6 2011, 11:11:32) 
[GCC 4.5.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> str(b"")
Traceback (most recent call last):
  File "", line 1, in 
BytesWarning: str() on a bytes instance


However, -b is highly unlikely to become the default, for the reasons already 
explained. It was mainly meant to ease porting from Python 2.

--

___
Python tracker 

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



[issue2057] difflib: add patch capability

2011-12-06 Thread Éric Araujo

Éric Araujo  added the comment:

Hi Marco, thanks for your interest in improving Python.  Do you want to propose 
a patch for this request?  If so, guidelines and help are found in the devguide.

(For the other bug, please read the discussion there to see why 2.7 is not 
possible.)

--

___
Python tracker 

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



[issue13408] Rename packaging.resources back to datafiles

2011-12-06 Thread Éric Araujo

Éric Araujo  added the comment:

MvL also thought the “resources” term to be non-obvious: 
http://mail.python.org/pipermail/python-dev/2006-April/063966.html Other people 
mentioned its prior use within the Mac, the X system or Web frameworks.  
Someone mentioned “assets” in the game industry (also vague in my opinion).

One con for “data” is that people may think it refers to files created by a 
program in the user home directory.

After reading this, I’m -0 rather than -1 on “resources”, and +0.5 on “data 
files”.  Whatever we decide, I strongly think all the code should use only one 
name (install_xxx command, dist.xxx attribute, dist-info/XXX file, etc.).

--

___
Python tracker 

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



[issue13408] Rename packaging.resources back to datafiles

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Sounds reasonable to me.

(is it normal that there's no online help for it:

$ ./python -m pydoc packaging.resources
no Python documentation found for 'packaging.resources'
)

--
nosy: +pitrou

___
Python tracker 

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



[issue13408] Rename the packaging “resources” concept back to “data files”

2011-12-06 Thread Éric Araujo

Éric Araujo  added the comment:

The resources subsystem has code in the install_data command, the p7g.database 
module and internal classes.  There used to be a p7g.resources module but it 
was merged into database because it contained only a few lines.

--
title: Rename packaging.resources back to datafiles -> Rename the packaging 
“resources” concept back to “data files”

___
Python tracker 

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



[issue13408] Rename the packaging “resources” concept back to “data files”

2011-12-06 Thread Éric Araujo

Éric Araujo  added the comment:

Regarding reST docs, there’s a good bit in packaging/setupcfg and I have plans 
to explain it more (what it does, how it works with sysconfig.cfg, how it 
obsoletes package_data, how to use it and keep compat with distutils).

--

___
Python tracker 

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



[issue13541] HTTPResponse (urllib) has no attribute read1 needed for TextIOWrapper

2011-12-06 Thread Peter

New submission from Peter :

Use case: I want to open an HTTP URL, and treat the handle as though it were 
opened in text mode (i.e. unicode strings not bytes).

$ python3
Python 3.2 (r32:88445, Feb 28 2011, 17:04:33) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> import urllib.request
>>> f_bytes = urllib.request.urlopen("http://www.python.org";)
>>> for line in io.TextIOWrapper(f_bytes, "iso-8859-1"): print(line)
... 
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'HTTPResponse' object has no attribute 'read1'

See also Slide 122 of 
http://www.slideshare.net/dabeaz/mastering-python-3-io-version-2 which reports 
the same exception.

See also issue 5628 on a related issue, where Benjamin Peterson's issue 5628 
message 84970 suggests double wrapping with BufferIOBase [sic] to solve this, 
but neither of the following works for me:

>>> f_bytes = urllib.request.urlopen("http://www.python.org";)
>>> for line in io.TextIOWrapper(io.BufferedIOBase(f_bytes), "iso-8859-1"): 
>>> print(line)
... 
Traceback (most recent call last):
  File "", line 1, in 
io.UnsupportedOperation: not readable


>>> f_bytes = urllib.request.urlopen("http://www.python.org";)
>>> for line in io.TextIOWrapper(io.BufferedReader(f_bytes), "iso-8859-1"): 
>>> print(line)
... 
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'HTTPResponse' object has no attribute 'readinto'


Nor incidentally does this:


>>> f_bytes = urllib.request.urlopen("http://www.python.org";)
>>> for line in io.BufferedReader(f_bytes): print(line)
... 
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'HTTPResponse' object has no attribute 'readinto'


See also issue 4996.

It is entirely possible I have simply failed to understand the proper way to do 
this, so at very least an example on the urllib documentation would be a 
welcome improvement. However it is my impression that the file-like object from 
urllib is not file-like enough.

--
messages: 148928
nosy: maubp
priority: normal
severity: normal
status: open
title: HTTPResponse (urllib) has no attribute read1 needed for TextIOWrapper
versions: Python 3.2

___
Python tracker 

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



[issue13535] Improved two's complement arithmetic support: to_signed() and to_unsigned()

2011-12-06 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue13535] Improved two's complement arithmetic support: to_signed() and to_unsigned()

2011-12-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

The 'self.bit_length() >= bits' condition for to_unsigned doesn't look right to 
me.

E.g., if bits == 32, I'd expect the acceptable range of values to be 
range(-2**31, 2**31)---i.e., including -2**31, but excluding 2**31.  But the 
ValueError for 'self.bit_length() >= 32' means that -2**31 is excluded.

--

___
Python tracker 

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



[issue13535] Improved two's complement arithmetic support: to_signed() and to_unsigned()

2011-12-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

On the feature request itself, I have to say that I'm unconvinced.  Doing x % 
(2**32) seems good enough to me, in situations where you don't need the bounds 
checking.  (And it's not clear to me that needing the bounds checks is the more 
common situation.)

--

___
Python tracker 

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



[issue13535] Improved two's complement arithmetic support: to_signed() and to_unsigned()

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> On the feature request itself, I have to say that I'm unconvinced.
> Doing x % (2**32) seems good enough to me, in situations where you
> don't need the bounds checking.

Ah, I didn't know that modulo worked for that. Nice trick.

--

___
Python tracker 

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



[issue13534] test_cmath fails on ppc with glibc-2.14.90 due to optimized architecture-specific "hypot"

2011-12-06 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue13500] Hitting EOF gets cmd.py into a infinite EOF on return loop

2011-12-06 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
assignee:  -> jcea

___
Python tracker 

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



[issue13500] Hitting EOF gets cmd.py into a infinite EOF on return loop

2011-12-06 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 5910c385fab6 by Jesus Cea in branch '2.7':
Close #13500: Hitting EOF gets cmd.py into a infinite EOF on return loop
http://hg.python.org/cpython/rev/5910c385fab6

New changeset b6b4d74b8d42 by Jesus Cea in branch '3.2':
Close #13500: Hitting EOF gets cmd.py into a infinite EOF on return loop
http://hg.python.org/cpython/rev/b6b4d74b8d42

New changeset 70ba352f9586 by Jesus Cea in branch 'default':
MERGE: Close #13500: Hitting EOF gets cmd.py into a infinite EOF on return loop
http://hg.python.org/cpython/rev/70ba352f9586

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue13500] Hitting EOF gets cmd.py into a infinite EOF on return loop

2011-12-06 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

Garrett, please verify the fix.

--

___
Python tracker 

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



[issue13534] test_cmath fails on ppc with glibc-2.14.90 due to optimized architecture-specific "hypot"

2011-12-06 Thread Mark Dickinson

Changes by Mark Dickinson :


--
versions:  -Python 3.4

___
Python tracker 

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



[issue13534] test_cmath fails on ppc with glibc-2.14.90 due to buggy architecture-specific "hypot"

2011-12-06 Thread Dave Malcolm

Dave Malcolm  added the comment:

The glibc bug has been fixed in that project's git repo:
http://repo.or.cz/w/glibc.git/commit/850fb039cec802072f70ed9763927881bbbf639c

--
title: test_cmath fails on ppc with glibc-2.14.90 due to optimized 
architecture-specific "hypot" -> test_cmath fails on ppc with glibc-2.14.90 due 
to buggy architecture-specific "hypot"

___
Python tracker 

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



[issue13541] HTTPResponse (urllib) has no attribute read1 needed for TextIOWrapper

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

For the record, readinto is handled in issue 13464.

--
components: +Library (Lib)
nosy: +pitrou
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.3

___
Python tracker 

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



[issue13535] Improved two's complement arithmetic support: to_signed() and to_unsigned()

2011-12-06 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue13534] test_cmath fails on ppc with glibc-2.14.90 due to buggy architecture-specific "hypot"

2011-12-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks for the report, and all the sleuthing.  It's always good to see Python's 
test suite expose C library (or C compiler) bugs. :-)

I propose closing this as 'won't fix':  I certainly wouldn't want to add 
workarounds in the cmath source (though in theory that would be possible).  I 
don't really think it's worth adding special cases to the test-suite, either.  
What do you think?

--

___
Python tracker 

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



[issue13534] test_cmath fails on ppc with glibc-2.14.90 due to buggy architecture-specific "hypot"

2011-12-06 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue13542] Memory leak in multiprocessing.pool

2011-12-06 Thread Yang Zhang

New submission from Yang Zhang :

Calling Pool.map (and friends) on empty lists [] causes Pool._cache to hang on 
to the MapResults forever:

tp = ThreadPool(5)
xs = tp.map(lambda x: 'a' * int(10e6), range(100))
# now using 1GB mem = 100 * 10MB strs
del xs
gc.collect()
# still using 1GB mem
tp.close(); tp.join()
# now using ~0GB mem

--
components: Library (Lib)
messages: 148937
nosy: yang
priority: normal
severity: normal
status: open
title: Memory leak in multiprocessing.pool
type: resource usage
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue13542] Memory leak in multiprocessing.pool

2011-12-06 Thread Yang Zhang

Yang Zhang  added the comment:

Oops, sorry - pasted a wrong example.


In [38]: tp = ThreadPool(5)

In [39]: xs = tp.map(lambda x: x, [])

In [40]: xs
Out[40]: []

In [41]: tp._cache
Out[41]: {3: }

--

___
Python tracker 

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



[issue13464] HTTPResponse is missing an implementation of readinto

2011-12-06 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 806cfe39f729 by Antoine Pitrou in branch 'default':
Issue #13464: Add a readinto() method to http.client.HTTPResponse.
http://hg.python.org/cpython/rev/806cfe39f729

--
nosy: +python-dev

___
Python tracker 

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



[issue13464] HTTPResponse is missing an implementation of readinto

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok, thank you. I've now committed the patch in the default branch. 
Congratulations!

(since the documentation doesn't claim that HTTPResponse implements RawIOBase, 
I tend to consider this a feature request rather than a bugfix, hence no 3.2 
commit)

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
type: behavior -> feature request
versions:  -Python 3.2

___
Python tracker 

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



[issue13543] shlex with string ending in space gives "ValueError: No closing quotation"

2011-12-06 Thread ekorn

New submission from ekorn :

It seems shlex fails on processing strings ending in space, causing this bug 
that I reported for IPython:
https://github.com/ipython/ipython/issues/1109

Fernando Perez made a minimal example of the problem, quoted below. As he 
points out, it would be best to fix this at the source, namely the shlex module.

Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul  3 2011, 15:13:59) [MSC v.1500 
32 bit (Intel)] on win32
>>> import shlex
>>> lex = shlex.shlex(' ("a ")', posix=False)
>>> lex.whitespace_split = True
>>> list(lex)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\lib\shlex.py", line 269, in next
token = self.get_token()
  File "C:\Python27\lib\shlex.py", line 96, in get_token
raw = self.read_token()
  File "C:\Python27\lib\shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation

--
components: Library (Lib)
messages: 148941
nosy: ekorn
priority: normal
severity: normal
status: open
title: shlex with string ending in space gives "ValueError: No closing 
quotation"
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue13543] shlex with string ending in space gives "ValueError: No closing quotation"

2011-12-06 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge
stage:  -> needs patch

___
Python tracker 

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



[issue13543] shlex with string ending in space gives "ValueError: No closing quotation"

2011-12-06 Thread R. David Murray

R. David Murray  added the comment:

Why do you consider this to be a bug?  You set posix=False and 
whitespace_split=True, so it seems to me that according to the documented rules 
the " inside the word ("a is as documented not recognized as a quote character. 
 If you use either posix=True or whitespace_split=False the string parses 
without error.  (Since I have no idea what standard non-posix mode is based on, 
I have no idea whether or not this is in fact correct behavior, though.)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue13544] Add __qualname__ to functools.WRAPPER_ASSIGNMENTS

2011-12-06 Thread Nick Coghlan

New submission from Nick Coghlan :

functools.update_wrapper() and functools.wraps() should copy the new property 
by default.

--
keywords: easy
messages: 148943
nosy: ncoghlan
priority: release blocker
severity: normal
stage: needs patch
status: open
title: Add __qualname__ to functools.WRAPPER_ASSIGNMENTS
versions: Python 3.3

___
Python tracker 

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



[issue12555] PEP 3151 implementation

2011-12-06 Thread Nick Coghlan

Changes by Nick Coghlan :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue13390] Hunt memory allocations in addition to reference leaks

2011-12-06 Thread Meador Inge

Meador Inge  added the comment:

I looked at the 'ctypes' "leak" a bit.  I haven't determined exactly what
is going on, but the leak has something to do with a change in the patch that
runs 'dash_R_cleanup' twice instead of once.  The new behavior can be reduced
to something like:

   import sys, ctypes, gc

   ctypes._reset_cache()
   gc.collect()

   for i in range(0, 5):
   ctypes._reset_cache()
   gc.collect()
   print("%d: start refs = %s" % (i, sys.gettotalrefcount()))
   proto = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_char))
   ctypes._reset_cache()
   gc.collect()
   print("%d: after refs = %s" % (i, sys.gettotalrefcount()))

which prints:

   0: start refs = 71395
   0: after refs = 71462
   1: start refs = 71463
   1: after refs = 71493
   2: start refs = 71465
   2: after refs = 71494
   3: start refs = 71465
   3: after refs = 71494
   4: start refs = 71465
   4: after refs = 71494

Note that the start/after refs converge on a difference of 29 references.

The existing version 'regrtest.py' does something like:

   import sys, ctypes, gc

   ctypes._reset_cache()
   gc.collect()

   for i in range(0, 5):
   print("%d: start refs = %s" % (i, sys.gettotalrefcount()))
   proto = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_char))
   ctypes._reset_cache()
   gc.collect()
   print("%d: after refs = %s" % (i, sys.gettotalrefcount()))

which prints:

   0: start refs = 71391
   0: after refs = 71458
   1: start refs = 71458
   1: after refs = 71489
   2: start refs = 71489
   2: after refs = 71490
   3: start refs = 71490
   3: after refs = 71490
   4: start refs = 71490
   4: after refs = 71490

This one converges on a difference of zero.

So, I am not sure whether there really is a leak, if this is just
a very senstive area of 'regrtest.py', or something else I am missing.

--

___
Python tracker 

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



[issue13390] Hunt memory allocations in addition to reference leaks

2011-12-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> So, I am not sure whether there really is a leak, if this is just
> a very senstive area of 'regrtest.py', or something else I am missing.

Well, test_ctypes seems to be the only test exhibiting that behaviour.
And since your script reproduces it, it's probably not regrtest.py in
itself.

--

___
Python tracker 

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



[issue8641] IDLE 3 doesn't highlights b"", but u""

2011-12-06 Thread Roger Serwy

Roger Serwy  added the comment:

I applied the patch against the latest version in the repository and it works 
correctly.

--
nosy: +serwy
type:  -> behavior
versions: +Python 3.2, Python 3.3

___
Python tracker 

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



[issue11838] IDLE: make interactive code savable as a runnable script

2011-12-06 Thread Roger Serwy

Roger Serwy  added the comment:

This issue relates to #1178

A traceback does not necessarily mean that the last statement had the error. 
For example:

>>> a = lambda: 1/0
>>> a()

Traceback (most recent call last):
  File "", line 1, in 
a()
  File "", line 1, in 
a = lambda: 1/0
ZeroDivisionError: integer division or modulo by zero

I suppose that the specification should be extended such that the above to get 
transformed to:

a = lambda: 1/0
#ERROR>>> a()
#
#Traceback  (most recent call last):
#

or something similar. Thoughts?

--

___
Python tracker 

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



[issue11051] system calls per import

2011-12-06 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue13511] ./configure --includedir, --libdir accept multiple

2011-12-06 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

You should request this new feature on autoc...@gnu.org or bug-autoc...@gnu.org 
mailing list.

--
nosy: +Arfrever

___
Python tracker 

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



[issue11838] IDLE: make interactive code savable as a runnable script

2011-12-06 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Interesting example. This issue is a bit more complicated than I thought. 
Clearly, the call that reveals an error in previous lines should not be simply 
deleted.

--

___
Python tracker 

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



[issue11682] PEP 380 reference implementation for 3.3

2011-12-06 Thread Ron Adam

Ron Adam  added the comment:

There is a test for 'yield from' as a function argument without the extra 
parentheses.

  f(yield from x)

You do need them in the case of a regular yield.

  f((yield))   or f((yield value))

Shouldn't the same rule apply in both cases?

* I'm trying to do a version of the patch with 'yield_from' as a separate item 
from 'yield' in the grammar, but it insists on the parentheses due to it being 
a yield_expr component.

--
nosy: +ron_adam

___
Python tracker 

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