[issue6415] warnings.warn segfaults on bad formatted string

2009-07-17 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

I've committed in r74040(trunk), r74043(release26-maint), r74046(py3k), 
r74047(release31-maint). Is release30-maint still active?

--
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 3.0

___
Python tracker 

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



[issue6473] hmac sha384/sha512 fails test vectors

2009-07-17 Thread Iain Wade

Iain Wade  added the comment:

d'oh, I should have checked HEAD before submitting the bug.

I am running 2.5.1 on OSX, the fix seems to be in 2.5.2 and above.

Thanks, and sorry for wasting your time.

--
status: open -> closed

___
Python tracker 

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



[issue6496] 2to3 generates "from urllib.parse import pathname2url"

2009-07-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +benjamin.peterson
priority:  -> normal
stage:  -> patch review

___
Python tracker 

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-17 Thread Graham Dumpleton

Graham Dumpleton  added the comment:

I see this problem on both MacOS X 10.5 and on Windows. This is when using 
Python embedded inside of Apache/mod_wsgi.

On MacOS X the error is:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module named encodings.utf_8

On Windows the error is:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding: cp0

The talk about the fix mentioned it only addressing MacOS X. What about 
Windows case I am seeing. Will it help with that at all?

--
nosy: +grahamd

___
Python tracker 

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-17 Thread Graham Dumpleton

Graham Dumpleton  added the comment:

Hmmm, actually my MacOS X error is different, although Windows one is 
same, except that encoding is listed and isn't empty.

--

___
Python tracker 

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-17 Thread Graham Dumpleton

Graham Dumpleton  added the comment:

You can ignore my MacOS X example as that was caused by something else.

My question still stands as to whether the fix will address the similar 
problem I saw on Windows.

--

___
Python tracker 

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



[issue6497] Support for digital Cinema/film DPX and Kodak Cineon image file formats in imghdr module

2009-07-17 Thread Ezio Melotti

Ezio Melotti  added the comment:

I can't judge the content of the patch because I don't know these
formats at all, however there are a few issues about the style:
1) there are tabs mixed with spaces, the standard is 4 spaces;
2) there should be an empty space before and after operators like ==, <
and >;
3) h and f are not really meaningful names, I can't figure out what they
are supposed to represent.
For further information about the style conventions see
http://www.python.org/dev/peps/pep-0008/

The "import struct" might be better at module level; 'f' is passed to
both the function and never used; the docstrings may be more comprehensive.

Finally, it would be nice if you could provide a patch against the
trunk, you can find more information about it on
http://www.python.org/dev/patches/ and
http://www.python.org/dev/faq/#patches

If you have any question feel free to ask.

--
keywords: +patch
nosy: +ezio.melotti
priority:  -> low
versions:  -Python 3.0, Python 3.1

___
Python tracker 

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



[issue6500] urllib2 maximum recursion depth exceeded

2009-07-17 Thread simon

New submission from simon :

def __getattr__(self, attr):
# XXX this is a fallback mechanism to guard against these
# methods getting called in a non-standard order.  this may be
# too complicated and/or unnecessary.
# XXX should the __r_XXX attributes be public?
if attr[:12] == '_Request__r_':
name = attr[12:]
if hasattr(Request, 'get_' + name):
getattr(self, 'get_' + name)()
return getattr(self, attr)
raise AttributeError, attr

this may cause "maximum recursion depth exceeded"

>>> import urllib2
>>> req = urllib2.Request('http://www.nbc.com')
>>> req._Request__r_method
RuntimeError: maximum recursion depth exceeded

"return getattr(self, attr)"? should it be removed?

--
components: Library (Lib)
messages: 90612
nosy: nako521
severity: normal
status: open
title: urllib2 maximum recursion depth exceeded
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6

___
Python tracker 

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



[issue6449] Improve/update python.org/dev/

2009-07-17 Thread Ezio Melotti

Ezio Melotti  added the comment:

Thanks to you for fixing it!
However on http://www.python.org/dev/buildbot/ now there's 3.w (maybe
you missed the '2' key?).
About the IRC stuff, at least #python-dev (and probably #python-docs
too) are under our control (even if Freenode is not under our control,
these channels are used and managed by Python developers).

--

___
Python tracker 

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



[issue6498] Py_Main() does not return on SystemExit

2009-07-17 Thread Rogi

Rogi  added the comment:

