[issue4708] os.pipe should return inheritable descriptors (Windows)

2009-01-14 Thread Aaron Brady

Aaron Brady  added the comment:

This is currently accomplished in 'multiprocessing.forking' with a
'duplicate' function.

Use (line #213):
rfd, wfd = os.pipe()

# get handle for read end of the pipe and make it inheritable
rhandle = duplicate(msvcrt.get_osfhandle(rfd), inheritable=True)

Definition (line #192).

Should it be included in the public interface and documented, or perhaps
a public entry point to it made?

___
Python tracker 

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



[issue4874] decoding functions in _codecs module accept str arguments

2009-01-14 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

On 2009-01-13 14:14, Antoine Pitrou wrote:
> Antoine Pitrou  added the comment:
> 
> The patch is probably fine, but it would be nice to add some unit tests
> for the new behaviour.

+1 from my side.

Thanks for the patch, Viktor.

___
Python tracker 

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



[issue4931] distutils does not show any error msg when can't build C module extensions due to a missing C compiler

2009-01-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The problem has two causes:
- IOError is raised when no compiler is found. DistutilsPlatformError
should be used instead, this was fixed by #4702.

- the distutils.util.grok_environment_error function transforms a
IOError("Unable to find vcvarsall.bat") into "error: None".

This function should not be used IMO. Its docstring claims that it
"Handles Python 1.5.1 and 1.5.2 styles", but str() does a better job...

Patch attached.

--
keywords: +needs review, patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file12739/distutils_ioerror.patch

___
Python tracker 

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



[issue4781] The function, Threading.Timer.run(), may be Inappropriate

2009-01-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Indeed, Timer is designed to run the function once.

--
nosy: +amaury.forgeotdarc
resolution:  -> works for me
status: open -> closed

___
Python tracker 

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



[issue4929] smptlib.py can raise socket.error

2009-01-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue4715] optimize bytecode for conditional branches

2009-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Your change to the "LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP"
> optimization doesn't preserve the optimization to:
>   def f():
> return 1 and a
> I suspect we don't care since "0 or a" wasn't optimized.

Yes, this optimization seems meant for "while 1" and "while True" mainly
(which my patch preserves, but I might add a comment).

> I wonder what the "POP_TOP JUMP_FORWARD 1 POP_TOP" was ever for. Why did
> compiler_comprehension_generator() emit it in the first place?

I'm as clueless as you...

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2009-01-14 Thread Steven D'Aprano

New submission from Steven D'Aprano :

Documentation for files states that when writing to a file, unicode 
strings are converted to byte strings using the encoding specified by 
file.encoding.
http://docs.python.org/library/stdtypes.html#file.encoding

sys.stdout is a file, but it does not behave as stated above:

>>> type(sys.stdout)

>>> sys.stdout.encoding
'UTF-8'
>>> u = u"\u554a"
>>> print u
啊
>>> sys.stdout.write(u)
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'ascii' codec can't encode character u'\u554a' in 
position 0: ordinal not in range(128)
>>> sys.stdout.write(u.encode('utf-8'))
啊

--
messages: 79849
nosy: stevenjd
severity: normal
status: open
title: sys.stdout fails to use default encoding as advertised
versions: Python 2.5, Python 2.6

___
Python tracker 

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



[issue4946] Lib/test/test__locale uses is to compare strings

2009-01-14 Thread Maciek Fijalkowski

New submission from Maciek Fijalkowski :

this is at least a bad practice. It also might break silently at any point.

--
components: Library (Lib), Tests
files: out.diff
keywords: patch
messages: 79846
nosy: fijal
severity: normal
status: open
title: Lib/test/test__locale uses is to compare strings
versions: Python 2.7
Added file: http://bugs.python.org/file12740/out.diff

___
Python tracker 

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



[issue4715] optimize bytecode for conditional branches

2009-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le mercredi 14 janvier 2009 à 02:48 +, Jeffrey Yasskin a écrit :
> Looking through the patch...
> 
> I don't really like the names for JUMP_OR_POP and POP_OR_JUMP.

I don't like them either, they're the only relatively short ones I could
come up with. I'll change them to your proposal
(JUMP_IF_{TRUE,FALSE}_OR_POP).

> I wonder if BINARY_AND and BINARY_OR should get predictions ... not for
> this patch.

With the patch, I don't think they need predictions anymore.

> POP_JUMP_IF_TRUE is only used in one place: assertions. I wonder if
> anyone would cry if we compiled assertions to UNARY_NOT;
> POP_JUMP_IF_FALSE instead...

No, POP_JUMP_IF_TRUE is also used when optimizing the sequence
"UNARY_NOT; POP_JUMP_IF_FALSE" (think "if not x: ...").

> In compiler_comprehension_generator, "compiler_use_next_block(c, skip);"
> is now always followed by "compiler_use_next_block(c, if_cleanup);".
> Should you remove the use(skip) call?

I'll look at this.

> In peephole.c, s/JUMP_SIGN/JUMPS_ON_TRUE/ ?

Great, another stupid name disappears :)

