[issue7904] urlparse.urlsplit mishandles novel schemes

2010-02-18 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed in the r78234 and merged back to other branches.
I fell back to RFC's definition of scheme, as anything before the ://.
I did not see the need to add s3 specifically as a valid scheme type, because 
s3 itself is not registered a schemetype.
So, the fix should work for s3 and other undefined schemes as per RFC.

Thanks for the patch.

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



[issue7005] ConfigParser does not handle options without values

2010-02-18 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr.  added the comment:

Patch and documentation merged to the py3k branch (r78233).

Work on this is complete.

--
resolution:  -> accepted
stage:  -> committed/rejected
status: open -> closed
type:  -> feature request

___
Python tracker 

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



[issue1540] Refleak tests: test_doctest and test_gc are failing

2010-02-18 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

One last thought on this bug.  The problem is that after we try to delete 
garbage, we really can't know much about the state of the objects in the 
finalizers list.  If any of the objects that are cleared end up causing a 
finalizer to run, then any of the objects in the finalizers list may be 
reachable again.  One possibility is to do nothing with the objects in the 
finalizers list if there was any garbage to delete.  That means objects with 
finalizers would be harder to get to gc.collect()--for example, you'd need to 
call gc.collect() twice in a row.  The first time to clear garbage, the second 
time to handle unreachable objects with finalizers.  Or the GC could run a 
second time if garbage was cleared and finalizers was non-empty.

A more complicated possibility would be to track some object state about when a 
finalizer was run.  If any of the objects in finalizers had a finalizer that 
ran while garbage was cleared, we could skip the finalizers list.  I don't know 
how to implement this, since an arbitrary C type could run Python code in 
tp_dealloc without notifying GC.

--

___
Python tracker 

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-02-18 Thread Michael Foord

Michael Foord  added the comment:

I'm not seeing the same issue on my Macbook Pro. I can get all this info from 
my desktop machine (Mac Pro) when I return from PyCon.

--

___
Python tracker 

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



[issue1540] Refleak tests: test_doctest and test_gc are failing

2010-02-18 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

I spent some time to understand the example script today.  The specific issue 
is that a set of objects get put into the list of unreachable objects with 
finalizers (both Immutable and Finalizer instances).  When Cycle's __dict__ is 
cleared, it also decrefs Immutable which resurrects it and Finalizer.  The 
garbage collector is not prepared for an unreachable finalizer object to become 
reachable again.  More generally, it's hard to assume anything about the state 
of the finalizers after unreachable trash is collected.  I'll think more about 
what to do, but I don't see any easy solutions.

--

___
Python tracker 

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



[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2010-02-18 Thread Matthew Barnett

Matthew Barnett  added the comment:

On a related note, this doesn't work either:

>>> "{-1}".format("x", "y", "z")
Traceback (most recent call last):
  File "", line 1, in 
"{-1}".format("x", "y", "z")
KeyError: '-1'

It could return "z".

It also rejects a leading '+', but that would be optional anyway.

--
nosy: +mrabarnett

___
Python tracker 

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-18 Thread Matthew Barnett

Matthew Barnett  added the comment:

issue2636-20100219.zip is a new version of the regex module.

The regex module should give the same results as the re module for backwards 
compatibility.

The ignorecase bug is now fixed.

This new version releases the GIL when matching on str and bytes (str and 
unicode in Python 2.x).

--
Added file: http://bugs.python.org/file16255/issue2636-20100219.zip

___
Python tracker 

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



[issue3132] implement PEP 3118 struct changes

2010-02-18 Thread Meador Inge

Meador Inge  added the comment:

Mark,

> I think a lot of this discussion needs to go back to python-dev;  with 
> luck, we can get some advice and clarifications from the PEP authors 
> there.

So the next step is to kick off a thread on python-dev summarizing the 
questions\problems we have come up with?  I can get that started.

> Are there other discussions that I'm missing?

I did a quick search and came up with the same.

--

___
Python tracker 

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



[issue7250] wsgiref.handlers.CGIHandler caches os.environ, leaking info between requests

2010-02-18 Thread Phillip J. Eby

Phillip J. Eby  added the comment:

What sort of test did you have in mind?  To test the desired outcome, it seems 
we'd need to poison os.environ, reload wsgiref.handlers, remove the poison, and 
then make sure it didn't get in.  That seems a bit like overkill (as well as 
hard to get right), while the alternative of simply testing that CGIHandler has 
an empty os_environ seems a bit like a cheat.  Any thoughts?