As a workaround, I copied teh function PyRun_InteractiveOneFlags() to my
own source and modified it so it would not print or clear exceptions.
However, I have never found documentation about PyArena* or
PyParser_AST*. Are those functions public or just for internal use?

--

___
Python tracker 

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



[issue6500] urllib2 maximum recursion depth exceeded

2009-07-17 Thread Ezio Melotti

Ezio Melotti  added the comment:

That __getattr__ was removed in r70815 and in Python 3.1 it's OK.
The change wasn't backported to the trunk though.

Assigning to Jeremy to see what he thinks about it.

--
assignee:  -> jhylton
nosy: +ezio.melotti, jhylton
priority:  -> normal
status: open -> pending
versions: +Python 2.7 -Python 2.4, Python 2.5, Python 2.6

___
Python tracker 

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



[issue6501] Fatal LookupError: unknown encoding: cp0 on Windows embedded startup.

2009-07-17 Thread Graham Dumpleton

New submission from Graham Dumpleton :

When using Python 3.1 for Apache/mod_wsgi (3.0c4) on Windows, Apache will 
crash on startup because Python is forcing the process to exit with:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding: cp0

I first mentioned this on issue6393, but have now created it as a separate 
issue as appears to be distinct from the issue on MacOS X, athough possibly 
related.

In the Windows case there is actually an encoding, that of 'cp0' where as on 
MacOS X, the encoding name was empty.

The same mod_wsgi code works fine under Python 3.1 on MacOS X.

--
components: Interpreter Core, Windows
messages: 90616
nosy: grahamd
severity: normal
status: open
title: Fatal LookupError: unknown encoding: cp0 on Windows embedded startup.
type: crash
versions: Python 3.1

___
Python tracker 

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-17 Thread Graham Dumpleton

Graham Dumpleton  added the comment:

I have created issue6501 for my Windows variant of this problem given that 
it appears to be subtly different due to there being an encoding where as 
the MacOS X variant doesn't have one.

Seeing that the fix for the MacOS X issue is in Python code, I will when I 
have a chance look at whether can work out any fix for the Windows 
variant. Not sure I have right tools to compile Python from C code on 
Windows, so if a C code problem, not sure can really investigate.

--

___
Python tracker 

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



[issue6501] Fatal LookupError: unknown encoding: cp0 on Windows embedded startup.

2009-07-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

- Apache is not a Console application, so the Windows GetConsoleCP()
function returns zero (and os.device_encoding(1) returns 'cp0').
- pythonw.exe has no console either; but in pythonrun.c, the test
(fileno(stdin) < 0) is true, and the standard streams are all set to None.
- It is probable that Apache has redefined stdin & co, so the previous
test does not work there.

As a workaround, I suggest to set the environment variable
PYTHONIOENCODING before starting Apache, or before the call to
Py_Initialize.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue6502] documentation error: missing comma between kwonlyargcount & nlocals

2009-07-17 Thread kai zhu

New submission from kai zhu :

missing comma between kwonlyargcount & nlocals

class code(object)
 |  code(argcount, kwonlyargcount nlocals, stacksize, flags, codestring,
 |constants, names, varnames, filename, name, firstlineno,
 |lnotab[, freevars[, cellvars]])

--
assignee: georg.brandl
components: Documentation
messages: 90619
nosy: georg.brandl, kaizhu
severity: normal
status: open
title: documentation error: missing comma between kwonlyargcount & nlocals
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue6501] Fatal LookupError: unknown encoding: cp0 on Windows embedded startup.

2009-07-17 Thread Graham Dumpleton

Graham Dumpleton  added the comment:

Yes, Apache remaps stdout and stderr to the Apache error log to still 
capture anything that errant modules don't log via the Apache error log 
functions. In mod_wsgi it replaces sys.stdout and sys.stderr with special 
file like objects that redirect via Apache error logging functions. This 
though obviously happens after Python first initialises sys.stdout and 
sys.stderr.

What would be an appropriate value to set PYTHONIOENCODING to on Windows 
as a workaround?

--

___
Python tracker 

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



[issue6502] documentation error: missing comma between kwonlyargcount & nlocals

2009-07-17 Thread Ezio Melotti

Ezio Melotti  added the comment:

Thanks for the report.
This was introduced in r60313 (see also #1939).

--
assignee: georg.brandl -> ezio.melotti
nosy: +ezio.melotti
priority:  -> low
resolution:  -> accepted
stage:  -> needs patch

___
Python tracker 

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



[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2009-07-17 Thread R. David Murray

R. David Murray  added the comment:

Personally I would like to see that happen, but I think you should
probably poll python-dev since it can be argued either way as to whether
it is a bug fix or a new feature.  FWIW, from the feeder bug reports it
looks to me like the users perceive it as a bug.

--

___
Python tracker 

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



[issue6503] Python Docs: 6.6.4. Mutable Sequence Types

2009-07-17 Thread Michael Kesper

New submission from Michael Kesper :

In http://docs.python.org/library/stdtypes.html#mutable-sequence-types
s.pop([i]) is listed. Correct would be:
s.pop(i)

--
assignee: georg.brandl
components: Documentation
messages: 90623
nosy: georg.brandl, mkesper
severity: normal
status: open
title: Python Docs: 6.6.4. Mutable Sequence Types
versions: Python 2.6

___
Python tracker 

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



[issue6503] Python Docs: 6.6.4. Mutable Sequence Types

2009-07-17 Thread Ezio Melotti

Ezio Melotti  added the comment:

The [] here mean that i is optional, the note (6) clarifies that its
default value is -1. Closing as invalid.

--
nosy: +ezio.melotti
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



[issue6163] [HP-UX] ld: Unrecognized argument: +s -L

2009-07-17 Thread Michael Haubenwallner

Michael Haubenwallner  added the comment:

While at it: gcc does not understand '+s', it does need '-Wl,+s'.

--
nosy: +haubi
Added file: 
http://bugs.python.org/file14514/distutils_hpux_libdir_option-gcc.patch

___
Python tracker 

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



[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2009-07-17 Thread James Broadhead

James Broadhead  added the comment:

+1 to the above. 

(imo, this is a bugfix, not a new feature)

--

___
Python tracker 

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



[issue6504] infinite recursion from calling builtins.open()

2009-07-17 Thread kai zhu

New submission from kai zhu :

# copy this to test.py
# > touch foo.txt
# > python3.1 -c "import test; import collections"
# > ...
# >   File "test.py", line 5, in find_module
# > def find_module(self, mname, path = None): open("foo.txt")
# >   File "test.py", line 5, in find_module
# > def find_module(self, mname, path = None): open("foo.txt")
# >   File "test.py", line 5, in find_module
# > def find_module(self, mname, path = None): open("foo.txt")
# >   File "test.py", line 5, in find_module
# > def find_module(self, mname, path = None): open("foo.txt")
# > RuntimeError: maximum recursion depth exceeded while calling a
# > Python object
class importer(object):
  def find_module(self, mname, path = None): open("foo.txt")
import sys; sys.meta_path.append(importer)

***

# note recursion behavior stops if we don't call open()
class importer(object):
  def find_module(self, mname, path = None): pass
import sys; sys.meta_path.append(importer)

--
components: IO, Interpreter Core
messages: 90627
nosy: kaizhu
severity: normal
status: open
title: infinite recursion from calling builtins.open()
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue6505] Minor typos in tutorial (i/o chapter)

2009-07-17 Thread csmayfield

New submission from csmayfield :

In tutorial/inputoutput.html:
"This also greater control over how the value is formatted. The 
following example truncates the Pi to three places after the decimal."

Should be:
"This allows greater control over how the value is formatted. The 
following example truncates pi to three places after the decimal."

Next subsection:
"However, because this old style of formatting will eventually removed 
from the language str.format() should generally be used."

Should be:
"However, because this old style of formatting will eventually be 
removed from the language, str.format() should generally be used."

--
assignee: georg.brandl
components: Documentation
messages: 90628
nosy: csmayfield, georg.brandl
severity: normal
status: open
title: Minor typos in tutorial (i/o chapter)
versions: Python 2.6, Python 3.1

___
Python tracker 

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



[issue6449] Improve/update python.org/dev/

2009-07-17 Thread Brett Cannon

Brett Cannon  added the comment:

On Fri, Jul 17, 2009 at 01:32, Ezio Melotti  wrote:

>
> Ezio Melotti  added the comment:
>
> Thanks to you for fixing it!
> However on http://www.python.org/dev/buildbot/ now there's 3.w (maybe
> you missed the '2' key?).

I did, but Aahz has already fixed it.

>
> About the IRC stuff, at least #python-dev (and probably #python-docs
> too) are under our control (even if Freenode is not under our control,
> these channels are used and managed by Python developers).

