[issue3706] Fix error message for wrong exec() argument type

2008-08-28 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

OK, I changed that and committed r66051.

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

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3696] Error parsing arguments on OpenBSD <= 4.4

2008-08-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

> Another small remark; #ifdef is better then #ifndef 
> Simply because it easier to get "Be positive" than "Don't be negative".

Yes; but here, the symbol (HAVE_BROKEN_MBSTOWC) has a negative meaning.
I tried to put the optimistic (=not broken) case first.
However, if this makes the code more difficult to read, I'll change it.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3711] docs still say to use .dll for compiled extensions

2008-08-28 Thread Gabriel Genellina

New submission from Gabriel Genellina <[EMAIL PROTECTED]>:

The "Extending and Embedding" document still says, in section "Building 
C and C++ Extensions on Windows":
http://docs.python.org/dev/extending/windows.html#a-cookbook-approach
that a C extension may be called spam.dll or spam_d.dll

Since version 2.5 the file must be called spam.pyd or spam_d.pyd - 
the .dll file extension isn't recognized anymore.

A proposed doc patch is attached.

--
assignee: georg.brandl
components: Documentation
files: windows.diff
keywords: patch
messages: 72071
nosy: gagenellina, georg.brandl
severity: normal
status: open
title: docs still say to use .dll for compiled extensions
versions: Python 2.5, Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11284/windows.diff

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3014] file_dealloc() assumes errno is set when EOF is returned

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

The title of your bug report might be misleading. Is the problem that
errno is misinterpreted in the error message, or that there is an error
message at all?

--
nosy: +pitrou
priority:  -> normal
versions: +Python 2.7 -Python 2.4

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3711] docs still say to use .dll for compiled extensions

2008-08-28 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Thanks, fixed in r66053.

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

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3708] os.urandom(1.1): infinite loop

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

The explicit int() conversion looked saner to me, rather than passing a
float argument to read().
By the way, is there a reason this code still uses os.open rather than
the builtin io.open?

--
nosy: +pitrou

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3660] reference leaks in 3.0

2008-08-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

- the "test_site leaked [88, 88]" is the same as problem as issue3667.

- test_unicodes leaks in PyUnicode_AsEncodedString (attached patch), and
also with:
  str(memoryview(b'character buffers are decoded to unicode'), 'utf-8')
I tried another patch, but I'm not sure: I get lost between all these
buffers... a Py_DECREF(self->view.obj) in memory_releasebuf() seems to work.

--
keywords: +patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file11285/encode-leak.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3660] reference leaks in 3.0

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

>   str(memoryview(b'character buffers are decoded to unicode'), 'utf-8')
> I tried another patch, but I'm not sure: I get lost between all these
> buffers... a Py_DECREF(self->view.obj) in memory_releasebuf() seems to work.

Could you open a separate issue for the latter? Adding a DECREF in
memory_releasebuf() isn't the right thing to do, because PyBuffer_Release()
already does such a DECREF. I think the problem is rather in memory_getbuf(), it
tries to take some strange shortcuts.

Oh, and I realize that memoryobject doesn't have tp_traverse and tp_clear, which
looks quite wrong...

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3696] Error parsing arguments on OpenBSD <= 4.4

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

> Yes; but here, the symbol (HAVE_BROKEN_MBSTOWC) has a negative meaning.
> I tried to put the optimistic (=not broken) case first.
> However, if this makes the code more difficult to read, I'll change it.

You could change HAVE_BROKEN_MBSTOWC for a positive flag, e.g.
HAVE_WORKING_MBSTOWC, and then the #ifdef would be the optimistic case.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3712] memoryview leaks references

2008-08-28 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc <[EMAIL PROTECTED]>:

Two problems with memoryview:
- The buffer interface of memoryview leaks a reference:
str(memoryview(b'text'), 'utf-8')

- memoryview does not implement tp_traverse and tp_clear, so reference
cycle cannot be collected, as with:

import gc
class MyBuf(bytes): pass

