[issue8959] WINFUNCTYPE wrapped ctypes callbacks not functioning correctly in Python 2.7

2010-06-10 Thread Michael Curran

New submission from Michael Curran :

There seem to be problems with WINFUNCTYPE callbacks causing exceptions, and or 
getting their return value ignored by the caller, when using Python 2.7 rc1.
Two examples provided.

Example 1:
Providing a WINFUNCTYPE wrapped python function when calling EnumWindows from 
user32.dll with ctypes, EnumWindows enumerates (calls the python function) for 
the first 5 windows and then causes a WindowsError, sometimes an access 
violation (reading, or writing), or even other strange unknown exceptions.
This specific testcase is attached to the bug.
Run this script in  Python 2.7 you should see the WindowsErrors. On Python 2.6 
it successfully enumerates through all windows.

Example 2:
Hooking low-level keyboard input in Windows with SetWindowsHookEx from 
user32.dll, providing a WINFUNCTYPE wrapped python function as the callback, 
and then typing some keys, causes the callback to be called but the return 
value is always ignored, which means the hook never blocks keys completely, 
even if  the value 1 is returned from the callback, to do so.
Again, a testcase is attached to the bug.
Run this script in Python. It will ask you to type some characters and press 
enter. On Python 2.6 no characters should be echoed to the screen, but you will 
hear beeps to let you know the keyboard hook is seeing the keys. On Python 2.7, 
the keys will be echoed to the screen, and you will also hear the beeps 
(meaning that the hook was seeing the keys, but was unable to actually block 
them -- its return value was being ignored).
Also in Python 2.7, after the quit message is sent to the hook thread, 
GetMessageW (in user32.dll) causes a WindowsError exception. This does not 
happen on Python 2.6.

Perhaps it may be related to this entry in the Python 2.7 What's new:
The underlying libffi library has been updated to version 3.0.9, containing 
various fixes for different platforms. (Updated by Matthias Klose; issue 8142.)

--
assignee: theller
components: ctypes
files: test_callbackRetval.py
messages: 107447
nosy: mdcurran, theller
priority: normal
severity: normal
status: open
title: WINFUNCTYPE wrapped ctypes callbacks not functioning correctly in Python 
2.7
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file17604/test_callbackRetval.py

___
Python tracker 

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



[issue8959] WINFUNCTYPE wrapped ctypes callbacks not functioning correctly in Python 2.7

2010-06-10 Thread Michael Curran

Changes by Michael Curran :


Added file: http://bugs.python.org/file17605/test_keyHook.py

___
Python tracker 

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



[issue8959] WINFUNCTYPE wrapped ctypes callbacks not functioning correctly in Python 2.7

2010-06-10 Thread Michael Curran

Michael Curran  added the comment:

I should also note that this has been tested on Windows 7 and XP (32 bit).
I have also seen cases where Python has crashed completely, rather than just 
causing a WindowsError, in these circomstances.

--

___
Python tracker 

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



[issue8828] Atomic function to rename a file

2010-06-10 Thread anatoly techtonik

anatoly techtonik  added the comment:

Does it work with FAT32 or network filesystem?

--

___
Python tracker 

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



[issue8839] PyArg_ParseTuple(): remove "t# format

2010-06-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
>> t# was meant to provide access to text data, so replacing it with a
>> parser code that is meant for binary data is not correct. The
>> closes Python3 gets to t# from Python2 is s# or s*, so please use
>> those in the NEWS entry and s* in charbuffer_encode().
> 
> Done. Patch commited as r81854 in 3.2: it removes also 
> codecs.charbuffer_encode(). Commit blocked in 3.1 (r81855).

Thanks.

--

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-06-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Brett Cannon wrote:
> 
> Brett Cannon  added the comment:
> 
> So yes, cPickle/pickle, cStringIO/StringIO, heapq, etc. are all examples of 
> the approach. One could choose to write the pure Python version first, 
> profile the code, and only write extension code for the hot spots, but 
> obviously that typically doesn't happen.

That's what was done for the datetime module. The pure-Python version
just never made it into the stdlib, AFAIK.

Note that we've just dropped the pure-Python version of the io package
as well, so an approach where we keep the pure-Python prototype
would be a novelty in Python land and should probably be codified
in a PEP.

> As for who maintains it, that's python-dev, just like every other module that 
> is structured like this. When the stdlib gets more of a clear separation from 
> CPython I suspect the other VM maintainers will contribute more.

I'm not sure whether there would be much interest in this. Unless
the core devs are also active in other VM implementations, there's
little motivation to maintain two separate implementations of the
same thing.

Users of CPython will likely only use the C version anyway, so the
pure-Python code would also get little real-life testing.

Perhaps we should open up python-dev to external VM developers
that would have to rely on those pure-Python implementations ?!

> As for PyPy not specifically needing this, that still doesn't solve the 
> problem that Jython and IronPython have with extension code or any other 
> future VM that doesn't try to come up with a solution for extensions.

Both Jython and IronPython could add bridges to CPython extensions
(Jython via the JNI and IronPython via unmanaged code.

Still, you're right in that it's unlikely they will move away from
being pure-Java or pure-C# implementations, so they do have a need
for such pure-Python implementations.

--
title: Add pure Python implementation of datetime module to CPython -> Add pure 
Python implementation of datetime module to CPython

___
Python tracker 

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



[issue8922] Improve encoding shortcuts in PyUnicode_AsEncodedString()

2010-06-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
>> Note that these shortcut bypass the codec registry logic.
> 
> Yes, but it's already the case without my patch. I don't think that it's 
> really useful to override latin1, utf-8, utf-16, utf-32 or mbcs. I prefer a 
> faster Python :-) 

Depends on your use case. E.g. utf-32 is hardly ever used in practice,
utf-16 is only common on Windows and then only as utf-16-le,
I'm not sure about mbcs since that's a meta-codec. In reality, this
will likely be the same as cp1252 most of the time.

I'm ok on ascii, latin1, utf-8 and mbcs (including the additional
normalization, aliasiing and case mapping), but not on the others.