Well, they are under our control as long as someone sits in them, but the
PSF is not a registered owner of any of the channels (I submitted our
application ages ago to help out with the German Python channel and still
have not heard back). And hardly anyone sits in #python-dev except on bug
days. I still don't feel comfortable mentioning them.

--
Added file: http://bugs.python.org/file14515/unnamed

___
Python tracker 

___On Fri, Jul 17, 2009 at 01:32, Ezio Melotti 
rep...@bugs.python.org> 
wrote:


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

Thanks to you for fixing it!
However on http://www.python.org/dev/buildbot/"; 
target="_blank">http://www.python.org/dev/buildbot/ now there's 3.w 
(maybe
you missed the '2' key?).I did, but 
Aahz has already fixed it. 


About the IRC stuff, at least #python-dev (and probably #python-docs
too) are under our control (even if Freenode is not under our control,
these channels are used and managed by Python 
developers).Well, they are under our control 
as long as someone sits in them, but the PSF is not a registered owner of any 
of the channels (I submitted our application ages ago to help out with the 
German Python channel and still have not heard back). And hardly anyone sits in 
#python-dev except on bug days. I still don't feel comfortable mentioning 
them.


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



[issue6415] warnings.warn segfaults on bad formatted string

2009-07-17 Thread Brett Cannon

Brett Cannon  added the comment:

On Fri, Jul 17, 2009 at 00:03, Hirokazu Yamamoto wrote:

>
> Hirokazu Yamamoto  added the comment:
>
> I've committed in r74040(trunk), r74043(release26-maint), r74046(py3k),
> r74047(release31-maint). Is release30-maint still active?
>

No, 3.0 is dead.

Thanks, Hirokazu!

--
Added file: http://bugs.python.org/file14516/unnamed

___
Python tracker 

___On Fri, Jul 17, 2009 at 00:03, Hirokazu 
Yamamoto rep...@bugs.python.org> 
wrote:


Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp> 
added the comment:

I've committed in r74040(trunk), r74043(release26-maint), r74046(py3k),
r74047(release31-maint). Is release30-maint still active?
No, 3.0 is 
dead.Thanks, Hirokazu!
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6496] 2to3 generates "from urllib.parse import pathname2url"

2009-07-17 Thread Eric Promislow

Eric Promislow  added the comment:

Not in Sridar's patch, but 'pathname2url' is also misspelled
as 'pahtname2url' in the MAPPING struct.

--
nosy: +ericp

___
Python tracker 

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



[issue6449] Improve/update python.org/dev/

2009-07-17 Thread R. David Murray

R. David Murray  added the comment:

Enzio, Georg, Antoine, Benjamin, Barry, and I, just to name a few, hang
out in #python-dev regularly (as in daily, for some of us).  (Well,
Barry doesn't actively monitor the channel, but if you mention his name
he often wakes up.)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2009-07-17 Thread Hans Lellelid

Hans Lellelid  added the comment:

Personally, I also think that this is a bugfix, though I realize that in
order to fix the bug an API addition had to be made.  So +1 from me on
rolling into 2.6 (though my opinion is simply that of someone who's
eager to see it fixed).

--

___
Python tracker 

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



[issue6496] 2to3 generates "from urllib.parse import pathname2url"

2009-07-17 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r74065.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue6506] lib2to3 fails to convert 'thread' when not followed by a period

2009-07-17 Thread Eric Promislow

New submission from Eric Promislow :

Given this code:

import thread
print thread

$ python
ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit
(Intel)] on
win32
>>> from lib2to3.main import main
>>> print open("flip2.py").read()
import thread
print thread

>>> main('lib2to3.fixes', ['flip2.py'])
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
--- flip2.py (original)
+++ flip2.py (refactored)
@@ -1,2 +1,2 @@
-import thread
-print thread
+import _thread
+print(thread)
RefactoringTool: Files that need to be modified:
RefactoringTool: flip2.py
0

Note how "thread" in the print statement is not converted.

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 90635
nosy: ericp
severity: normal
status: open
title: lib2to3 fails to convert 'thread' when not followed by a period
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue6506] lib2to3 fails to convert 'thread' when not followed by a period

2009-07-17 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +benjamin.peterson
priority:  -> normal
stage:  -> test needed