def f():
buf = MyBuf(b'abc')
m = memoryview(buf)
buf.m = m
gc.collect();gc.collect();gc.collect()

each call to f() leaks 6 references.

--
messages: 72078
nosy: amaury.forgeotdarc
priority: release blocker
severity: normal
status: open
title: memoryview leaks references
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3660] reference leaks in 3.0

2008-08-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

issue3712 tracks the memoryview issues.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3712] memoryview leaks references

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Here is a patch. I feel a bit unsafe with the intended semantics of
getting a buffer on a memoryview object, but it fixes the leak.

--
components: +Interpreter Core
keywords: +needs review, patch
nosy: +pitrou, teoliphant
type:  -> resource usage
Added file: http://bugs.python.org/file11286/memleak.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3712] memoryview leaks references

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

(I forgot to say, the patch is for the first problem only)

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3660] reference leaks in 3.0

2008-08-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

the leaks in test_pickle and test_pickletools are corrected by the
attached patch.

Added file: http://bugs.python.org/file11288/pickle-leak.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3616] shutil.rmtree() fails on invalid filename

2008-08-28 Thread STINNER Victor

STINNER Victor <[EMAIL PROTECTED]> added the comment:

Python 2.5 has the same problem (at least, on Linux). rmtree() fails if the directory contains invalid unicode 
string. Backtrace:
---
File "shutil.py", line 163, in rmtree
   fullname = os.path.join(path, name)
File "posixpath.py", line 65, in join
   path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xac in position 
3: ordinal not in range(128)
---

The filename:
   $ ls /tmp/run-3/exitcode1/run-4/run-1/session-2/
   ?I?#??|?*?  Pum

The instruction was 
rmtree(u"/tmp/run-3/exitcode1/run-4/run-1/session-2").

--
versions: +Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3667] Reloading an extension module always leaks

2008-08-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

The fix is actually simple: _PyImport_FindExtension() used to return a
borrowed reference, the "strong" reference being stored in the
PyImport_GetModuleDict() dictionary. All paths should behave the same.

See attached patch.

(for unit tests, run for example
regrtest.py -R:: test_site
)

--
keywords: +needs review, patch
Added file: http://bugs.python.org/file11289/import-leak.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3712] memoryview leaks references

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Here is an aggregate patch addressing both problems. Please review.

Added file: http://bugs.python.org/file11290/memleak2.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3713] Compile warning for Objects/stringlib

2008-08-28 Thread Andy

New submission from Andy <[EMAIL PROTECTED]>:

Checked out the PY3K branch and built. Received a warning 
about "characters after #ifdef ignored" from Objects/stringlib/find.h

the line in question is:

#ifdef STRINGLIB_WANT_CONTAINS_OBJ && !defined(FROM_BYTEARRAY)

Which is likely to mean that it will not do what is expected.

System is Ubuntu using GCC (otoh can't remember full compiler spec will 
post in later)

Patch to follow that modifies the above line to:

#if defined(STRINGLIB_WANT_CONTAINS_OBJ) && !defined(FROM_BYTEARRAY)

and will change the comment on the closing #endif too.

hope component choice is correct

--
components: Library (Lib)
messages: 72087
nosy: kirkshorts
severity: normal
status: open
title: Compile warning for Objects/stringlib
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3616] shutil.rmtree() fails on invalid filename

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Selon STINNER Victor <[EMAIL PROTECTED]>:
>
> Python 2.5 has the same problem (at least, on Linux). rmtree( directory name>) fails if the directory contains invalid unicode
> string. Backtrace:

Well, I'm not sure we should call it the same problem, although the roots are
the same. The difference is that in 2.x, using bytes strings for file and
directory names is quite normal, especially under Linux where they are just
bytes at the OS level. In 3.0 though, those strings are supposed to be unicode
at the Python level, which makes the problem much more critical.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3713] Compile warning for Objects/stringlib

2008-08-28 Thread Andy

