[issue16202] sys.path[0] security issues

2012-10-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Definite +1 on distutils needing to be fixed in the upcoming maintenance 
releases for 2.7, 3.2 and 3.3.

-1 on doing the strict path security checks on a normal invocation, -0 on doing 
them when -S or -E have been passed in, +0 if it is *just* a warning to users 
that they're doing something risky, but proceeds with normal (backwards 
compatible) sys.path initialisation.

For 3.4, I plan to have a look at the organically-grown-over-time mess that is 
CPython's current interpreter initialisation system and see if I can figure out 
something a bit more sane and easier to configure/control (especially when 
embedding Python in a larger application) :P

--

___
Python tracker 

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



[issue16209] add a "class str" entry to the docs

2012-10-12 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Let me start over with what I'm suggesting, because the idea wasn't fully 
developed when I first filed this issue.

I'm thinking that we should create a class entry for str that contains the 
current string methods nested beneath it -- a bit like issue 12901. :)  In 
conjunction with that, we should move the documentation of the str() function 
to the constructor for that class entry.  All str links throughout the 
documentation would go to the class entry, and the built-in function str() 
would be a stub entry that also links to the class entry.  That's how we do it 
for dict, for example:

http://docs.python.org/dev/library/functions.html#func-dict

One reason is practical.  By doing the above, clicking "str" anywhere in the 
docs will take you to the documentation for both the function str() and the 
string methods.  When I was first learning Python, it was very common for me to 
look up the "String Methods" section.  But looking them up never seemed as 
convenient as it should be because they were in a different location.  I always 
had to remember they were an extra click or two away in a separate "String 
Methods" section.

In 3.3 we made a bit of progress on this by giving the string type its own 
section:

http://docs.python.org/dev/library/stdtypes.html#text-sequence-type-str

But we could go further by doing what we do for list, tuple, set, memoryview, 
range, etc. and put the documentation of the str() function and its methods 
next to each other in the same location.

--

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-12 Thread Tim Peters

Tim Peters added the comment:

Matthew, Guido wrote "check that the whole input string matches" (or slice if 
pos and (possibly also) endpos is/are given).  So, yes, \Z is more to the point 
than $ if people want to continue wasting time trying to implement this as a 
Python-level function ;-)

I don't understand what you're asking about MULTILINE.  What's the issue there? 
 Focus on Guido's "whole input string matches", not on his motivational talk 
about "a regex ending in $".  $ and/or \Z aren't the point here; "whole input 
string matches" is the point.

--

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Éric Araujo

Changes by Éric Araujo :


--
assignee:  -> eric.araujo
components: +Distutils
nosy: +eric.araujo, ncoghlan, tarek

___
Python tracker 

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



[issue16209] add a "class str" entry to the docs

2012-10-12 Thread Éric Araujo

Éric Araujo added the comment:

This sort of request came up before, the last time only a few months ago if 
memory serves.  The shot answer is that str is a built-in function as well as a 
class, and trying to split hairs over that does not really add value to the 
docs.  I can dig up the issue(s) if you don't find them.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue16211] MacInstalls break PyDev

2012-10-12 Thread Ned Deily

Ned Deily added the comment:

There is *no* way to install Python using a python.org installer and *not* have 
the .py files installed.  You would have to go in and remove those files 
yourself.  You should be able to see the .py files yourself by looking at 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7. Most likely 
the IDE you are using is not using the Python instance you think it is.  To use 
a python.org Python, it would likely need to be reconfigured to use 
/usr/local/bin/python2.7 or 
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7.

If you still think there is a problem, please enumerate the steps you are 
performing and explain exactly what failure you are seeing.  Also, include the 
results of running the following in the failing configuration:

import sys
print(sys.executable)
print(sys.path)
print(sys.version)

--

___
Python tracker 

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



[issue16211] MacInstalls break PyDev

2012-10-12 Thread Doug Ransom

Doug Ransom added the comment:

The problem described was in respect to the python installed by the installer 
from python.org, not the python that ships with mac.  Using OSX 10.8.1.

Installing python from python.org binary installer does not fix the problem.  I 
ran the installer before submitting this bug, which is in reference to the 
installer downloaded from python.org, not what OSX Provides.  It may be that if 
OS X already installed python 2.7 the installer from python.org doesn't do 
anything. 

Installing Xcode Command Line tools also doesn't seem to work.

installing python from ports sudo port install python27 does seem to work.

Therefore, I think the problem is with the binary installer for os x.  I think 
this deserves closer inspection.

--
resolution: invalid -> 
status: closed -> open

___
Python tracker 

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



[issue16216] Arithmetic operations with NULL

2012-10-12 Thread STINNER Victor

STINNER Victor added the comment:

> I think it is unsafe to do with NULL.

Could you please elaborate?

--
nosy: +haypo

___
Python tracker 

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



[issue16216] Arithmetic operations with NULL

2012-10-12 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

In the function STRINGLIB(fastsearch_memchr_1char) in the file 
Objects/stringlib/fastsearch.h NULL returned by memchr/memrchr casted to 
intptr_t, then some arithmetic operations performed on this integer, and result 
casted back to pointer. I think it is unsafe to do with NULL. The code is easy 
to rewrite in order to avoid such a questionable operations.

--
components: Interpreter Core
files: null_align.patch
keywords: 3.3regression, patch
messages: 172791
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Arithmetic operations with NULL
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file27548/null_align.patch

___
Python tracker 

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



[issue16215] Possible double memory free in str.replace

2012-10-12 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

In the function replace() in the file Objects/unicodeobject.c possible double 
free memory pointed by buf1. release1 indicates if memory was allocated and 
deallocation needed. However there are places where memory temporary 
deallocated but flag was not cleared.