--

___
Python tracker 

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-18 Thread Vlastimil Brom

Vlastimil Brom  added the comment:

Thanks for fixing the argument positions;
unfortunately, it seems, there might be some other problem, that makes my code 
work differently than the builtin re;
it seems, in the character classes the ignorcase flag is ignored somehow: 

>>> regex.findall(r"[ab]", "aB", regex.I)
['a']
>>> re.findall(r"[ab]", "aB", re.I)
['a', 'B']
>>> 

(The same with the flag set in the pattern.)

Outside of the character class the case seems to be handled normally, or am I 
missing something?

vbr

--

___
Python tracker 

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



[issue7963] Misleading error message from object(arg)

2010-02-18 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

>>> object(1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: object.__new__() takes no parameters


This is misleading because object.__new__() takes one parameter:

>>> object.__new__(object)



I suggest changing "object.__new__() takes no parameters" to "object() takes no 
parameters".

Some other inconsistencies that I noticed:

>>> tuple.__new__(tuple, 1, 2, 3)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: tuple() takes at most 1 argument (3 given)

but

>>> list.__new__(list, 1, 2, 3)
[]

--
components: Interpreter Core
messages: 99547
nosy: Alexander.Belopolsky
severity: normal
status: open
title: Misleading error message from object(arg)
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



[issue2736] datetime needs an "epoch" method

2010-02-18 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Victor,

As you explain in your own documentation, the proposed method is equivalent to 
``(time.mktime(self.timetuple()), self.microsecond)``, so all it does is 
replacing a less than a one-liner.  Moreover, I am not sure 
time.mktime(self.timetuple()) is something that people would want to do with a 
TZ-aware datetime.  If the tzinfo of the datetime object does not match the 
system TZ used by mktime, the result will be quite misleading.

On the patch itself:

1. See my comment at Issue1726687 about the tm_wday == 1 typo.

2. I don't think time_t to long cast is safe on all platforms.

--
nosy: +Alexander.Belopolsky
title: datetime needs and "epoch" method -> datetime needs an "epoch" method
type: behavior -> feature request

___
Python tracker 

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Ori Avtalion

Ori Avtalion  added the comment:

Ignoring the custom utf-8/latin-8 conversion functions, the actual checking if 
a codec exists is done in Python/codecs.c's PyCodec_Decode.

Is that where I should move the aforementioned optimization to?
Is it safe to assume that the decoded object is always a string/bytestring?

--

___
Python tracker 

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

And PyUnicode_Decode doesn't look up the encoding in the registry either:  
that's somewhere in PyCodec_Decode.

I'm going to butt out now and leave this to those who know the code better. :)

--

___
Python tracker 

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

I take that back:  test_codecs_errors isn't the right function to add these 
tests to.  I actually don't see any current tests for invalid codecs.  Part of 
the problem would be coming up with an invalid codec name in the first place:  
as I understand it, new codecs can be registered at run time.

--

___
Python tracker 

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks for the patch.

Rather than remove that optimization entirely, I'd consider pushing it into 
PyUnicode_Decode.

All tests (whether for the standard library or for the core) go into Lib/test, 
so that would be the right place.  test_codecs_errors in 
Lib/test/test_unicode.py looks appropriate.

Adding Marc-André to the nosy list:  this is much more his domain than mine.

--
nosy: +lemburg

___
Python tracker 

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



[issue1726687] Bug found in datetime for Epoch time = -1

2010-02-18 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I wonder: with year bounds being checked in gettmarg() and mktime accepting 
arbitrary values for the rest of the tm structure members (at least it appears 
to on my Mac), is it possible trigger "mktime argument out of range"?

If it is possible, then a unit test should be added for such case.  Note that 
the issue2736 patch contains a typo that assures that overflow is never 
reported, but the unit test presented here does not catch that bug:

"""
+   buf.tm_wday = -1;
tt = mktime(&buf);
-   if (tt == (time_t)(-1)) {
+   if (tt == (time_t)(-1) && buf.tm_wday == 1) {
PyErr_SetString(PyExc_OverflowError,
"mktime argument out of range");
"""
(Note missing '-' in buf.tm_wday == 1 check. See issue2736.)

--

___
Python tracker 

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Ori Avtalion

Ori Avtalion  added the comment:

OK.

The attached patch removes the empty string check before decoding.

I'm not sure where tests should go, since I can only find them in Lib/test/ and 
this is not a library change.

--
keywords: +patch
Added file: http://bugs.python.org/file16254/decode.patch

___
Python tracker 

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



[issue7434] pprint doesn't know how to print a namedtuple

2010-02-18 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Will ponder this a bit more but will likely close this specific request 
(leaving open the possibility of a more general rewrite of pprint).

--
assignee:  -> rhettinger
priority:  -> low
versions: +Python 2.7, Python 3.2 -Python 2.6

___
Python tracker 

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

Specifically, the behaviour comes from an early check for empty strings in the 
PyUnicode_FromEncodedObject function:

/* Convert to Unicode */
if (len == 0) {
Py_INCREF(unicode_empty);
v = (PyObject *)unicode_empty;
}
else
v = PyUnicode_Decode(s, len, encoding, errors);

It's not until PyUnicode_Decode that there's any attempt to make sense of 
'encoding'.  This doesn't seem like a serious bug to me, but I agree that it 
would be cleaner to fail on unknown encodings even for an empty string.

Ori:  are you interested in working on a patch?

--
components: +Interpreter Core -None
nosy: +mark.dickinson
stage:  -> needs patch

___
Python tracker 

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



[issue7960] test.support.captured_output has invalid docstring example

2010-02-18 Thread Michael Newman

New submission from Michael Newman :

test.support.captured_output is not covered in the online documents:
http://docs.python.org/3.1/library/test.html
http://docs.python.org/dev/py3k/library/test.html

However, it does have a docstring in "C:\Python31\Lib\test\support.py" (see 
below). The current example for "captured_output" does not work. Looks like 
someone moved it from "captured_stdout" but did not fully update it. Note the 
old example still references "captured_stdout". 

# Here's the current code in "support.py":

@contextlib.contextmanager
def captured_output(stream_name):
"""Run the 'with' statement body using a StringIO object in place of a
specific attribute on the sys module.
Example use (with 'stream_name=stdout')::

   with captured_stdout() as s:
   print("hello")
   assert s.getvalue() == "hello"
"""
import io
orig_stdout = getattr(sys, stream_name)
setattr(sys, stream_name, io.StringIO())
try:
yield getattr(sys, stream_name)
finally:
setattr(sys, stream_name, orig_stdout)

def captured_stdout():
return captured_output("stdout")

# Example for captured_output should now be:

   with captured_output("stdout") as s:
   print("hello")
   assert s.getvalue() == "hello"

# It would be nice to reconcile the online doc versus the docstrings, since it 
confusing and makes me confused whether captured_stdout is deprecated.

--
assignee: georg.brandl
components: Documentation
messages: 99529
nosy: georg.brandl, mnewman
severity: normal
status: open
title: test.support.captured_output has invalid docstring example
versions: Python 3.1, Python 3.2

___
Python tracker 

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



[issue7959] ctypes memory leak

2010-02-18 Thread Thomas Heller

New submission from Thomas Heller :

This little script 'ctypes-leak.py' leaks memory:

"""
import gc
from ctypes import *

PROTO = WINFUNCTYPE(None)

class Test(object):
def func(self):
pass

def __init__(self):
self.v = PROTO(self.func)


while 1:
try:
Test()
gc.collect()
except KeyboardInterrupt:
print len([x for x in gc.get_objects()
   if isinstance(x, Test)])
"""

The cause is that patch related to issue #2682; it leaks since rev. 62481 (in 
trunk) and rev. 62484 (in py3k).

