[issue9541] node.pre_order() does not do preorder traversal

2010-08-07 Thread Joe Amenta

New submission from Joe Amenta ament...@msu.edu:

In Lib/lib2to3/pytree.py, Node.pre_order() calls the post_order() method of its 
children, instead of pre_order().  As a result, the only difference between the 
two orderings is that pre_order() yields the original node first, whereas 
post_order() yields the original node last.  It seems highly unlikely to me 
that any code would depend on this behavior.

The fix, of course, is trivial: change the call to child.post_order() on line 
289 into a call to child.pre_order().

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 113233
nosy: joe.amenta
priority: normal
severity: normal
status: open
title: node.pre_order() does not do preorder traversal
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue9541] node.pre_order() does not do preorder traversal

2010-08-07 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

Fixed in r83811.

--
status: open - closed

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



[issue7162] 2to3 does not convert __builtins__.file

2010-03-07 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

Yes, the idea was that it doesn't seem outlandish for someone to do:
def file(something):
do_stuff()

You can use lib2to3.fixer_util.is_probably_builtin for this... modified the 
patch and attached.

--
Added file: http://bugs.python.org/file16490/issue7162-3.patch

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



[issue767645] incorrect os.path.supports_unicode_filenames

2010-01-12 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

If it is decided to keep supports_unicode_filenames, here is a patch for 
test_os.py that verifies the value of supports_unicode_filenames against the 
following line from the documentation:
True if arbitrary Unicode strings can be used as file names (within 
limitations imposed by the file system), and if os.listdir() returns Unicode 
strings for a Unicode argument.

--
keywords: +patch
nosy: +joe.amenta
Added file: 
http://bugs.python.org/file15843/test_supports_unicode_filenames.patch

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



[issue7006] The replacement suggested for callable(x) in py3k is not equivalent

2009-12-25 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

I believe that this patch works like you described...

Attached a patch with more test cases to show this.

(the [1:] parts are to make the test cases readable; they will still pass 
if all the leading newlines are removed from the triple-quoted strings and 
all [1:] are removed :-)

--
Added file: 
http://bugs.python.org/file15673/new_callable_semantics_moretests.patch

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



[issue7006] The replacement suggested for callable(x) in py3k is not equivalent

2009-12-25 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

To elaborate on my last comment:

- touch_import looks for the required import binding in any scope, and it 
will add a global import if not found, otherwise it leaves it alone
- the import added does not have a newline prefix, so if the newlines were 
left in, (without [1:]) the tests would fail.
  However, I found that the test cases are easier to read if they all 
start on the same indentation level, so adding a newline for the reader 
but telling the parser to ignore it makes readable, correct test cases.

--

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



[issue7006] The replacement suggested for callable(x) in py3k is not equivalent

2009-12-24 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

One such weird corner case:

from collections import Callable
class Spam(object):
   def __call__(self):
  return self

can_of_spam = Spam()
print callable(can_of_spam) == isinstance(can_of_spam, Callable) # True
del Spam.__call__
can_of_spam.__call__ = lambda can: 'spam'
print callable(can_of_spam) == isinstance(can_of_spam, Callable) # False

Regardless, attached a patch for the new proposed semantics

--
keywords: +patch
nosy: +joe.amenta
Added file: http://bugs.python.org/file15671/new_callable_semantics.patch

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



[issue7162] 2to3 does not convert __builtins__.file

2009-10-17 Thread Joe Amenta

New submission from Joe Amenta ament...@msu.edu:

Step to reproduce:

$ echo 'file(/some/file)' | python `which 2to3` -

(replace python with whichever python executable version you wish to
use, e.g. ~/python-trunk/python or /usr/local/bin/python3.2 )

Expected result:
Anything referring to the fact that the file type no longer exists in
python 3.x, whether it be a warning or a refactoring.

Actual result:
RefactoringTool: No files need to be modified.

Just a report for now, I don't have the time to write a patch.

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 94190
nosy: joe.amenta
severity: normal
status: open
title: 2to3 does not convert __builtins__.file
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2

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



[issue7162] 2to3 does not convert __builtins__.file

2009-10-17 Thread Joe Amenta

Changes by Joe Amenta ament...@msu.edu:


--
type:  - behavior

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



[issue3563] fix_idioms.py generates bad code

2009-10-06 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

Attached a patch that implements more thoroughly what appears to be the
intended behavior.

--
nosy: +joe.amenta
Added file: http://bugs.python.org/file15061/fix_idioms.patch

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



[issue3563] fix_idioms.py generates bad code

2009-10-06 Thread Joe Amenta