>> we have to be careful about adding more such shortcuts.
> 
> I just want to add a shortcut for ISO-8859-1.

Fine, even though that name is really not used much in Python code.

--

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

I like the idea of a pure Python implementation of the datetime module, for 
different reasons:
 - it will become the reference implementation
 - other Python interpreters can use it
 - it can be used to test another implementation, eg. the current C version
 - implement/test a new feature is much faster in Python than in C

About the last point: I already used _pyio many times to fix a bug or to 
develop a new feature. _pyio helps to choice the right solution because you can 
easily write a short patch and so compare different solutions.

If other Python interpreters have already their Python implementation, we can 
just choose the best one, and patch it to add last new features of the C 
version.

--
nosy: +haypo

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-06-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
> I like the idea of a pure Python implementation of the datetime module, for 
> different reasons:
>  - it will become the reference implementation
>  - other Python interpreters can use it
>  - it can be used to test another implementation, eg. the current C version
>  - implement/test a new feature is much faster in Python than in C
> 
> About the last point: I already used _pyio many times to fix a bug or to 
> develop a new feature. _pyio helps to choice the right solution because you 
> can easily write a short patch and so compare different solutions.

Ah, so that where the Python io module hides. Thanks for the pointer.

--

___
Python tracker 

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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

I created a tarball (.tar.gz) on Windows with Python 3.1 (which uses "mbcs" 
encoding). With locale.getpreferredencoding() == 'cp1252', "é" (U+00e9) is 
encoded 0xe9 (1 byte) and "à" (U+00e0) as 0xe0 (1 byte). WinRAR displays 
correctly the file names, but 7-zip displays the wrong glyphs.

So WinRAR expects CP1252 whereas 7-zip expects CP850.

I also tested an archive encoded with UTF-8: WinRAR and 7-zip display the wrong 
glyph, they decode utf-8 with CP1252 / CP850 :-/

If an archive will be used on UNIX, I think that the archive should use UTF-8 
(on Windows and UNIX). But if the archive is read on Windows with WinRAR or 
7-zip, the archive should use a codepage.

Since mbcs looks to be the least worst choice, it may be used but with 
"replace" error handler (because it doesn't support "surrogateescape" error 
handler).

--

About the code pages:

 - chcp command displays "Active code page: 850"
 - python -c "import locale; print(locale.getpreferredencoding())" displays 
"cp1252"
 - python -c "import sys; print(sys.stdout.encoding)" displays "cp850"

Python calls GetConsoleOutputCP() to get stdout/stderr encoding (code page), 
whereas locale.getpreferredencoding() (_locale.getdefaultencoding()) calls 
GetACP().

--

___
Python tracker 

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



[issue8922] Improve encoding shortcuts in PyUnicode_AsEncodedString()

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

Commited in 3.2 (r81869), blocked in 3.1 (r81870).

--

Oops, I don't know why I wrote utf-16 and utf-32. I don't want to add them to 
the shortcuts.

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



[issue8885] markerbase declaration errors aren't recoverable

2010-06-10 Thread R. David Murray

R. David Murray  added the comment:

"This module is used as a foundation for the HTMLParser and sgmllib
modules (indirectly, for htmllib as well).  It has no documented
public API and should not be used directly."

So, #2 is not relevant unless you are talking about a docstring update or 
comment in ParserBase.

Do you have a test case using one of the consumer modules that demonstrates a 
bug?  markupbase has no test suite of its own (which probably should be fixed 
someday :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue8924] Error in error message in logging

2010-06-10 Thread Vinay Sajip

Changes by Vinay Sajip :


--
assignee:  -> vinay.sajip
nosy: +vinay.sajip

___
Python tracker 

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



[issue8960] 2.6 README

2010-06-10 Thread Vojtěch Rylko

New submission from Vojtěch Rylko :

In 2.6 README are this paragraphs from 2.5 README:

A number of features are not supported in Python 2.5 anymore. Some
support code is still present, but will be removed in Python 2.6. 

The following systems are still supported in Python 2.5, but
support will be dropped in 2.6:
- Systems using --with-wctype-functions
- Win9x, WinME

Following Microsoft's closing of Extended Support for
Windows 98/ME (July 11, 2006), Python 2.6 will stop
supporting these platforms.

--
assignee: d...@python
components: Documentation
messages: 107458
nosy: d...@python, vojta.rylko
priority: normal
severity: normal
status: open
title: 2.6 README
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



[issue8922] Improve encoding shortcuts in PyUnicode_AsEncodedString()

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

Le jeudi 10 juin 2010 14:02:34, vous avez écrit :
> Commited in 3.2 (r81869), blocked in 3.1 (r81870).

This commit introduced a regression: ISO-8859-15 was seen as an alias to 
ISO-8859-1 because the normalized string was truncated. Fixed in r81871 
(blocked in 3.1: r81872).

--

___
Python tracker 

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



[issue8961] compile Python-2.7rc1 on AIX 5.3 with xlc_r

2010-06-10 Thread Tamás Gulácsi

New submission from Tamás Gulácsi :

I'm trying to compile Python2.7rc1 on AIX 5.3 with the following call:
FW=/home/kobe/kobed/tgulacsi/freeware
CC='xlc_r -q64' CXX='xlC_r -q64' AR='ar -X64' NM='nm -X64' LD='ld -X64' \
LD_LIBRARY_PATH=$FW/lib:$LD_LIBRARY_PATH \
  ./configure -C --without-gcc \
  CFLAGS="-DHAVE_BROKEN_POSIX_SEMAPHORES -I$FW/include" \
  LDFLAGS='-L$FW/lib' \
  ARFLAGS='cru' \
  --prefix=$FW

make

The result is attached, as I see sysconfig.get_config_var doesn't have 
CONFIG_ARGS set.

Thanks in advance,
Tamás Gulácsi