___
Python tracker 

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



[issue6506] lib2to3 fails to convert 'thread' when not followed by a period

2009-07-17 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

This is purposeful. Otherwise random variables, functions, or classes,
with the same name as a module which people were using could be changed.

--

___
Python tracker 

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



[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-17 Thread Terry J. Reedy

New submission from Terry J. Reedy :

dis.dis(ob) currently accepts "a module, a class, a method, a function,
or a code object." But for most uses I have seen on python-list, people
start with a code snippet. They must then wrap that in a function or
remember (or lookup) a call such as compile(code, '', 'exec') to make a
code object. I propose that dis do the latter automatically. Dis already
has to branch on the input class, so I assume adding another branch
should not be difficult.

On the Python ideas list, Steven D'Aprano raised the issue of 'exec'
versus 'single' versus 'eval'. As far as dis is concerned, there seems
to be no difference between 'exec' and 'single'.

>>> dis(compile('x = x+1', '', 'single'))
  1   0 LOAD_NAME0 (x) 
  3 LOAD_CONST   0 (1) 
  6 BINARY_ADD   
  7 STORE_NAME   0 (x) 
 10 LOAD_CONST   1 (None) 
 13 RETURN_VALUE 

>>> dis(compile('x = x+1', '', 'exec'))
  1   0 LOAD_NAME0 (x) 
  3 LOAD_CONST   0 (1) 
  6 BINARY_ADD   
  7 STORE_NAME   0 (x) 
 10 LOAD_CONST   1 (None) 
 13 RETURN_VALUE 

Using 'exec' instead of 'eval' adds two spurious, but easily ignored, lines.

>>> dis(compile('x+1','', 'eval'))
  1   0 LOAD_NAME0 (x) 
  3 LOAD_CONST   0 (1) 
  6 BINARY_ADD   
  7 RETURN_VALUE
 
>>> dis(compile('x+1', '', 'exec'))
  1   0 LOAD_NAME0 (x) 
  3 LOAD_CONST   0 (1) 
  6 BINARY_ADD   
  7 POP_TOP  
  8 LOAD_CONST   1 (None) 
 11 RETURN_VALUE 

Between the current doc sentences "For a single code sequence, it prints
one line per bytecode instruction." and "If no object is provided, it
disassembles the last traceback." I propose adding the following two
sentences.

"Strings are first compiled as statements to code objects with
compile(string,'','exec'). For expressions, this adds a spurious POP_TOP
and LOAD_CONST at the end."

'compile' should be cross-referenced to its listing under built-in
functions.

--
components: Library (Lib)
messages: 90637
nosy: tjreedy
severity: normal
status: open
title: Enhance dis.dis to autocompile codestrings
type: feature request
versions: Python 3.2

___
Python tracker 

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



[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-17 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
priority:  -> low
stage:  -> needs patch

___
Python tracker 

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



[issue6506] lib2to3 fails to convert 'thread' when not followed by a period

2009-07-17 Thread Eric Promislow

Eric Promislow  added the comment:

Understood.  Could the tool emit a warning when it encounters
something like this?

--

___
Python tracker 

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



[issue6506] lib2to3 fails to convert 'thread' when not followed by a period

2009-07-17 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

2009/7/17 Eric Promislow :
>
> Eric Promislow  added the comment:
>
> Understood.  Could the tool emit a warning when it encounters
> something like this?

Perhaps, but I think you could find this out just as well by running a
tool like Pylint over your code.

--

___
Python tracker 

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



[issue6506] lib2to3 fails to convert 'thread' when not followed by a period

2009-07-17 Thread Benjamin Peterson

Changes by Benjamin Peterson :


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

___
Python tracker 

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



[issue6501] Fatal LookupError: unknown encoding: cp0 on Windows embedded startup.

2009-07-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

On a Western Windows, I suggest
PYTHONIOENCODING=cp1252:backslashreplace

But 
PYTHONIOENCODING=mbcs
is also OK, except that characters outside the Windows code page will be 
replaced with '?'

--

___
Python tracker 

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



[issue6477] Pickling of NoneType raises PicklingError

2009-07-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Given that dumps(type(Ellipsis)) and dumps(type(NotImplemented)) don't
work either, I am reclassifying this as a documentation bug.

The thing about the types of these three objects (None, Ellipsis,
NotImplemented) is that they are all designed to be singletons and they
all disallow creation of new instances of them.

>>> type(None)()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot create 'NoneType' instances
>>> type(NotImplemented)()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot create 'NotImplementedType' instances
>>> type(Ellipsis)()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot create 'ellipsis' instances

This does mean None has to be special cased if pickling "(object,
type(object))" pairs, but passing types through pickle strikes me as a
dubious enough exercise that it would take a fairly convincing use case
to accept an RFE to make NoneType pickleable (note that any such patch
would have to make sure that doing loads() on such a pickle didn't
manage to create a second copy of NoneType or None).

--
assignee:  -> georg.brandl
components: +Documentation -Library (Lib)
nosy: +georg.brandl, ncoghlan

___
Python tracker 

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



[issue6508] expose setresuid

2009-07-17 Thread Travis H.

New submission from Travis H. :

Python should expose setresuid in the same module that exposes setuid.

The reason why is complicated, but is best explained here:

http://www.eecs.berkeley.edu/~daw/papers/setuid-usenix02.pdf

I might work on a patch to implement this.

--
components: Extension Modules
messages: 90642
nosy: solinym
severity: normal
status: open
title: expose setresuid
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



[issue6461] multiprocessing: freezing apps on Windows

2009-07-17 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee:  -> jnoller
nosy: +jnoller

___
Python tracker 

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



[issue6465] email.feedparser regular expression bug (NLCRE_crack)

2009-07-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I believe both 2.4 and 3.0 are no longer maintained. 2.5 only gets
security fixes. On the otherhand, fix should go into 3.2 ;-).