--
components: Interpreter Core
files: dbl_mem_free.patch
keywords: 3.3regression, patch
messages: 172790
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Possible double memory free in str.replace
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file27547/dbl_mem_free.patch

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Martin v . Löwis

Martin v. Löwis added the comment:

> AFAIR, the problem is that you first need to import the locale  
> module (and its dependencies) before you can decide what the  
> filesystem encoding is.

I don't think this is true. The file system encoding works fine all along,
and also doesn't have to do much with co_filename.

--

___
Python tracker 

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



[issue16086] tp_flags: Undefined behaviour with 32 bits long

2012-10-12 Thread STINNER Victor

STINNER Victor added the comment:

Can anyone review my new patch, unsigned_tp_flags-2.patch?

--

___
Python tracker 

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



[issue16201] socket.gethostbyname incorrectly parses ip

2012-10-12 Thread STINNER Victor

STINNER Victor added the comment:

> Buggy due to the use of scanf at Modueles/socketmodule.c:868

I don't think so. The following test fails because sscanf() returns 5 instead 
of 4:

if (sscanf(name, "%d.%d.%d.%d%c", &d1, &d2, &d3, &d4, &ch) == 4 && ...)

So '192.168.1.1  ' is passed to getaddrinfo().

If you consider that '192.168.1.1  ' is an invalid name, you should report the 
issue to the vendor of the C library of your OS.

--

On Linux, the "issue" is also present in inet_ntoa():

$ python
Python 2.7.3 (default, Jul 24 2012, 11:41:40) 
[GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux2
>>> import ctypes
>>> buffer=ctypes.create_string_buffer(128)
>>> libc=ctypes.cdll.LoadLibrary("libc.so.6")

>>> libc.inet_aton(b"127.0.0.1", ctypes.byref(buffer))
1
>>> buffer.raw[:4]
'\x7f\x00\x00\x01'

>>> libc.inet_aton(b"127.0.0.2   ", ctypes.byref(buffer))
1
>>> buffer.raw[:4]
'\x7f\x00\x00\x02'

The source code of the inet_aton() function of the GNU libc:

http://sourceware.org/git/?p=glibc.git;a=blob;f=resolv/inet_addr.c;h=144b87a74c1aef62779862e78e5f87e18e66ee9e;hb=HEAD#l108

Website of the GNU libc:
http://www.gnu.org/software/libc/

--
nosy: +haypo

___
Python tracker 

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



[issue16208] getaddrinfo returns wrong results if IPv6 is disabled

2012-10-12 Thread Ralf Schmitt

Ralf Schmitt added the comment:

Thanks for looking at this. loewis told me in  
http://bugs.python.org/issue7735#msg172726 the following:

"""The switch --disable-ipv6 is supported and works as intended. It is not the 
intention of the switch to disable  lookups. Instead, it disables support 
for IPv6 sockets."""

So, I expected it to work.

Can you please take a look at the issue 7735? loewis closed this as wontfix. 
And my argumentation actually involves "don't ask for IPv6 addresses if you 
disabled IPv6 support".

Anyway, I still think those bogus addresses should be filtered from the 
getaddrinfo result (if they can't be made correct).

Note that you'll also get bogus results from this call when not explicitly 
asking for IPv6 addresses (e.g. passing socket.AF_UNSPEC as the third argument).

--

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Charles-François Natali

Charles-François Natali added the comment:

> You can use file locks to be protected against such race condition.
> See for example:

Those are advisory locks, not mandatory locks.
It's possible to do some mandatory locking on some systems, but on every file, 
and it's not portable.

--

___
Python tracker 

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



[issue16208] getaddrinfo returns wrong results if IPv6 is disabled

2012-10-12 Thread STINNER Victor

STINNER Victor added the comment:

> getaddrinfo returns wrong results if IPv6 is disabled

If IPv6 support is disabled, Python is unable to decode an IPv6 address. So 
don't ask for IPv6 addresses if you disabled IPv6 support.

I don't understand this issue.

--
nosy: +haypo

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 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



[issue12268] file readline, readlines & readall methods can lose data on EINTR

2012-10-12 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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread STINNER Victor

STINNER Victor added the comment:

"Well, there are some higly non-portable ways to try to escape this (see
http://stackoverflow.com/questions/2663456/write-a-signal-handler-to-catch-sigsegv),
 but it won't fly in our case."

There is also the libsigsegv library, but it's hard and unsafe to handle such 
low level signals in Python.
http://www.gnu.org/software/libsigsegv/

"It has a race condition as another process could truncate the file between the 
fstat() check and the code lines that access the mmapped file."

You can use file locks to be protected against such race condition. See for 
example:
http://pypi.python.org/pypi/lockfile

--
nosy: +haypo

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Charles-François Natali

Charles-François Natali added the comment:

> I think, handling the signal would do.

You can't.
Handling a signal like SIGSEGV or SIGBUS in any other way that exiting
the process will result in an infinite loop (as soon as the signal
handler returns the faulty instruction will be re-executed). Well,
there are some higly non-portable ways to try to escape this (see
http://stackoverflow.com/questions/2663456/write-a-signal-handler-to-catch-sigsegv),
but it won't fly in our case.
You may want to have a look at the faulthandler module for "graceful"
shutdown, but nothing can't be done.

--

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> As for fix_co_filename, I think it would indeed be useful if
> marshal.load(s) supported an optional filename= parameter, which then
> fills rf.current_filename.

AFAIR, the problem is that you first need to import the locale module (and its 
dependencies) before you can decide what the filesystem encoding is. Until 
that, you aren't sure the filenames have been decoded correctly.

--

___
Python tracker 

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



[issue16061] performance regression in string replace for 3.3

2012-10-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The performance numbers are very nice, but the patch needs a comment about the 
optimization, IMO.

--
nosy: +pitrou

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

marshal currently has a simple, coherent, high-level interface: dump and load 
serializations.

_fix_co_filename sounds a bit hackish and ad hoc. Martin's suggestion looks to 
me like a better way to publicly expose filename setting.
Making a function public indefinitely freezes the api and behavior, so we need 
to consider if we might want to change it.

If Martin is correct as to the definition of _w_long, its a trivial one line 
convenience function that is not particularly specific to marshal and that 
could have been inlined in the code (and for all I know, is, when C compiled). 
Its existence in marshal really seems to me like an implementation detail that 
should remain private.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue16210] combine the two type() definitions in built-in function docs

2012-10-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In other words, change
'''
type(object)

Return the type of an object. ...
...
With three arguments, type() functions as a constructor as detailed below.

type(name, bases, dict)

Return a new type object
'''
to something like
'''
type(object)
type(name, bases, dict)

With one argument, return the type of an object. ...

With three arguments, return a new type object. ...
'''
Now that we are using double headers elsewhere, I agree we should do so here 
also.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue12268] file readline, readlines & readall methods can lose data on EINTR

2012-10-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 751a91e332d9 by Gregory P. Smith in branch '2.7':
Fixes Issue #12268 for the io module - File readline, readlines and
http://hg.python.org/cpython/rev/751a91e332d9

--

___
Python tracker 

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



[issue16206] dict() docs should display multiple signatures

2012-10-12 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Attaching proposed patch.

--
keywords: +patch
Added file: http://bugs.python.org/file27546/issue-16206-1-default.patch

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-12 Thread Matthew Barnett

Matthew Barnett added the comment:

'$' will match at the end of the string or just before the final '\n':

>>> re.match(r'abc$', 'abc\n')
<_sre.SRE_Match object at 0x00F15448>

So shouldn't you be using r'\Z' instead?

>>> re.match(r'abc\Z', 'abc')
<_sre.SRE_Match object at 0x00F15410>
>>> re.match(r'abc\Z', 'abc\n')
>>> 

And what happens if the MULTILINE flag is turned on?

>>> re.match(r'abc$', 'abc\ndef', flags=re.MULTILINE)
<_sre.SRE_Match object at 0x00F15448>
>>> re.match(r'abc\Z', 'abc\ndef', flags=re.MULTILINE)
>>>

--
nosy: +mrabarnett

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Brett Cannon

Brett Cannon added the comment:

_w_long and _r_long originally came from marshal; forgot I re-implemented them 
in pure Python in the end.

--

___
Python tracker 

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



[issue2350] 'exceptions' import fixer

2012-10-12 Thread Brett Cannon

Brett Cannon added the comment:

I don't remember.

--
resolution: fixed -> 
stage:  -> patch review
status: closed -> open

___
Python tracker 

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



[issue2350] 'exceptions' import fixer

2012-10-12 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Brett: Why did you close the issue? Benjamin's change was never committed...

--

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I don't understand this issue at all:

a) _bootstrap does not currently use any private API of marshal. Instead, it 
has functions _w_long and _r_long implemented in pure Python. So where is the 
special functionality that only importlib has? Anybody could easily replicate 
these functions.

