[issue5364] documentation in epub format

2011-12-05 Thread James Polley

James Polley jamezpol...@gmail.com added the comment:

It looks like the first release that had epub support was 1.0; docs.python.org 
is still using 0.6.7, according to the footer on the bottom of the page.

I suspect that this is (A) pending the upgrade to 1.0.0, which is (B) more 
difficult than it sounds like, or at least, needs someone to make a concerted 
effort, and (C) should automatically just happen (or at least, be fairly 
trivial) once the move to the new version happens.

--

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



[issue5364] documentation in epub format

2011-12-05 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Hello James,
please note that EPUB is already available for Python 3 documentation: 
http://docs.python.org/py3k/download.html . We will probably make it available 
also for 2.7 when I'll find the time to work on upgrading sphinx on 2.7 branch.

--
nosy: +sandro.tosi

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



[issue13443] wrong links and examples in the functional HOWTO

2011-12-05 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

This section has been removed from the 3.x docs in 3828f81a64e7 and 
2aeef275bec8, but it's still there in 2.7.

--
nosy: +pitrou

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



[issue13531] add test for defaultdict with non-callable first argument

2011-12-05 Thread mike c

New submission from mike c coolbutusel...@gmail.com:

Could a test be added to ./Lib/test/test_defaultdict.py to test for TypeError 
being thrown when the the first argument to collections.defaultdict is not 
callable?  

pypy does not behave the same way as CPython 2.7.2 as the problem is not 
covered in the testcases.

e.g.
def test_callable_arg:
d1 = defaultdict({})
self.assertRaises(TypeError)  # TypeError: first argument must be callable

--
components: Tests
messages: 148868
nosy: mike.c
priority: normal
severity: normal
status: open
title: add test for defaultdict with non-callable first argument
versions: Python 2.7

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



[issue13531] add test for defaultdict with non-callable first argument

2011-12-05 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Sure, do you want to propose a patch?  (You can see the devguide for more 
information.)

--
keywords: +easy
nosy: +ezio.melotti
stage:  - test needed
versions: +Python 3.2, Python 3.3

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



[issue13531] add test for defaultdict with non-callable first argument

2011-12-05 Thread mike c

mike c coolbutusel...@gmail.com added the comment:

Cloning repo. Reading the devguide.  Patch forthcoming.

--

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



[issue13531] add test for defaultdict with non-callable first argument

2011-12-05 Thread mike c

mike c coolbutusel...@gmail.com added the comment:

Patch to add a defaultdict test which checks that if the first argument is not 
callable, then a TypeError is thrown.

--
keywords: +patch
Added file: http://bugs.python.org/file23855/defaultdict_callable_test.patch

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



[issue13531] add test for defaultdict with non-callable first argument

2011-12-05 Thread mike c

mike c coolbutusel...@gmail.com added the comment:

patch v2. Now with assertRaises()!

--
Added file: http://bugs.python.org/file23856/defaultdict_callable_test_v2.patch

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