--
nosy: +tjreedy
versions: +Python 3.2 -Python 2.4, Python 2.5, Python 3.0

___
Python tracker 

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



[issue6467] raw_input() doesn't work as expected when it gets multiple ^D

2009-07-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Confirmed - it's actually pressing "Ctrl-D" after entering text on the
line that seems to cause strange behaviour. For example, in the
following, the only letters I typed were "test" and then I just pressed
"Ctrl-D" 4 times and got the output seen below:

$ ./python raw_input_test.py
testtes
Traceback (most recent call last):
  File "raw_input_test.py", line 3, in 
c = raw_input()
EOFError

The "test" appeared as typed, the "tes\n" appeared after pressing Ctrl-D
three times, then the 4th Ctrl-D on its own line correctly triggered
EOFError.

(This with 2.7a0 on Ubuntu 8.04)

--
nosy: +ncoghlan

___
Python tracker 

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



[issue6508] expose setresuid

2009-07-17 Thread Travis H.

Travis H.  added the comment:

should also expose setresgid for same reason.

Paper also defines a higher-level API in section 8.2.1 that would
probably be worth implementing.

--

___
Python tracker 

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



[issue6461] multiprocessing: freezing apps on Windows

2009-07-17 Thread Jesse Noller

Jesse Noller  added the comment:

Thanks for noticing this. Unfortunately, I don't know enough about 
py2exe/windows to dig into that part. I can fix the low hanging fruit 
though

--

___
Python tracker 

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



[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Copying my suggestion (minus examples) over from the python-ideas thread:

We could define it as trying the three modes in order (first 'eval',
then 'single', then 'exec') moving on to the next option if it raises
syntax error:

from dis import dis
def dis_str(source):
  modes = ('eval', 'single', 'exec')
  for mode in modes:
try:
  c = compile(source, '', mode)
  break
except SyntaxError:
  if mode is modes[-1]:
raise
  return dis(c)

--
nosy: +ncoghlan

___
Python tracker 

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



[issue6477] Pickling of NoneType raises PicklingError

2009-07-17 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

I agree with Nick.

And if you really want to, you could hack a Pickler subclass to support
NoneType:

import io
import pickle

class XPickler(pickle.Pickler):
  def persistent_id(self, obj):
if obj is type(None):
  return "NoneType"
return None

class XUnpickler(pickle.Unpickler):
  def persistent_load(self, persistent_id):
if persistent_id == "NoneType":
  return type(None)

def dumps(obj):
f = io.BytesIO()
XPickler(f).dump(obj)
return f.getvalue()

def loads(s):
return XUnpickler(io.BytesIO(s)).load()

Not super elegant, but it works:

>>> loads(dumps([type(None), None]))
[, None]

--

___
Python tracker 

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



[issue6504] infinite recursion from calling builtins.open()

2009-07-17 Thread kai zhu

kai zhu  added the comment:

recursion also goes away if we open as raw bytes: open("foo.txt", "rb"). modes 
"r+" & "w" also give infinite recursion, while "rb+" & "wb" do not.

note found another bug:
instance method find_module should raise exception anyway, since its 
class was uninstantiated in sys.meta_path (proper behavior in python2.6)

--

___
Python tracker 

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



[issue6509] re.py - encounter unexpected str-object

2009-07-17 Thread kai zhu

New submission from kai zhu :

>>> import re
>>> compiled = re.compile(b"a(\w)")
>>> s = b"aa"
>>> s = compiled.sub(b"a\\1", s)
Traceback (most recent call last):
  File "", line 1, in 
  File ".../lib/python3.1/re.py", line 303, in filter
return sre_parse.expand_template(template, match)
  File ".../lib/python3.1/sre_parse.py", line 810, in expand_template
return sep.join(literals)
TypeError: sequence item 0: expected bytes, str found

--
components: Library (Lib)
messages: 90650
nosy: kaizhu
severity: normal
status: open
title: re.py -  encounter unexpected 
str-object
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue6509] re.py - encounter unexpected str-object