Andy <[EMAIL PROTECTED]> added the comment:

patch for issue attached.

gcc -v => gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

tests:

./runtests.sh =>
   0 BAD
 297 GOOD
  27 SKIPPED
 324 total

--
keywords: +patch
Added file: http://bugs.python.org/file11291/issue3713.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3714] nntplib module broken by str to unicode conversion

2008-08-28 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev <[EMAIL PROTECTED]>:

The following commands fail badly:

>>> from nntplib import NNTP
>>> s = NNTP("free-text.usenetserver.com")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/nntplib.py", line 116, in __init__
self.welcome = self.getresp()
  File "/py3k/Lib/nntplib.py", line 215, in getresp
resp = self.getline()
  File "/py3k/Lib/nntplib.py", line 209, in getline
elif line[-1:] in CRLF: line = line[:-1]
TypeError: 'in ' requires string as left operand, not bytes

Actually there are many places in nntplib module which need to be
converted to bytes, or socket input/output values need to be converted
from/to str. I think API need to be updated to pass user defined
encoding at some stages. I can make a patch later if needed.

--
components: Library (Lib)
messages: 72090
nosy: hdima
severity: normal
status: open
title: nntplib module broken by str to unicode conversion
type: crash
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3714] nntplib module broken by str to unicode conversion

2008-08-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

Yes, the module is unusable in the current state.

--
nosy: +amaury.forgeotdarc
priority:  -> critical

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3714] nntplib module broken by str to unicode conversion

2008-08-28 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

I've attached the patch which adds encoding parameter to the NNTP class.

--
keywords: +patch
Added file: http://bugs.python.org/file11292/nntplib.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3713] Compile warning for Objects/stringlib

2008-08-28 Thread Christian Heimes

Christian Heimes <[EMAIL PROTECTED]> added the comment:

Thanks! It was a merge glitch. Fixed in r66055

--
nosy: +christian.heimes
resolution:  -> fixed
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3014] file_dealloc() assumes errno is set when EOF is returned

2008-08-28 Thread johansen

johansen <[EMAIL PROTECTED]> added the comment:

The problem is present in Python 2.4.4, the version that we're using
here.  I'm not familiar with the versions keyword that's used here, but
that's the version for which I'm reporting this bug.

To be clear, the problem is that when file_dealloc() sees an EOF, it
assumes that an error has occurred.  It then checks errno.  However,
it's possible for file_dealloc() to get an EOF under conditions where
errno hasn't been set.  In that case, it reports an error with a stale
value of errno.  This is explained in detail in the initial report.  I
don't think the title is misleading; it's incorrect for file_dealloc()
to assume that errno is set every time it gets an EOF.

--
versions: +Python 2.4 -Python 2.7

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3014] file_dealloc() assumes errno is set when EOF is returned

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Selon johansen <[EMAIL PROTECTED]>:
>
> The problem is present in Python 2.4.4, the version that we're using
> here.  I'm not familiar with the versions keyword that's used here, but
> that's the version for which I'm reporting this bug.

The only changes that may be brought now to the 2.4 branch are security fixes
and nothing else. Bug fixes with a slight risk of changing legitimate behaviour
like the present one, on the other hand, will happen either on the 2.6 branch or
on the 2.7 one.

> To be clear, the problem is that when file_dealloc() sees an EOF, it
> assumes that an error has occurred.  It then checks errno.  However,
> it's possible for file_dealloc() to get an EOF under conditions where
> errno hasn't been set.  In that case, it reports an error with a stale
> value of errno.  This is explained in detail in the initial report.

You still haven't explained what the correct behaviour would be, though.
Must it report an error or not? If it must, then how should this specific error
be detected and how should the error message be phrased?

Thanks in advance.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3675] Python 2.6 can't read sets pickled with Python 3.0

2008-08-28 Thread Daniel Diniz

Daniel Diniz <[EMAIL PROTECTED]> added the comment:

Hagen,
does this simple patch (against 2.6) solve it for you?