I have not yet been able to find the cause of the leak.

--
assignee: theller
components: ctypes
files: ctypes-leak.py
messages: 99527
nosy: theller
severity: normal
status: open
title: ctypes memory leak
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file16253/ctypes-leak.py

___
Python tracker 

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



[issue7956] unittest.Testcase assertDictContainsSubset with integer keys

2010-02-18 Thread Michael Foord

Michael Foord  added the comment:

Thanks for reporting this.

I can fix this particular error easily by repr'ing the keys. In the process 
I've found another fun way of killing this assert method:


one = ''.join(chr(i) for i in range(255))
two = u'\uFFFD'
first = {'foo': one}
second = {'foo': two}
self.assertDictContainsSubset(first, second)

  File "/Users/michael/Dev/Packages/python-trunk/Lib/unittest/case.py", line 
728, in assertDictContainsSubset
(key, value, actual[key]))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 143: 
ordinal not in range(128)

--

___
Python tracker 

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



[issue1578269] Add os.symlink() and os.path.islink() support for Windows

2010-02-18 Thread Eric Smith

Eric Smith  added the comment:

At the language summit we okay'd using ctypes in the tests for standard lib 
modules, specifically for this issue.

--

___
Python tracker 

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



[issue1540] Refleak tests: test_doctest and test_gc are failing