2009-07-17 Thread kai zhu

Changes by kai zhu :


--
components: +Regular Expressions

___
Python tracker 

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



[issue6509] re.py - encounter unexpected str-object

2009-07-17 Thread kai zhu

kai zhu  added the comment:

traced culprit to sre_parse.py  (where literal is always str):

...
def parse_template(source, pattern):
# parse 're' replacement string into list of literals and
# group references
s = Tokenizer(source)
sget = s.get
p = []
a = p.append
def literal(literal, p=p, pappend=a):
if p and p[-1][0] is LITERAL:
p[-1] = LITERAL, p[-1][1] + literal
else:
pappend((LITERAL, literal))
...

a possible hack-around is :

...
a = p.append
def literal(literal, p=p, pappend=a):
if isinstance(source, (bytes, bytearray)): # hack
literal = literal.encode() # hack str->bytes
if p and p[-1][0] is LITERAL:
...

--

___
Python tracker 

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



[issue6510] zipfile: OSError File exists

2009-07-17 Thread Sridhar Ratnakumar

New submission from Sridhar Ratnakumar :

sridh...@whymac:/tmp/i > wget http://google-chartwrapper.googlecode.com/
files/GChartWrapper-0.8.osx-10.5.zip
Saving to: `GChartWrapper-0.8.osx-10.5.zip'
sridh...@whymac:/tmp/i > apy -c "import zipfile; zipfile.ZipFile
('GChartWrapper-0.8.osx-10.5.zip').extractall()"
Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 935, in extractall
self.extract(zipinfo, path, pwd)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 923, in extract
return self._extract_member(member, path, pwd)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 960, in _extract_member
os.mkdir(targetpath)
OSError: [Errno 17] File exists: '/private/tmp/i/GChartWrapper/charts/
templatetags'
sridh...@whymac:/tmp/i >

--
components: Library (Lib)
messages: 90652
nosy: srid
severity: normal
status: open
title: zipfile: OSError File exists
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue6511] zipfile: Invalid argument when opening zero-sized files

2009-07-17 Thread Sridhar Ratnakumar

New submission from Sridhar Ratnakumar :

Ideally, zipfile.BadZipFile should be thrown when trying to open files 
that are zero-sized.

sridh...@whymac:/tmp/i > apy -c "import zipfile; zipfile.ZipFile
('empty.zip').extractall()"
Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 693, in __init__
self._GetContents()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 713, in _GetContents
self._RealGetContents()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 723, in _RealGetContents
endrec = _EndRecData(fp)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 189, in _EndRecData
fpin.seek(-sizeEndCentDir, 2)
IOError: [Errno 22] Invalid argument
sridh...@whymac:/tmp/i >

--
components: Library (Lib)
messages: 90653
nosy: srid
severity: normal
status: open
title: zipfile: Invalid argument when opening zero-sized files
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue6511] zipfile: Invalid argument when opening zero-sized files

2009-07-17 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

Also repros on python-3.1

--
versions: +Python 3.1

___
Python tracker 

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



[issue6511] zipfile: Invalid argument when opening zero-sized files

2009-07-17 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

Note: empty.zip is nothing but an empty file created using the 'touch' 
command.

--

___
Python tracker 

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