Index: Lib/pickle.py
===
--- Lib/pickle.py   (revision 66050)
+++ Lib/pickle.py   (working copy)
@@ -1121,6 +1121,8 @@

 def find_class(self, module, name):
 # Subclasses may override this
+if module == "builtins":
+module = "__builtin__"
 __import__(module)
 mod = sys.modules[module]
 klass = getattr(mod, name)

I think a dict mapping the moved modules would work better, perhaps
having it in PyPI would be enough?

--
nosy: +ajaksu2

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3675] Python 2.6 can't read sets pickled with Python 3.0

2008-08-28 Thread Hagen Fürstenau

Hagen Fürstenau <[EMAIL PROTECTED]> added the comment:

Well, Python <= 2.5 still wouldn't be able to unpickle those built in
objects.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3014] file_dealloc() assumes errno is set when EOF is returned

2008-08-28 Thread johansen

johansen <[EMAIL PROTECTED]> added the comment:

As I said before:

  check_and_flush calls ferror(3C) and then fflush(3C) on the FILE
  stream associated with the file object.  There's just one problem
  here.  If it finds an error that was previously encountered on the
  file stream, there's no guarantee that errno will be valid.
  Should an error be encountered in fflush(3C), errno will get set;
  however, the contents of errno are undefined should fflush()
  return successfully.

The problem is this:

The caller of check_and_flush() will check errno if check_and_flush
returns an error.  However, check_and_flush() checks two different error
sources.  If ferror() returns an error, you can't check errno, because
that routine doesn't set errno.  However, if fflush() returns an error,
it will set errno.

In its current form, no caller of check_and_flush() should check errno
if the check_and_flush doesn't return successfully, since there's no way
of knowing whether errno will be set or not.

That doesn't make a lot of sense to me, so I would probably re-write
this code.  However, since I'm not an expert in the inner workings of
the Python interpreter, it's hard for me to suggest just how to do this.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3715] hashlib's docstring throws exception in pydoc

2008-08-28 Thread Erick Tryzelaar

New submission from Erick Tryzelaar <[EMAIL PROTECTED]>:

Hello,

I noticed that doing "pydoc3.0 hashlib" was throwing this exception:

Traceback (most recent call last):
  File "/opt/local/bin/pydoc3.0", line 5, in 
pydoc.cli()
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 2237, in cli
help.help(arg)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1714, in help
elif request: doc(request, 'Help on %s:')
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1504, in doc
pager(render_doc(thing, title, forceload))
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1319, in pager
pager(text)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1339, in 
return lambda text: pipepager(text, 'less')
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1360, in pipepager
pipe.write(text)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/io.py", line 1486, in write
b = encoder.encode(s)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/encodings/mac_roman.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]


This problem is coming from this block of text:

>>> import hashlib
>>> m = hashlib.md5()
>>> m.update(b"Nobody inspects")
>>> m.update(b" the spammish repetition")
>>> m.digest()
b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

Specifically, the last line. It seems that pydoc is interpreting the 
last line as a unicode string, and then when it tries to print it out on 
my mac it errors out.

--
components: Library (Lib)
messages: 72099
nosy: erickt
severity: normal
status: open
title: hashlib's docstring throws exception in pydoc
type: crash
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3675] Python 2.6 can't read sets pickled with Python 3.0

2008-08-28 Thread Daniel Diniz

Daniel Diniz <[EMAIL PROTECTED]> added the comment:

FWIW, there's a mapping of 2.6:3.0 modules in lib2to3:

from lib2to3.fixes.fix_imports import MAPPING

The attached patch uses that for a quick and dirty way of loading 3.0
pickles in 2.6.

--
keywords: +patch
Added file: http://bugs.python.org/file11293/pickle.diff

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2501] xml.sax.parser() doesn't terminate when given a filename

2008-08-28 Thread Daniel Diniz

Daniel Diniz <[EMAIL PROTECTED]> added the comment:

ISTM that this release blocker can be solved by changing
xml.sax.xmlreader.py line 122 from:
while buffer != "":
to
while buffer != b"":

--
nosy: +ajaksu2

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3680] Cycles with some iterator are leaking.

2008-08-28 Thread Jesús Cea Avión

Changes by Jesús Cea Avión <[EMAIL PROTECTED]>:


--
nosy: +jcea

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2501] xml.sax.parser() doesn't terminate when given a filename

2008-08-28 Thread Christian Heimes

Christian Heimes <[EMAIL PROTECTED]> added the comment:

I've a better idea:


while buffer: 

It's faster and works for both empty bytes and str.

The patch fixes the issue and re-enables three unit tests.

--
keywords: +needs review, patch
Added file: http://bugs.python.org/file11295/xmlreader_buffer.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue1923] meaningful whitespace can be lost in rfc822_escape

2008-08-28 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

I've just checked that the patch still applies cleanly to 2.6 and it
does and the tests still passes. It looks like the patch has already
been applied to 3.0 but without the test. The test part of the part
applies cleanly to 3.0 too.

--
nosy: +hodgestar

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3716] mistake in 3.4.2 Customizing attribute access

2008-08-28 Thread Alex7564

New submission from Alex7564 <[EMAIL PROTECTED]>:

"Note that if the attribute is found through the normal mechanism,
__getattr__() is not called."
"...because otherwise __setattr__() would have no way to access other
attributes of the instance."

I think it should be __getattr__() instead of __setattr__()

--
assignee: georg.brandl
components: Documentation
messages: 72105
nosy: Alex7564, georg.brandl
severity: normal
status: open
title: mistake in 3.4.2 Customizing attribute access
versions: Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3716] mistake in 3.4.2 Customizing attribute access

2008-08-28 Thread Alex7564

Alex7564 <[EMAIL PROTECTED]> added the comment:

"Note that if the attribute is found through the normal mechanism,
__getattr__() is not called."
"because otherwise __setattr__() would have no way to access other
attributes of the instance."

I think it's __getattr__() instead of __setattr__()

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3708] os.urandom(1.1): infinite loop

2008-08-28 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

if i did 

 n = int(n)

that would change the API to allow bytes/unicode to be passed in which
is not something i want.  i don't even like that it allows floats.

by not doing the int conversion at all, a DeprecationWarning is raised
by the read() about the argument being a float which I figure it not a
bad thing given that the API really should only accept ints...

fwiw, daniel's patch would still cause this deprecation warning from
read so I guess using while len(bs) < int(n): isn't that bad either. 
but it would allow a string such as '0' to be passed in as an argument
without an exception...

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3716] mistake in 3.4.2 Customizing attribute access

2008-08-28 Thread Alex7564

Alex7564 <[EMAIL PROTECTED]> added the comment:

I was talking about Python Reference Manual
(http://docs.python.org/ref/attribute-access.html)

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3708] os.urandom(1.1): infinite loop

2008-08-28 Thread Daniel Diniz

Daniel Diniz <[EMAIL PROTECTED]> added the comment:

Gregory,
IMHO your patch is better in all aspects.

Regarding my patch, the API wouldn't change at all, as the source reads:
while len(bytes) < int(n):
bytes += read(_urandomfd, n - len(bytes))

So "n - len(bytes)" restricts the API to what it was before. But it
would call int() for each loop iteration :/

@Pitrou: My patch still passed the float to read (to keep the current
behavior, warning included), but if doing that can be considered a bug,
let's get rid of the DeprecationWarning by passing an int.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue1868] threading.local doesn't free attrs when assigning thread exits

2008-08-28 Thread Ben Cottrell

Ben Cottrell <[EMAIL PROTECTED]> added the comment:

I like this patch, too! I think it's a much cleaner way of implementing
the thread._local type. However, when I test it, I have problems with
subclasses of thread._local; using the class itself seems to work.

I've attached a test program that shows the issue.