b) Isn't it easy to implement it as such:

def _w_long(x):
  return x.to_bytes(4, 'little')

As for fix_co_filename, I think it would indeed be useful if marshal.load(s) 
supported an optional filename= parameter, which then fills 
rf.current_filename. It's better to load it into the correct form in the first 
place instead of fixing it after loading completed - in particular since 
marshal already has a mechanism to update all filenames.

--
nosy: +loewis

___
Python tracker 

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



[issue16214] 2to3 does not remove exceptions import

2012-10-12 Thread Chris Mayo

New submission from Chris Mayo:

Create file a.py:
#!/usr/bin/python
import exceptions

and run:
2to3 a.py
...
RefactoringTool: No files need to be modified.

Issue 2350 is marked as closed but this is still present for me in 2to3 of 
Python 2.7, 3.2 and 3.3.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 172770
nosy: cjmayo
priority: normal
severity: normal
status: open
title: 2to3 does not remove exceptions import
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



[issue16061] performance regression in string replace for 3.3

2012-10-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> The patch should be completed to optimize also other Unicode kinds.

I'm working on it.

Here are benchmark scripts which I use. First tests regular strings (replace 
every n-th char), second tests random strings (replace 1/n of  total randomly 
distributed chars).

--
Added file: http://bugs.python.org/file27544/replacebench.py
Added file: http://bugs.python.org/file27545/replacebench2.py

___
Python tracker 

___import timeit, gc, sys
size = 10
repeats = 10
numbers = 100
gc.disable()