Changes by Joe Amenta ament...@msu.edu:


Removed file: http://bugs.python.org/file15061/fix_idioms.patch

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



[issue3563] fix_idioms.py generates bad code

2009-10-06 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

Missed a paren in the last one... re-uploading it.

--
Added file: http://bugs.python.org/file15062/fix_idioms.patch

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



[issue5705] os.getpwent returns unsigned 32bit value, os.setuid refuses it

2009-09-02 Thread Joe Amenta

Changes by Joe Amenta ament...@msu.edu:


--
nosy: +joe.amenta

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



[issue6711] macurl2path has typos that raise AttributeError

2009-08-16 Thread Joe Amenta

New submission from Joe Amenta ament...@msu.edu:

In a few spots, urllib.parse misses a . after the package name.

e.g., urllib.parse.quote is spelled urllib.parsequote, which
generates an AttributeError when run.

To reproduce, open up a python3.x interpreter and execute:
from macurl2path import *
url2pathname('doesnt_matter_what')
pathname2url('some_string')
_pncomp2url('something_else')

Attaching a patch that will fix the issue.

--
components: Library (Lib)
files: py3k_url2path.patch
keywords: patch
messages: 91627
nosy: joe.amenta
severity: normal
status: open
title: macurl2path has typos that raise AttributeError
type: crash
versions: Python 3.0, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file14735/py3k_url2path.patch

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



[issue6583] 2to3 fails to fix test.test_support

2009-07-26 Thread Joe Amenta

New submission from Joe Amenta ament...@msu.edu:

PEP 3108 states that test.test_support was renamed to test.support as a
part of the Standard Library Reorganization process.  However...

2to3 does not refactor (or even warn about) test.test_support.  Simply
adding
test.test_support: test.support,
into the MAPPING of fix_imports.py would not work, because
fix_imports.py does not accept anything with a dot in it, i.e. foo.bar.

--
components: 2to3 (2.x to 3.0 conversion tool)
files: 2to3_out.txt
messages: 90975
nosy: joe.amenta
severity: normal
status: open
title: 2to3 fails to fix test.test_support
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file14575/2to3_out.txt

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



[issue6185] 2to3 misses buffer slicing

2009-06-02 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

Patch that will fix the problem (and make the test pass)

--
Added file: http://bugs.python.org/file14165/bufferfix.patch

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




[issue6174] What's new in 2.6, wrong indentation in code sample

2009-06-01 Thread Joe Amenta

New submission from Joe Amenta ament...@msu.edu:

In the final example in the multiprocessing package on
http://docs.python.org/3.0/whatsnew/2.6.html#pep-371-the-multiprocessing-package
a part of the code is not properly indented.  There should be one more
level of indentation starting at #Mark pool as closed.

Patch adds that level of indentation.

--
assignee: georg.brandl
components: Documentation
files: docdiff.patch
keywords: patch
messages: 88716
nosy: georg.brandl, joe.amenta
severity: normal
status: open
title: What's new in 2.6, wrong indentation in code sample
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file14154/docdiff.patch

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



[issue6070] Pyhon 2.6 makes .pyc/.pyo bytecode files executable

2009-05-22 Thread Joe Amenta

Joe Amenta ament...@msu.edu added the comment:

Python writes compiled files with the same file permissions as the
source module.  In your specific example:

$ python2.6 -c 'import module'

This will produce module.pyc with the same attributes as module.py

While I am not familiar with modifying C stat structs, I can say that in
trunk/Python/import.c, somewhere after line 977 but before line 1014,
the stat struct st must be examined for S_IXUSR, S_IXGRP, and S_IXOTH
and have those bits removed in order to never produce a compiled module
with x in the stat.  I would assign low priority to this issue, as it
has little impact on the behavior of Python, even though it might cause
unintended consequences to a user trying to execute the bytecode, if the
user interprets the x to mean that it is executable by the system.

--
nosy: +joe.amenta

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



[issue6050] zipfile: Extracting a directory that already exists generates an OSError

2009-05-17 Thread Joe Amenta

New submission from Joe Amenta ament...@msu.edu:

zipfile.ZipFile.extract() fails if targetpath is a directory that
already exists.

Bug revealed itself on Ubuntu, using extractall().

Happened on the latest 3.1 and 2.7.

Attached a patch that I think will fix this issue.

--
components: Library (Lib)
files: zipdiff.diff
keywords: patch
messages: 88014
nosy: joe.amenta
severity: normal
status: open
title: zipfile: Extracting a directory that already exists generates an OSError
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file14005/zipdiff.diff

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