--
nosy: +tamino
Added file: http://bugs.python.org/file11296/test1868.py

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3717] Py_InitModule* is still referenced in docs

2008-08-28 Thread Erick Tryzelaar

New submission from Erick Tryzelaar <[EMAIL PROTECTED]>:

The docs still reference Py_InitModule*, which was removed in r64107. 
Also,  Demo/embed/demo.c still use Py_InitModule, and thus doesn't 
compile.

--
assignee: georg.brandl
components: Documentation
messages: 72111
nosy: erickt, georg.brandl
severity: normal
status: open
title: Py_InitModule* is still referenced in docs
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

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



[issue1868] threading.local doesn't free attrs when assigning thread exits

2008-08-28 Thread Christian Heimes

Christian Heimes <[EMAIL PROTECTED]> added the comment:

Good catch, Ben!

The generic setattr/getattr functions don't work as expected when the
base class doesn't provide a __dict__. They are setting the attributes
in the subclass' __dict__ instead of the thread local dict.

My patch fixes the behavior. However it might be a better idea to make
the threadlocal class non subclass-able.

Added file: http://bugs.python.org/file11297/threading_local2.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3717] Py_InitModule* is still referenced in docs

2008-08-28 Thread Erick Tryzelaar

Erick Tryzelaar <[EMAIL PROTECTED]> added the comment:

On Thu, Aug 28, 2008 at 1:48 PM, Erick Tryzelaar <[EMAIL PROTECTED]> wrote:
>
> New submission from Erick Tryzelaar <[EMAIL PROTECTED]>:
>
> The docs still reference Py_InitModule*, which was removed in r64107.
> Also,  Demo/embed/demo.c still use Py_InitModule, and thus doesn't
> compile.

Here's a patch to get demo.c working, though it's acting a little
strange. Printing out sys.argv results in japanese characters for some
reason.

Index: Demo/embed/demo.c
===
--- Demo/embed/demo.c   (revision 66055)
+++ Demo/embed/demo.c   (working copy)
@@ -2,9 +2,9 @@

 #include "Python.h"

-void initxyzzy(void); /* Forward */
+PyObject* PyInit_xyzzy(void); /* Forward */

-main(int argc, char **argv)
+main(int argc, wchar_t **argv)
 {
/* Pass argv[0] to the Python interpreter */
Py_SetProgramName(argv[0]);
@@ -13,7 +13,7 @@
Py_Initialize();

/* Add a static module */
-   initxyzzy();
+   PyInit_xyzzy();

/* Define sys.argv.  It is up to the application if you
   want this; you can also let it undefined (since the Python
@@ -26,10 +26,10 @@

/* Execute some Python statements (in module __main__) */
PyRun_SimpleString("import sys\n");
-   PyRun_SimpleString("print sys.builtin_module_names\n");
-   PyRun_SimpleString("print sys.modules.keys()\n");
-   PyRun_SimpleString("print sys.executable\n");
-   PyRun_SimpleString("print sys.argv\n");
+   PyRun_SimpleString("print(sys.builtin_module_names)\n");
+   PyRun_SimpleString("print(sys.modules.keys())\n");
+   PyRun_SimpleString("print(sys.executable)\n");
+   PyRun_SimpleString("print(sys.argv)\n");

/* Note that you can call any public function of the Python
   interpreter here, e.g. call_object(). */
@@ -57,9 +57,22 @@
{NULL,  NULL}   /* sentinel */
 };

-void
-initxyzzy(void)
+static struct PyModuleDef xyzzymodule = {
+   {}, /* m_base */
+   "xyzzy",  /* m_name */
+   0,  /* m_doc */
+   0,  /* m_size */
+   xyzzy_methods,  /* m_methods */
+   0,  /* m_reload */
+   0,  /* m_traverse */
+   0,  /* m_clear */
+   0,  /* m_free */
+};
+
+PyObject*
+PyInit_xyzzy(void)
 {
-   PyImport_AddModule("xyzzy");
-   Py_InitModule("xyzzy", xyzzy_methods);
+   PyObject* res = PyModule_Create(&xyzzymodule);
+   if (!res) return NULL;
+   return res;
 }