def bench(a, b, c):
for i in list(range(1, 11)) + [20, 50, 100, 1000, 1]:
string = (c * (i - 1) + a) * (size // i)
string += c * (size - len(string))
gc.collect()
best = min(timeit.Timer("text.replace(a, b)",
"a=%r; b=%r; text=%r" % (a, b, string)
).repeat(repeats, numbers))
print('%.0f\t%d %a %a %a' % (best *1e6 / numbers, i, a, b, c))
sys.stdout.flush()

bench('a', 'b', 'c')
bench('\u010a', '\u010b', '\u010c')
bench('\U0001000a', '\U0001000b', '\U0001000c')
import timeit, gc, random, sys
size = 10
repeats = 5
numbers = 100
gc.disable()
def bench(a, b, c):
for i in list(range(1, 11)) + [20, 50, 100, 1000, 1]:
data = list(a * (size // i) + c * (size - size // i))
random.shuffle(data)
string = ''.join(data)
gc.collect()
best = min(timeit.Timer("text.replace(a, b)",
"a=%r; b=%r; text=%r" % (a, b, string)
).repeat(repeats, numbers))
print('%.0f\t%d %a %a %a' % (best *1e6 / numbers, i, a, b, c))
sys.stdout.flush()

bench('a', 'b', 'c')
bench('\u010a', '\u010b', '\u010c')
bench('\U0001000a', '\U0001000b', '\U0001000c')
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16202] sys.path[0] security issues

2012-10-12 Thread Robert Bradshaw

Robert Bradshaw added the comment:

Good point about cleanup, patch updated.

--
Added file: http://bugs.python.org/file27543/fix_distutils.patch

___
Python tracker 

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



[issue15472] Itertools doc summary table misdocuments some arguments

2012-10-12 Thread Petri Lehtinen

Petri Lehtinen added the comment:

cycle() doesn't use seq, but p (p0, p1, ...). Others use seq (seq[0], seq[1], 
...). How do you think these should be changed?

--
nosy: +petri.lehtinen

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Benjamin Peterson

Benjamin Peterson added the comment:

disutils should definitely be fixed.

--

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Vladimir Ushakov

Vladimir Ushakov added the comment:

I think, handling the signal would do.

--

___
Python tracker 

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



[issue15936] Add link from os.urandom to random.SystemRandom

2012-10-12 Thread Petri Lehtinen

Changes by Petri Lehtinen :


--
keywords: +easy
stage:  -> needs patch
versions: +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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Christian Heimes

Christian Heimes added the comment:

Ultimately it's Benjamin's and Georg's decision. They are the release managers 
of 2.7 to 3.3 and need to come to an agreement. You have to convince them that 
the proposed security restriction is worth the risk of breaking 3rd party 
software. 

It would help if you describe the circumstances under which your patch doesn't 
add the module's path to sys.path.

--
nosy: +benjamin.peterson, georg.brandl

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Brett Cannon

Brett Cannon added the comment:

http://bugs.python.org/issue15031 would deal with not needing to expose _r_long 
and _w_long, but that still means people are screwed for _fix_co_filename. You 
could argue that is a margin use-case, though.

--
dependencies: +Split .pyc parsing from module loading

___
Python tracker 

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



[issue16191] ceval cleanup

2012-10-12 Thread Dave Malcolm

Changes by Dave Malcolm :


--
nosy: +dmalcolm

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Jeroen Demeyer

Jeroen Demeyer added the comment:

If you don't plan any further Python-2 releases, it would be pity that this 
cannot be fixed.  If you do plan a further Python-2 release, I find backwards 
compatibility a poor excuse.  I'm not saying that backwards compatibility 
should be totally ignored, but it certainly should not trump everything either, 
especially for security issues.  I carefully designed my patch to have no 
impact for most existing secure setups (but as I said, I'm open for 
improvements).

--

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Charles-François Natali

Charles-François Natali added the comment:

No, it's not.
That's why I think there's nothing that can be done.

--

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Christian Heimes

Christian Heimes added the comment:

The fstat() check isn't bullet proof, too. It has a race condition as another 
process could truncate the file between the fstat() check and the code lines 
that access the mmapped file.

--

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Charles-François Natali

Charles-François Natali added the comment:

That's normal.
You're truncating the file after having it mapped, so touching the pages 
corresponding to the truncated part of the file will result in a segfault.
See mmap's man page:
"""
   Use of a mapped region can result in these signals:

   SIGBUS Attempted access to a portion of the buffer that does not 
correspond to
  the file (for example, beyond the end of the file, including the 
case
  where another process has truncated the file).
"""

The only way to guard against it would be to call fstat() in every 
buffer-protocol method in case of file-backed mapping to check against the 
current file size, but that would be awfully slow in case of sequential access 
(just imagine performing an md5sum of an mmap-ed file).

--
nosy: +neologix

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le vendredi 12 octobre 2012 à 16:23 +, Brett Cannon a écrit :
> Well, it means importlib becomes a special library and that no one
> could ever replicate it as a third-party library.

Well, it *is* a special library. It is tightly integrated with the
interpreter core, and it provides a fundamental service in the language.

Besides, since the pyc format is an implementation detail, I don't see
how exposing r_long, w_long and friends would help third-party
libraries, which would still have to rely on non-public details.

--

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Brett Cannon

Brett Cannon added the comment:

Well, it means importlib becomes a special library and that no one could ever 
replicate it as a third-party library.

Now if we can expose the various APIs around this such that they are abstracted 
away then it isn't a big deal. That can be done for the _r_long and _w_long, 
but _fix_co_filename is still a rather special thing.

--

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Christian Heimes

Christian Heimes added the comment:

I'm all in favor for the proposal to add a warning when the script is in a 
world-writable directory. But any modification can't be added to stable version 
as it's a new feature.

Robert, you have to cleanup and remove the directory manually at the end of the 
block. mkdtemp() creates the directory but doesn't do house keeping.

--

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Robert Bradshaw

Robert Bradshaw added the comment:

Here's a fix to distutils.  I think at least a warning is in order for running 
scripts from insecure directories, and ideally some happy medium can be found.

--
Added file: http://bugs.python.org/file27542/fix_distutils.patch

___
Python tracker 

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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Why is it a problem for importlib to use internal APIs?
I don't think support these low-level APIs as public helps anyone.

--
nosy: +pitrou

___
Python tracker 

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



[issue15853] IDLE crashes selecting Preferences menu with OS X ActiveState Tcl/Tk 8.5.12.1

2012-10-12 Thread Roger Serwy

Roger Serwy added the comment:

It appears that Kevin's patch is working around a bug in Tkinter's tkFont 
object configuration. I would suggest removing the editFont object entirely 
from configDialog if it is truly the root cause of Tk crashing.

Kevin, is the .textHighlightSample causing the crash or is the editFont.config 
line causing the crash?

Setting the font in the Fonts/Tab pane should also change the font in the 
Highlighting pane. This is part of issue14876. Would the following still work 
on your version of IDLE?

newFont = (fontName, self.fontSize.get(), fontWeight)
self.labelFontSample.config(font = newFont)
self.textHighlightSample.configure(font=newFont)

Also, since this is a problem with Tk itself, can the crashing behavior be 
isolated into a small test script? I don't have a Mac to test with.

--

___
Python tracker 

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



[issue16191] ceval cleanup

2012-10-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ac30a1b1cf17 by Benjamin Peterson in branch 'default':
ceval cleanup
http://hg.python.org/cpython/rev/ac30a1b1cf17

--
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



[issue16213] Expose private functions in marshal used by importlib

2012-10-12 Thread Brett Cannon

New submission from Brett Cannon:

IOW make _w_long, _r_long, and __fix_co_filename public so as to not be some 
special ability that only importlib has.

--
components: Library (Lib)
messages: 172751
nosy: brett.cannon
priority: normal
severity: normal
stage: needs patch
status: open
title: Expose private functions in marshal used by importlib
type: enhancement
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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Christian Heimes

Christian Heimes added the comment:

Robert Bradshaw's idea is the only feasible option for Python 2.7 or any other 
version except for 3.4dev. Your suggested modification to sys.path is out of 
option as it would create a backwards incompatibility with existing software.

I'm adding 2.6 to 3.4 as all versions of Python are affected.

--
stage:  -> needs patch
versions: +Python 2.6, 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



[issue15350] {urllib,urllib.parse}.urlencode.__doc__ is unclear

2012-10-12 Thread samwyse

samwyse added the comment:

Look good.  I'd fix the last line, however:  "sent the quote_plus" ->
"sent to the quote_plus function", maybe.

On Fri, Sep 28, 2012 at 6:18 AM, Brian Brazil  wrote:
>
> Brian Brazil added the comment:
>
> How does the attached patch look?
>
> I also reworded the first line to be a bit clearer, and be under 80 chars.
>
> --
> keywords: +patch
> nosy: +bbrazil
> Added file: http://bugs.python.org/file27329/issue15350.patch
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue16211] MacInstalls break PyDev