2010-02-18 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

I'm trying to figure out the attached script.  If I run Python 3.0, the script 
doesn't run because of the undefined gc.DEBUG_OBJECTS.  If I just remove that, 
the script runs without error.  Does that mean the problem is fixed?  Or is 
running without an error an example of the problem?

If I add gc.DEBUG_SAVEALL, it fails--but that seems obvious because 
DEBUG_SAVEALL adds all objects with finalizers to gc.garbage.

--
nosy: +Jeremy.Hylton

___
Python tracker 

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



[issue7955] TextIOWrapper Buffering Inconsistent Between _io and _pyio

2010-02-18 Thread Andrew McNabb

Andrew McNabb  added the comment:

I would imagine that this would come up in most programs that read data from a 
pipe or from a socket (which are binary data) and then output to stdout or 
stderr.  I ran across the problem in my first non-trivial port to Python 3, and 
it seems like a common case to me.

But having the weird behavior documented is the most important thing.

--

___
Python tracker 

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



[issue7955] TextIOWrapper Buffering Inconsistent Between _io and _pyio

2010-02-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I agree this deserves documentation. I'm not convinced it's a common need, 
though. Usually you either use stdin/stdout in binary mode or in text mode, but 
you don't interleave both quite frequently.

--
assignee:  -> georg.brandl
components: +Documentation
nosy: +georg.brandl
resolution: invalid -> 
stage: committed/rejected -> 
versions: +Python 2.6, Python 2.7, Python 3.2

___
Python tracker 

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



[issue7955] TextIOWrapper Buffering Inconsistent Between _io and _pyio

2010-02-18 Thread Andrew McNabb

Andrew McNabb  added the comment:

This seems like a common need (particularly for stdout and stderr), and setting 
`stdout._CHUNK_SIZE = 1` is relying on an implementation detail.

1) Can the documentation for TextIOWrapper be updated to clearly describe this 
extra buffering (how often buffer.write is called, etc.)?

2) Can there be a flush-like method, say write_to_buffer() to force a 
buffer.write() without the overhead of a flush?

--
status: closed -> open

___
Python tracker 

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



[issue5839] RegOpenKeyEx key failed on Vista 64Bit with return 2

2010-02-18 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Closing because of lack of feedback.

--
nosy: +loewis
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue6040] bdist_msi does not deal with pre-release version

2010-02-18 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

The problem is that the version number goes into the MSI ProductVersion 
property, which MUST be numeric, or else Windows will refuse to install the 
package. So this is not just an arbitrary choice (at least not by bdist_msi).

I'm not sure how a strictly numeric version could be determined from the 
metadata for a prerelease.

--
nosy: +loewis

___
Python tracker 

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



[issue7958] test_platform failure on OS X 10.6

2010-02-18 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