With loop.c, there are issues with char*/wchar_t* and I'm not sure
what the right approach is. Finally, importexc.c is segfaulting with:

#0  0x0005b2f3 in PyDict_SetItem (op=0x0, key=0x44bed0,
value=0x17d460) at Objects/dictobject.c:712
#1  0x0005ee02 in PyDict_SetItemString (v=0x0, key=0x16e860
"last_type", item=0x17d460) at Objects/dictobject.c:2090
#2  0x0012c23a in PySys_SetObject (name=0x16e860 "last_type",
v=0x17d460) at Python/sysmodule.c:67
#3  0x00122c99 in PyErr_PrintEx (set_sys_last_vars=1) at Python/pythonrun.c:1254
#4  0x001228bc in PyErr_Print () at Python/pythonrun.c:1150
#5  0x001223a1 in PyRun_SimpleStringFlags (command=0x157b80 "import
sys", flags=0x0) at Python/pythonrun.c:1075
#6  0x243b in main () at importexc.c:13

--
nosy: +idadesub

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2235] __eq__ / __hash__ check doesn't take inheritance into account

2008-08-28 Thread Nick Coghlan

Nick Coghlan <[EMAIL PROTECTED]> added the comment:

Reopening - still need to fix the Python level docs for hash() and
__hash__().

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

___
Python tracker <[EMAIL PROTECTED]>

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



[issue1868] threading.local doesn't free attrs when assigning thread exits

2008-08-28 Thread Ben Cottrell

Ben Cottrell <[EMAIL PROTECTED]> added the comment:

Christian,

Your patch works for me -- thanks!!

I made a slight modification to your patch to allow "del" to work,
and have attached my modified version.

I agree that allowing subclassing makes thread._local harder to get
right than it would otherwise be. There is code out there that uses
that feature, though -- I'm running into it in the context of django,
which (when using the sqlite database back end) keeps its sqlite
connections in a subclass of thread._local.

Added file: http://bugs.python.org/file11298/threading_local3.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3718] environment variable MACHDEP and python build system

2008-08-28 Thread Roumen Petrov

New submission from Roumen Petrov <[EMAIL PROTECTED]>:

A) The reason to propose this patch following paragraph
from README:

2) To set sys.platform to something sensible, pass the
   following environment variable to the configure script:

 MACHDEP=unicosmk

The sentence above is not true in all cases. It don't state how to pass
as example
1) MACHDEP=abcd
   export MACHDEP
   ./configure 
2) MACHDEP=abcd ./configure 
3) ./configure MACHDEP=abcd 

The Makefile.pre.in contain dependency rule "Run the configure script": 
that create config.status if file "configure" is changed as run the script.
>From above three samples for environment varaible passing only 3) will
save MACHDEP
into variable CONFIG_ARGS from generated Makefile.
The case 2) alwais lost it if config.status is created from makefile rule.
The case 1) will work only if developer don't remeber to set it every day.


