[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-20 Thread Charlie Clark


Charlie Clark  added the comment:

I can confirm that using "de-DE" does indeed avoid the crash.

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] zipfile.writestr causes a Python crash on Windows if the locale is set

2019-05-04 Thread Charlie Clark


New submission from Charlie Clark :

Based on a bug report 
(https://bitbucket.org/openpyxl/openpyxl/issues/1266/locale) from a user of the 
openpyxl library I've identified a bug in the zipfile module that causes the 
Python process to crash on Windows. Currently tested with Python 3.7.3 (32-bit 
on Windows 10).

Sample code

import faulthandler
import locale
from zipfile import ZipFile

faulthandler.enable()

locale.setlocale(locale.LC_ALL, 'de_DE')
out = open("out.zip", "wb") 
archive = ZipFile(out, "w")
archive.writestr("properties.xml", b"")

faulthandler fingers line 1757 as the culprit but running this line locally 
does not cause the crash. The issue seems to be limited to Windows.

--
components: Interpreter Core, Windows
messages: 341380
nosy: CharlieClark, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: zipfile.writestr causes a Python crash on Windows if the locale is set
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] zipfile.writestr causes a Python crash on Windows if the locale is set

2019-05-05 Thread Charlie Clark


Charlie Clark  added the comment:

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit 
(Intel)] on win32

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] zipfile.writestr causes a Python crash on Windows if the locale is set

2019-05-05 Thread Charlie Clark

Charlie Clark  added the comment:

That's what we thought when we looked at it, but as I said, I couldn't 
reproduce it with just the `time` call or the `ZInfo` instantiation, so 
something odd is happening. I do have a German version of Windows as I suspect 
the original reporter does. You'd think that sort of thing wouldn't matter…

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] zipfile.writestr causes a Python crash on Windows if the locale is set

2019-05-05 Thread Charlie Clark


Charlie Clark  added the comment:

winver tells me I have 1809. I'm only using Windows in a VM so I'm not that 
familiar with its innards.

Also get the error with WinPython 3.6:

Windows fatal exception: code 0xc374

Current thread 0x10c0 (most recent call first):
  File "C:\Users\charlieclark\WPy64-3680\python-3.6.8.amd64\lib\zipfile.py", 
line 1658 in writestr
  File "", line 1 in 

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] zipfile.writestr causes a Python crash on Windows if the locale is set

2019-05-06 Thread Charlie Clark


Charlie Clark  added the comment:

I can confirm the error is caused by time.localtime(time.time()) as indicated 
by the related bug.

I've also found the crash log. It's in 
C:\ProgramData\Microsoft\Windows\WER\ReportQueue on my machine. Well, at least 
that's all I can find.

--
Added file: https://bugs.python.org/file48303/Report.wer

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] zipfile.writestr causes a Python crash on Windows if the locale is set

2019-05-06 Thread Charlie Clark


Charlie Clark  added the comment:

import time, locale
locale.setlocale(locale.LC_ALL, 'de_DE')
'de_DE'
time.strftime("%Z")
aborted (disconnected)

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-06 Thread Charlie Clark


Charlie Clark  added the comment:

import ctypes, struct
libc = ctypes.cdll.msvcrt
buf = ctypes.create_string_buffer(1024)
tm = struct.pack('9i', 2019, 5, 6, 9, 50, 4, 0, 126, 1)
print('count:', libc.strftime(buf, 1024, b'%Z', tm))
print('value:', buf.value)

count: 28
value: b'Mitteleurop\xe4ische Sommerzeit'

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-06 Thread Charlie Clark

Charlie Clark  added the comment:

import ctypes, struct
libc = ctypes.cdll.msvcrt
buf = ctypes.create_string_buffer(1024)
tm = struct.pack('9i', 2019, 5, 6, 9, 50, 4, 0, 126, 1)
print('count:', libc.strftime(buf, 1024, b'%Z', tm))
print('value:', buf.value)
wbuf = ctypes.create_unicode_buffer(1024)
print('count:', libc.wcsftime(wbuf, 1024, '%Z', tm))
print('value:', wbuf.value)
print('count:', libc.mbstowcs(wbuf, buf, 1024))
print('value:', wbuf.value)

count: 28
value: b'Mitteleurop\xe4ische Sommerzeit'
count: 28
value: Mitteleuropäische Sommerzeit
count: 28
value: Mitteleuropäische Sommerzeit

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-07 Thread Charlie Clark


Change by Charlie Clark :


Added file: 
https://bugs.python.org/file48307/WER9DB9.tmp.WERInternalMetadata.xml

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-07 Thread Charlie Clark


Charlie Clark  added the comment:

The code crashes on this line:
print('count:', crt_time.strftime(buf, 1024, b'%Z', tm))

--
Added file: https://bugs.python.org/file48306/Report.wer

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-07 Thread Charlie Clark


Charlie Clark  added the comment:

If the process crashes at the first print statement, I'm not sure how I can run 
the tests. Or should I try them separately?

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-07 Thread Charlie Clark


Charlie Clark  added the comment:

print('count:', crt_time.wcsftime(wbuf, 1024, '%Z', tm)) also fails
but
crt_convert = ctypes.CDLL('api-ms-win-crt-convert-l1-1-0', use_errno=True)
print('count:', crt_convert.mbstowcs(wbuf, buf, 1024))
seems to work okay.

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-07 Thread Charlie Clark

Charlie Clark  added the comment:

And this is the result.

old locale: C
count: 28
value: Mitteleuropäische Sommerzeit
new locale: de_DE
count: -1
value:
Windows fatal exception: code 0xc374

Looks like

print('new locale:', crt_locale._wsetlocale(0, 'de_DE'))
print('count:', crt_time.wcsftime(wbuf, 1024, '%Z', tm))

is the culprit.

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-07 Thread Charlie Clark

Charlie Clark  added the comment:

This is the result
\issue36792>test.exe

The current locale is now: C
The time zone is: 'Mitteleuropõische Sommerzeit' (28 characters)

The updated locale is now: de_DE
The time zone is: '' (-1 characters)

NB something is wrong with that string. Should be Mitteleuropäsiche Sommerzeit 
but that could just be an encoding thing.

--

___
Python tracker 
<https://bugs.python.org/issue36792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15460] SQLite cursor.description is not DB-API compatible

2012-07-26 Thread Charlie Clark

New submission from Charlie Clark :

It says in the docs:
"""This read-only attribute provides the column names of the last query. To 
remain compatible with the Python DB API, it returns a 7-tuple for each column 
where the last six items of each tuple are None."""

According to the DB-API, however, the first two items, name and type, must be 
specified:
"""
The first two items (name and type_code) are mandatory, the other five are 
optional and are set to None if no meaningful values can be provided.
"""

Even with it's limited number of types SQLite is typed and should be able to 
return the type for column.

--
components: Library (Lib)
messages: 166498
nosy: CharlieX
priority: normal
severity: normal
status: open
title: SQLite cursor.description is not DB-API compatible
type: behavior

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