2012-10-12 Thread Ned Deily

Ned Deily added the comment:

In current OS X releases, it is true that the system Pythons as shipped by 
Apple do not include the .py files in 
/System/Library/Frameworks/Python.framework; only .pyc and .pyo files are 
present.  However, those .py files are added when you install the "Command Line 
Tools" component of Xcode 4.  So, either do that or install another version of 
python, like from python.org.  In any case, the behavior is under the control 
of Apple and OS X, not Python.

--
nosy: +ned.deily
resolution:  -> invalid
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



[issue13440] Explain the "status quo wins a stalemate" principle in the devguide

2012-10-12 Thread Mike Hoy

Mike Hoy added the comment:

Patch affects faq.rst/index.rst. In faq I put the two links along with some 
text as Chris suggested. In index I changed resources to Additional Resources 
and split up the old 'Resources' into 'Additional Resources/Essential Reading'. 
Feedback appreciated I will incorporate any new ideas into a version 2 and so 
forth until issue resolved.

--
keywords: +patch
Added file: http://bugs.python.org/file27541/issue13440_v1.diff

___
Python tracker 

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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Christian Heimes

Christian Heimes added the comment:

I'm able to reproduce the bug. Here is a stack trace:

#0  0x005a650d in PyBytes_FromStringAndSize (str=0x7f44c127a000 
, size=1)
at Objects/bytesobject.c:82
82  (op = characters[*str & UCHAR_MAX]) != NULL)
(gdb) bt
#0  0x005a650d in PyBytes_FromStringAndSize (str=0x7f44c127a000 
, size=1)
at Objects/bytesobject.c:82
#1  0x7f44bf7c11b2 in mmap_subscript (self=0x7f44bf9ca350, item=)
at /home/heimes/dev/python/cpython/Modules/mmapmodule.c:799
#2  0x00590863 in PyObject_GetItem (o=, key=)
at Objects/abstract.c:143

--
nosy: +christian.heimes
stage:  -> needs patch
versions: +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



[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Vladimir Ushakov

New submission from Vladimir Ushakov:

The following code crashes the interpreter on Linux:

#!/usr/bin/python3

import mmap

with open('test', 'wb') as f:
f.write(bytes(1))

with open('test', 'r+b') as f:
m = mmap.mmap(f.fileno(), 0)
f.truncate()
a = m[:]

---

It's not specific to the zero size truncation, it's enough if the file size 
decreases beyond a page border.

--
components: IO
messages: 172745
nosy: Vladimir.Ushakov
priority: normal
severity: normal
status: open
title: mmap() dumps core upon resizing the underlying file
type: crash
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



[issue16211] MacInstalls break PyDev

2012-10-12 Thread Ronald Oussoren

Ronald Oussoren added the comment:

The binary installers for OSX do install all of the std library, and AFAIK the 
same is true for the version of python that ships with the OS.

Please explains how to reproduce the problem you are having:

* What release of OSX

* Which python version (/usr/bin/python, binary installer from www.python.org 
(and if so which one))?

* How can I verify that the problem is present?

--

___
Python tracker 

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



[issue16211] MacInstalls break PyDev

2012-10-12 Thread Doug Ransom

New submission from Doug Ransom:

A number of .py files are not installed in the mac installer.  While python 
programs run OK, this thwarts users from using IDEs like Aptana Studio/PyDev.  
For those of us who are python dabblers, this makes it nearly impossible to 
write/debug python code.

urllib.py is an example.

Here is the note from PyDev which works with Aptana Studio 
http://pydev.org/manual_101_interpreter.html (though installing python as they 
discuss doesn't fix the problem, and the /lib folder thing is probably beyond 
most of us to figure out):

