[issue15570] email.header.decode_header parses differently

2012-08-06 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov:

The following script
---
import email.header
print(email.header.decode_header(foo =?windows-1251?Q?bar?=))
---
produces

[(b'foo', None), (b'bar', 'windows-1251')]

in Python 3.2 but

[(b'foo ', None), (b'bar', 'windows-1251')]

in Python 3.3.0b1

--
components: Library (Lib)
messages: 167602
nosy: ddvoinikov
priority: normal
severity: normal
status: open
title: email.header.decode_header parses differently
type: behavior
versions: Python 3.3

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



[issue15534] xmlrpc escaping breaks on unicode \u043c

2012-08-02 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov:

For the following script

import xmlrpc.client; from xmlrpc.client import escape
text = ...\u043c..
print(escape(text))

Python 3.3.0b1 produces
...ь..lt;...
whereas Python 3.2
...ь..lt;

--
components: Library (Lib)
messages: 167199
nosy: ddvoinikov
priority: normal
severity: normal
status: open
title: xmlrpc escaping breaks on unicode \u043c
type: behavior
versions: Python 3.3

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



[issue15524] Dict items() ordering varies across interpreter invocations

2012-08-01 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov:

The following line prints different things each time you run it:

python3 -c print(', '.join({ '1': '2', '3': '4' }.keys()))

The output is either 1, 3 or 3, 1. Is such indeterministic behavior 
intentional ?

Using Python 3.3.0b1 (default, Aug  1 2012, 06:09:44)

--
components: Interpreter Core
messages: 167116
nosy: ddvoinikov
priority: normal
severity: normal
status: open
title: Dict items() ordering varies across interpreter invocations
type: behavior
versions: Python 3.3

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



[issue14648] Attempt to format ascii and non-ascii strings together fails with ... UCS2 ...

2012-04-23 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov dmi...@targeted.org:

Using Python 3.3.0a2 (default, Apr  1 2012, 19:34:58) [MSC v.1500 64 bit 
(AMD64)] on win32.

This line of code

{0:s}{1:s}.format(ABC, \u0410\u0411\u0412)

results in

SystemError: Cannot copy UCS2 characters into a string of ascii characters

--
components: Interpreter Core
messages: 159014
nosy: ddvoinikov
priority: normal
severity: normal
status: open
title: Attempt to format ascii and non-ascii strings together fails with ... 
UCS2 ...
type: behavior
versions: Python 3.3

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



[issue9892] Event spends less time in wait() than requested

2010-09-18 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov dmi...@targeted.org:

If you request Event.wait(x), the call consistently returns in less than x 
seconds.

Sample:
-
from threading import Event
from time import time

e = Event()

before = time()
e.wait(0.1)
after = time()

print(after - before)

# under Python 3.1 prints 0.10...
# under Python 3.2 prints 0.092999...
-

--
components: Library (Lib)
messages: 116772
nosy: ddvoinikov
priority: normal
severity: normal
status: open
title: Event spends less time in wait() than requested
type: behavior
versions: Python 3.2

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



[issue9892] Event spends less time in wait() than requested

2010-09-18 Thread Dmitry Dvoinikov

Dmitry Dvoinikov dmi...@targeted.org added the comment:

You are right, sorry. It's Windows XP Prof, Python 3.2a2.

The differences in OS may be the cause, but the problem doesn't appear in 3.1 
on the same machine.

--

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



[issue4171] SSL handshake fails after TCP connection in getpeername()

2010-05-08 Thread Dmitry Dvoinikov

Dmitry Dvoinikov dmi...@targeted.org added the comment:

Checked out and built revision 80956 of py3k against OpenSSL 0.9.8n. Here is 
the banner:

Python 3.2a0 (py3k:80956, May  8 2010, 11:31:45) [MSC v.1500 32 bit (Intel)] on 
win32

Now, the breaking script appears not to be breaking any more, even though I 
tried it in a loop, a 1000 attempts to execute were all successful. 

It seems to be fine now, thank you for your help.

--

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



[issue4171] SSL handshake fails after TCP connection in getpeername()

2010-05-07 Thread Dmitry Dvoinikov

Dmitry Dvoinikov dmi...@targeted.org added the comment:

Well, I'm sorry to bring this up again, but the problem persists
with Python 3.1.2 (x86, Windows XP). The difference with the
test script behaviour is that now it doesn't break every time.
Perhaps this is the reason I said the problem was gone.
In fact, now that I run the aforementioned script I may get

worked so far
but not here it didn't

and some other time I may get

worked so far
Traceback (most recent call last):
  File test.py, line 23, in module
test_handshake(address, False)
  File test.py, line 17, in test_handshake
ssl.do_handshake()
  File C:\Python31\lib\ssl.py, line 327, in do_handshake
self._sslobj.do_handshake()
AttributeError: 'NoneType' object has no attribute 'do_handshake'

and the outcome is unpredictable. It may work many times in a row
and it may break many times in a row.

If this is of any relevance, I've had pywin32-2.14 installed since.

--
status: closed - open

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



[issue4171] SSL handshake fails after TCP connection in getpeername()

2010-04-25 Thread Dmitry Dvoinikov

Dmitry Dvoinikov dmi...@targeted.org added the comment:

The problem does not reproduce in 3.1.1 nor in 3.1.2
(either x86 or x64).

Antoine Pitrou пишет:
 Antoine Pitrou pit...@free.fr added the comment:
 
 What happens if you remove the call to settimeout()?
 Also, it would be nice if you could try with the latest py3k checkout. 
 There's a couple of fixes for do_handshake there (including timeout issues).
 
 --
 nosy: +pitrou
 priority:  - normal
 versions: +Python 3.1, Python 3.2 -Python 3.0
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue4171
 ___