[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

2011-12-05 Thread maniram maniram

New submission from maniram maniram maniandra...@gmail.com:

In IDLE, sys.stdout.write and sys.stderr can write any pickleable object such 
as 100 when they should only allow strings.
IDLE seems to be pickling the object.
 import sys
 sys.stdout.write(100)
100
 sys.stdout.write(sys)
Traceback (most recent call last):
  File pyshell#2, line 1, in module
sys.stdout.write(sys)
_pickle.PicklingError: Can't pickle class 'module': attribute lookup 
builtins.module failed
The error above is more detailed in IDLE 2.7.
While in Python on the command-line:
 import sys
 sys.stdout.write(100)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: must be str, not int
 
The error above in Python 2.7:
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: expected a character buffer object

--
components: IDLE
messages: 148873
nosy: maniram.maniram
priority: normal
severity: normal
status: open
title: In IDLE, sys.stdout.write and sys.stderr can write any pickleable object
type: behavior
versions: Python 2.7, Python 3.2

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



[issue12944] Accept arbitrary files for packaging's upload command

2011-12-05 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Someone from the mentoring project has volunteered to work on a patch.

--

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



[issue13533] Would like Py_Initialize to play friendly with host app

2011-12-05 Thread dangermouseb

New submission from dangermouseb da...@bigredmedia.tv:

I'm building a dll add-in (on Windows) in which I want to use the installed 
version of Python, not provide my own installation. When py_initialize fails it 
appears to call exit(). This doesn't seem very friendly behaviour for an 
embeddable scripting language as the host application is terminated (out of my 
control).

So my request is that either py_initialize is changed to return a code 
indicating failure or sucess or another function is added to th api to test if 
the installation is good or not. That way I can report to the user that there 
is a problem in the python installation rather than apparently crashing the 
host app.

Currently the only strategy I've thought of to get around this is to fork a 
seperate process, and inspect it after a delay to see if it is running 
(indicating that py_initialize hasn't failed), terminate the new process and 
then call py_initialize in the host application process.

This has been raised before but only in terms of consistency with the 
documentation, not about if a embeddable scripting engine should terminate the 
hosting process without regard to that host.

Many thanks,

David

--
components: None
messages: 148875
nosy: dangermouseb
priority: normal
severity: normal
status: open
title: Would like Py_Initialize to play friendly with host app
type: feature request
versions: Python 2.7, Python 3.4

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



[issue13491] Fixes for sqlite3 doc

2011-12-05 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

The updated patch looks good, I’ll commit it soon.

--

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



[issue13491] Fixes for sqlite3 doc

2011-12-05 Thread Nebelhom

Nebelhom nebel...@googlemail.com added the comment:

Hi,

thanks for your help and support, mate.

Unfortunately, no word about the createdb.py business (the last bullet
point on the list) and whether it should be referred to in the doc. Should
we just drop this from the adjustments?

Thanks.

Johannes

P.S. Any suggestions where to look in the doc next until your packaging
patch is ready for reviewing?

On Mon, Dec 5, 2011 at 4:50 PM, Éric Araujo rep...@bugs.python.org wrote:


 Éric Araujo mer...@netwok.org added the comment:

 The updated patch looks good, I’ll commit it soon.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue13491
 ___


--

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



[issue13491] Fixes for sqlite3 doc

2011-12-05 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

 Unfortunately, no word about the createdb.py business (the last bullet point 
 on the list)
 and whether it should be referred to in the doc.
If you make the whitespace more standard, use the tempfile module (to remove 
the os.remove line) and use with statements, the file is actually very short 
(so my earlier hypothesis about createdb was wrong :).

I think we could inline it (with a literalinclude directive) or link to it 
(with :source:`Doc/include/sqlite3/createdb.py`).  Add something like “If you 
want to run these examples, run this code to create and populate the initial 
database” and we’re set.

--
nosy: +ezio.melotti

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



[issue1685453] email package should work better with unicode

2011-12-05 Thread Sivan Greenberg

Sivan Greenberg siv...@gmail.com added the comment:

I am having hard time parsing all the text/html and text/plain parts of a 
message, concatenating them into a string. I am thinking of writing some custom 
code to do manual handling of this...

If this could be fixed that would be great. The issues are converting from and 
to ascii/unicode or whatever encoding/charset the part uses.

--
nosy: +sivang

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



[issue13533] Would like Py_Initialize to play friendly with host app

2011-12-05 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

If we add a (yet another) variant of Py_Initialize, I would suggest we make it 
extensible by passing it a struct of arguments (so that the struct can be 
augmented without breaking compatibility).

--
components: +Interpreter Core -None
nosy: +pitrou
versions: +Python 3.3 -Python 2.7, Python 3.4

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



[issue1685453] email package should work better with unicode

2011-12-05 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

That particular problem will get fixed in the next version of the email package 
(hopefully in Python3.3), but that isn't ready yet.

--

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



[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Darren Dale

Darren Dale dsdal...@gmail.com added the comment:

Patch addressing latest comments in review. Notable change: defines 
_PyObject_IsAbstract in object.c/object.h, rather than repeating the code in 
multiple files and functions.

--
Added file: http://bugs.python.org/file23857/abc_descriptor.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11610
___
___
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-05 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Here's a trivial patch reducing the number of calls to open.
before:

$ strace -c -e open ./python -c 
% time seconds  usecs/call callserrors syscall
-- --- --- - - 
100.000.49   0   392   306 open
-- --- --- - - 
100.000.49   392   306 total

after:

$ strace -c -e open ./python -c 
% time seconds  usecs/call callserrors syscall
-- --- --- - - 
100.000.24   086   open
-- --- --- - - 
100.000.2486   total


As for the flury of tentative locations, I don't feel like modifying this since 
I'm not familiar enough with the import machinery.

--
keywords: +patch
nosy: +neologix
Added file: http://bugs.python.org/file23858/import_stat.diff

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



[issue13503] improved efficiency of bytearray pickling by using bytes type instead of str

2011-12-05 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset e2959a6a1440 by Antoine Pitrou in branch 'default':
Issue #13503: Use a more efficient reduction format for bytearrays with
http://hg.python.org/cpython/rev/e2959a6a1440

--
nosy: +python-dev

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



[issue13503] improved efficiency of bytearray pickling by using bytes type instead of str

2011-12-05 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

The patch wasn't entirely PEP 7-compliant (spaces around operators, space after 
if), but I've fixed that when committing. Thank you!

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue13533] Would like Py_Initialize to play friendly with host app

2011-12-05 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13533
___
___
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-05 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

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



[issue11147] _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h

2011-12-05 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

Confirmed, and this is really annoying.  I'm of the mind to apply your second 
idea.

--
nosy: +barry

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



[issue11147] _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h

2011-12-05 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

Sorry, I meant your first option.

--

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



[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

2011-12-05 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Why do you think this is a bug? Is this behavior causing problems?

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13532
___
___
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-05 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 First, I don't understand why we need to check both foo.so and
 foomodule.so.

Because we always did, i.e. changing it now may break backwards compatibility. 
Now, as for why we always had *module.so also: it may be that calling an 
extension module foo.so might not be feasible if it needs to link with a system 
library called foo.so (rather than libfoo.so). 

I don't know how serious this problem is in practice - we may consider 
deprecating-then-removing *module.so from the import machinery.

As for checking both foo.so and foo.cpython-32m.so: that's for backwards 
compatibility also. Existing build processes may produce foo.so, as they did in 
previous Python versions (in particular, if they are not based on distutils, 
but, say, make). Unfortunately, PEP 3149 did not specify a deprecation 
scheduling. You could ask Barry - I suppose that was an oversight, and not 
actually deliberate.

Of course, with .cpython-32m.so being present, removing *module.so would be 
easy enough, except again for breaking existing projects which might use that 
name.

--

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



[issue11147] _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h

2011-12-05 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue11147] _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h

2011-12-05 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 4579cd952156 by Barry Warsaw in branch '3.2':
- Issue #11147: Fix an unused argument in _Py_ANNOTATE_MEMORY_ORDER.  (Fix
http://hg.python.org/cpython/rev/4579cd952156

New changeset 6b6c79eba944 by Barry Warsaw in branch 'default':
- Issue #11147: Fix an unused argument in _Py_ANNOTATE_MEMORY_ORDER.  (Fix
http://hg.python.org/cpython/rev/6b6c79eba944

--
nosy: +python-dev

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



[issue11886] test_time.test_tzset() fails on x86 FreeBSD 7.2 3.x: AEST timezone called EST

2011-12-05 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Alex ? Florent ?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11886
___
___
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-05 Thread Dave Malcolm

New submission from Dave Malcolm dmalc...@redhat.com:

On ppc64, on this box, with glibc-2.14.90-19.ppc64, test_cmath fails with:

==
FAIL: test_specific_values (test.test_cmath.CMathTests)
--
Traceback (most recent call last):
  File /builddir/build/BUILD/Python-2.7.2/Lib/test/test_cmath.py, line 352,
in test_specific_values
msg=error_message)
  File /builddir/build/BUILD/Python-2.7.2/Lib/test/test_cmath.py, line 112,