"IMPORTANT for Mac users: The Python version that usually ships with Mac 
doesn't seem to have the .py source files 
available, which are required for PyDev, so, using a different interpreter is 
recommended (i.e.: Download it from http://python.org). If you don't want to 
use a different interpreter, get the source files for the Python '/Lib' folder
and add those to the system installation.

After those steps, you should have a screen as presented below:..."

How about changing the install so IDEs like pydev, for all versions?  A few 
extra bytes of disk space probably won't harm anything.

--
assignee: ronaldoussoren
components: Macintosh
messages: 172743
nosy: Doug.Ransom, ronaldoussoren
priority: normal
severity: normal
status: open
title: MacInstalls break PyDev
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



[issue16191] ceval cleanup

2012-10-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I won't examine the patch in detail, but the cleanup is welcome and I trust you 
(and the test suite :-)) that it works fine.

--
nosy: +pitrou

___
Python tracker 

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



[issue16205] update :class:`str` references to link to the str type section

2012-10-12 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> If :class:`str` and :func:`str` point respectively to stdtypes.rst and 
> functions.rst once a class directive is added to stdtypes.rst, then we can do 
> that.

I agree.  I would suggest starting small by adding a stub class entry above the 
string methods.  The class constructor could link to the built-in function 
str() for its definition.

--

___
Python tracker 

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



[issue16205] update :class:`str` references to link to the str type section

2012-10-12 Thread Ezio Melotti

Ezio Melotti added the comment:

Adding a class directive for str is tracked in #16209.

--
dependencies: +add a "class str" entry to the docs

___
Python tracker 

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



[issue16205] update :class:`str` references to link to the str type section

2012-10-12 Thread Ezio Melotti

Ezio Melotti added the comment:

If :class:`str` and :func:`str` point respectively to stdtypes.rst and 
functions.rst once a class directive is added to stdtypes.rst, then we can do 
that.  We might than need to update a few links to use :class: instead of 
:func:, and possibly use :ref:`textseq` where appropriate.

--

___
Python tracker 

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



[issue11009] urllib.splituser is not documented

2012-10-12 Thread Vinay Sajip

Vinay Sajip added the comment:

Note that at least splituser is being used outside the stdlib: packaging
(which was intended to be part of the stdlib) used it, and hence so do
distutils2 and distlib (by sharing parts of their codebases). Of course these 
last two are outside the stdlib.

Similar functions are reimplemented outside the stdlib (e.g. see 
parse_credentials in pip.download).

If the only reason for not exposing these is documentation clutter, surely 
there are approaches to minimise this. If the reason is that future 
implementations may change or remove them, that should be clarified. But since 
the basics of an url are unlikely to change, I don't see why these functions 
might be removed in the future.

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
nosy: +hynek

___
Python tracker 

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



[issue15853] IDLE crashes selecting Preferences menu with OS X ActiveState Tcl/Tk 8.5.12.1

2012-10-12 Thread Kevin Walzer

Kevin Walzer added the comment:

The crash occurs during a "self.editFont.config" call, when the sample text in 
the font dialog is updated with new font properties. My changes re-structures 
the configure event to first create a tuple with new font properties, then 
apply that to the parent label widget's font. Same effect, works around the 
crash. 

My testing shows the crash occurs at the event loop level--somewhere in the 
event loop between Python, Tk, and Cocoa, this specific configuration causes Tk 
to barf and then crash. If you have followed the traffic on the event loop 
issues in Tk-Cocoa at SF and the Tcl-Mac list, you're aware that a) the event 
loop is fragile and complex and b) pretty much impossible to solve at this time 
because the only one who really understands it well, the original author of the 
code, is no longer involved with Tk development. As a result, it is often 
simpler to work around Tk-Cocoa event loop issues at the script level: that is 
what my patch does.  There is little chance of solving the crash at the Tk 
level at this time. 

I don't understand what the problem with in requesting that IDLE users update 
their installation to get this patch; it's no different than any other bug fix. 
As far as making sure it works with the various releases of Python, that's work 
that you or another Python dev will have to do. It's a two-line fix so I doubt 
it will be that complicated to implement. And yes, in an ideal world, it would 
be better to fix Tk, but this patch solve the immediate problem because we are 
not able to address this issue at the Tk level at this time.

--

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Volker Braun

Volker Braun added the comment:

The fact that Python's own testsuite tripped over this proves that this is 
subtle enough to merit some special handling.

1) It is not, and has never been, a good idea to run/compile anything off /tmp. 
This isn't specific to Python, it is just common sense that you don't hand over 
control of directory contents to others.

2) Removing /tmp from sys.path upon startup is not enough to guarantee safety. 
Many Python modules will happily add it back. Just as a random example, see 
profile.py: "sys.path.insert(0, os.path.dirname(progname))". The aim of the 
patch should be to warn the user of the dangers of running code in /tmp, not 
trying to make it safe (and, therefore, implicitly encouraging it).

3) The patch is too restrictive in my opinion, it rules out some plausible and 
perfectly safe use cases. For example, root owns directory and wheel owns 
Python script. Or sharing a group with a trusted user. Just disallowing o+w 
would be enough to save the unwary from executing in /tmp.

--
nosy: +vbraun

___
Python tracker 

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



[issue16192] ctypes - documentation example

2012-10-12 Thread Ezio Melotti

Ezio Melotti added the comment:

The note at the beginning could be turned in an actual note using the `.. 
note:` markup.  This will make it more visible.

--

___
Python tracker 

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



[issue16210] combine the two type() definitions in built-in function docs