___
Python tracker 

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



[issue4715] optimize bytecode for conditional branches

2009-01-14 Thread Paolo 'Blaisorblade' Giarrusso

Changes by Paolo 'Blaisorblade' Giarrusso :


--
nosy: +blaisorblade

___
Python tracker 

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



[issue4941] Tell GCC Py_DECREF is unlikely to call the destructor

2009-01-14 Thread Paolo 'Blaisorblade' Giarrusso

Paolo 'Blaisorblade' Giarrusso  added the comment:

Also, GCC 2.95 does not support the construct, GCC 2.96 is required.
So, I'd suggest defining likely/unlikely unconditionally and using this,
which leads to less code overall:

#  if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 95))
#  define __builtin_expect(exp, prediction)  (exp)
#  endif

This is the simplest way to code this, assuming that ICC defines
__GNUC__, and my reference guide tells "yes, it defines __GNUC__ and
__INTEL_COMPILER".

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2009-01-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It probably uses sys.getdefaultencoding() instead.

--
components: +Interpreter Core
nosy: +pitrou
priority:  -> high
type:  -> behavior

___
Python tracker 

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



[issue1519638] Unmatched Group issue - workaround

2009-01-14 Thread Bobby Xiao

Bobby Xiao  added the comment:

Well, in this example the group (ar) is unmatched, so sre throws the
error, and because of the alternation, the workaround you mentioned
doesn't seem to directly apply.

A better example is probably
re.sub("foo(?:b(ar)|foo)","\\1","foofoo")
because this can't be simply repaired by refactoring the regex.

The correct behaviour, as I have observed in other regex
implementations, is to replace the group by the empty string; for
example, in Javascript:
>>> 'foobar'.replace(/foo(?:b(ar)|baz)/,'$1')
"ar"
>>> 'foobaz'.replace(/foo(?:b(ar)|baz)/,'$1')
""

--
versions: +Python 2.5, Python 2.6, Python 3.0

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-14 Thread Javen Wang

Javen Wang  added the comment:

gagenellina,

My application is a little bit different from your test code. It won't
wait for the exit of new process and there're file writing operations
during makefile running. I changed the test code to be real
multi-process and tried many file sizes. But I cannot reproduce it.
Maybe my application is more complicated situation.

___
Python tracker 

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



[issue2233] Makefile.pre.in contains extra slash before $(DESTDIR) which can cause Cygwin build to fail

2009-01-14 Thread Jason Tishler

Jason Tishler  added the comment:

Your latest patch is on the right track, but see my latest one, 
Makefile.pre.in.v2.diff, for an optimization.  I tested make install 
with and without DESTDIR defined on the command line and both cases 
behaved as expected.

Added file: http://bugs.python.org/file12741/Makefile.pre.in.v2.diff

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-14 Thread Javen Wang

Javen Wang  added the comment:

The created files are on local drive. I saw the problem on the laptop
(XP-SP2), desktop(XP-SP3) and server (Win2003). But there's no such
problem on the Linux and Mac boxes.

I tried to use fopen/fwrite in my extension according to your
suggestion. The problem wasn't be reproduced. It seems the bug is more
alike in Python part.

My application is a build system and is also an open source project. Is
it possible for you to download it and try it in your box?

I created temporary user (py123, password: 123py123) for you (just in
case) and here's steps of how to reproduce it.

  1. Checkout the build system source code in, for example, c:\test
 C:\test> svn co --username py123 --password 123py123
https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools tools

  2. Checkout the source code to be built against in c:\test
 C:\test> svn co --username py123 --password 123py123
https://edk2.tianocore.org/svn/edk2/trunk/edk2 edk2

  3. Change the source code between line 222 and line 229 of
c:\test\tools\Source\Python\Common\Misc.py (SaveFileOnChange function)
like below:

 Fd = open(File, "wb")
 Fd.write(Content)
 Fd.flush()
 os.fsync(Fd.fileno())
 Fd.close()

  4. In c:\test\edk2, run
 C:\test\edk2> edksetup.bat
 C:\test\edk2> set PYTHONPATH=C:\test\tools\Source\Python
 C:\test\edk2> python.exe C:\test\tools\Source\Python\build\build.py
-n 2 -p MdeModulePkg\MdeModulePkg.dsc -a IA32 -s

  5. If the application stops with message like "makefile not found" or
"AutoGen.h not found" message, that means the problem happened.

Visual Studio 2005 is needed to reproduce it.

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-14 Thread Javen Wang

Javen Wang  added the comment:

There would be more chances to see the problem by doing this:

C:\test\edk2> python.exe C:\test\tools\Source\Python\build\build.py
-n 2 -p IntelFrameworkModulePkg\IntelFrameworkModulePkg.dsc -a IA32 -s

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

I really tried, but I can't run your script. first PYTHONPATH must be
set to some value (I tried with tools\Source\Python); Also the tool is
complaining about missing WORKSPACE and EDK_TOOLS_PATH env vars, and a
missing file "Conf\target.txt".
This seems very complicated for a test case... furthermore it comes with
binaries already linked with a specific version of python... what if I
want to use a debug build?

Another question: is there a running anti-virus? if yes, can you try to
temporarily disable it?

___
Python tracker 

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



[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Benoit Boissinot

New submission from Benoit Boissinot :

Generalize heapq to work with all kind of mutable sequences. It should
be investigated PySequence_SetItem is a lot slower than PyList_SET_ITEM
(same for GET_ITEM and GET_SIZE).

--
components: Extension Modules
messages: 79859
nosy: bboissin
severity: normal
status: open
title: Make heapq work with all mutable sequences
type: feature request

___
Python tracker 

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



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

Hi haypo,
 Ok I've been testing with python 2.6 and I put the results here:
 optimizedurlparse is the file with my patch

 First test optimizedurlparse, second urlparse:

#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 
timing optimizedurlparse.urlparse():
[0.89634895324707031, 0.61937308311462402, 0.62004208564758301]
timing urlparse.urlparse():
[0.64083003997802734, 0.6862800121307373, 0.67195010185241699]

#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 2000
timing optimizedurlparse.urlparse():
[1.5077390670776367, 1.2391939163208008, 1.2390918731689453]
timing urlparse.urlparse():
[1.2550511360168457, 1.2493829727172852, 1.2445049285888672]

Now I'll change the order of execution, first urlparse , second
optimizedurlparse:

#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 2000
timing urlparse.urlparse():
[1.6836080551147461, 1.3892900943756104, 1.3195438385009766]
timing optimizedurlparse.urlparse():
[1.4834678173065186, 1.4077410697937012, 1.3824198246002197]
[19647 refs]
#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 2000
timing urlparse.urlparse():
[1.4398901462554932, 1.3237769603729248, 1.3057329654693604]
timing optimizedurlparse.urlparse():
[1.3134419918060303, 1.3127460479736328, 1.2928199768066406]
[19647 refs]

Python Version: 
2.6.1+ (release26-maint:68606, Jan 14 2009, 08:48:41)

The small changes optimize the urlparse.urlparse and urlsplit function a
bit :D.

Added file: http://bugs.python.org/file12742/optmizedurlparse.py

___
Python tracker 

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



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

Please, attach patches instead of the full file.

___
Python tracker 

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



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

And that is the profile code.

Added file: http://bugs.python.org/file12743/profile_urlparse.py

___
Python tracker 

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



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

Hi haypo, 
 sorry for submit all the file, it's my first time here and I'm not very
used to this process yet. :)
Now I attach the patch.