in rAssertAlmostEqual
'{!r} and {!r} are not sufficiently close'.format(a, b))
AssertionError: acos0200: acos(complex(1.620686051868302e+308,
1.0308426226285283e+308))
Expected: complex(0.5665082609382622, -710.5420687424156)
Received: complex(0.5665082609382622, -inf)
Received value insufficiently close to expected value.

It turns out (after much debugging) that libm in this version of glibc has an 
architecture-specific implementation of hypot(3) which returns inf in many of 
the test cases in tests/cmath_testcases.txt, when the non-architecture-specific 
implementation returns large finite values.

See downstream bug in Fedora's bug tracker:
  https://bugzilla.redhat.com/show_bug.cgi?id=750811
for more details.

Seen with the Python 2.7.2 tarball, but the code doesn't appear to have changed 
in hg in either the default or the 2.7 branches.

I will also file a bug in glibc's bug tracker about this.

--
components: Tests
messages: 148893
nosy: dmalcolm
priority: normal
severity: normal
status: open
title: test_cmath fails on ppc with glibc-2.14.90 due to optimized 
architecture-specific hypot
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13534
___
___
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-05 Thread Dave Malcolm

Dave Malcolm dmalc...@redhat.com added the comment:

Reported in glibc's bug tracker as:
  http://sourceware.org/bugzilla/show_bug.cgi?id=13472

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13534
___
___
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-05 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Here's a trivial patch reducing the number of calls to open.