--
components: Build
files: python-2.7rc1-aix5.3.log
messages: 107460
nosy: tgulacsi
priority: normal
severity: normal
status: open
title: compile Python-2.7rc1 on AIX 5.3 with xlc_r
versions: Python 2.7
Added file: http://bugs.python.org/file17606/python-2.7rc1-aix5.3.log

___
Python tracker 

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



[issue8961] compile Python-2.7rc1 on AIX 5.3 with xlc_r

2010-06-10 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy: +srid

___
Python tracker 

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



[issue8961] compile Python-2.7rc1 on AIX 5.3 with xlc_r

2010-06-10 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
assignee:  -> tarek
nosy: +tarek
priority: normal -> high

___
Python tracker 

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



[issue8950] In getargs.c, make 'L' code raise TypeError for float arguments.

2010-06-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

Committed, r81873.  Thanks for reviewing, Victor.

--

___
Python tracker 

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



[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-06-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

FWIW, I prefer PyLongObject* over PyLong.  (Though I'm sure I'm guilty of 
writing PyLong in comments.)

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue8962] IOError: [Errno 13] permission denied

2010-06-10 Thread Caitlin Kavanaugh

New submission from Caitlin Kavanaugh :

Hi, I'm new to python, so I'm sorry if my explanation is terribly concise, I'm 
trying to explain it with fairly limited terminology.

I have been attempting to write data out to a file, yet I continually receive 
the error:

IOError: [Errno 13] permission denied '/trained.nn'

No matter where or what I try to save the file as, it returns this error with 
the corresponding file name. My friend insists that I need to use a slash, yet 
I'm not sure this is the correct syntax. Otherwise, I'm absolutely lost in how 
to solve this.

I tried looking up possible solutions first, but either the terminology was 
beyond me, or they supplied a piece of code that could fix it. I don't really 
want a plug and chug solution. I really want to understand this, so any 
explanation would be greatly appreciated.

Thank you!

--
components: Windows
messages: 107463
nosy: Caitlin.Kavanaugh
priority: normal
severity: normal
status: open
title: IOError: [Errno 13] permission denied
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue8948] cleanup functions are not executed with unittest.TestCase.debug()

2010-06-10 Thread Michael Foord

Michael Foord  added the comment:

Committed revision 81875.
Committed revision 81874.

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

___
Python tracker 

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



[issue8962] IOError: [Errno 13] permission denied

2010-06-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

Hi,

Sorry, but this tracker is for reporting bugs in Python itself, not for getting 
help with using Python.  You might try asking on one of the python mailing 
lists:

http://mail.python.org/mailman/listinfo/python-list

or

http://mail.python.org/mailman/listinfo/tutor

--
nosy: +mark.dickinson
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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

My tests with 7-zip and WinRAR conviced me that it's not a good idea to use 
utf-8 *by default* on Windows. But since mbcs doesn't support surrogateescape 
error handler, we should restore the previous behaviour just for this encoding.

tarfile_mbcs_errors.patch creates a function choose_errors() which determine 
the best error handler depending on the encoding and the mode (read or write):
 - "strict" to write with mbcs
 - "replace" to read with mbcs
 - "surrogateescape" otherwise

Please, review my changes on the documentation :-)

On Windows, patched tarfile works exactly as Python 3.1.

--
Added file: http://bugs.python.org/file17607/tarfile_mbcs_errors.patch

___
Python tracker 

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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
> My tests with 7-zip and WinRAR conviced me that it's not a good idea to use 
> utf-8 *by default* on Windows. But since mbcs doesn't support surrogateescape 
> error handler, we should restore the previous behaviour just for this 
> encoding.
> 
> tarfile_mbcs_errors.patch creates a function choose_errors() which determine 
> the best error handler depending on the encoding and the mode (read or write):
>  - "strict" to write with mbcs
>  - "replace" to read with mbcs
>  - "surrogateescape" otherwise

I think you should implement this in a more general way:
have the class test whether the codec supports "surrogateescape"
and then use it. Otherwise fall back to "strict" for writing
and "replace" for reading.

--

___
Python tracker 

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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

>> 7-zip encodes "à" (U+00e0) as 0x85 (1 byte), and "é" (U+00e9) as 0x82 (1 
>> byte). I don't know this encoding.
>
> That's an old DOS code paged used in Europe: CP850

There is a good chance that they use it because it is the OEM code page 
on the system.

In any case, I think that both cp850 and cp1252 are inherently incorrect 
for tarfiles (despite these tools using them). tar is a POSIX thing, and 
these encodings have nothing to do with POSIX.

So using UTF-8 is a reasonable choice, IMO. The other reasonable choice 
would be ASCII.

--

___
Python tracker 

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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread Lars Gustäbel

Lars Gustäbel  added the comment:

Maybe I'm going out on a limb here, but I think we should again consider what 
tarfile users on Windows(!) actually use it for under which circumstances. The 
following list is probably not exhaustive, but IMHO covers 90%:

1. Download tar archives from a webpage (when no zip is supplied) for viewing 
or extracting.
2. Create backups for personal use.
3. Create source archives from a project for unix users who hate zipfiles.

I am convinced that the tarfile module is not very popular on Windows, because 
of a simple reason: tar archives are not. Windows users will always prefer zip 
archives and hence the zipfile module, because it's something they're familiar 
with.

The point I am trying to make is, that, first, we should not choose a default 
encoding based on what works best with WinRAR, 7-zip and such, because they all 
act very differently which makes it impossible. Second, we must not 
overemphasize the encoding issue to a point where portability is in danger. 
This means that in almost all real-life cases there are no encoding issues. In 
my whole tarfile maintaining career I cannot remember a single incident of a 
tar archive that I got from an external source that contained special 
characters. The only tar archives that contain special characters in my 
experience are backups. But: these backups are created and later restored on 
one and the same system. Again, no encoding issues.

Long story short, I still vote for utf-8, because it enables Windows users to 
create backups without losing special characters, and it's ASCII-"compatible" 
and should be able to read 99% of the files that you get from the internet.

--

___
Python tracker 

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



[issue8950] In getargs.c, make 'L' code raise TypeError for float arguments.