2012-10-12 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue16210] combine the two type() definitions in built-in function docs

2012-10-12 Thread Chris Jerdonek

New submission from Chris Jerdonek:

[Found by Ezio]

The built-in function documentation has what looks like two separate 
definitions of the built-in function type():

http://docs.python.org/dev/library/functions.html#type

These two definitions should be combined into one with a multi-line signature 
like we're doing for the other built-in functions.

--
assignee: docs@python
components: Documentation
messages: 172734
nosy: chris.jerdonek, docs@python, ezio.melotti
priority: normal
severity: normal
status: open
title: combine the two type() definitions in built-in function docs
versions: Python 2.7, 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



[issue16207] distinguish methods from non-methods in classes in the stdtypes docs

2012-10-12 Thread Chris Jerdonek

Changes by Chris Jerdonek :


--
title: add class name to method signatures in stdtypes docs -> distinguish 
methods from non-methods in classes in the stdtypes docs

___
Python tracker 

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



[issue16209] add a "class str" entry to the docs

2012-10-12 Thread Chris Jerdonek

New submission from Chris Jerdonek:

This issue is to add a str class entry to the built-in types page like we have 
for dict, set, memoryview, etc:

http://docs.python.org/dev/library/stdtypes.html

This will let us reference ``str`` the class separately from ``str()`` the 
built-in function.  It will also let us remove the "str." prefix from all of 
the string method descriptions.  Thirdly, it will make the str documentation 
match what is being done for the types previous to it in the documentation, 
including the range, tuple, and list classes.  Lastly, it will make referencing 
string-related sections in Sphinx a bit more intuitive.  Currently, 
:class:`str` points to the built-in function :func:`str`.

--
assignee: docs@python
components: Documentation
messages: 172733
nosy: chris.jerdonek, docs@python, ezio.melotti
priority: normal
severity: normal
status: open
title: add a "class str" entry to the docs
type: enhancement
versions: 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



[issue16207] add class name to method signatures in stdtypes docs

2012-10-12 Thread Chris Jerdonek

Chris Jerdonek added the comment:

So it looks like the class name gets stripped when rendering if you prefix the 
method name with the class name and the methods are nested beneath the class.