This test seems to trigger an issue in site.py, adding '-v' to the code that 
starts the interpreter in test_platform.py gives the following output (amongst 
a lot more text that doesn't seem to be relevant):

'import site' failed; traceback:
Traceback (most recent call last):
  File "/Users/ronald/Projects/python/python-trunk/build/../Lib/site.py", line 
530, in 
main()
  File "/Users/ronald/Projects/python/python-trunk/build/../Lib/site.py", line 
509, in main
addbuilddir()
  File "/Users/ronald/Projects/python/python-trunk/build/../Lib/site.py", line 
118, in addbuilddir
s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
  File "/Users/ronald/Projects/python/python-trunk/Lib/sysconfig.py", line 577, 
in get_platform
cfgvars = get_config_vars()
  File "/Users/ronald/Projects/python/python-trunk/Lib/sysconfig.py", line 402, 
in get_config_vars
_init_posix(_CONFIG_VARS)
  File "/Users/ronald/Projects/python/python-trunk/Lib/sysconfig.py", line 255, 
in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open 
/usr/local/lib/python2.7/config/Makefile (No such file or directory)


The root cause is that test_architecture_via_symlink starts python through a 
symlink, and that confuses the sysconfig module because that tries to detect if 
it is running in the build tree by looking for a file relative to 
sys.executable, without resolving symlinks.

A simple patch to sysconfig seems to fix the issue:

-_PROJECT_BASE = abspath(os.path.dirname(sys.executable))
+_PROJECT_BASE = abspath(os.path.dirname(os.path.realpath(sys.executable)))

(also attached as a proper patch).

I'm adding tarek because he added Lib/sysconfig.py.

Tarek: could you please review the patch?

--
keywords: +patch
nosy: +tarek
Added file: http://bugs.python.org/file16252/sysconfig.patch

___
Python tracker 

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



[issue7957] Tutorial issue regarding the sys module

2010-02-18 Thread Lucian Ursu

Lucian Ursu  added the comment:

Then it must be an issue with my Python. This is what I get. 
>>> import sys
>>> dir(sys)
['__displayhook__', '__doc__', '__excepthook__', '__name__', '__package__', 
'__stderr__', '__stdin__', '__stdout__', '_clear_type_cache', 
'_current_frames', '_getframe', 'api_version', 'argv', 'builtin_module_names', 
'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook', 
'dllhandle', 'dont_write_bytecode', 'exc_clear', 'exc_info', 'exc_traceback', 
'exc_type', 'exc_value', 'excepthook', 'exec_prefix', 'executable', 'exit', 
'flags', 'float_info', 'getcheckinterval', 'getdefaultencoding', 
'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 
'getsizeof', 'gettrace', 'getwindowsversion', 'hexversion', 'last_traceback', 
'last_type', 'last_value', 'maxint', 'maxsize', 'maxunicode', 'meta_path', 
'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 
'py3kwarning', 'setcheckinterval', 'setprofile', 'setrecursionlimit', 
'settrace', 'stderr', 'stdin', 'stdout', 'subversion', 'version', 
'version_info', 'warnoptions', 'winver']
>>> sys.ps1

Traceback (most recent call last):
  File "", line 1, in 
sys.ps1
AttributeError: 'module' object has no attribute 'ps1'
>>>

--

___
Python tracker 

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



[issue7957] Tutorial issue regarding the sys module

2010-02-18 Thread Georg Brandl

Georg Brandl  added the comment:

They exist only in interactive mode.  They won't be present if you do e.g.

python -c "import sys; print dir(sys)"

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



[issue7958] test_platform failure on OS X 10.6

2010-02-18 Thread Mark Dickinson

New submission from Mark Dickinson :

With a 64-bit debug non-framework builds of the trunk and py3k, on OS X 10.6, 
I'm consistently getting the following failure in test_platform:

trunk dickinsm$ ./python.exe Lib/test/regrtest.py -uall test_platform
test_platform
[18064 refs]
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/dickinsm/python/svn/trunk/Lib/platform.py", line 1017, in 
architecture
import struct
  File "/Users/dickinsm/python/svn/trunk/Lib/struct.py", line 1, in 
from _struct import *
ImportError: No module named _struct
[17485 refs]
test test_platform failed -- Traceback (most recent call last):
  File "/Users/dickinsm/python/svn/trunk/Lib/test/test_platform.py", line 24, 
in test_architecture_via_symlink
self.assertEqual(get(real), get(link))
AssertionError: Tuples differ: ("('64bit', '')\n", None) != ('', None)

First differing element 0:
('64bit', '')



- ("('64bit', '')\n", None)
+ ('', None)

1 test failed:
test_platform
[36722 refs]

--
assignee: ronaldoussoren
components: Macintosh, Tests
messages: 99512
nosy: mark.dickinson, ronaldoussoren
severity: normal
status: open
title: test_platform failure on OS X 10.6
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker 

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



[issue7957] Tutorial issue regarding the sys module

2010-02-18 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

That's odd, they should exist and do for me:

Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.ps1
'>>> '
>>> sys.ps2
'... '
>>>

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue7957] Tutorial issue regarding the sys module