2010-06-10 Thread Mark Dickinson

Changes by Mark Dickinson :


--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

$ LANG=C ./python.exe -m test.regrtest test_imp
test_imp
test test_imp failed -- Traceback (most recent call last):
  File "Lib/test/test_imp.py", line 109, in test_issue5604
self.assertEqual(fs_encoding, 'utf-8')
AssertionError: 'ascii' != 'utf-8'
- ascii+ utf-8

1 test failed:
test_imp


Same with LC_ALL=C.  Passes on Linux.

--
assignee: ronaldoussoren
components: Macintosh
messages: 107498
nosy: belopolsky, ronaldoussoren
priority: normal
severity: normal
status: open
title: test_imp fails on OSX when LANG is set
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue8966] ctypes: remove implicit conversion between unicode and bytes

2010-06-10 Thread STINNER Victor

New submission from STINNER Victor :

ctypes doesn't have strict separation between bytes and characters, whereas 
Python3 splitted str/unicode of Python2 into bytes/str which a strict 
separation. The result is that sometimes it works (no error), sometimes it 
fails (the first time that the user inserts a non-ASCII character).

I wrote 3 patches:
 - ctypes_s_set.patch: fix s_set(), return an unicode string instead of a bytes 
string
 - ctypes_conversion.patch: remove ctypes.set_conversion_mode() and all code 
using it (remove the implicit conversions)
 - ctypes_tests.patch: fix all tests according the changes introduced by the 
two previous patches

ctypes_s_set.patch is trivial and fixes a real bug. ctypes_conversion.patch 
does basically remove code. ctypes_tests.patch is the biggest part because the 
test suite is mostly based on the implicit conversion.

Except the parts removing the calls to ctypes.set_conversion_mode() and the 
tests testing the implicit conversion, ctypes_tests.patch can be commited alone 
because it improves the test suite (use the right types).

--
assignee: theller
components: Unicode, ctypes
files: ctypes_conversion.patch
keywords: patch
messages: 107499
nosy: haypo, theller
priority: normal
severity: normal
status: open
title: ctypes: remove implicit conversion between unicode and bytes
versions: Python 3.2
Added file: http://bugs.python.org/file17610/ctypes_conversion.patch

___
Python tracker 

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



[issue8966] ctypes: remove implicit conversion between unicode and bytes

2010-06-10 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file17611/ctypes_conversion.patch

___
Python tracker 

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



[issue8966] ctypes: remove implicit conversion between unicode and bytes

2010-06-10 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file17612/ctypes_s_set.patch

___
Python tracker 

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



[issue8966] ctypes: remove implicit conversion between unicode and bytes

2010-06-10 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file17613/ctypes_tests.patch

___
Python tracker 

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



[issue8966] ctypes: remove implicit conversion between unicode and bytes

2010-06-10 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file17610/ctypes_conversion.patch

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

BTW, looking at test_bad_address(), I wonder why it puts extra dots in the url? 
 The comment above it suggests that the intent is to use a name within RFC 2606 
.invalid TLD.  Not likely to be a problem in your case, but using made up TLD 
is not a good idea.

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

This looks like a glibc bug to me. I suspect an unauthorized redhat change; I 
hope Ulrich Drepper would have never accepted a glibc that causes getaddrinfo 
to implicitly call setlocale - see

http://sources.redhat.com/ml/libc-alpha/2004-03/msg00161.html

You might experiment with disabling IDN support in getaddrinfo.

--

___
Python tracker 

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



[issue8961] compile Python-2.7rc1 on AIX 5.3 with xlc_r

2010-06-10 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

FYI, I cannot reproduce this on AIX 5.1:

bash-2.04$ i/bin/python
ActivePython 2.7.0c1.0 (ActiveState Software Inc.) based on
Python 2.7rc1 (r27rc1:81772, Jun  5 2010, 23:20:01) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_config_var("CONFIG_ARGS")
"'--prefix=/home/apy/tmp/issue8961/ActivePython-2.7.0c1.0-aix-powerpc64/i' 
'--without-cxx' '--disable-ipv6' 'CC=xlc_r'"
>>> ^D
bash-2.04$ i/bin/python -m platform
AIX-1-000C763E4C00-powerpc-64bit

--

___
Python tracker 

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



[issue8964] Method _sys_version() module Lib\platform.py does parse correctly IronPython 2.x version

2010-06-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Frederic Torres wrote:
> 
> New submission from Frederic Torres :
> 
> Method _sys_version() module Lib\platform.py does parse correctly IronPython 
> 2.x version
> 
> The format of sys.version now start with a version number and (
> 2.6.1 (IronPython 2.6.1 (2.6.10920.0) on .NET 4.0.30319.1)
> 
> File: Lib\platform.py
> Function: def _sys_version(sys_version=None):
> Line: 1326

I assume you meant: doesn't correctly parse the version number.

Could you provide a complete example formatted as Python string,
e.g. print repr(sys.version) ?!

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com


2010-07-19: EuroPython 2010, Birmingham, UK38 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! 

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--
title: Method _sys_version() module Lib\platform.py does parse correctly 
IronPython 2.x version -> Method _sys_version() module Lib\platform.py does 
parse  correctly IronPython 2.x version

___
Python tracker 

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



[issue8958] 2.7rc1 tarfile.py: `bltn_open(targetpath, "wb")` -> IOError: Is a directory

2010-06-10 Thread Lars Gustäbel

Changes by Lars Gustäbel :


--
assignee:  -> lars.gustaebel

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

New submission from Antoine Pitrou :

This test failure just happened to me on a py3k checkout:

test test_urllibnet failed -- Traceback (most recent call last):
  File "/home/antoine/py3k/debug/Lib/test/test_urllibnet.py", line 191, in 
test_data_header
time.strptime(datevalue, dateformat)
  File "/home/antoine/py3k/debug/Lib/_strptime.py", line 461, in _strptime_time
return _strptime(data_string, format)[0]
  File "/home/antoine/py3k/debug/Lib/_strptime.py", line 332, in _strptime
(data_string, format))
ValueError: time data 'Thu, 10 Jun 2010 19:03:39 GMT' does not match format 
'%a, %d %b %Y %H:%M:%S GMT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/debug/Lib/test/test_urllibnet.py", line 193, in 
test_data_header
self.fail('Date value not in %r format', dateformat)
TypeError: fail() takes at most 2 arguments (3 given)

