[issue12920] inspect.getsource fails to get source of local classes

2011-09-10 Thread Popa Claudiu

Popa Claudiu pcmantic...@gmail.com added the comment:

I forgot to mention that I executed this code directly in IDLE. It seems to 
work perfectly on command line though.

--

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



[issue12940] Cmd example using turtle left vs. right doc-bug

2011-09-10 Thread Roundup Robot

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

New changeset 1ab62d3b96d2 by Ezio Melotti in branch '3.2':
#12940: fix cmd example.  Patch by Tim Chase.
http://hg.python.org/cpython/rev/1ab62d3b96d2

New changeset b239b7d9f752 by Ezio Melotti in branch 'default':
#12940: merge with 3.2.
http://hg.python.org/cpython/rev/b239b7d9f752

--
nosy: +python-dev

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



[issue12940] Cmd example using turtle left vs. right doc-bug

2011-09-10 Thread Ezio Melotti

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

Fixed, thanks for the report and the patch!
2.7 doesn't have the example, so there's nothing to fix there.

--
assignee: docs@python - ezio.melotti
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
versions: +Python 3.2

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



[issue12942] Shebang line fixer for 2to3

2011-09-10 Thread Vlada Peric

Changes by Vlada Peric vlada.pe...@gmail.com:


--
nosy: +VPeric

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



[issue12926] tarfile tarinfo.extract*() broken with symlinks

2011-09-10 Thread Lars Gustäbel

Changes by Lars Gustäbel l...@gustaebel.de:


--
assignee:  - lars.gustaebel

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



[issue12951] List behavior is different

2011-09-10 Thread Amaury Forgeot d'Arc

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

See also 
http://docs.python.org/faq/programming.html#how-do-i-create-a-multidimensional-list

--
nosy: +amaury.forgeotdarc

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



[issue12936] armv5tejl: random segfaults in getaddrinfo()

2011-09-10 Thread Charles-François Natali

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

 No such luck. Somehow gdb doesn't dump the core file:

What do
$ /sbin/sysctl -a | grep kernel.core

And
$ grep core /etc/security/limits.conf

return?

--

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



[issue12955] urllib2.build_opener().open() is not friendly to with ... as:

2011-09-10 Thread Valery Khamenya

New submission from Valery Khamenya khame...@gmail.com:

The following intuitive construction

with urllib2.build_opener().open() as:
...

leads to AttributeError: addinfourl instance has no attribute '__exit__'

http://docs.python.org/library/urllib2.html says almost nothing about concept 
of closing.

Could it be possible to add a canonical with ... as: example for 
urllib2.build_opener() ?

Thanks,
Valery

--
assignee: docs@python
components: Documentation, IO, Library (Lib)
messages: 143836
nosy: Valery.Khamenya, docs@python
priority: normal
severity: normal
status: open
title: urllib2.build_opener().open() is not friendly to with ... as:
type: resource usage
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

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



[issue12955] urllib2.build_opener().open() is not friendly to with ... as:

2011-09-10 Thread Ezio Melotti

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


--
nosy: +ezio.melotti, orsenthil

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



[issue11457] Expose nanosecond precision from system calls

2011-09-10 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

[about adding float128]
 I realize a new float type would be a major undertaking

That's an understatement and a half.  The only way this could ever be viable is 
if float128 support becomes widespread enough that we don't have to write our 
own algorithms for basic float128 operations;  even then, it would still be a 
massive undertaking.  MPFR provides these operations, but it's LGPL.

I don't see this happening in the forseeable future.

--

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



[issue12927] test_ctypes: segfault with suncc

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

I see what is going on.  I don't think the 'libffi' code can be executed 
correctly when built by 'suncc'.  The code currently requires 
'__attribute__((regparm(1)))', which AFAICT is not implemented by 'suncc';  
only 'gcc'.

Take a look at 'ffi_closure_SYSV_inner' in 
'Modules/_ctypes/libffi/src/x86/ffi.c':