2010-02-18 Thread Lucian Ursu

New submission from Lucian Ursu :

Hello,

I've discovered an issue while reading the Python tutorial. In chapter 6.2. 
"Standard Modules", the tutorial mentions the "sys" module and two of its 
attributes, ps1='<<<' and ps2='...'. The problem is I can't find these 
attributes in my version of Python (2.6.4.) when I do "dir(sys)". Have these 
attributes been deprecated but not removed from the tutorial yet?
Thank you for your time.
Lucian

--
assignee: georg.brandl
components: Documentation
messages: 99510
nosy: LucianU, georg.brandl
severity: normal
status: open
title: Tutorial issue regarding the sys module
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



[issue7633] decimal.py: type conversion in context methods

2010-02-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

Tweaked some doctests in r78218:

- add integer argument doctest for logical_invert
- fix integer literals with a leading zero for the other logical_***
  methods, since they're illegal in Python 3.

Merged to py3k in r78219.

Thanks, everyone!

--
resolution:  -> accepted
stage: needs patch -> 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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-18 Thread Christoph Neuroth

Christoph Neuroth  added the comment:

As recommended by eric.smith on #7950, I'd like to suggest further extending 
the documentation to include a security warning about (quite easily) possible 
code injection bugs when using the shell=True parameter (similar to other 
places in the documentation).

--
nosy: +christoph.neuroth

___
Python tracker 

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



[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-02-18 Thread Christoph Neuroth

Christoph Neuroth  added the comment:

Good idea :)

--
status: open -> closed

___
Python tracker 

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



[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-02-18 Thread Eric Smith

Eric Smith  added the comment:

If you want to generate some more discussion, I suggest you close this issue 
and reopen the other one, since that has more people on the nosy list.

--

___
Python tracker 

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



[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-02-18 Thread Christoph Neuroth

Christoph Neuroth  added the comment:

You're right, that has been improved in regard to how you can do it instead. 
However, I still think it lacks to mention the security risk involved - compare 
this to e.g. os.tempnam(), which has a warning in a red box.

--
status: closed -> open

___
Python tracker 

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



[issue5604] imp.find_module() mixes UTF8 and MBCS

2010-02-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Also the test has a few problems:
1) the keys of known_locales are lowercase, but locale_encoding = 
locale.getpreferredencoding() can return uppercase encodings (e.g. UTF-8);
2) this masks another error: the b'\xe4' is not a valid utf-8 byte and it can 
be decoded;
3) the test should be skipped properly if the preferred encoding is not among 
the ones of the known_locales dict;
4) the 'encoded_char' should be 'decoded_char'.

It seems that in the failure linked by Florent, find_module tries to encode the 
filename with the wrong encoding and with error='replace' and the char at the 
end of 'test_imp_helper_' is converted to U+FFFD.
If the file is created with the correct name (e.g. 'test_imp_helper_\xc0') and 
find_module tries to search the wrong name (i.e. 'test_imp_helper_\ufffd'), 
then the error is raised (but then cp1252 used by the terminal can't encode 
that char and the second exception is raised).
Now the tests are run on C: and the filesystem encoding might be different, so 
it might not match anymore the encoding returned by 
locale.getpreferredencoding().

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



[issue7633] decimal.py: type conversion in context methods

2010-02-18 Thread Stefan Krah

Stefan Krah  added the comment:

It looks good (I agree on number_class), but I'd change these:

  - Add raiseit=True to context.copy_decimal()

  - Remove wrong comment from context.is_infinite()

  - Add _convert_other(a, raiseit=True) to context.logical_invert()

  - More whitespace in test_decimal()



The new tests could be condensed quite a bit by using getattr(), but
that isn't so important.

--
Added file: http://bugs.python.org/file16251/issue7633_jjconti5_metd.patch

___
Python tracker 

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



[issue7942] Inconsistent error types/messages for __len__ (and __nonzero__) between old and new-style classes

2010-02-18 Thread Paul Boddie

Paul Boddie  added the comment:

Actually, in the issue reported, the initial problem occurs in the evaluation 
of an object in a boolean context (and the subsequent problem occurs with an 
explicit len invocation):

http://www.selenic.com/pipermail/mercurial/2010-February/030066.html

Presumably (from memory and a brief look at the reference), when "if data:" is 
evaluated, Python attempts to invoke an instance's __nonzero__ method or its 
__len__ method. Since the mercurial.httprepo.httpsendfile class only provides a 
__len__ method, the __len__ method's return value is used to determine truth.

The following demonstrates this particular issue:

>>> class C:
... def __len__(self):
... return 2**35
...
>>> c = C()
>>> if c: pass
...
Traceback (most recent call last):
  File "", line 1, in 
TypeError: __nonzero__ should return an int
>>> class C(object):
... def __len__(self):
... return 2**35
...
>>> c = C()
>>> if c: pass
...
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: long int too large to convert to int

Here, I could actually argue that the message mentioning __nonzero__ is 
obscure: there isn't such a method defined, and __len__ is the misbehaving 
method. Still, in the context of boolean evaluation, the OverflowError is less 
helpful than it could be.

--
title: Inconsistent error types/messages for __len__ between old and new-style 
classes -> Inconsistent error types/messages for __len__ (and __nonzero__) 
between old and new-style classes

___
Python tracker 

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



[issue7956] unittest.Testcase assertDictContainsSubset with integer keys

2010-02-18 Thread Michael Newman

New submission from Michael Newman :

The attached example unit test file shows that assertDictContainsSubset cannot 
handle error messages that need to show integer keys. Below is the output of 
the test suite, where "test_mixed_keys_fail" has an error (code mistake), while 
"test_text_keys_fail" produces a failure (result mistake) as expected.

C:\notes>C:\Python31\python.exe test_one_and_one.py
.E.F
==
ERROR: test_mixed_keys_fail (__main__.Test_one_and_one)
--
Traceback (most recent call last):
  File "test_one_and_one.py", line 30, in test_mixed_keys_fail
self.assertDictContainsSubset({3: "this does not exist"}, self.dict_with_mix
ed_keys)
  File "C:\python31\lib\unittest.py", line 908, in assertDictContainsSubset
standardMsg = 'Missing: %r' % ','.join(missing)
TypeError: sequence item 0: expected str instance, int found

==
FAIL: test_text_keys_fail (__main__.Test_one_and_one)
--
Traceback (most recent call last):
  File "test_one_and_one.py", line 33, in test_text_keys_fail
self.assertDictContainsSubset({"3": "this does not exist"}, self.dict_with_t
ext_keys)
AssertionError: Missing: '3'

--
Ran 4 tests in 0.010s

FAILED (failures=1, errors=1)

--
components: Library (Lib)
files: test_one_and_one.py
messages: 99500
nosy: mnewman
severity: normal
status: open
title: unittest.Testcase assertDictContainsSubset with integer keys
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file16250/test_one_and_one.py

___
Python tracker 

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



[issue5604] imp.find_module() mixes UTF8 and MBCS

2010-02-18 Thread Florent Xicluna

Florent Xicluna  added the comment:

Still an issue for some buildbot:

http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/1487
http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/1491


It is loosely related with #7712, because now the tests are run in TEMP (on C:) 
instead of the build dir (on D:).

--
keywords: +buildbot
nosy: +ezio.melotti, flox
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue7712] Add a context manager to change cwd in test.test_support and run the test suite in a temp dir.

2010-02-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Ported to py3k in r78214. I will think about the cleanups later, they are not 
so important right now.

--

___
Python tracker 

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