[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 getpass.getpass('Password: ', sys.stdout)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/serhiy/py/cpython/Lib/getpass.py, line 72, in unix_getpass
passwd = _raw_input(prompt, stream, input=input)
  File /home/serhiy/py/cpython/Lib/getpass.py, line 146, in _raw_input
stream.write(bytes(prompt, tty_encoding))
TypeError: must be str, not bytes

 getpass.getpass('Password: ', io.StringIO())
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/serhiy/py/cpython/Lib/getpass.py, line 72, in unix_getpass
passwd = _raw_input(prompt, stream, input=input)
  File /home/serhiy/py/cpython/Lib/getpass.py, line 146, in _raw_input
stream.write(bytes(prompt, tty_encoding))
TypeError: string argument expected, got 'bytes'

--
nosy: +serhiy.storchaka

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



[issue11959] smtpd cannot be used without affecting global state

2013-06-06 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


Added file: http://bugs.python.org/file30480/34974b9bc4d0.diff

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



[issue18146] Document miss, Stats objects has no method called print_results

2013-06-06 Thread Dmi Baranov

Dmi Baranov added the comment:

Duplication of issue 18033

--
nosy: +dmi.baranov

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



[issue11959] smtpd cannot be used without affecting global state

2013-06-06 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

LGTM now.

--

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



[issue18146] Document miss, Stats objects has no method called print_results

2013-06-06 Thread hanks

Changes by hanks zhouhan...@gmail.com:


--
status: open - closed

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



[issue18146] Document miss, Stats objects has no method called print_results

2013-06-06 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
resolution:  - duplicate
stage:  - committed/rejected
superseder:  - Example for Profile Module shows incorrect method

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



[issue18147] SSL: diagnostic functions to list loaded CA certs

2013-06-06 Thread Christian Heimes

New submission from Christian Heimes:

The patch adds two methods to SSLContext which return information about loaded 
x509 certs, CRL and CAs. 

Example:

 ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
 ctx.load_verify_locations(SVN_PYTHON_ORG_ROOT_CERT)
 ctx.cert_store_stats()
{'crl': 0, 'x509': 1}
 ctx.get_ca_list()
[{'issuer': ((('organizationName', 'Root CA'),),
 (('organizationalUnitName', 'http://www.cacert.org'),),
 (('commonName', 'CA Cert Signing Authority'),),
 (('emailAddress', 'supp...@cacert.org'),)),
  'notAfter': 'Mar 29 12:29:49 2033 GMT',
  'notBefore': 'Mar 30 12:29:49 2003 GMT',
  'serialNumber': '00',
  'subject': ((('organizationName', 'Root CA'),),
  (('organizationalUnitName', 'http://www.cacert.org'),),
  (('commonName', 'CA Cert Signing Authority'),),
  (('emailAddress', 'supp...@cacert.org'),)),
  'version': 3}]

--
components: Extension Modules
files: ssl_ca_stats.patch
keywords: patch
messages: 190709
nosy: brett.cannon, christian.heimes, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: SSL: diagnostic functions to list loaded CA certs
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file30481/ssl_ca_stats.patch

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components: +IO
nosy: +hynek, pitrou, stutzbach

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The problem is in io.open, not in getpass. Here is a test script.

$ ./python buffered_open_fd_leak.py 
buffered_open_fd_leak.py:7: ResourceWarning: unclosed file _io.FileIO name=3 
mode='rb+'
  tty = io.open(fd, 'w+', 1)

--
versions: +Python 3.4
Added file: http://bugs.python.org/file30482/buffered_open_fd_leak.py

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-06 Thread Vajrasky Kok

Vajrasky Kok added the comment:

So the correct fix should be:
1. Make sure we can open /dev/tty in non-binary mode,
2. We can write string to /dev/tty,
3. Close the leak if we can not open /dev/tty.

Is it?

--

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



[issue11959] smtpd cannot be used without affecting global state

2013-06-06 Thread R. David Murray

R. David Murray added the comment:

Looks good to me too.

--

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



[issue18148] Make of Python 3.2.2 fails on Solaris SPARC

2013-06-06 Thread Donal Duane

New submission from Donal Duane:

Hi,

I am trying to configure/make/make install Python 3.2.2 on Solaris SPARC.
The configure goes ok, but I am getting an error when doing make.

I am using GCC 3.4.6.

Error:

make/usr/local/bin/gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o 
Modules/python.o ./Modules/python.cIn file included from 
Include/Python.h:50,from ./Modules/python.c:3:Include/pyport.h:257:13: #error 
This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG*** Error code 
1make: Fatal error: Command failed for target `Modules/python.o'

Regards,
Donal

--
components: Cross-Build
messages: 190713
nosy: eeiddne
priority: normal
severity: normal
status: open
title: Make of Python 3.2.2 fails on Solaris SPARC
type: compile error
versions: Python 3.2

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-06 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Fixing IO leak resource would fix this bug but leave another bug opened which I 
try to fix as well.

These statements with Python3 under Linux will always fail because we need to 
open /dev/tty file in binary mode (for whatever reason).

fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY)
tty = os.fdopen(fd, 'w+', 1)

So I guess the correct fix would be to open /dev/tty in binary mode (and set 
buffering off) and go on from there.

Of course, one can argue whether this bug should be separated from the original 
bug (resource warning). I am not sure either.

Anyway, here is the patch that will work with stream StringIO and stdout.

Thank you for Serhiy for pointing out my mistakes.

--
Added file: 
http://bugs.python.org/file30483/getpass_fix_works_with_stringio_and_stdout_stream.patch

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



[issue18149] filecmp.cmp() - cache invalidation fails when file modification times haven't changed

2013-06-06 Thread Matej Fröbe

New submission from Matej Fröbe:

Example:

  with open('file1', 'w') as f:
f.write('a')

  with open('file2', 'w') as f:
f.write('a')

  print filecmp.cmp('file1', 'file2', shallow=False) # true

  with open('file2', 'w') as f:
f.write('b')

  print filecmp.cmp('file1', 'file2', shallow=False) # true




Because of the caching, both calls to filecmp.cmp() return true on my system.

When retrieving value from cache, the function filecmp.cmp() checks the 
signatures of the files:

  s1 = _sig(os.stat(f1))
  s2 = _sig(os.stat(f2))
  ...
  outcome = _cache.get((f1, f2, s1, s2))

But the signatures in cache are the same, if the file sizes and times of 
modification (os.stat().st_mtime) haven't changed from the last call, even if 
the content has changed.

The buffer is mentioned in the documentation, but there isn't any documented 
way to clear it. It also isn't nice IMO, that one has to worry about the file 
system's resolution of the file modification time when calling a simple file 
comparison.

--
components: Library (Lib)
messages: 190715
nosy: fbm
priority: normal
severity: normal
status: open
title: filecmp.cmp() - cache invalidation fails when file modification times 
haven't changed
type: behavior
versions: Python 2.7

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



[issue13483] Use VirtualAlloc to allocate memory arenas

2013-06-06 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 getpass.getpass('Password: ', open('/dev/stdout', 'w'))
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/serhiy/py/cpython/Lib/getpass.py, line 72, in unix_getpass
passwd = _raw_input(prompt, stream, input=input)
  File /home/serhiy/py/cpython/Lib/getpass.py, line 143, in _raw_input
stream.write(bytes(prompt, tty_encoding))
TypeError: must be str, not bytes

It seems that you are moving in the wrong direction. No need to test explicitly 
for stdout/stderr/etc, the code should work with arbitrary text stream.

--

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



[issue18150] Duplicate test inside TestSingleDispatch

2013-06-06 Thread Vajrasky Kok

New submission from Vajrasky Kok:

There is a duplicate test inside TestSingleDispatch in file 
Lib/test/test_functools.py.

The method test_mro and test_classic_classes are not different at all.

--
components: Tests
files: duplicate_test_for_testsingledispatch.diff
keywords: patch
messages: 190717
nosy: lukasz.langa, vajrasky
priority: normal
severity: normal
status: open
title: Duplicate test inside TestSingleDispatch
versions: Python 3.4
Added file: 
http://bugs.python.org/file30484/duplicate_test_for_testsingledispatch.diff

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-06-06 Thread Terry J. Reedy

New submission from Terry J. Reedy:

This issue is about uniformly updating the old idiom

try:
  f = open('file')
  use f)
  f.close()  # omitted at least in GrepDialog
except IOError as msg:
  ignore or display message

to the current idiom

try:
  with open('file') as f:
use f
except OSError as msg:  # still use IOError in 2.7
ignore or display message

#16715 changed 'IOError' to 'OSError' everywhere in Lib/* for 3.4 only.

I ran into this issue (again) because GrepDialog.Grepdialog.grep_it uses open 
without close. Consequently, with debug builds, 'Find in files' raises a 
ResourceWarning for each file opened. Because of the 3.4-only change, there 
will be a merge conflict.

To avoid this, now and in the future, I plan to backport the idlelib subset of 
the Svetlov's patch to 3.3 (it applied with only one fix).

Currently, all 3.x patches are being applied to both 3.3 and 3.4 and any 3.3 
patch with 'IOError' will have a merge conflict. Any 3.4 patch with 'OSError' 
will not apply to 3.3. There is no longer an issue with breaking 3.2 to 3.3 
merges. This change will break existing 3.3 patches with 'IOError', but they 
would break anyway on the merge.

--
components: IDLE
files: idle33.io2os.diff
keywords: patch
messages: 190718
nosy: Todd.Rovito, roger.serwy, terry.reedy
priority: normal
severity: normal
stage: commit review
status: open
title: Idlelib: update to with open ... except OSError  (in 2.7, leave 
IOError)
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30485/idle33.io2os.diff

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



[issue18152] Idle: add 2.7 backport script

2013-06-06 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Backporting Idle patches from 3.x to 2.7 would be easier with a canned edit 
script. Below are the substitutions I can think of immediately. Do any of you 
know of others?

Easy (str.replace):
tkinter - Tkinter
import tkinter.messagebox as tkMessageBox - import tkMessageBox

A bit tricky (but still use str.replace):
OSError - IOError
This presumes that IOError become OSError in 3.3 as well as 3.4 (#18151). But 
there are a few existig OSErrors is 3.3 (and that pre-existed the change in 
3.4). So there would would need to be a check that a changed line matched an 
existing 2.7 line.

Harder (2to3 parser?):
print(arglist) - print arglist  # but what if keyword args?
Outputting fix print on line nn would be easiest.

README needed (python -m) test - (python -m) test.regrtest in the test 
instructions, but this should be the only place that occurs.

I might put 'edit_patch' or whatever in idle_test.

--
messages: 190719
nosy: Todd.Rovito, asvetlov, ned.deily, roger.serwy, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Idle: add 2.7 backport script
type: enhancement
versions: Python 2.7

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-06-06 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Here is the 'OS' version of the fix and update to grep_it. Change 'OS' to 'IO' 
on line 17 to apply to current 3.3, without the io2os patch.  Besides using 
'with', it iterates the files directly instead of iterating blocks of 
readlines. The two changes make the code simpler and cleaner. The changed 
summary looks better to me, besides avoiding the hit/hits problem.

As can be seen in the io2os patch, there are other opens to be updated in 
another patch.

OutputWindow.OutputWindow._file_line_helper has this one:
f = open(filename, r)
f.close()
which would become:
with open(filename, r): pass

This tests whether the filename extracted from a traceback or grep report is 
correct (can be opened). (Each of several patterns are tried until one works.) 
The opened file is discarded because the filename is returned to be passes to 
editwin's flist.open. I believe this could be replaced by an os.stat() call.

Backportint to 2.7 is the subject of #18152

--
keywords: +needs review
Added file: http://bugs.python.org/file30486/grep_it.diff

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



[issue18152] Idle: add 2.7 backport script

2013-06-06 Thread Ezio Melotti

Ezio Melotti added the comment:

Are you planning to use this on the patches instead of using hg graft?
These things should be easy to fix during the 3-way merge, so I'm not sure if 
it's worth adding a specific script.  If you think it's necessary, consider 
making it a mercurial extension that can be run automatically during the graft.

--
nosy: +ezio.melotti

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



[issue18152] Idle: add 2.7 backport script

2013-06-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Please regenerate your patches without --git for review. Rietveld doesn't like 
git-style patches.

--
nosy: +serhiy.storchaka

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



[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-06 Thread Richard Oudkerk

Changes by Richard Oudkerk shibt...@gmail.com:


--
status: open - closed

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



[issue18152] Idle: add 2.7 backport script

2013-06-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
Removed message: http://bugs.python.org/msg190722

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-06-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Please regenerate your patches without --git for review. Rietveld doesn't like 
git-style patches.

--
nosy: +serhiy.storchaka

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



[issue12932] filecmp.dircmp does not allow non-shallow comparisons

2013-06-06 Thread Steve Ward

Changes by Steve Ward plane...@gmail.com:


--
nosy: +planet36

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



[issue12545] Incorrect handling of return codes in the posix_lseek function in posixmodule.c

2013-06-06 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I just reproduced the issue on my gdb.py program, which is part of the 
python-ptrace program. When searching for a pattern in the memory of another 
process, /proc/pid/maps is used to get the list of all memory mappings of this 
process. On Linux x64, the last mapping is ff60-ff601000 
r-xp  00:00 0 [vsyscall], machine code used for system calls. gdb.py 
opens /proc/pid/mem in binary mode and tries to seek at 0xff60 but 
FileIO.seek() fails because it gets an offset bigger than 2^63, which is seen 
as a negative number and FileIO.seek() considers a negative number as an error.

Attached patch fixes this issue by checking not only the result of lseek(), but 
also errno:

errno = 0;
Py_BEGIN_ALLOW_THREADS
#if defined(MS_WIN64) || defined(MS_WINDOWS)
res = _lseeki64(fd, pos, how);
#else
res = lseek(fd, pos, how);
#endif
Py_END_ALLOW_THREADS
if (res == (off_t)-1  errno)
return posix_error();

PyLong_AsUnsignedLong() is tried if PyLong_AsLong() failed with an 
OverflowError. I kept PyLong_AsLong() for relative seek with a negative offset, 
and I prefer to try first PyLong_AsLong() because the overflow case is very 
unlikely compared to negative offsets for relative seek.

The result is always casted to an unsigned number. I never seen a device or 
file descriptor supporting negative offset.

I don't know how to test this code path automatically. I only know the 
[vsyscall] mapping use case on Linux, and it requires to parse 
/proc/self/maps which is not trivial and I would prefer sometimes simpler (more 
reliable with less maintenance). I propose to not add an unit test, except 
someone find how to write a simple and reliable test.

 This is not true of a regular file where I get errno=22
 when seeking to an offset greater than or equal to 2^63.

Same behaviour on Linux: OSError(22, Invalid argument) when I try file.seek(1 
 63) on a regular file.

--
Added file: http://bugs.python.org/file30487/lseek_unsigned.patch

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



[issue12545] Incorrect handling of return codes in the posix_lseek function in posixmodule.c

2013-06-06 Thread STINNER Victor

STINNER Victor added the comment:

About the version field: If we decide to change os.lseek() and FileIO.seek(), 
it is safer to only do it in Python 3.4.

--
versions: +Python 3.4 -Python 2.7, Python 3.2, Python 3.3

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



[issue12545] os.lseek() and FileIO.seek() does not support offset larger than 2^63-1

2013-06-06 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file22721/unnamed

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



[issue12545] os.lseek() and FileIO.seek() does not support offset larger than 2^63-1

2013-06-06 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: Incorrect handling of return codes in the posix_lseek function in 
posixmodule.c - os.lseek() and FileIO.seek() does not support offset larger 
than 2^63-1

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



[issue12545] os.lseek() and FileIO.seek() does not support offset larger than 2^63-1

2013-06-06 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file22641/unnamed

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



[issue12545] os.lseek() and FileIO.seek() does not support offset larger than 2^63-1

2013-06-06 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file22645/unnamed

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-06-06 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Serhiy: I don't care about patch style but I read somewhere that I 'should' set 
the hg options file to automatically produce git style diff. However, since the 
hg doc says that this setting does not affect pushes, I don't know why, and I 
cannot find where I read that. Is it obsolete? Are you suggesting that all 
patches should never be git style?

I turned git off and will leave it off until someone complains.

--
Added file: http://bugs.python.org/file30488/idle33.io2os.diff

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-06-06 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


Added file: http://bugs.python.org/file30489/grep_it.diff

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



[issue12545] os.lseek() and FileIO.seek() does not support offset larger than 2^63-1

2013-06-06 Thread STINNER Victor

STINNER Victor added the comment:

lseek_negative.diff is not correct: 0x8000 is a valid offset for a 
/proc/pid/mem file.

--

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



[issue12545] os.lseek() and FileIO.seek() does not support offset larger than 2^63-1

2013-06-06 Thread STINNER Victor

STINNER Victor added the comment:

lseek_unsigned_test.py: script to test manually the patch on Linux. It may work 
on Solaris, I didn't try.

--
Added file: http://bugs.python.org/file30490/lseek_unsigned_test.py

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



[issue12545] os.lseek() and FileIO.seek() does not support offset larger than 2^63-1

2013-06-06 Thread STINNER Victor

STINNER Victor added the comment:

The patch is not complete: _iomodule.h defines PyLong_AsOff_t() and 
PyLong_FromOff_t(), but these functions don't support unsigned off_t (larger 
than 2^63-1).

#if defined(MS_WIN64) || defined(MS_WINDOWS)

/* Windows uses long long for offsets */
typedef PY_LONG_LONG Py_off_t;
# define PyLong_AsOff_t PyLong_AsLongLong
# define PyLong_FromOff_t   PyLong_FromLongLong
# define PY_OFF_T_MAX   PY_LLONG_MAX
# define PY_OFF_T_MIN   PY_LLONG_MIN
# define PY_OFF_T_COMPATPY_LONG_LONG /* type compatible with off_t */
# define PY_PRIdOFF lld/* format to use for that type */

#else

/* Other platforms use off_t */
typedef off_t Py_off_t;
#if (SIZEOF_OFF_T == SIZEOF_SIZE_T)
# define PyLong_AsOff_t PyLong_AsSsize_t
# define PyLong_FromOff_t   PyLong_FromSsize_t
# define PY_OFF_T_MAX   PY_SSIZE_T_MAX
# define PY_OFF_T_MIN   PY_SSIZE_T_MIN
# define PY_OFF_T_COMPATPy_ssize_t
# define PY_PRIdOFF zd
#elif (HAVE_LONG_LONG  SIZEOF_OFF_T == SIZEOF_LONG_LONG)
# define PyLong_AsOff_t PyLong_AsLongLong
# define PyLong_FromOff_t   PyLong_FromLongLong
# define PY_OFF_T_MAX   PY_LLONG_MAX
# define PY_OFF_T_MIN   PY_LLONG_MIN
# define PY_OFF_T_COMPATPY_LONG_LONG
# define PY_PRIdOFF lld
#elif (SIZEOF_OFF_T == SIZEOF_LONG)
# define PyLong_AsOff_t PyLong_AsLong
# define PyLong_FromOff_t   PyLong_FromLong
# define PY_OFF_T_MAX   LONG_MAX
# define PY_OFF_T_MIN   LONG_MIN
# define PY_OFF_T_COMPATlong
# define PY_PRIdOFF ld
#else
# error off_t does not match either size_t, long, or long long!
#endif

#endif

My patch fixes FileIO.seek(), but no BufferedReader  friends. So seek() works 
on open(/proc/self/mem, rb, 0), but not on open(/proc/self/mem, rb).

I didn't notice immediatly because I'm using an unbuffered file in my 
python-pytrace project.

--

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



[issue18151] Idlelib: update to with open ... except OSError (in 2.7, leave IOError)

2013-06-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you. AFAIK you need git style diff only when moving/renaming files.

--

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



[issue18152] Idle: add 2.7 backport script

2013-06-06 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Ezio: yes. Once I have written a working-directory diff to a file for upload 
(non-trivial on Windows), 'Import' is as easy to use as Graft and as far as I 
know, the result when successful is the same. I know I 'should' learn to use 
kdiff3 effectively, but it seldom works right for me, and the live repository 
is the wrong place to learn by failure. (This gives me an idea for another 
forum.)

A third always correct import substitution pair:
import tkinter.simpledialog as tkSimpleDialog - import tkSimpleDialog

I am not sure if a script will be used until I try one. I do not know anything 
about writing extensions. A lists of Idle-specific conversions may be enough.

--

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



[issue17486] datetime.timezone returns the wrong tzname()

2013-06-06 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

This is not a bug in datetime.timezone.  The value returned by 
timezone.tzname() is documented and the code works correctly.  %Z should not be 
used to produce machine-readable timestamps and for a human reader 
'UTC+03:00+0300' should not be confusing.

Note that calling the astimezone() method (without arguments) will return local 
time with tzname set:

 os.putenv('TZ', 'XYZ-3')
 time.tzset()
 utctime = datetime.datetime.now(datetime.timezone.utc)
 localtime = utctime.astimezone()
 localtime.strftime('%Z%z')
'XYZ+0300'

--
nosy: +belopolsky
resolution:  - invalid
status: open - closed

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



[issue18153] python imaplib - error 'unexpected repsonse'

2013-06-06 Thread tahnoon pasha

New submission from tahnoon pasha:

Hi I've suddenly encountered an error using imaplib on some code that worked 
fine before.

import imaplib
m = imaplib.IMAP4('myserver','port')
m.login(r'username','password')
m.select()

gives me the error 

Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/imaplib.py, line 649, in select
typ, dat = self._simple_command(name, mailbox)
  File /usr/lib/python2.7/imaplib.py, line 1070, in _simple_command
return self._command_complete(name, self._command(name, *args))
  File /usr/lib/python2.7/imaplib.py, line 899, in _command_complete
raise self.abort('command: %s = %s' % (name, val))
imaplib.abort: command: SELECT = unexpected response: '*  1520 EXISTS'

I'm not sure what it means. Emails are otherwise coming through fine, and I'm 
using davmail as a server.

The program in its entirety saves attachments with a certain name in a specific 
folder. 

I've stepped through it and its definitely the `m.select()` that is where its 
falling over.

This same program worked absolutely fine until recently.

What am I doing wrong, and how do I fix it?

The log of activity is as follows

 import imaplib
 m = imaplib.IMAP4('server','port')
 Debug=4
 m.debug
0
 m.debug=4
 m.debug
4
 m.login(r'username','password')
  01:26.55  HLFI1 LOGIN username password
  01:30.76  HLFI1 OK Authenticated
('OK', ['Authenticated'])
 m.list()
  01:56.33  HLFI2 LIST  *
  02:00.04  * LIST (\HasNoChildren) / Trash/Sent Messages
  02:00.04  * LIST (\HasNoChildren) / Sync Issues/Server Failures
  02:00.04  * LIST (\HasNoChildren) / Sync Issues/Local Failures
  02:00.04  * LIST (\HasNoChildren) / Sync Issues/Conflicts
  02:00.04  * LIST (\HasChildren) / Sync Issues
  02:00.04  * LIST (\HasNoChildren) / Junk E-mail
  02:00.04  * LIST (\HasNoChildren) / Drafts
  02:00.04  * LIST (\HasChildren) / Trash
  02:00.04  * LIST (\HasNoChildren) / Sent
  02:00.04  * LIST (\HasNoChildren) / Outbox
  02:00.04  * LIST (\HasNoChildren) / INBOX
  02:00.04  HLFI2 OK LIST completed
('OK', ['(\\HasNoChildren) / Trash/Sent Messages', '(\\HasNoChildren) 
/ Sync Issues/Server Failures', '(\\HasNoChildren) / Sync Issues/Local 
Failures', '(\\HasNoChildren) / Sync Issues/Conflicts', '(\\HasChildren) 
/ Sync Issues', '(\\HasNoChildren) / Junk E-mail', '(\\HasNoChildren) 
/ Drafts', '(\\HasChildren) / Trash', '(\\HasNoChildren) / Sent', 
'(\\HasNoChildren) / Outbox', '(\\HasNoChildren) / INBOX'])
 m.select()
  02:21.37  HLFI3 SELECT INBOX
  02:30.87  *  1548 EXISTS
  02:30.87 last 4 IMAP4 interactions:
  00:16.73  * OK [CAPABILITY IMAP4REV1 AUTH=LOGIN MOVE] IMAP4rev1 DavMail 
4.3.0-2125 server ready
  00:16.73  HLFI0 CAPABILITY
  00:16.74  * CAPABILITY IMAP4REV1 AUTH=LOGIN MOVE
  00:16.77  HLFI0 OK CAPABILITY completed
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/imaplib.py, line 649, in select
typ, dat = self._simple_command(name, mailbox)
  File /usr/lib/python2.7/imaplib.py, line 1070, in _simple_command
return self._command_complete(name, self._command(name, *args))
  File /usr/lib/python2.7/imaplib.py, line 899, in _command_complete
raise self.abort('command: %s = %s' % (name, val))
imaplib.abort: command: SELECT = unexpected response: '*  1548 EXISTS'


I understand that this seems to be occurring because of the extra spaces in the 
final RETURN from a query on stack overflow

http://stackoverflow.com/questions/16911238/python-imaplib-error-unexpected-repsonse

and it was suggested I file an issue report.

I'm using Davmail as the server on Ubuntu 13.04 and the server works fine with 
Thunderbird, Fetchmail and Evolution 

My first attempt at filing an issue so apologies if I've done something wrong.

--
components: email
messages: 190733
nosy: barry, r.david.murray, tahnoon
priority: normal
severity: normal
status: open
title: python imaplib - error 'unexpected repsonse'
type: behavior
versions: Python 2.7

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



[issue18153] python imaplib - error 'unexpected repsonse'

2013-06-06 Thread R. David Murray

R. David Murray added the comment:

I think that technically the server is out of spec with the RFC.  It isn't 100% 
clear, though since while the RFC says extra spaces are invalid, it also says 
that an untagged response is formed by prefixing the token '*', without 
otherwise mentioning it in the BNF.  So one assumes, based on the rest of the 
document, that a single space follows the '*', and anything else is invalid.

Now, the RFC says the server MUST reject malformed commands from the client, 
but does not speak to what the client should do given malformed responses from 
the server.  So, it might indeed be reasonable to fix imaplib to handle an 
arbitrary number of spaces after the '*'.

IMO Davmail should be fixed, though.  IMAP is a finicky protocol.

--
versions: +Python 3.3, Python 3.4

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



[issue18150] Duplicate test inside TestSingleDispatch

2013-06-06 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Removed file: 
http://bugs.python.org/file30484/duplicate_test_for_testsingledispatch.diff

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



[issue18150] Duplicate test inside TestSingleDispatch

2013-06-06 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I think to test the mro case, we have to test the multiple inheritance with the 
same ancestor case.

Attached my guess of the correct test should be.

--
Added file: http://bugs.python.org/file30491/test_mro.diff

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