Looks good to me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11051
___
___
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-05 Thread Nick Coghlan

New submission from Nick Coghlan ncogh...@gmail.com:

This RFE proposes two new methods to_signed and to_unsigned on 'int' 
objects and on the numbers.Integral ABC.

Semantics (and number.Integral implementation):

def to_unsigned(self, bits):
  Convert this integer to its unsigned two's complement equivalent for the 
given bit length
  if self.bit_length() = bits:
   raise ValueError({} is too large for {}-bit two's complement
precision.format(self, bits))
  if self = 0:
   return self
  return 2**bits + self # self is known to be negative at this point

def to_signed(self, bits):
  Convert an integer in two's complement format to its signed equivalent for 
the given bit length
  if self  0:
   raise ValueError({} is already signed.format(self))
  if self.bit_length()  bits:
   raise ValueError({} is too large for {}-bit two's complement
precision.format(self, bits))
  upper_bound = 2**bits
  if self  (upper_bound / 2):
 return self
  return upper_bound - self

To add these methods to numbers.Integral, a concrete 
numbers.Integral.bit_length() operation will also be needed. This can be 
implemented simply as:

def bit_length(self):
return int(self).bit_length()

(Initial concept from this python-ideas thread: 
http://mail.python.org/pipermail/python-ideas/2011-December/012989.html)

--
components: Interpreter Core, Library (Lib)
messages: 148896
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Improved two's complement arithmetic support: to_signed() and 
to_unsigned()
type: feature request
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13535
___
___
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-05 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13535
___
___
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-05 Thread Alex Gaynor

New submission from Alex Gaynor alex.gay...@gmail.com:

In 2.7 ast.literal_eval blows up with a set for input:


 import ast
 ast.literal_eval({1})

--
messages: 148897
nosy: alex
priority: low
severity: normal
status: open
title: ast.literal_eval fails on sets
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
___
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-05 Thread Alex Gaynor

Alex Gaynor alex.gay...@gmail.com added the comment:

Patch with tests

--
keywords: +patch
Added file: http://bugs.python.org/file23859/x.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
___
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-05 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
___
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-05 Thread Brian Curtin

Brian Curtin br...@python.org added the comment:

I don't profess to have any special ast knowledge, but given the context around 
there and the fact that it works...it looks fine to me.

--
nosy: +brian.curtin

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
___
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-05 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13535
___
___
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-05 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Dict and Set comprehensions are also broken:

 {1 for x in ()}
set([])
 {1:2 for x in ()}
{}
 ast.literal_eval({1 for x in ()})
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib64/python2.7/ast.py, line 80, in literal_eval
return _convert(node_or_string)
  File /usr/lib64/python2.7/ast.py, line 79, in _convert
raise ValueError('malformed string')
ValueError: malformed string
 ast.literal_eval({1:2 for x in ()})
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib64/python2.7/ast.py, line 80, in literal_eval
return _convert(node_or_string)
  File /usr/lib64/python2.7/ast.py, line 79, in _convert
raise ValueError('malformed string')
ValueError: malformed string

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
___
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-05 Thread Alex Gaynor

Alex Gaynor alex.gay...@gmail.com added the comment:

There's no support for comprehensions of any sort, and confusingly limited 
support for arithmetic ops, I'd like to keep the scope of this issue small, 
basically backporting 90bf0631bfb8 and adding the tests (which I can also add 
to default).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
___
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-05 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
resolution:  - invalid
status: open - closed
superseder:  - ast.literal_eval does not handled new set literals

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




[issue13503] improved efficiency of bytearray pickling by using bytes type instead of str

2011-12-05 Thread Alexandre Vassalotti

Alexandre Vassalotti alexan...@peadrop.com added the comment:

Antoine, do we have unit tests for this code path?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13503
___
___
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-05 Thread Alexandre Vassalotti

Alexandre Vassalotti alexan...@peadrop.com added the comment:

This might not be the case anymore, but __module__ can sometime be None. There 
is some discussion about this in Issue 3657. We should define the expected 
behavior when this happens.

Also, I don't think backward-compatibility of the protocol is a big issue if we 
use the getattr approach. I feel bumping the protocol version is only necessary 
if we introduce new opcodes or change their interpretation.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13520
___
___
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-05 Thread Alexandre Vassalotti

Alexandre Vassalotti alexan...@peadrop.com added the comment:

I think we are kind of stuck here. I might need to rely on some clever hack to 
generate the desired str object in 2.7 without breaking the bytes support in 
3.3 and without changing 2.7 itself.

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

from array import array

class bytes:
def __reduce__(self):
return (array.tostring, (array('B', self),))

Of course, this doesn't work because pickle doesn't method pickling. But, maybe 
someone can figure out a way around this... I don't know.

Also, this is a bit annoying to fix since we changed the semantic meaning of 
the STRING opcodes in 3.x---i.e., it now represents a unicode string instead of 
a byte string.

--

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



[issue3635] pickle.dumps cannot save instance of dict-derived class that overrides __getattribute__

2011-12-05 Thread Alexandre Vassalotti

Alexandre Vassalotti alexan...@peadrop.com added the comment:

I don't think it is a bug.

The posted code completely breaks the expected behavior of __getattribute__. 
With a such implementation, there is nothing we can do with this object as we 
cannot introspect it.

Use the following if you really need this kind of behaviour:

class E(dict):
def __getattribute__(self,name):
try:
return self[name]
except KeyError:
return dict.__getattribute__(self, name)

--
resolution:  - works for me
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3635
___
___
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-05 Thread Marco Scataglini

Marco Scataglini atlant...@gmx.com added the comment:

I agree with Anatoly that it should be an easy way to create and apply Unified 
Diff Patches within Python. Also issue 2142 should get fixed, as proposed, but 
also include the fix at least on 2.7 not only on 3.x

--
nosy: +marco

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



[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

2011-12-05 Thread maniram maniram

maniram maniram maniandra...@gmail.com added the comment:

It is different behaviour than usual.
I agree it is of low importance.

--

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



[issue13530] Docs for os.lseek neglect to mention what it returns

2011-12-05 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
nosy: +eli.bendersky

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



[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: http://bugs.python.org/file23819/abc_descriptor.patch

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



[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: http://bugs.python.org/file22729/abc_descriptor.patch

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



[issue11610] Improved support for abstract base classes with descriptors

2011-12-05 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: http://bugs.python.org/file22407/abc_descriptor.patch

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