void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
 __attribute__ ((regparm(1)));

...

/* This function is jumped to by the trampoline */

unsigned int FFI_HIDDEN
ffi_closure_SYSV_inner (closure, respp, args)
 ffi_closure *closure;
 void **respp;
 void *args;
{
  /* our various things...  */
  ffi_cif   *cif;
  void **arg_area;

  cif = closure-cif;
  arg_area= (void**) alloca (cif-nargs * sizeof (void*));

The '__attribute__ ((regparm(1)))' causes the first parameter to be passed in a 
register and the rest of the parameters to be spilled to the stack.  For most 
(all?) x86 compilers, '%eax' is the first register used to pass parameters when 
the calling convention requires registers.

'suncc' ignores this attribute (you can see warnings by greping the build logs) 
and expects 'closure' to be on the stack where as the trampoline code puts it 
in '%eax'.  This causes a bogus 'closure' and a huge value for 'cif-nargs', 
which overflows the stack with 'alloca'.

If you build Python on OpenSolaris with 'gcc' (pkg install gcc-dev), then 
everything works fine.  Does 'libffi' claim to support Solaris Studio?  If not, 
then this can be closed.

Also see issue1544339.  This issue was run into there as well (although no one 
ever really diagnosed it).

--
nosy: +meadori

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



[issue12927] test_ctypes: segfault with suncc

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

According to the latest release notes 
(https://github.com/atgreen/libffi/blob/master/README) the Solaris compiler 
should be supported for building:

3.0.10 Aug-23-11
Add support for Apple's iOS.
Add support for ARM VFP ABI.
Add RTEMS support for MIPS and M68K.
Fix instruction cache clearing problems on
ARM and SPARC.
Fix the N64 build on mips-sgi-irix6.5.
Enable builds with Microsoft's compiler.
Enable x86 builds with Oracle's Solaris compiler.
Fix support for calling code compiled with Oracle's Sparc
Solaris compiler.
Testsuite fixes for Tru64 Unix.
Additional platform support.

So 'x86' builds work with 'suncc', but I guess no runtime testing was 
performed, which is consistent with 
(http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.11).  I will open a 
bug with 'libffi'.

--

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



[issue12936] armv5tejl: random segfaults in getaddrinfo()

2011-09-10 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

This is slightly embarrassing: The partition containing the qemu images
was full. I don't encounter this often, so it tends to be the last thing
I think of.

Proudly presenting a core dump. Since the segfault occurs in
libpthread, I suggest we close this. What do you think?


gdb ./python ./build/test_python_2217/core


Core was generated by `./python -m test -uall -r --randseed=8304772'.
Program terminated with signal 11, Segmentation fault.
[New process 2217]
#0  0x400356f4 in raise () from /lib/libpthread.so.0
(gdb) bt
#0  0x400356f4 in raise () from /lib/libpthread.so.0
#1  0x400356d8 in raise () from /lib/libpthread.so.0
Backtrace stopped: frame did not save the PC
(gdb)

--

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



[issue12956] 2.7.2 build fails with --enable-framework and space in pathname on OS X 10.7.1

2011-09-10 Thread LMO

Changes by LMO rayco...@gmail.com:


--
components: Build
nosy: rzn8tr
priority: normal
severity: normal
status: open
title: 2.7.2 build fails with --enable-framework and space in pathname on OS X 
10.7.1
versions: Python 2.7

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



[issue12927] test_ctypes: segfault with suncc

2011-09-10 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Nice debugging work! I compiled --with-system-ffi and there the
issue seems fixed.

Do we have a libffi-3.0.10 release candidate in Modules/_ctypes?
The README says libffi-3.0.10, but the last commit for ffi.c was
17 months ago:

http://hg.python.org/cpython/log/b239b7d9f752/Modules/_ctypes/libffi/src/x86/ffi.c

--

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



[issue12301] Use :data:`sys.thing` instead of ``sys.thing`` throughout

2011-09-10 Thread Bryce Verdier

Bryce Verdier bryceverd...@gmail.com added the comment:

No worries, I totally understand. I was working on it a little bit at a time, 
as life would allow. And being probably more thorough than I needed to be. Here 
is the patch of everything that I've accomplished. Hope this helps.

--
keywords: +patch
Added file: http://bugs.python.org/file23125/issue-12031.patch

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



[issue12914] Add cram function to textwrap

2011-09-10 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

This pretty well summarizes my vague feelings. I originally used a size 30 in 
my example, getting 'This sentence...made available' and then realized that it 
was a complete accident that I got complete words. If anything were made 
publicly available, I might like a more sophisticated algorithm. I think other 
things in pydoc are more worth of consideration. So I am now -.5 or more and 
would not mind closing this one of the four new pydoc exposure issues.

--

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



[issue6560] socket sendmsg(), recvmsg() methods

2011-09-10 Thread Michael Schurter

Changes by Michael Schurter m...@schmichael.com:


--
nosy: +schmichael

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



[issue12957] mmap.resize changes memory address of mmap'd region

2011-09-10 Thread Michael Schurter

New submission from Michael Schurter m...@schmichael.com:

Since mmap.resize uses MREMAP_MAYMOVE on Linux, it would be nice to warn users 
that pointers into their memory mapped regions will be invalid after resizes. 
Linux's manpage offers the following explanation:

If the mapping is relocated, then absolute pointers into the old mapping 
location become invalid (offsets relative to the starting address of the 
mapping should be employed).

Since the only way I know of to use pointers into mmaps from pure Python is to 
use ctypes.type.from_buffer(mmap), perhaps clarification would be better in 
the ctypes docs.

--
assignee: docs@python
components: Documentation
files: killctypes.py
messages: 143845
nosy: docs@python, schmichael
priority: normal
severity: normal
status: open
title: mmap.resize changes memory address of mmap'd region
type: feature request
versions: Python 2.7
Added file: http://bugs.python.org/file23126/killctypes.py

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



[issue12957] mmap.resize changes memory address of mmap'd region

2011-09-10 Thread Alex Gaynor

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


--
nosy: +alex

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



[issue12880] ctypes: clearly document how structure bit fields are allocated

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Another example of desperately needed documentation: issue12945.

--
components: +ctypes

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



[issue12945] ctypes works incorrectly with _swappedbytes_ = 1

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Pavel, I looked into to this a little more and have some ideas.  First off, 
'_swappedbytes_' is an undocumented implementation detail that is used to 
implement the LittleEndianStructure and BigEndianStructure types.  So using it 
directly like that is not expected to work.  If you want to change the 
endianity of the layout, then use LittleEndianStructure or BigEndianStructure 
instead.

Next, consider your test case when removing '_swappedbytes_' and using a 
LittleEndianStructure.  I am using a Linux hosted Python which lays out the 
structures in a manner similar to GCC.  This gives a layout like:

 ---
 | unsigned short   | unsigned short   |
 ---
 |     |
 ---
 | 00010010 00110100 01010110 0000 |
 ---

'a', 'b', and 'c' all get expanded into one 'unsigned short'.  Then 'd' has 
to go in an 'unsigned short' as well leaving one byte left over with don't 
cares.

Similarly, the big endian layout looks like:

 ---
 | unsigned short   | unsigned short   |
 ---
 |     |
 ---
 | 00010010 00110100 01010110 0000 |
 ---

All of this is really a roundabout way of saying that the documentation for 
ctypes structure layout stinks.  issue12880 has been opened to fix it.

Does this seem reasonable to you?

--

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



[issue12927] test_ctypes: segfault with suncc

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

I am not sure, but it does seem that way considering the most recent libffi 
says that 3.0.10 was released on Aug-23-11.  What is the process for updating 
libffi anyway?

Also, I posted a question concerning the Solaris Studio support on 
libffi-discuss: http://sourceware.org/ml/libffi-discuss/2011/msg00185.html.

--

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



[issue12945] ctypes works incorrectly with _swappedbytes_ = 1

2011-09-10 Thread Pavel Boldin

Pavel Boldin boldin.pa...@gmail.com added the comment:

Yes. Thanks. But here is another error:

import ctypes


class X(ctypes.Structure):
_pack_ = 1
_fields_ = [
('a', ctypes.c_ubyte, 4),
('b', ctypes.c_ubyte, 4),
('c', ctypes.c_ushort, 4),
('d', ctypes.c_ushort, 12),
]

buf = '\x12\x34\x56\x78'
x = X.from_buffer_copy(buf)

print X.a
print X.b
print X.c
print X.d

print x.a == 2
print x.b == 1
print x.c == 4
print x.d == 0x563


Prints (python 2.7.1):
True
True
True
False

Can you reproduce this?

--

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



[issue12945] ctypes works incorrectly with _swappedbytes_ = 1

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Yes I can.  This seems strange, but it is correct.  The little endian case look 
like:

 Little endian
 ---
 | unsigned short   | unsigned short   |
 ---
 |     |
 ---
 | 00010010 00110100 01010110 0000 |
 ---

where the 'd' bits pack from left to right, so '1000 01010110'.
The big endian case look like:

 Big endian
 ---
 | unsigned short   | unsigned short   |
 ---
 |     |
 ---
 | 00010010 00110100 01010110 0000 |
 ---

where the 'd' bits pack from right to left, so '01010110 0111'.

The native case (Structure) can typically be verified using your host C 
compiler.  For example, the above code can be represented in C as:

#include stdio.h

struct T
{
  unsigned char  a : 4;
  unsigned char  b : 4;
  unsigned short c : 4;
  unsigned short d : 12;
};

int main (int argc, char **argv)
{
  unsigned char bytes[] = {0x12, 0x34, 0x56, 0x78};
  struct T *t = (struct T*)bytes;

  printf (%X\n, t-a);
  printf (%X\n, t-b);
  printf (%X\n, t-c);
  printf (%X\n, t-d);
}

With respect to structure layout, ctypes typically behaves the same way as the 
native compiler used to build the interpreter.

--

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



[issue12881] ctypes: segfault with large structure field names

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Ping.  Any thoughts on this one?

--

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



[issue12483] CThunkObject_dealloc should call PyObject_GC_UnTrack?

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

This patch seems reasonable, is consistent with the GC docs, and passed all 
regression tests.  Can someone apply?

--
nosy: +amaury.forgeotdarc, belopolsky, meadori
stage:  - patch review
type:  - behavior

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



[issue12943] tokenize: add python -m tokenize support back

2011-09-10 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Patch against tip.

--
assignee:  - docs@python
components: +Documentation
keywords: +needs review, patch
nosy: +docs@python
stage: needs patch - patch review
Added file: http://bugs.python.org/file23127/issue12943.patch

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



[issue12958] test_socket failures on Mac OS X

2011-09-10 Thread Nick Coghlan

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

Several of the new socket tests introduced in #6560 are failing on the Mac OS X 
buildbots. These appear to be due to platform problems rather than anything in 
the test suite or the new sendmsg/recvmsg code, but it would be good if a 
developer on Mac OS X could take a closer look at them.

To avoid polluting the buildbot results, the affected tests will be flagged as 
expected failures when run on Mac OS X (this isn't in the repo yet, but once it 
is, the tests will be marked with anticipate_failure in the test_socket code).

--
components: Library (Lib)
messages: 143854
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: test_socket failures on Mac OS X
type: behavior
versions: Python 3.3

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



[issue6560] socket sendmsg(), recvmsg() methods

2011-09-10 Thread Nick Coghlan

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

Closing the feature request as complete. The remaining Mac OS X buildbot issues 
now have their own tracker item: #12958

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
superseder:  - test_socket failures on Mac OS X

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