--
keywords: +patch
Added file: http://bugs.python.org/file12744/urlparse.patch

___
Python tracker 

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



[issue4945] json checks True/False by identity, not boolean value

2009-01-14 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> bob.ippolito
nosy: +bob.ippolito

___
Python tracker 

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



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread STINNER Victor

STINNER Victor  added the comment:

> Now I attach the patch.

Your first patch for Python 2.5 was interesting, and looked close to the 
python 2.6 version. But your second patch (for 2.6) contains only 
micro-optimisations:
 - inline the one-line clear_cache() function
 - replace "scheme, url = ..." assignation (used for scheme different 
   than http) by classic assignation (url = ...)

Your benchmark numbers are difficult to read, but I can't see impressive 
results (I guess it's smaller than 10%, maybe 5%).

___
Python tracker 

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



[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

This was discussed at the outset and the decision was a conscious one.

Do you have any particular use cases in mind (what other mutable
sequences do you reach for when you need a heap)?  Or is this just a
general discussion on generalization?

--
assignee:  -> rhettinger
nosy: +rhettinger
versions: +Python 2.7, Python 3.1

___
Python tracker 

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



[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Benoit Boissinot

Benoit Boissinot  added the comment:

I was thinking about array.array. I don't know if it would be faster
than using a list, but it seemed elegant to be able to do a heap on it
anyway.

___
Python tracker 

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



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

Yes are micro-optimizations, but when I parsed a lot of url(10.000 or
more) that 10% or 8% or 5% is very well for me :). It was little
contribution to that module, anyway, i think that there are more
optimizatoins to do but I will try to do it then.

___
Python tracker 

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



[issue4949] Constness in PyErr_NewException

2009-01-14 Thread Andreas Kloeckner

New submission from Andreas Kloeckner :

The "name" argument to PyErr_NewException() should be changed from "char
*" to "const char *". Since the rest of pyerrors.h is const-correct,
this seems like an omission.

--
components: Interpreter Core
messages: 79868
nosy: inducer
severity: normal
status: open
title: Constness in PyErr_NewException
versions: Python 2.5, Python 2.6, Python 3.0

___
Python tracker 

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



[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

array.array is terribly slow.  It is optimized for space, not speed.

___
Python tracker 

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



[issue4950] Redundant declaration in pyerrors.h

2009-01-14 Thread Floris Bruynooghe

New submission from Floris Bruynooghe :

When compiling with -Wredundant-decls gcc spots a redundant declaration:

f...@laurie:sandbox$ cat test.c 
#include 
#include 

int main(void)
{
printf("hello\n");
return 0;
}
f...@laurie:sandbox$ gcc -I /usr/local/include/python3.0/
-Wredundant-decls test.c 
In file included from /usr/local/include/python3.0/Python.h:102,
 from test.c:1:
/usr/local/include/python3.0/pyerrors.h:155: warning: redundant
redeclaration of ‘PyExc_BufferError’
/usr/local/include/python3.0/pyerrors.h:147: warning: previous
declaration of ‘PyExc_BufferError’ was here
f...@laurie:sandbox$

This is annoying since when developing extension modules I usually use
-Werror on top of -Wredundant-decls (among others).

Regards
Floris

--
components: Extension Modules
messages: 79870
nosy: flub
severity: normal
status: open
title: Redundant declaration in pyerrors.h
type: compile error
versions: Python 3.0, Python 3.1

___
Python tracker 

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



[issue4949] Constness in PyErr_NewException

2009-01-14 Thread Ulrich Eckhardt

Ulrich Eckhardt  added the comment:

It's not just that function, at least not in trunk. There are also 
PyErr_SetFromErrnoWithFilename, PyErr_SetFromErrnoWithUnicodeFilename 
and _PyErr_BadInternalCall which should be made const correct, see 
attached patch for trunk.

This patch also fixes some inconsistencies between the documentation 
and warning support functions.

--
keywords: +patch
nosy: +eckhardt
Added file: http://bugs.python.org/file12745/python-2.7-const-error.1.patch

___
Python tracker 

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



[issue4933] Patch to add preliminary support for Haiku

2009-01-14 Thread Scott McCreary

Scott McCreary  added the comment:

On Tue, Jan 13, 2009 at 10:38 PM, Martin v. Löwis
 wrote:
>
> Martin v. Löwis  added the comment:
>
>> I don't have any particular interest in BeOS variants, but this comes as
>> a surprise given that http://python.org/about/ proclaims that "Python
>> runs everywhere."
>>
>> Maybe Haiku could become a supported platform instead of more or less
>> defunct BeOS?
>
> Maybe this can be discussed on python-dev, but there is a standing BDFL
> pronouncement on this matter. It used to be the policy to accept patches
> for any operating system, but this policy is reverted now.
>

I just joined that list, and will move further discussion of this
there, that is once I have a clean patch that can be applied to the
2.6.x branch.  One of Haiku's goals was to improve on POSIX
compliance, so in many ports that we've done (over 100 now) we've
actually had to un-workaround former BeOS workarounds.  So we'd be
fine with removing any BeOS cruft that we come across during a
potential Haiku port/fork.

>> As far as I can tell there is no current BeOS port
>> maintainer, but there is some crud left over from the better times.  If
>> Haiku community can step in and clean up BeOS crud by either removing it
>> or making sure it works on modern BeOS variants, this can only be a good
>> thing.
>
> No. The cost is too high, and there are more important issues to
> resolve. Of course, the Haiku community can provide there fork of Python
> if they want to (and they also get official blessing for forking if they
> want to).
>

I disagree about the cost being too high, as long as our patches are
clean I don't see an issue here, if anything we might find things that
are broken in python that weren't uncovered previously, I think it's a
win-win.  I don't think there's going to be a whole lot that needs to
be patched to get it working on Haiku, we've got a mostly working
2.5.2 binary already, but it's failing a few of the regression tests,
so we are looking into why on those and have left those patches out of
what was submitted, as we wouldn't want to have to undo one of our
previous patches.

-scottmc

___
Python tracker 

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



[issue1242657] list(obj) can swallow KeyboardInterrupt

2009-01-14 Thread Nick Coghlan

Nick Coghlan  added the comment:

Reassigning to Raymond (as per the thread at
http://mail.python.org/pipermail/python-dev/2009-January/085030.html)

--
assignee: georg.brandl -> rhettinger
nosy: +ncoghlan

___
Python tracker 

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



[issue2233] Makefile.pre.in contains extra slash before $(DESTDIR) which can cause Cygwin build to fail

2009-01-14 Thread Roumen Petrov

Roumen Petrov  added the comment:

Hi Jason,
quick review without tests - I expect $${DESTDIR:-/} to work without :
in expression, i.e. just $${DESTDIR-/}.

The ":" in expression is not so portable (some shells fail on this).
Please see "Shell Substitutions" in autoconf manual.

___
Python tracker 

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



[issue4933] Patch to add preliminary support for Haiku

2009-01-14 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

Ok, I'm closing this patch as rejected. If the discussion on python-dev
turns out that Haiku support should be added, then please create a new
issue (with a patch for 2.7 - clearly, for 2.6, no new features can be
added).

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



[issue4908] adding a get_metadata in distutils

2009-01-14 Thread Tarek Ziadé

Changes by Tarek Ziadé :


Added file: http://bugs.python.org/file12746/get_metadata.diff

___
Python tracker 

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



[issue4908] adding a get_metadata in distutils

2009-01-14 Thread Tarek Ziadé

Changes by Tarek Ziadé :


Removed file: http://bugs.python.org/file12692/get_metadata.diff

___
Python tracker 

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



[issue4908] adding a get_metadata in distutils

2009-01-14 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

I have improved the patch (uploaded here) (some cases are not done yet,
still work in progress)

Ray, it should work with egg generated by setuptools now, (zipped as well)

Andi, right ! -> fixed in the current patch

___
Python tracker 

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



[issue2233] Makefile.pre.in contains extra slash before $(DESTDIR) which can cause Cygwin build to fail

2009-01-14 Thread Jason Tishler

Jason Tishler  added the comment:

I guess you mean the following:

${var:-value} 
Old BSD shells, including the Ultrix sh, don't accept the colon for 
any shell substitution, and complain and die.

If so, should we just go forward without the colon?  The bash manpage 
indicates the following:

In each of the cases below, ... bash tests for a parameter that is 
unset or null; omitting the colon results in a test only for a 
parameter that is unset.

So, if a user executes "make DESTDIR= install", then the build will 
fail. Or, maybe we shouldn't worry about that corner case.

What do you think?

___
Python tracker 

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



[issue4933] Patch to add preliminary support for Haiku

2009-01-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, I've launched a discussion on python-dev.  If the OP is willing to
maintain the deltas over a long period of time (and perhaps provide a
buildbot for Haiku), then I fully support his effort.

--
nosy: +rhettinger

___
Python tracker 

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



[issue4946] Lib/test/test__locale uses is to compare strings

2009-01-14 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

Yes, checking object identity is wrong in this case. Your patch looks 
fine to me.

I've found several other "is" comparisons that should not be there -- 
working on a patch right now.

--
nosy: +gagenellina

___
Python tracker 

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



[issue4933] Patch to add preliminary support for Haiku

2009-01-14 Thread Guido van Rossum

Guido van Rossum  added the comment:

[Copy of a post I just made to python-dev]

I'm with Martin. In these days of distributed version control systems, I
would think that the effort for the Haiku folks to maintain a branch of
Python in their own version control would be minimal. It is likely that
for each new Python version that comes out, initially it is broken on
Haiku, and then they have to go in and fix it. Doing that in their own
version control has the advantage that they don't have to worry about
not breaking support for any other minority operating systems, so I
expect that all in all the cost will be less for them than if they have
to submit these patches to core Python; and since that will definitely
be less work for core Python, I would call that a win-win solution.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue4951] failure in test_httpservers

2009-01-14 Thread Antoine Pitrou

New submission from Antoine Pitrou :

This one seems to pop up rather frequently on the buildbots:


==
FAIL: test_post (test.test_httpservers.CGIHTTPServerTestCase)
--
Traceback (most recent call last):
  File
"E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_httpservers.py",
line 330, in test_post
self.assertEquals(res.read(), b'1, python, 123456\n')
AssertionError: b'' != b'1, python, 123456\n'

--

--
components: Library (Lib), Tests
messages: 79881
nosy: pitrou
priority: high
severity: normal
status: open
title: failure in test_httpservers
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue4929] smptlib.py can raise socket.error

2009-01-14 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

On Windows, if you exit a process abnormally (using e.g. os._exit() in 
Python) while it still has open connections, the other side receives a 
WSAECONNRESET (error 10054).

So, you could write a test case using a dumb server (running as another 
process) with a very short, predefined sequence of recv/send calls, 
ending abruptly with os._exit().

On Linux I *think* you would get ECONNRESET, and at least some form of 
error on other OS's.

--
nosy: +gagenellina

___
Python tracker 

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



[issue4929] smptlib.py can raise socket.error

2009-01-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

IMHO I wouldn't test such case.
Behaviors between different platform are unpredictable.

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-14 Thread Javen Wang

Javen Wang  added the comment:

Thank you very much for the trying. You might miss the step 4 in my
previous message. The step is:

  C:\test\edk2> edksetup.bat
  C:\test\edk2> set PYTHONPATH=C:\test\tools\Source\Python
  C:\test\edk2> python.exe C:\test\tools\Source\Python\build\build.py
-n 2 -p IntelFrameworkModulePkg\IntelFrameworkModulePkg.dsc -a IA32 -s

The Visual Studio 2005 must be in the standard installation directory.
Otherwise the C:\test\edk2\Conf\tools_def.txt needs to be changed to
reflect the real path.

And I tried to disabled all antivirus services and the problem is still
there. 

Don't worry about the binary version of build in
edk2\BaseTools\Bin\Win32 (linked against Python 2.5.2). The step I told
you is to execute my application from Python script directly. And I
tried to execute from script source against Python 2.5.4 and the problem
is the same. And no matter running the build from script source or the
freeze-ed binary, the results are the same either.

If it's hard or inconvenient for you to reproduce it, could you please
give me any advice or suggestion on how to debug it (in the interpreter)
and where's most possible place the root cause would be in the Python
interpreter's code? I can try to change something in the Python
interpreter's code, rebuild it and try it on my machine. Although I have
work around for this problem, I'd like to root cause it to avoid further
possible build break of our project.

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-14 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

I patiently waited for all those 150MB to download, modified Misc.py, 
run the specified commands and got this error:

build.py...
 : error 7000: Failed to start command
C:\Program Files\Microsoft Visual Studio 8\Vc\bin\nmake.exe /
nologo -s t
build [C:\test\edk2\Build\MdeModule\DEBUG_MYTOOLS\IA32\MdePkg\Library
\BasePrintL
ib\BasePrintLib]

That's right - VS is installed in another place. "C:\Program Files" 
doesn't even exist in my Spanish version of Windows. edksetup.bat 
didn't report any error, and I have nmake.exe in my PATH.

Anyway, trying to hunt a bug in the middle of 150 MB of code is way too 
much. You should try to reduce it to the smallest piece that still 
shows the problem. 

(As a side note, a project so big SHOULD have plenty of unit tests, but 
I see they're almost inexistant. Having to write tests forces people to 
use a more modular design. In this case, probably it would have been 
easier to test this issue, in a more isolated way, without having to 
bring the whole framework in).

Multithreaded programs may be tricky. Looking at the 
_MultiThreadBuildPlatform method (we're talking of it, right?) it isn't 
obvious that there are no race conditions in the code.

For a producer-consumer process like this, I would use a pool of worker 
threads, all waiting for work to do from a Queue, and a main (producer) 
thread that puts tasks to be done into the Queue. The synchronization 
is already done for you, it's almost automatic.

I've modified my previous example to show this usage.

Unless you can bring more evidence that this is a real Python issue and 
not a race condition in your code or something, I'd recommend to close 
this as invalid.

Added file: http://bugs.python.org/file12747/test_file_flush.py

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-14 Thread Javen Wang

Javen Wang  added the comment:

I agree multithread programming is kind of difficult and tricky. But I
don't think there's a race condition in _MultiThreadBuildPlatform
method, because I do have only one producer. And the consumer consumes
the product only when it's done (i.e. the file is created and closed).
The only race condition, I think, it's in the Python or Windows file
system, in which the file created might not be seen by other process due
to the file buffer mechanism. I think the flush() method of file object
and os.fsync() are to remove the race condition. But it seems that they
are not working as they're supposed to be.

What I know is that os.fsync() calls the _commit() which calls
FlushFileBuffers(). Why no problem if I call the FlushFileBuffers()
directly? That's why I think the most possible race condition is in
Python file buffer operation which is out of the control of my Python code.

I'm sorry that I didn't realize there's 150M code to checkout. Thanks
for your patience. Actually they are not code of my application itself.
They are the code used to test my application because my application is
a build system which needs source code to build. The real code of my
application is in the, for my example, directory of
C:\test\tools\Source\Python with just about 3M source files :-) And I
think I have narrowed down the issue in the file creation in
SaveFileOnChange function in C:\test\tools\Source\Python\Common\Misc.py. 

I know it's very hard to reproduce issue in multi-thread context. And I
cannot say absolutely there's no bug in my code. It's OK for you to
close this tracker. But it would be better to let it open for a few days
so that I can do more investigation then. Anyway, thanks for the trying
again.

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2009-01-14 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

> It probably uses sys.getdefaultencoding() instead.

That would be wrong too, according to the cited documentation.

file.encoding is a read only attribute; it can be set in C code using 
PyFile_SetEncoding. Apart from its definition in fileobject.c, it is 
*only* used by PyInitialize when sys.stdin/stdout/stderr are created. 
There are no tests, nor any other use of it anywhere. Apparently the 
attribute *is* checked when writing unicode objects, but it does not 
work.

I'm guessing now, but probably the original intent was to make file 
objects behave like the wrapper returned by codecs.open works now -- 
later it was deemed impractical and forgotten. Now, the "declarative" 
meaning of file.encoding survives, but the "behavior" is broken.

I don't know what would be the right thing to do. The encoding used by 
stdin/stdout/stderr is valuable information so the attribute should 
remain. Fixing the behavior is like having a crippled 
StreamReaderWriter and I don't see the point. But StreamReaderWriter 
has an "encoding" attribute too, and it "works", so one cannot rely on 
having such attribute to know whether the stream automatically encodes 
its data or not.

--
nosy: +gagenellina

___
Python tracker 

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



[issue4952] Running Python Script to Run a C++ Code

2009-01-14 Thread Gil

New submission from Gil :

Attached you will find my attachment "testdll.zip", my dilemma was how 
to run the attached C++ program using python scripts.  Please advise.

Thanks,
Gil

--
components: IDLE
files: testdll.zip
messages: 79888
nosy: dominade27
severity: normal
status: open
title: Running Python Script to Run a C++ Code
type: feature request
versions: Python 2.6
Added file: http://bugs.python.org/file12748/testdll.zip

___
Python tracker 

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



[issue4952] Running Python Script to Run a C++ Code

2009-01-14 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

Please post your question to the Python users mailing list: python-
l...@python.org -- mirrored as the comp.lang.python newsgroup too.
Also, gmane.org provides a web interfase: http://dir.gmane.org/
gmane.comp.python.general

Back to your question, the easiest way would be to define a C interfase 
(not C++) that you can call directly from Python using the ctypes 
module (available in the standard library since 2.5)
Another good alternative is to use Cython (which evolved from the Pyrex 
project). See http://wiki.python.org/moin/
IntegratingPythonWithOtherLanguages

--
nosy: +gagenellina

___
Python tracker 

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



[issue4952] Running Python Script to Run a C++ Code

2009-01-14 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

The bug tracker is not a place to obtain help, but to offer help (e.g.
by proposing patches to Python). As Gabriel explains, there are better
places to get help with Python. Closing the report as invalid.

--
nosy: +loewis
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue1242657] list(obj) can swallow KeyboardInterrupt

2009-01-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Here's a patch that fixes-up length_hint and it's internal callers.

I think there are plenty of other places that also swallow exceptions
but will leave those for someone who wants to look at every instance of
PyErr_Clear() to see if it has been restricted to some small group of
exceptions.

--
assignee: rhettinger -> 
keywords: +patch
versions: +Python 2.7, Python 3.0
Added file: http://bugs.python.org/file12749/lenhint.diff

___
Python tracker 

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