So it seems like the options are to either (1) move the non-methods outside the 
class (e.g. before the class), or (2) clearly divide the methods and 
non-methods into two groups (e.g. "These are the operations..." and "These are 
the methods...").  I lean towards the latter.  And it would be a smaller change.

--

___
Python tracker 

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



[issue12268] file readline, readlines & readall methods can lose data on EINTR

2012-10-12 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



[issue16201] socket.gethostbyname incorrectly parses ip

2012-10-12 Thread Michele Orrù

Changes by Michele Orrù :


Added file: http://bugs.python.org/file27540/issue16201.patch

___
Python tracker 

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



[issue7735] python creates IPv6 DNS requests even when built with --disable-ipv6

2012-10-12 Thread Ralf Schmitt

Ralf Schmitt added the comment:

btw  lookups do not work if python is configured with --disable-ipv6, see 
http://bugs.python.org/issue16208

--

___
Python tracker 

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



[issue16208] getaddrinfo returns wrong results if IPv6 is disabled

2012-10-12 Thread Ralf Schmitt

New submission from Ralf Schmitt:

I'm running the following code on python 2.7.3 on a 64 bit linux.

import socket
print "has_ipv6", socket.has_ipv6

res = socket.getaddrinfo("python.org", 80, socket.AF_INET6, socket.SOCK_STREAM)
print "python.org is", res

With IPv6 enabled, I get the following output:
has_ipv6 True
python.org is [(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]

With IPv6 disabled (i.e I ran ./configure --disable-ipv6), I get:

has_ipv6 False
python.org is [(10, 1, 6, '', (10, '\x00P\x00\x00\x00\x00 \x01\x08\x88 
\x00\x00\r'))]

--
components: +Library (Lib)
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



[issue16208] getaddrinfo returns wrong results if IPv6 is disabled

2012-10-12 Thread Ralf Schmitt

Changes by Ralf Schmitt :


--
nosy: schmir
priority: normal
severity: normal
status: open
title: getaddrinfo returns wrong results if IPv6 is disabled

___
Python tracker 

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



[issue7735] python creates IPv6 DNS requests even when built with --disable-ipv6

2012-10-12 Thread Ralf Schmitt

Ralf Schmitt added the comment:

The switch disables support for IPv6 sockets, and since IPv6 support is 
disabled, there is no need to try to lookup IPv6 addresses in 
create_connection. They just cannot be used afterwards.

I didn't request that the switch disables any code that somehow deals with 
IPv6. I'm just talking about that one function!

You refuse to acknowledge the problem based on broken assumptions and bogus 
arguments.

--

___
Python tracker 

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



[issue16207] add class name to method signatures in stdtypes docs

2012-10-12 Thread Georg Brandl

Georg Brandl added the comment:

> I think I would be more okay with this if it weren't for the fact that 
> some functions also appear indented under their class entries (making 
> them look like methods). 

I see, yes.  In this case I agree.

--

___
Python tracker 

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



[issue16207] add class name to method signatures in stdtypes docs

2012-10-12 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I think I would be more okay with this if it weren't for the fact that some 
functions also appear indented under their class entries (making them look like 
methods).  Right now, there's no visual distinction between the functions and 
the methods.  Prefixing the methods with the class name or moving the functions 
above the class definition would address this.

--
status: pending -> open

___
Python tracker 

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



[issue7735] python creates IPv6 DNS requests even when built with --disable-ipv6

2012-10-12 Thread Martin v . Löwis

Martin v. Löwis added the comment:

The switch --disable-ipv6 is supported and works as intended. It is not the 
intention of the switch to disable  lookups. Instead, it disables support 
for IPv6 sockets.

Requesting that the switch disables any code that somehow deals with IPv6 is 
unreasonable - it would also affect the ipaddress module and urllib.parse.

So closing this as won't 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



[issue15853] IDLE crashes selecting Preferences menu with OS X ActiveState Tcl/Tk 8.5.12.1

2012-10-12 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch, Kevin. It does need to be updated a bit for the current 
2.7 branch as there have been changes since 2.7.3.  Can you outline what you 
believe the problem is that your patch is trying to workaround?  Certainly, 
nothing that IDLE or any other tkinter-based application does should be able to 
cause a hard crash in Tk.  It seems very problematic to force a change to all 
existing versions of IDLE and require users to update their installed IDLEs 
just to work around a crash in the Cocoa Tk that was introduced by a specific 
recent checkin in Tk.  Since there have been other serious bugs in Cocoa Tk 
that have been corrected in every recent release of Cocoa Tk, it is pretty much 
incumbent on users to keep up with the latest available version.

--

___
Python tracker 

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



[issue16207] add class name to method signatures in stdtypes docs

2012-10-12 Thread Georg Brandl

Georg Brandl added the comment:

This is by design: these method descriptions are indented under their class 
entries; no need to repeat the class name.

--
nosy: +georg.brandl
resolution:  -> works for me
status: open -> pending

___
Python tracker 

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



[issue16201] socket.gethostbyname incorrectly parses ip

2012-10-12 Thread Michele Orrù

Michele Orrù added the comment:

> Attaching patch to trim leading and trailing whitespaces prior to
> processing.
Note that tests are incorrect: the parsing is of the form %d.%d.%d.%d%c, so the 
parser should accept trailing spaces. That's the same for ping iirc: 

$ ping "192.168.1.1"
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.

--- 192.168.1.1 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1007ms

$ ping " 192.168.1.1"
ping: unknown host  192.168.1.1


I am trying to get out with a simple parser inside the function, probabl y 
strtol() is the way. 
 Since Python's C API does not provide any sscanf wrapper, I thought about 
adding a new one. But given that, AFAIS it appears just two times over the 
entire sourcecode, there is no need IMO for exporting a new one right now. What 
is your opinion?

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue16202] sys.path[0] security issues

2012-10-12 Thread Jeroen Demeyer

Jeroen Demeyer added the comment:

Robert: I don't think that running scripts in /tmp is inherently unsafe.  It is 
Python's sys.path handling which makes it unsafe.  That being said, I am not 
against distutils being "fixed" but I do think the root issue should be fixed.

And of course you're right about complicated permission checking and ACLs and 
what not.  But I think my patch does the Right Thing in 99% of the cases, in 
particular for /tmp.  I tried to err on the safe side.

--

___
Python tracker 

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



[issue14937] IDLE's deficiency in the completion of file names (Python 32, Windows XP)

2012-10-12 Thread Francisco Gracia

Francisco Gracia added the comment:

In my machine with Windows XP and Python 3.3.0 both variants work, the only
difference being that

'c:/
brings up the selection box authomatically and

'c:\

requieres that it be summoned with the tab key, as indicated.

2012/10/12 Terry J. Reedy 

>
> Terry J. Reedy added the comment:
>
> This patch (I suspect it is this one) disabled the use of '/' in filenames
> on windows when using filename completion.
>
> 'c:\in 3.2.3 and 3.3.0>
> (If there is no 'r' prefix, it really should require '\\' to be safe.)
>
> "c:/   ditto for 3.2.3.
> In 3.3.0, (and, I presume, 3.2.4 if not changed) tab inserts spaces to
> next tab stop, while ^space is ignored.
>
> Since using '/' is recommended over unsafe '\', this is an undesireable
> regression.
>
> --
> resolution: fixed ->
> stage: patch review -> needs patch
> status: closed -> open
> versions: +Python 3.3, Python 3.4
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue16207] add class name to method signatures in stdtypes docs

2012-10-12 Thread Chris Jerdonek

New submission from Chris Jerdonek:

The method signatures for some of the classes documented in library/stdtypes 
lack the class name.  For example, the list, dict, set, and memoryview methods 
lack the class name.  Adding the class name will help to distinguish methods 
from functions.

--
assignee: docs@python
components: Documentation
messages: 172720
nosy: chris.jerdonek, docs@python, ezio.melotti
priority: normal
severity: normal
stage: needs patch
status: open
title: add class name to method signatures in stdtypes docs
type: enhancement
versions: Python 2.7, 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



[issue15853] IDLE crashes selecting Preferences menu with OS X ActiveState Tcl/Tk 8.5.12.1

2012-10-12 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +serwy

___
Python tracker 

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



[issue7735] python creates IPv6 DNS requests even when built with --disable-ipv6

2012-10-12 Thread Ralf Schmitt

Ralf Schmitt added the comment:

It's not quite true what I wrote. Actually you get a "error: getsockaddrarg: 
bad family" error.

But regardless of the error, there just is no need to ask for IPv6 addresses!

--

___
Python tracker 

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



[issue16206] dict() docs should display multiple signatures

2012-10-12 Thread Chris Jerdonek

New submission from Chris Jerdonek:

The documentation for dict() (for both the built-in function and the class 
constructor) should display multiple signatures as do dict.__doc__ and the 
documentation for, say, str().

Currently, the dict() documentation just has one signature:

dict([arg])

Something more in line with the docstring would be better, for example:

dict(mapping={})
dict(iterable)
dict(**kwargs)

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 172718
nosy: chris.jerdonek, docs@python, ezio.melotti
priority: normal
severity: normal
status: open
title: dict() docs should display multiple signatures
versions: Python 2.7, 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