B) The test case (note that MACHDEP isn't valid name!):
$ MACHDEP=linuxTEST ./configure --disable-ipv6
checking MACHDEP... linuxTEST

checking for build directories... done
configure: creating ./config.status

creating Makefile

Now lets see if "configure" script is changed:
$ touch configure; make
/bin/sh ./configure '--disable-ipv6'
checking MACHDEP... linux2 <-- MACHDEP is lost

checking for build directories... done
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Modules/Setup.config
config.status: creating pyconfig.h
config.status: pyconfig.h is unchanged
creating Modules/Setup
creating Modules/Setup.local
creating Makefile
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= /bin/sh config.status
config.status: creating Makefile.pre
make -f Makefile.pre Makefile
make[1]: Entering directory `/python-release25-maint'
make[1]: `Makefile' is up to date. <--- extra
make[1]: Leaving directory `/python-release25-maint'
/bin/sh ./Modules/makesetup -c ./Modules/config.c.in \

The Makefile was updated, you may need to re-run make.
gcc -pthread -c 


Note an extra attempt to create Makefile.


C) Next lets see after patch:
(the python configuration is the same as above):
$ touch configure; make
/bin/sh ./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure  --disable-ipv6
MACHDEP=linuxTEST  --no-create --no-recursion
checking MACHDEP... linuxTEST  <-- MACHDEP is same as at
configure time

checking for build directories... done
configure: creating ./config.status
creating Modules/Setup
creating Modules/Setup.local
creating Makefile
/bin/sh ./config.status Makefile.pre
config.status: creating Makefile.pre
/bin/sh ./Modules/makesetup -c ./Modules/config.c.in \
-s Modules \
Modules/Setup.config \
Modules/Setup.local \
Modules/Setup
The Makefile was updated, you may need to re-run make.
gcc -pthread -c - 
(ignore failure here since MACHDEP=linuxTEST is used only to show problem)


D) Rerefence (from autoconf textinfo sections):
4.8.5 Automatic Remaking
7.2 Setting Output Variables (see macro AC_ARG_VAR)
16 config.status Invocation

--
components: Build
files: python-release25-MACHDEP.patch
keywords: patch
messages: 72116
nosy: rpetrov
severity: normal
status: open
title: environment variable MACHDEP and python build system
versions: Python 2.5
Added file: http://bugs.python.org/file11299/python-release25-MACHDEP.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3014] file_dealloc() assumes errno is set when EOF is returned

2008-08-28 Thread Antoine Pitrou

Changes by Antoine Pitrou <[EMAIL PROTECTED]>:


--
nosy:  -pitrou

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3708] os.urandom(1.1): infinite loop

2008-08-28 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Le jeudi 28 août 2008 à 19:30 +, Gregory P. Smith a écrit :
> if i did 
> 
>  n = int(n)
> 
> that would change the API to allow bytes/unicode to be passed in which
> is not something i want.

Ok, I hadn't thought about that. You convinced me.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3719] platform.py: _syscmd_file() can't handle target path with space or special shell character

2008-08-28 Thread jfdp

New submission from jfdp <[EMAIL PROTECTED]>:

If you install python in a location which has a space
or shell character in the path then platform.platform()
will generate an error and/or fail to get all platform
information.

For example

$ pwd
/disk0/tmp/foobar(2)/python2.4/bin
$ ./python
Python 2.4.4 (#8, Apr 11 2008, 11:42:39) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> print platform.platform()
sh: syntax error at line 1: `(' unexpected
SunOS-5.10-sun4u-sparc-32bit

Note the error from 'sh' was well as the fact that "ELF"
is missing from the platform string. If you are in a path
with a space then it silently fails to identify "ELF".

The problem is in platform.py: _syscmd_file(target,default='')
in particular this line:

f = os.popen('file %s 2> /dev/null' % target)

This should be:

f = os.popen('file "%s" 2> /dev/null' % target)

Note the double quotes to protect the path from the shell.

I've examined the 2.5, 2.6 and 3.0 source and they all
have this same problem.

--
components: Library (Lib)
messages: 72118
nosy: jfdp
severity: normal
status: open
title: platform.py: _syscmd_file() can't handle target path with space or 
special shell character
type: behavior
versions: Python 2.4

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3720] segfault in for loop with evil iterator

2008-08-28 Thread Gideon Smeding

New submission from Gideon Smeding <[EMAIL PROTECTED]>:

The attached example crashes python. The crash is caused by an evil 
iterator that removes its own next function.

--
files: baditerator.py
messages: 72119
nosy: gideon
severity: normal
status: open
title: segfault in for loop with evil iterator
type: crash
versions: Python 2.5, Python 3.0
Added file: http://bugs.python.org/file11300/baditerator.py

___
Python tracker <[EMAIL PROTECTED]>

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