--

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



[issue4171] SSL handshake fails after TCP connection in getpeername()

2008-11-09 Thread Dmitry Dvoinikov

Dmitry Dvoinikov [EMAIL PROTECTED] added the comment:

1.py == test.py obviously :)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4171
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4171] SSL handshake fails after TCP connection in getpeername()

2008-11-09 Thread Dmitry Dvoinikov

Dmitry Dvoinikov [EMAIL PROTECTED] added the comment:

Same thing on Python 3.0rc2:

C:\TEMPpython test.py
worked so far
Traceback (most recent call last):
  File 1.py, line 23, in module
test_handshake(address, False)
  File 1.py, line 17, in test_handshake
ssl.do_handshake()
  File C:\Python30\lib\ssl.py, line 327, in do_handshake
self._sslobj.do_handshake()
AttributeError: 'NoneType' object has no attribute 'do_handshake'

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4171
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4171] SSL handshake fails after TCP connection in getpeername()

2008-10-22 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov [EMAIL PROTECTED]:

If I connect a TCP socket s using regular s.connect(), then wrap it
using ssl.wrap_socket(s) and call do_handshake on the resulting SSL
socket, handshake fails in ssl.py:320 with 

AttributeError: 'NoneType' object has no attribute 'do_handshake'

The problem is that when TCP socket is being wrapped in ssl.py:116, it
is not recognized as connected by a call to getpeername(), the exception
thrown in ssl.py:116 and silenced is this:

[Errno 10057] A request to send or receive data was disallowed because
the socket is not connected and (when sending on a datagram socket using
a sendto call) no address was supplied

This is awkward, because synchronous s.connect() has just returned
successfully. Even more weird, if I insert s.getpeername() between TCP
connect() and SSL do_handshake() the latter works fine.

Here is a working sample:

---

from socket import socket, AF_INET, SOCK_STREAM
from ssl import wrap_socket, PROTOCOL_TLSv1, CERT_NONE

def test_handshake(address, WORKAROUND):

s = socket(AF_INET, SOCK_STREAM)
s.settimeout(3.0)
s.connect(address)

if WORKAROUND:
s.getpeername()

ssl = wrap_socket(s, server_side = False,
  ssl_version = PROTOCOL_TLSv1,
  cert_reqs = CERT_NONE,
  do_handshake_on_connect = False)
ssl.do_handshake()

address = (www.amazon.com, 443)

test_handshake(address, True) # with workaround
print(worked so far)
test_handshake(address, False)
print(but not here it didn't)

---

I'm using Python 3.0rc1 under Windows.

--
components: Library (Lib)
messages: 75077
nosy: ddvoinikov
severity: normal
status: open
title: SSL handshake fails after TCP connection in getpeername()
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4171
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3890] ssl.SSLSocket.recv() implementation may not work with non-blocking sockets

2008-10-21 Thread Dmitry Dvoinikov

Changes by Dmitry Dvoinikov [EMAIL PROTECTED]:


--
nosy: +ddvoinikov

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3890
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3613] base64.encodestring does not actually accept strings

2008-08-20 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov [EMAIL PROTECTED]:

This quote from base64.py:

---
bytes_types = (bytes, bytearray)  # Types acceptable as binary data
...
def encodestring(s):
Encode a string into multiple lines of base-64 data.

Argument and return value are bytes.

if not isinstance(s, bytes_types):
raise TypeError(expected bytes, not %s % s.__class__.__name__)
...
---

shows that encodestring method won't accept str for an argument, only
bytes. Perhaps this is by design, but then wouldn't it make sense to
change the name of the method ?

Anyway, this behavior clashes in (the least I know) xmlrpc.client, line
1168 when basic authentication is present:

---
auth = base64.encodestring(urllib.parse.unquote(auth))
---

because unquote() returns str, not bytes.

--
components: Library (Lib)
messages: 71513
nosy: ddvoinikov
severity: normal
status: open
title: base64.encodestring does not actually accept strings
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3613
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3614] typo in xmlrpc.client

2008-08-20 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov [EMAIL PROTECTED]:

In xmlrpc.client:1204:
---
headers = {}
if extra_headers:
for key, val in extra_headers:
header[key] = val
---
shouldn't it read 
---
headers[key] = val
  ^
---
?

Otherwise it bails out with 
---
NameError: global name 'header' is not defined
---

--
components: Library (Lib)
messages: 71514
nosy: ddvoinikov
severity: normal
status: open
title: typo in xmlrpc.client
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2833] __exit__ silences the active exception

2008-05-12 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov [EMAIL PROTECTED]:

If a context manager is used within exception handling block, the active
exception is silenced after the context block completes and __exit__ exits.

try:
raise Exception(foo)
except:
with SomeContextManager():
pass
raise # in Py2.5 throws 'foo', in Py3.0 fails with RuntimeError

--
components: Interpreter Core
messages: 66713
nosy: ddvoinikov
severity: normal
status: open
title: __exit__ silences the active exception
type: behavior
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2833
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2832] Line numbers reported by extract_stack are offset by the #-*- encoding line

2008-05-11 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov [EMAIL PROTECTED]:

Stack trace information extracted with traceback.extract_stack is
incorrect in that the #-*- line causes double counting. For example:

#comment
from traceback import extract_stack
print(this is line, extract_stack()[-1][1])

prints 'this is line 3', but

#comment
#-*- coding: windows-1251 -*-
from traceback import extract_stack
print(this is line, extract_stack()[-1][1])

prints 'this is line 6'

--
components: Library (Lib)
messages: 66708
nosy: ddvoinikov
severity: normal
status: open
title: Line numbers reported by extract_stack are offset by the #-*- encoding 
line
type: behavior
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2832
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com