--
assignee: orsenthil
components: Library (Lib), Tests
messages: 107470
nosy: belopolsky, orsenthil, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: test_urllibnet failure
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

How do I enable `network' resource?

I am getting

$ ./python.exe -m test.regrtest test_urllibnet
test_urllibnet
test_urllibnet skipped -- Use of the `network' resource not enabled
1 test skipped:
test_urllibnet
Those skips are all expected on darwin.


Same on Linux ...

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> How do I enable `network' resource?

Use the "-unetwork" flag to regrtest.

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

What is your locale?

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I've reported the bug upstream at Mandriva:
https://qa.mandriva.com/show_bug.cgi?id=59736

It would be nice to know whether other distributions with a Redhat lineage are 
affected. Can someone with such a distribution the code in msg107484?

In the end, I'm not sure it's Python's task to workaround such bug.
However, the bug in error reporting should be fixed.

--
assignee: orsenthil -> 
nosy: +dmalcolm

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Is this check needed on darwin?  Why not simply set fs_encoding = 'utf-8'?

--
nosy: +flox

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Strangely, it also works here from the prompt:

>>> import time
>>> time.strptime('Thu, 10 Jun 2010 19:03:39 GMT', '%a, %d %b %Y %H:%M:%S GMT')
time.struct_time(tm_year=2010, tm_mon=6, tm_mday=10, tm_hour=19, tm_min=3, 
tm_sec=39, tm_wday=3, tm_yday=161, tm_isdst=-1)
>>> import locale
>>> locale.getlocale(locale.LC_TIME)
(None, None)

Apparently, something sets the locale before running the test.

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I still cannot reproduce the failure, but please, try the attached patch.

--
keywords: +patch
Added file: http://bugs.python.org/file17608/issue8963.diff

___
Python tracker 

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



[issue8958] 2.7rc1 tarfile.py: `bltn_open(targetpath, "wb")` -> IOError: Is a directory

2010-06-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue8958] 2.7rc1 tarfile.py: `bltn_open(targetpath, "wb")` -> IOError: Is a directory

2010-06-10 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

On 2010-06-10, at 1:06 PM, Lars Gustäbel wrote:

> Is this problem specific to 2.7rc1

Yes.

> or are other versions affected as well?

Nope, at least ... I know that 2.6 doesn't have this problem.

--

___
Python tracker 

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



[issue8958] 2.7rc1 tarfile.py: `bltn_open(targetpath, "wb")` -> IOError: Is a directory

2010-06-10 Thread Lars Gustäbel

Lars Gustäbel  added the comment:

Unfortunately I do not have access to an OS X machine. Is this problem specific 
to 2.7rc1 or are other versions affected as well? I thought the OS X filesystem 
was case sensitive ...

--
nosy: +lars.gustaebel

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The patch is not sufficient, since other failures can then occur if 
test_strptime gets run after test_urllibnet:

==
ERROR: test_twelve_noon_midnight (test.test_strptime.Strptime12AMPMTests)
--
Traceback (most recent call last):
  File "/home/antoine/py3k/debug/Lib/test/test_strptime.py", line 389, in 
test_twelve_noon_midnight
eq(time.strptime('12 PM', '%I %p')[3], 12)
  File "/home/antoine/py3k/debug/Lib/_strptime.py", line 461, in _strptime_time
return _strptime(data_string, format)[0]
  File "/home/antoine/py3k/debug/Lib/_strptime.py", line 335, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: PM

==
FAIL: test_pattern (test.test_strptime.TimeRETests)
--
Traceback (most recent call last):
  File "/home/antoine/py3k/debug/Lib/test/test_strptime.py", line 124, in 
test_pattern
pattern_string)
AssertionError: did not find abbreviated weekday in pattern string 
'(?Plun\.|mar\.|mer\.|jeu\.|ven\.|sam\.|dim\.)\s+(?Pmercredi|vendredi|dimanche|samedi|lundi|mardi|jeudi)\s+(?P3[0-1]|[1-2]\d|0[1-9]|[1-9]|
 [1-9])'

==
FAIL: test_hour (test.test_strptime.StrptimeTests)
--
Traceback (most recent call last):
  File "/home/antoine/py3k/debug/Lib/test/test_strptime.py", line 266, in 
test_hour
(strf_output, strp_output[3], self.time_tuple[3]))
AssertionError: testing of '%I %p' directive failed; '08 ' -> 8 != 20

--

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> The patch is not sufficient, since other
> failures can then occur if test_strptime gets
> run after test_urllibnet

This looks like a bug in support.run_with_locale decorator.  

It is described as
#===

 
# Decorator for running a function in a different locale, correctly resetting   

 
# it afterwards.

but apparently does not.

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 2.6, 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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

In setipaddr() in socketmodule.c, the following line appears to change the 
current locale when DNS lookup fails:

error = getaddrinfo(name, NULL, &hints, &res);

This is checked by making a call to setlocale(LC_TIME, NULL) before and after 
the aforementioned line.

This is with the following libc:
$ rpm -qv glibc
glibc-2.11.1-8mnb2

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Would s/LC_TIME/LC_ALL/ in my patch fix your problem?

As I explained, this wouldn't fix the later failures in test_strptime.

--

___
Python tracker 

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



[issue8964] Method _sys_version() module Lib\platform.py does parse correctly IronPython 2.x version

2010-06-10 Thread Frederic Torres

New submission from Frederic Torres :

Method _sys_version() module Lib\platform.py does parse correctly IronPython 
2.x version

The format of sys.version now start with a version number and (
2.6.1 (IronPython 2.6.1 (2.6.10920.0) on .NET 4.0.30319.1)

File: Lib\platform.py
Function: def _sys_version(sys_version=None):
Line: 1326

--
components: Library (Lib)
messages: 107487
nosy: fredericaltorres, lemburg
priority: normal
severity: normal
status: open
title: Method _sys_version() module Lib\platform.py does parse correctly 
IronPython 2.x version
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

> 2. Create backups for personal use.

What? Really? I'm sure that all Windows users will use ZIP or maybe RAR, but 
never the geek choice.

> 1. Download tar archives from a webpage (when no zip is supplied) for viewing 
> or extracting.

Tarballs come from UNIX/BSD world which use UTF-8 by default since some years 
ago.

> 3. Create source archives from a project for unix users who hate zipfiles.

In this case, UTF-8 is also better.

--

Did I mentionned that 7-zip is only able to create TAR archive? I mean 
uncompressed archive. Who will use that? (not me ;-))

WinRAR is unable to create tarballs, even (uncompressed) .tar archive.

--

If the maintainer of the tarfile module agrees that UTF-8 is the best choice, I 
will commit my initial patch. I would prefer to commit 
tarfile_windows_utf8.patch because it changes 4 lines, whereas 
tarfile_mbcs_errors.patch changes... much more code :-)

tarfile_windows_utf8.patch is not complete: the documentation should also be 
updated:

.. data:: ENCODING

   The default character encoding i.e. the value from either
   :func:`sys.getfilesystemencoding` or :func:`sys.getdefaultencoding`.

=>

.. data:: ENCODING

   The default character encoding: ``'utf-8'`` on Windows,
   :func:`sys.getfilesystemencoding` otherwise.

--

___
Python tracker 

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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

FWIW, I agree with Lars: the main use of tar files under Windows is when they 
come from other systems. Windows users almost never generate tar files by 
themselves; they will generate zip, rar or 7z files instead.

--
nosy: +pitrou

___
Python tracker 

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



[issue8924] Error in error message in logging

2010-06-10 Thread Vinay Sajip

Vinay Sajip  added the comment:

It seems like the logging message will be Unicode (as you have specified that 
it should be so) but the exception message will be string. Can you confirm 
whether this is the case? What type is the return value of 
Formatter.formatException for the specific exception you're getting, in your 
exact environment?

If it's not Unicode, can you see what happens if you use a subclassed Formatter 
whose formatException decodes the returned value from the base class 
formatException with the appropriate encoding, and return Unicode from your 
overridden formatException message?

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Antoine,

Would s/LC_TIME/LC_ALL/ in my patch fix your problem?  I could not find an 
affected system, but I simulated the problem by adding 
locale.setlocale(locale.LC_ALL, "") call in the test.

I think the patch is worth applying. It fixes the typo in the except clause and 
makes the test independent of the locale settings.

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> What is your locale?

$ locale
LANG=fr_FR.utf8
LC_CTYPE="fr_FR.utf8"
LC_NUMERIC="fr_FR.utf8"
LC_TIME="fr_FR.utf8"
LC_COLLATE="fr_FR.utf8"
LC_MONETARY="fr_FR.utf8"
LC_MESSAGES="fr_FR.utf8"
LC_PAPER="fr_FR.utf8"
LC_NAME="fr_FR.utf8"
LC_ADDRESS="fr_FR.utf8"
LC_TELEPHONE="fr_FR.utf8"
LC_MEASUREMENT="fr_FR.utf8"
LC_IDENTIFICATION="fr_FR.utf8"
LC_ALL=

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

$ ./python.exe -m test.regrtest -unetwork test_urllibnet
test_urllibnet
1 test OK.

Also the arguments to strptime from reported error message work fine:

>>> import time
>>> time.strptime('Thu, 10 Jun 2010 19:03:39 GMT', '%a, %d %b %Y %H:%M:%S GMT')
time.struct_time(tm_year=2010, tm_mon=6, tm_mday=10, tm_hour=19, tm_min=3, 
tm_sec=39, tm_wday=3, tm_yday=161, tm_isdst=-1)
>>> from datetime import *
>>> datetime.strptime('Thu, 10 Jun 2010 19:03:39 GMT', '%a, %d %b %Y %H:%M:%S 
>>> GMT')
datetime.datetime(2010, 6, 10, 19, 3, 39)

--

___
Python tracker 

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



[issue1452] subprocess's popen.stdout.seek(0) doesn't raise an error

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
type:  -> feature request
versions: +Python 3.2 -Python 3.0

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok, so what it boils down to is the following behaviour:

>>> import locale, socket
>>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> locale.getlocale(locale.LC_TIME)
(None, None)
>>> sock.connect(("invalidhost", 80))
Traceback (most recent call last):
  File "", line 1, in 
socket.gaierror: [Errno -2] Nom ou service inconnu
>>> locale.getlocale(locale.LC_TIME)
('fr_FR', 'UTF8')

--
nosy: +loewis

___
Python tracker 

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



[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

Updated version of the utf-8 patch:
 - Use also UTF-8 for Windows CE
 - Update the documentation
 - Prepare the NEWS entry

--
Added file: http://bugs.python.org/file17609/tarfile_windows_utf8-2.patch

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The culprit seems to be test_bad_address. If I disable this test, or replace 
the bad URL by a good one, everything works fine. It seems that failing to 
resolve the domain name changes the current locale...

--

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

I haven't looked at the actual test yet, but the filesystem encoding on OSX is 
UTF-8.

--

___
Python tracker 

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



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

It looks like your libc calls setlocale(LC_ALL, "") on error.  This may or may 
not be right and not python's problem in any case.  What is worth to 
investigate, however is why @run_with_locale decorator fails to restore the 
locale after it was modified by libc.

--

___
Python tracker 

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



[issue3453] PyType_Ready doesn't ensure that all bases are ready

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

My knowledge may be out of date, but I thought multiple inheritance was only 
supported at the python level.  If this is still the case, then no 
initialization check is needed. (You cannot get an uninitialized type at python 
level.)  An extra defensive assert is usually not a bad thing in the code, but 
in this particular case one would need a loop with checks and it does not seem 
justified.

-1

--
nosy: +belopolsky
stage:  -> needs patch
type:  -> feature request
versions: +Python 3.2 -Python 2.4, Python 2.5, Python 2.6

___
Python tracker 

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



[issue1516] make _ctypes work with non-gcc compilers

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
type:  -> feature request
versions: +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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

Oooh. That's my fault. I introduced this regression in issue #8610 (commit 
r81190). Can you try attached patch please?

The file system encoding is hardcoded to 'utf-8' on Mac OS X (it should not 
depend on the locale).

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file17614/initfsencoding_apple.patch

___
Python tracker 

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



[issue4113] Add custom __repr__ to functools.partial

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I understand that the latest RFE in this issue is to provide a custom __repr__ 
to functools.partial.  Something along the lines of

class partial(functools.partial):
def __repr__(self):
return "functools.partial(%r, %s)" % (self.func, 
  ', '.join(repr(a) for a in self.args)


>>> def f(x, y, z):
...   pass
>>> partial(f, 1, 2)
functools.partial(, 1, 2)

Looks like a reasonable proposal, but coding this in C is a chore. (The 
prototype above does not process keywords, so complete implementation is more 
involved.)

--
keywords: +easy -patch
nosy: +belopolsky
stage:  -> needs patch
title: functools.partial(), no __name__; wrong __doc__ -> Add custom __repr__ 
to functools.partial

___
Python tracker 

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



[issue4113] Add custom __repr__ to functools.partial

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
versions: +Python 3.2 -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



[issue8967] Create PyErr_GetWindowsMessage() function

2010-06-10 Thread STINNER Victor

New submission from STINNER Victor :

PyErr_SetExcFromWindowsErrWithFilenameObject() and 
PyErr_SetFromErrnoWithFilenameObject() have the same code to read the localized 
error message. The code can be factorized in a new function 
PyErr_GetWindowsMessage().

About the patch:
 - free s_buf just after the call to PyUnicode_FromUnicode(), don't wait until 
the end of the function
 - free s_buf if s_buf is not NULL and len==0. I suppose that this case is 
impossible, if len==0, s_buf is set to NULL or leaved unchanged (so it's also 
equal to NULL)

I wrote the function to raise an UnicodeDecodeError with a Windows error 
message.

--
components: Interpreter Core, Unicode, Windows
files: pyerr_getwindowsmessage.patch
keywords: patch
messages: 107505
nosy: haypo
priority: normal
severity: normal
status: open
title: Create PyErr_GetWindowsMessage() function
versions: Python 3.2
Added file: http://bugs.python.org/file17615/pyerr_getwindowsmessage.patch

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Victor,

Your patch works for me and makes sense even though I don't really know where 
Py_FileSystemDefaultEncoding is set on Darwin. :-)

--

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On the second thought, test_imp is not the right place to test this.  Can you 
add a sys module test for this issue?

--
stage:  -> unit test needed

___
Python tracker 

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2010-06-10 Thread A.M. Kuchling

A.M. Kuchling  added the comment:

Demo/embed/demo.c calls PySys_SetArgv(), which may be where
some people are copying their code from.  I've updated it to
use PySys_SetArgvEx() and added an explanatory comment in rev. 81881.

--
nosy: +akuchling

___
Python tracker 

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



[issue8968] token type constants are not documented

2010-06-10 Thread Ilya Sandler

New submission from Ilya Sandler :

the token module defines constants for token types e.g

 NAME = 1
 NUMBER = 2
 STRING = 3
 NEWLINE = 4

etc.

These constants are very useful for any code which needs to tokenize python 
source, yet they are not listed in the documentation.


Is this a documentation bug?

--
assignee: d...@python
components: Documentation
messages: 107509
nosy: d...@python, isandler
priority: normal
severity: normal
status: open
title: token type constants are not documented
versions: Python 3.3

___
Python tracker 

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



[issue1402289] Allow mappings as globals (was: Fix dictionary subclass ...)

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
stage:  -> patch review
type:  -> feature request
versions: +Python 3.2 -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




[issue8969] Windows: use (mbcs in) strict mode to encode/decode filenames, and enable os.fsencode()

2010-06-10 Thread STINNER Victor

New submission from STINNER Victor :

mbcs encoding doesn't support surrogateescape (see #850997), and mbcs should 
only be used in strict mode to encode/decode filenames.

os.fsencode() should also be enabled on Windows. First I tried to disable this 
function on Windows to avoid the evil mbcs encoding, but mbcs encoding *is* 
used by some modules written in C (functions using PyUnicode_FSConverter(): 
encode the filename to bytes with mbcs encoding on Windows). Eg. _ssl module 
use PyUnicode_FSConverter() to get filenames because the underlying library, 
OpenSSL, requires bytes for the filenames (C type: char*). Enable os.fsencode() 
on Windows helps some tests (eg. fix test_ssl).

Use "strict" error handler, instead of "surrogateescape", to encode/decode 
filenames with mbcs encoding, does nothing yet because mbcs codec ignore the 
errors argument. These changes prepare the work on mbcs codec: see #850997.

Note: os.fsencode() was introduced by #8514.

--
components: Interpreter Core, Library (Lib), Unicode, Windows
files: fsencode_mbcs.patch
keywords: patch
messages: 107510
nosy: haypo
priority: normal
severity: normal
status: open
title: Windows: use (mbcs in) strict mode to encode/decode filenames, and 
enable os.fsencode()
versions: Python 3.2
Added file: http://bugs.python.org/file17616/fsencode_mbcs.patch

___
Python tracker 

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



[issue8969] Windows: use (mbcs in) strict mode to encode/decode filenames, and enable os.fsencode()

2010-06-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +lemburg, loewis

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

Patch commited as r81883 (blocked in 3.1: r81884).

> Can you add a sys module test for this issue?

Ok, I added a test to test_sys: r81885 (blocked in 3.1: r81886).

> I don't really know where Py_FileSystemDefaultEncoding 
> is set on Darwin. :-)

In Python/bltinmodule.c.

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

Hum. To avoid regression, we should maybe have a test with the C locale. 

@belopolsky: Can you try test_sys.patch on Mac OS X?

--
Added file: http://bugs.python.org/file17617/test_sys.patch

___
Python tracker 

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



[issue850997] mbcs encoding ignores errors

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

I worked again on the patch. I opened new issues to prepare the new mbcs codec:
 - #8966: ctypes: remove implicit conversion between unicode and bytes
 - #8967: Create PyErr_GetWindowsMessage() function
 - #8969: Windows: use (mbcs in) strict mode to encode/decode filenames, and 
enable os.fsencode()

#8967 can be used to get the translated message of a mbcs encode error. 
PyErr_GetWindowsMessage() returns a PyUnicodeObject, whereas 
make_translate_exception() and PyUnicodeTranslateError_SetReason() expect a 
"char*". Another patch is requied: translate_reason_unicode.patch (attached to 
this issue, not tested). But I don't think that the message is very important 
for now :-)

#8784 (tarfile/Windows: Don't use mbcs as the default encoding) is still open.

--
Added file: http://bugs.python.org/file17618/translate_reason_unicode.patch

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Nope.
$ ./python.exe -m test.regrtest test_sys
test test_sys failed -- Traceback (most recent call last):
  File "Lib/test/test_sys.py", line 877, in test_getfilesystemencoding
self.assertEqual(fs_encoding, 'utf-8')
AssertionError: b'utf-8\n' != 'utf-8'

Should be easy to fix, though.

--

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Added file: http://bugs.python.org/file17619/issue8965-test.diff

___
Python tracker 

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2010-06-10 Thread A.M. Kuchling

A.M. Kuchling  added the comment:

Since the function was also added to 2.6, the 2.6 What's New should mention it; 
added in rev81887.

--

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Added file: http://bugs.python.org/file17620/issue8965-test.diff

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Removed file: http://bugs.python.org/file17619/issue8965-test.diff

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Sorry for extra traffic.  I thought my patch introduced an indentation error, 
but it looks like you truly don't check sys.getfilesystemencoding() output if 
not on darwin.

--

___
Python tracker 

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



[issue8965] test_imp fails on OSX when LANG is set

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Added file: http://bugs.python.org/file17621/issue8965-test-1.diff

___
Python tracker 

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



[issue850997] mbcs encoding ignores errors

2010-06-10 Thread STINNER Victor

STINNER Victor  added the comment:

New version of the patch:
 - decode_mbcs() calls raise_translate_exception() to set the error (in the 
previous patch, I'm not sure that the error was set)
 - include #8784 patch (tarfile uses utf-8 as the default encoding)
 - ctypes: use mbcs is strict mode instead of ignore mode. This is just a 
workaround, the real fix is to remove the implicit conversion between bytes and 
characters: see #8966

The patch requires #8969 patch (use mbcs in strict mode to encode/decode 
filenames).

--
Added file: http://bugs.python.org/file17622/mbcs_errors-py3k-2.patch

___
Python tracker 

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



[issue8885] markerbase declaration errors aren't recoverable

2010-06-10 Thread Mark Nottingham

Mark Nottingham  added the comment:

I'm using it from HTMLParser; try to parse a document with the DTD given when 
error is something like:

def error(self, msg):
self.errors += 1

and it will loop.

--

___
Python tracker 

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



[issue8885] markerbase declaration errors aren't recoverable

2010-06-10 Thread Mark Nottingham

Mark Nottingham  added the comment:

Attaching test case.

--
Added file: http://bugs.python.org/file17623/testcase_8885.py

___
Python tracker 

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



[issue8870] --user-access-control=force produces invalid installer on Vista

2010-06-10 Thread R. David Murray

Changes by R. David Murray :


--
superseder:  -> friendly errors for UAC misbehavior in windows installers

___
Python tracker 

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



[issue8903] Add module level now() and today() functions to datetime module

2010-06-10 Thread R. David Murray

R. David Murray  added the comment:

I actually agree with Anatoly here.  I find it much more intuitive to do

  import datetime

   timestamp = datetime.now()

than to do 

   timestamp = datetime.datetime.now()

I always have to remember that 'now' is a class method, often after getting a 
"datetime module has no attribute 'now'" message.  In most standard library 
modules a function like that would be, well, a function.  I can't imagine code 
where I'd find it more convenient to get 'now' from the class, and if I saw 
code like

timestamp = othertimestamp.now()

I'd run screaming.

Personally I think the class methods would be better off deprecated in favor of 
module level functions.

However, all that said, the datetime API is what it is, and I'm not sure it is 
worth going through a deprecation cycle for this.  (Though othertimestamp.now() 
really does give me the heebie jeebies.)

--
nosy: +r.david.murray
status: pending -> open

___
Python tracker 

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



[issue3129] struct allows repeat spec. without a format specifier

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Looks reasonable to me as well.  Code patch applies cleanly, but tests don't.  
I'll get it ready for commit.

--
assignee:  -> belopolsky
nosy: +belopolsky
resolution:  -> accepted
versions:  -Python 2.6, 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



[issue3129] struct allows repeat spec. without a format specifier

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am attaching an updated patch, but it fails one of the old tests.  Need to 
investigate this some more.

--
resolution: accepted -> 
Added file: http://bugs.python.org/file17624/issue3129.diff

___
Python tracker 

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



[issue3129] struct allows repeat spec. without a format specifier

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Attached patch works and passes the tests.  The failing test was clearly wrong. 
 I am still not sure that it is right to raise TypeError rather than 
struct.error on invalid offset in pack_into, but this is a separate issue.

--
Added file: http://bugs.python.org/file17625/issue3129.diff

___
Python tracker 

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



[issue3129] struct allows repeat spec. without a format specifier

2010-06-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Removed file: http://bugs.python.org/file17624/issue3129.diff

___
Python tracker 

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



  1   2   >